emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] harfbuzz b40dde7: Merge branch 'master' into harfbuzz


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] harfbuzz b40dde7: Merge branch 'master' into harfbuzz
Date: Wed, 22 May 2019 21:55:23 -0400 (EDT)

branch: harfbuzz
commit b40dde705af4d53853de6185a2468153b442dc9a
Merge: 5d7dafa 03feb93
Author: YAMAMOTO Mitsuharu <address@hidden>
Commit: YAMAMOTO Mitsuharu <address@hidden>

    Merge branch 'master' into harfbuzz
---
 .gitlab-ci.yml                                     |   2 +-
 INSTALL                                            |  41 +-
 INSTALL.REPO                                       |   4 +-
 Makefile.in                                        |  21 +-
 admin/admin.el                                     |   8 +-
 admin/authors.el                                   |   2 -
 admin/find-gc.el                                   |   2 -
 admin/last-chance.el                               |   1 -
 admin/make-tarball.txt                             |   2 +-
 admin/update-copyright                             |   2 +
 autogen.sh                                         |  13 +-
 build-aux/config.guess                             |  27 +-
 build-aux/git-hooks/prepare-commit-msg             |  45 ++
 build-aux/make-info-dir                            |   1 -
 configure.ac                                       |   7 +-
 doc/emacs/arevert-xtra.texi                        |  17 +-
 doc/emacs/buffers.texi                             |   4 +-
 doc/emacs/building.texi                            |   6 +
 doc/emacs/cmdargs.texi                             |  18 +-
 doc/emacs/custom.texi                              |  25 +-
 doc/emacs/display.texi                             |  49 ++
 doc/emacs/emacs-xtra.texi                          |   2 +-
 doc/emacs/emacs.texi                               |   4 +-
 doc/emacs/files.texi                               |  82 +-
 doc/emacs/maintaining.texi                         |  11 +
 doc/emacs/misc.texi                                |  25 +-
 doc/emacs/programs.texi                            |   5 +-
 doc/emacs/text.texi                                |   4 +
 doc/lispintro/emacs-lisp-intro.texi                |  15 +-
 doc/lispref/commands.texi                          |   9 +-
 doc/lispref/hooks.texi                             |   1 +
 doc/lispref/internals.texi                         |  11 +
 doc/lispref/loading.texi                           |  23 +-
 doc/lispref/modes.texi                             |   7 +-
 doc/lispref/nonascii.texi                          |   2 +-
 doc/lispref/os.texi                                |   7 +-
 doc/lispref/processes.texi                         |   2 +-
 doc/lispref/searching.texi                         |   7 +
 doc/lispref/sequences.texi                         |   2 +-
 doc/lispref/text.texi                              |   8 +-
 doc/lispref/variables.texi                         |   2 +-
 doc/lispref/windows.texi                           |  67 +-
 doc/misc/flymake.texi                              |   8 -
 doc/misc/texinfo.tex                               | 516 ++++++-------
 doc/misc/tramp.texi                                |  15 +-
 etc/NEWS                                           | 337 ++++++---
 etc/NEWS.24                                        |   2 +
 etc/TODO                                           |   9 -
 etc/tutorials/TUTORIAL.translators                 |   5 +-
 leim/SKK-DIC/README                                |  10 +-
 leim/SKK-DIC/SKK-JISYO.L                           | 112 +--
 lib-src/etags.c                                    |  10 +-
 lib-src/make-fingerprint.c                         |  32 +-
 lib/gnulib.mk.in                                   |   1 +
 lib/mktime-internal.h                              |  60 +-
 lib/mktime.c                                       |  71 +-
 lib/timegm.c                                       |  32 +-
 lisp/abbrev.el                                     |   1 -
 lisp/align.el                                      |   1 -
 lisp/ansi-color.el                                 |  12 +-
 lisp/arc-mode.el                                   | 215 +++---
 lisp/array.el                                      |   1 -
 lisp/autoinsert.el                                 |   1 -
 lisp/autorevert.el                                 | 220 ++++--
 lisp/bindings.el                                   |   1 -
 lisp/bs.el                                         |  19 +-
 lisp/buff-menu.el                                  |   1 -
 lisp/calendar/time-date.el                         |   2 +-
 lisp/case-table.el                                 |   1 -
 lisp/cdl.el                                        |   1 -
 lisp/cedet/cedet.el                                |   2 +-
 lisp/cedet/semantic/imenu.el                       |   2 +-
 lisp/cedet/semantic/senator.el                     |   1 -
 lisp/cedet/semantic/wisent/python.el               |   4 +-
 lisp/char-fold.el                                  |   1 -
 lisp/chistory.el                                   |   1 -
 lisp/cmuscheme.el                                  |   1 -
 lisp/comint.el                                     |   1 -
 lisp/completion.el                                 |   1 -
 lisp/composite.el                                  |   2 +-
 lisp/cus-edit.el                                   |  28 +-
 lisp/cus-start.el                                  |  13 +
 lisp/cus-theme.el                                  |   1 -
 lisp/custom.el                                     |  22 +-
 lisp/dabbrev.el                                    |   1 -
 lisp/delim-col.el                                  |  70 +-
 lisp/delsel.el                                     |   1 -
 lisp/descr-text.el                                 |   1 -
 lisp/dired-aux.el                                  |  55 +-
 lisp/dired-x.el                                    |   2 +-
 lisp/dired.el                                      |  14 +-
 lisp/dirtrack.el                                   |   2 -
 lisp/disp-table.el                                 |   1 -
 lisp/display-fill-column-indicator.el              |  77 ++
 lisp/display-line-numbers.el                       |   1 -
 lisp/dnd.el                                        |   1 -
 lisp/dos-fns.el                                    |   1 -
 lisp/dos-vars.el                                   |   1 -
 lisp/dynamic-setting.el                            |   1 -
 lisp/ebuff-menu.el                                 |   1 -
 lisp/echistory.el                                  |   1 -
 lisp/ehelp.el                                      |   1 -
 lisp/electric.el                                   |   1 -
 lisp/emacs-lisp/advice.el                          |   1 -
 lisp/emacs-lisp/avl-tree.el                        |   1 -
 lisp/emacs-lisp/backquote.el                       |   1 -
 lisp/emacs-lisp/byte-opt.el                        |   1 -
 lisp/emacs-lisp/byte-run.el                        |   1 -
 lisp/emacs-lisp/bytecomp.el                        |   1 -
 lisp/emacs-lisp/cconv.el                           |   1 -
 lisp/emacs-lisp/cl-indent.el                       |   1 -
 lisp/emacs-lisp/cl-macs.el                         |  30 +-
 lisp/emacs-lisp/debug.el                           |   1 -
 lisp/emacs-lisp/derived.el                         |   1 -
 lisp/emacs-lisp/disass.el                          |   1 -
 lisp/emacs-lisp/edebug.el                          |  86 +--
 lisp/emacs-lisp/eieio-base.el                      |  32 +-
 lisp/emacs-lisp/eldoc.el                           |   2 +-
 lisp/emacs-lisp/elint.el                           |   2 +-
 lisp/emacs-lisp/elp.el                             |   1 -
 lisp/emacs-lisp/ewoc.el                            |   2 +-
 lisp/emacs-lisp/float-sup.el                       |   1 -
 lisp/emacs-lisp/gv.el                              |  26 +-
 lisp/emacs-lisp/helper.el                          |   1 -
 lisp/emacs-lisp/lisp-mnt.el                        |   1 -
 lisp/emacs-lisp/lisp-mode.el                       |  23 +-
 lisp/emacs-lisp/lisp.el                            |  14 +-
 lisp/emacs-lisp/map-ynp.el                         |   1 -
 lisp/emacs-lisp/map.el                             |   2 -
 lisp/emacs-lisp/package.el                         | 154 ++--
 lisp/emacs-lisp/regexp-opt.el                      |   5 +-
 lisp/emacs-lisp/ring.el                            |   1 -
 lisp/emacs-lisp/rmc.el                             |   2 -
 lisp/emacs-lisp/rx.el                              |  15 +-
 lisp/emacs-lisp/seq.el                             |   2 -
 lisp/emacs-lisp/subr-x.el                          |   1 -
 lisp/emacs-lisp/syntax.el                          |   6 +-
 lisp/emacs-lisp/tcover-ses.el                      |   4 +-
 lisp/emacs-lisp/tcover-unsafep.el                  |   4 +-
 lisp/emacs-lisp/thunk.el                           |   2 -
 lisp/emacs-lisp/timer-list.el                      |   1 -
 lisp/emacs-lisp/timer.el                           |   1 -
 lisp/emacs-lisp/tq.el                              |   1 -
 lisp/emacs-lisp/trace.el                           |   1 -
 lisp/emacs-lisp/warnings.el                        |   1 -
 lisp/emacs-lock.el                                 |   1 -
 lisp/env.el                                        |   1 -
 lisp/epa-file.el                                   |   4 +-
 lisp/epa.el                                        |  23 -
 lisp/epg.el                                        |  34 -
 lisp/erc/erc-autoaway.el                           |   1 -
 lisp/erc/erc-backend.el                            |   1 -
 lisp/erc/erc-button.el                             |   1 -
 lisp/erc/erc-capab.el                              |   2 -
 lisp/erc/erc-compat.el                             |   1 -
 lisp/erc/erc-dcc.el                                |   1 -
 lisp/erc/erc-ezbounce.el                           |   1 -
 lisp/erc/erc-fill.el                               |   1 -
 lisp/erc/erc-goodies.el                            |   1 -
 lisp/erc/erc-ibuffer.el                            |   1 -
 lisp/erc/erc-identd.el                             |   1 -
 lisp/erc/erc-imenu.el                              |   1 -
 lisp/erc/erc-join.el                               |   1 -
 lisp/erc/erc-lang.el                               |   1 -
 lisp/erc/erc-list.el                               |   1 -
 lisp/erc/erc-log.el                                |   1 -
 lisp/erc/erc-match.el                              |   1 -
 lisp/erc/erc-menu.el                               |   1 -
 lisp/erc/erc-netsplit.el                           |   1 -
 lisp/erc/erc-networks.el                           |   1 -
 lisp/erc/erc-notify.el                             |   1 -
 lisp/erc/erc-page.el                               |   2 -
 lisp/erc/erc-pcomplete.el                          |   1 -
 lisp/erc/erc-replace.el                            |   1 -
 lisp/erc/erc-ring.el                               |   1 -
 lisp/erc/erc-services.el                           |   2 -
 lisp/erc/erc-sound.el                              |   2 -
 lisp/erc/erc-speedbar.el                           |   1 -
 lisp/erc/erc-spelling.el                           |   1 -
 lisp/erc/erc-stamp.el                              |   1 -
 lisp/erc/erc-track.el                              |   1 -
 lisp/erc/erc-truncate.el                           |   1 -
 lisp/erc/erc-xdcc.el                               |   1 -
 lisp/erc/erc.el                                    |   1 -
 lisp/eshell/esh-mode.el                            |   6 +-
 lisp/expand.el                                     |   1 -
 lisp/faces.el                                      |  13 +-
 lisp/ffap.el                                       |  28 +-
 lisp/filenotify.el                                 | 171 +++--
 lisp/files-x.el                                    |   1 -
 lisp/files.el                                      |  72 +-
 lisp/filesets.el                                   |   1 -
 lisp/find-dired.el                                 |   1 -
 lisp/find-file.el                                  |   1 -
 lisp/flow-ctrl.el                                  |   1 -
 lisp/foldout.el                                    |   1 -
 lisp/follow.el                                     |   1 -
 lisp/font-core.el                                  |   1 -
 lisp/font-lock.el                                  |  54 +-
 lisp/frame.el                                      |   4 +-
 lisp/fringe.el                                     |   1 -
 lisp/gnus/gnus-agent.el                            |   4 +-
 lisp/gnus/gnus-art.el                              |   2 +-
 lisp/gnus/gnus-async.el                            |   2 +-
 lisp/gnus/gnus-cache.el                            |   6 +-
 lisp/gnus/gnus-demon.el                            |   4 +-
 lisp/gnus/gnus-group.el                            |  67 +-
 lisp/gnus/gnus-kill.el                             |   6 +-
 lisp/gnus/gnus-msg.el                              |  16 +-
 lisp/gnus/gnus-salt.el                             |   6 +-
 lisp/gnus/gnus-score.el                            |   4 +-
 lisp/gnus/gnus-start.el                            |  15 +-
 lisp/gnus/gnus-sum.el                              | 361 ++++-----
 lisp/gnus/gnus-win.el                              |  21 +-
 lisp/gnus/gnus.el                                  |   4 +-
 lisp/gnus/mail-source.el                           |   5 +-
 lisp/gnus/message.el                               | 146 ++--
 lisp/gnus/mm-decode.el                             |  17 +-
 lisp/gnus/mm-view.el                               |   6 +-
 lisp/gnus/mml.el                                   |  18 +-
 lisp/gnus/nndiary.el                               |   6 +-
 lisp/gnus/nnfolder.el                              |   6 +-
 lisp/gnus/nnheader.el                              | 116 +--
 lisp/gnus/nnir.el                                  |   2 +-
 lisp/gnus/nnmail.el                                |   2 -
 lisp/gnus/nnmaildir.el                             |   2 +-
 lisp/gnus/nnmairix.el                              |   4 +-
 lisp/gnus/nnml.el                                  |   8 +-
 lisp/gnus/nntp.el                                  |   6 +-
 lisp/gnus/nnvirtual.el                             | 130 ++--
 lisp/gnus/nnweb.el                                 |  19 +-
 lisp/help-fns.el                                   |  19 +-
 lisp/help-macro.el                                 |   1 -
 lisp/help-mode.el                                  |   1 -
 lisp/help.el                                       |  40 +-
 lisp/hexl.el                                       |  24 +-
 lisp/hippie-exp.el                                 |   1 -
 lisp/hl-line.el                                    |   1 -
 lisp/ibuffer.el                                    |  23 +-
 lisp/icomplete.el                                  |   4 +-
 lisp/ielm.el                                       |   1 -
 lisp/iimage.el                                     |   1 -
 lisp/image-file.el                                 |   7 +-
 lisp/image.el                                      |   5 +-
 lisp/imenu.el                                      |  93 ---
 lisp/indent.el                                     |   1 -
 lisp/info.el                                       |  60 --
 lisp/informat.el                                   |   1 -
 lisp/international/isearch-x.el                    |   4 +-
 lisp/international/iso-ascii.el                    |   1 -
 lisp/international/iso-transl.el                   |   1 -
 lisp/international/mule-cmds.el                    |   8 +-
 lisp/international/mule-util.el                    |  24 +-
 lisp/international/mule.el                         |  29 +-
 lisp/international/ogonek.el                       |   1 -
 lisp/international/quail.el                        |   6 +-
 lisp/international/utf7.el                         |   1 -
 lisp/isearch.el                                    |  15 +-
 lisp/isearchb.el                                   |   1 -
 lisp/jka-cmpr-hook.el                              |   1 -
 lisp/jka-compr.el                                  |   1 -
 lisp/kermit.el                                     |   1 -
 lisp/kmacro.el                                     |   1 +
 lisp/language/cyrillic.el                          |   2 +-
 lisp/language/european.el                          |   2 +-
 lisp/language/indian.el                            |   2 +-
 lisp/language/thai-word.el                         |   2 +-
 lisp/ldefs-boot.el                                 | 167 +++--
 lisp/leim/quail/py-punct.el                        |   2 +-
 lisp/leim/quail/pypunct-b5.el                      |   2 +-
 lisp/linum.el                                      |   1 -
 lisp/loadhist.el                                   |   1 -
 lisp/loadup.el                                     |   1 -
 lisp/lpr.el                                        |   1 -
 lisp/ls-lisp.el                                    |   1 -
 lisp/macros.el                                     |  35 +-
 lisp/mail/blessmail.el                             |   1 -
 lisp/mail/emacsbug.el                              |   1 -
 lisp/mail/feedmail.el                              |   2 +-
 lisp/mail/footnote.el                              | 497 +++++--------
 lisp/mail/hashcash.el                              |   1 -
 lisp/mail/mail-extr.el                             |   1 -
 lisp/mail/mail-utils.el                            |   1 -
 lisp/mail/mailabbrev.el                            |   1 -
 lisp/mail/mailalias.el                             |   1 -
 lisp/mail/reporter.el                              |   1 -
 lisp/mail/rfc822.el                                |   1 -
 lisp/mail/rmail.el                                 |   1 -
 lisp/mail/rmailedit.el                             |   1 -
 lisp/mail/rmailkwd.el                              |   1 -
 lisp/mail/rmailmm.el                               |   1 -
 lisp/mail/rmailmsc.el                              |   1 -
 lisp/mail/rmailout.el                              |   1 -
 lisp/mail/rmailsort.el                             |   1 -
 lisp/mail/rmailsum.el                              |   1 -
 lisp/mail/sendmail.el                              |   2 +-
 lisp/mail/smtpmail.el                              |   6 +-
 lisp/mail/supercite.el                             |   1 -
 lisp/mail/undigest.el                              |   1 -
 lisp/mail/unrmail.el                               |   1 -
 lisp/makesum.el                                    |   1 -
 lisp/man.el                                        |  24 +-
 lisp/menu-bar.el                                   |   1 -
 lisp/minibuffer.el                                 |  24 +-
 lisp/misc.el                                       |   1 -
 lisp/mouse.el                                      |   5 +-
 lisp/msb.el                                        |   1 -
 lisp/mwheel.el                                     |   2 +-
 lisp/net/ange-ftp.el                               |   3 +-
 lisp/net/browse-url.el                             |   1 -
 lisp/net/eww.el                                    |  23 +-
 lisp/net/goto-addr.el                              |   1 -
 lisp/net/ldap.el                                   |   1 -
 lisp/net/pop3.el                                   |   1 -
 lisp/net/rcirc.el                                  |  24 +-
 lisp/net/rfc2104.el                                |  12 +-
 lisp/net/shr.el                                    |  15 +-
 lisp/net/socks.el                                  |   2 +-
 lisp/net/telnet.el                                 |   1 -
 lisp/net/tramp-adb.el                              |   4 +-
 lisp/net/tramp-archive.el                          |   2 +
 lisp/net/tramp-compat.el                           | 196 ++---
 lisp/net/tramp-gvfs.el                             |  11 +-
 lisp/net/tramp-integration.el                      |   2 +-
 lisp/net/tramp-sh.el                               | 279 +++----
 lisp/net/tramp-smb.el                              |  18 +-
 lisp/net/tramp.el                                  |  65 +-
 lisp/newcomment.el                                 |  12 +-
 lisp/novice.el                                     |   1 -
 lisp/nxml/nxml-mode.el                             |   4 +-
 lisp/nxml/nxml-rap.el                              |  42 +-
 lisp/obarray.el                                    |   1 -
 lisp/obsolete/abbrevlist.el                        |   1 -
 lisp/obsolete/bruce.el                             |   1 -
 lisp/obsolete/fast-lock.el                         |   1 -
 lisp/obsolete/gs.el                                |   1 -
 lisp/obsolete/gulp.el                              |   1 -
 lisp/obsolete/info-edit.el                         |  82 ++
 lisp/obsolete/lazy-lock.el                         |   1 -
 lisp/obsolete/ledit.el                             |   1 -
 lisp/obsolete/levents.el                           |   1 -
 lisp/obsolete/lucid.el                             |   1 -
 lisp/obsolete/mailpost.el                          |   1 -
 lisp/obsolete/meese.el                             |   1 -
 lisp/obsolete/pc-mode.el                           |   1 -
 lisp/obsolete/rcompile.el                          |   1 -
 lisp/obsolete/sregex.el                            |   1 -
 lisp/obsolete/sup-mouse.el                         |   1 -
 lisp/obsolete/terminal.el                          |   1 -
 lisp/obsolete/ws-mode.el                           | 180 +----
 lisp/obsolete/yow.el                               |   1 -
 lisp/org/ox-publish.el                             |   2 +-
 lisp/outline.el                                    |   1 -
 lisp/paren.el                                      |   1 -
 lisp/play/cookie1.el                               |   1 -
 lisp/play/dissociate.el                            |   1 -
 lisp/play/doctor.el                                |   1 -
 lisp/play/gamegrid.el                              |   4 +-
 lisp/play/gomoku.el                                |   1 -
 lisp/play/hanoi.el                                 |   1 -
 lisp/play/life.el                                  |   1 -
 lisp/play/spook.el                                 |   1 -
 lisp/play/studly.el                                |   1 -
 lisp/play/tetris.el                                |   1 +
 lisp/progmodes/ada-mode.el                         |   2 +-
 lisp/progmodes/asm-mode.el                         |   1 -
 lisp/progmodes/cc-align.el                         |  12 +-
 lisp/progmodes/cc-awk.el                           |   1 -
 lisp/progmodes/cc-defs.el                          |   6 +-
 lisp/progmodes/cc-engine.el                        | 472 ++++++++----
 lisp/progmodes/cc-fonts.el                         |  12 +-
 lisp/progmodes/cc-langs.el                         | 115 ++-
 lisp/progmodes/cc-mode.el                          |  45 +-
 lisp/progmodes/cc-vars.el                          |   8 +-
 lisp/progmodes/compile.el                          |   1 -
 lisp/progmodes/cperl-mode.el                       |   1 -
 lisp/progmodes/dcl-mode.el                         |   1 -
 lisp/progmodes/ebrowse.el                          |   1 -
 lisp/progmodes/elisp-mode.el                       |   1 -
 lisp/progmodes/etags.el                            |   1 -
 lisp/progmodes/flymake.el                          |  34 +-
 lisp/progmodes/gdb-mi.el                           |   1 -
 lisp/progmodes/grep.el                             |   4 +-
 lisp/progmodes/gud.el                              |   1 -
 lisp/progmodes/hideshow.el                         |  59 +-
 lisp/progmodes/make-mode.el                        |   1 -
 lisp/progmodes/mixal-mode.el                       |   1 -
 lisp/progmodes/modula2.el                          |   1 -
 lisp/progmodes/octave.el                           |   3 +-
 lisp/progmodes/perl-mode.el                        |   1 -
 lisp/progmodes/prog-mode.el                        |   1 -
 lisp/progmodes/project.el                          | 102 +--
 lisp/progmodes/python.el                           |  13 +-
 lisp/progmodes/sh-script.el                        |   1 -
 lisp/progmodes/tcl.el                              |   1 -
 lisp/progmodes/verilog-mode.el                     |  22 +-
 lisp/progmodes/xref.el                             |  35 +-
 lisp/progmodes/xscheme.el                          |   1 -
 lisp/ps-bdf.el                                     |   2 +-
 lisp/ps-def.el                                     |   4 +-
 lisp/ps-mule.el                                    |   4 +-
 lisp/ps-print.el                                   |  17 +-
 lisp/ps-samp.el                                    |   4 +-
 lisp/register.el                                   |   1 -
 lisp/replace.el                                    |   1 -
 lisp/reposition.el                                 |   1 -
 lisp/rot13.el                                      |   1 -
 lisp/savehist.el                                   |  47 +-
 lisp/saveplace.el                                  |   1 -
 lisp/scroll-bar.el                                 |   1 -
 lisp/scroll-lock.el                                |   1 -
 lisp/select.el                                     |   8 +-
 lisp/server.el                                     |  63 +-
 lisp/ses.el                                        |   2 +-
 lisp/shell.el                                      |   1 -
 lisp/simple.el                                     |   9 +-
 lisp/skeleton.el                                   |   1 -
 lisp/sort.el                                       |   1 -
 lisp/soundex.el                                    |   1 -
 lisp/startup.el                                    |   1 -
 lisp/strokes.el                                    |   1 -
 lisp/subr.el                                       |  19 +-
 lisp/t-mouse.el                                    |   1 -
 lisp/tabify.el                                     |   1 -
 lisp/talk.el                                       |   1 -
 lisp/tar-mode.el                                   |   1 -
 lisp/tempo.el                                      |  41 +-
 lisp/term.el                                       |  49 +-
 lisp/term/common-win.el                            |   1 -
 lisp/term/pc-win.el                                |   1 -
 lisp/term/tty-colors.el                            |   1 -
 lisp/textmodes/bib-mode.el                         |   1 -
 lisp/textmodes/fill.el                             |   1 -
 lisp/textmodes/flyspell.el                         |   1 -
 lisp/textmodes/ispell.el                           |   2 +-
 lisp/textmodes/makeinfo.el                         |   1 -
 lisp/textmodes/nroff-mode.el                       |   1 -
 lisp/textmodes/page.el                             |   1 -
 lisp/textmodes/paragraphs.el                       |   1 -
 lisp/textmodes/picture.el                          |   2 -
 lisp/textmodes/refbib.el                           |   1 -
 lisp/textmodes/refer.el                            |   1 -
 lisp/textmodes/remember.el                         |   1 -
 lisp/textmodes/sgml-mode.el                        |  68 +-
 lisp/textmodes/table.el                            |  10 +-
 lisp/textmodes/tex-mode.el                         |   1 -
 lisp/textmodes/texinfmt.el                         |   1 -
 lisp/textmodes/texinfo.el                          |   1 -
 lisp/textmodes/texnfo-upd.el                       |   1 -
 lisp/textmodes/text-mode.el                        |   1 -
 lisp/textmodes/underline.el                        |   1 -
 lisp/thingatpt.el                                  |   9 +-
 lisp/thread.el                                     |   1 -
 lisp/thumbs.el                                     |   1 -
 lisp/time.el                                       |   2 -
 lisp/tmm.el                                        |   1 -
 lisp/tutorial.el                                   |   1 -
 lisp/uniquify.el                                   |   1 -
 lisp/url/url-auth.el                               |   6 +-
 lisp/url/url-dav.el                                |   1 -
 lisp/url/url-gw.el                                 |   1 -
 lisp/url/url-handlers.el                           | 192 +++--
 lisp/url/url-http.el                               |  29 +-
 lisp/url/url-util.el                               |   2 +-
 lisp/url/url.el                                    |   9 +-
 lisp/userlock.el                                   |   1 -
 lisp/vc/add-log.el                                 |   1 -
 lisp/vc/compare-w.el                               |   1 -
 lisp/vc/diff-mode.el                               |  24 +-
 lisp/vc/diff.el                                    |   1 -
 lisp/vc/ediff-ptch.el                              |  31 +-
 lisp/vc/log-view.el                                |  21 +-
 lisp/vc/vc-annotate.el                             |   1 -
 lisp/vc/vc-bzr.el                                  |   6 +-
 lisp/vc/vc-cvs.el                                  |   1 -
 lisp/vc/vc-dispatcher.el                           |  13 +-
 lisp/vc/vc-filewise.el                             |   1 -
 lisp/vc/vc-git.el                                  |   6 +-
 lisp/vc/vc-hg.el                                   |   3 +-
 lisp/vc/vc-hooks.el                                |   1 -
 lisp/vc/vc-mtn.el                                  |   2 +-
 lisp/vc/vc-rcs.el                                  |   1 -
 lisp/vc/vc-sccs.el                                 |   1 -
 lisp/vc/vc-src.el                                  |   1 -
 lisp/vc/vc.el                                      |   1 -
 lisp/vcursor.el                                    |   1 -
 lisp/version.el                                    |   1 -
 lisp/view.el                                       |   1 -
 lisp/vt100-led.el                                  |   1 -
 lisp/w32-fns.el                                    |   3 +
 lisp/wid-edit.el                                   |   1 -
 lisp/window.el                                     | 149 +++-
 lisp/woman.el                                      |   1 -
 lisp/x-dnd.el                                      |   1 -
 m4/manywarnings.m4                                 |   9 +-
 make-dist                                          |  11 +-
 nt/INSTALL.W64                                     |   6 +-
 src/.gdbinit                                       |   6 +-
 src/alloc.c                                        |  77 +-
 src/bignum.h                                       |  12 +
 src/buffer.c                                       |  27 +-
 src/buffer.h                                       |   4 +
 src/bytecode.c                                     |   2 +-
 src/character.h                                    |   9 +-
 src/coding.c                                       |  23 +
 src/coding.h                                       |  11 +
 src/conf_post.h                                    |   6 +-
 src/data.c                                         |  46 +-
 src/dbusbind.c                                     |   8 +-
 src/dispextern.h                                   |  94 ++-
 src/dispnew.c                                      |  94 ++-
 src/dynlib.h                                       |   2 +-
 src/emacs-module.c                                 |  38 +-
 src/emacs-module.h.in                              |   2 +
 src/emacs.c                                        |   3 -
 src/eval.c                                         |  50 +-
 src/fileio.c                                       |   9 +-
 src/fns.c                                          |   6 +-
 src/font.h                                         |   4 +-
 src/frame.h                                        |   2 +-
 src/ftcrfont.c                                     | 417 +++++++----
 src/ftfont.c                                       | 255 +++++--
 src/ftfont.h                                       |  18 +-
 src/ftxfont.c                                      |   8 +-
 src/gtkutil.c                                      |   2 +-
 src/gtkutil.h                                      |   2 +-
 src/image.c                                        | 825 +++++++--------------
 src/indent.c                                       |   7 +-
 src/insdel.c                                       |  13 +-
 src/intervals.c                                    |  39 +-
 src/json.c                                         |  59 +-
 src/keyboard.c                                     |   6 +-
 src/lisp.h                                         |   7 +-
 src/lread.c                                        | 148 ++--
 src/macfont.m                                      |  19 +-
 src/marker.c                                       |   4 +
 src/mini-gmp.c                                     | 559 ++++++++------
 src/mini-gmp.h                                     |   2 +-
 src/minibuf.c                                      |   3 +-
 src/msdos.h                                        |   2 -
 src/nsfont.m                                       |   2 +-
 src/nsgui.h                                        |  62 +-
 src/nsimage.m                                      |   4 +-
 src/nsmenu.m                                       |   7 +-
 src/nsselect.m                                     |  14 +-
 src/nsterm.h                                       |  60 +-
 src/nsterm.m                                       | 193 ++---
 src/print.c                                        |  40 +-
 src/search.c                                       |   7 +-
 src/termhooks.h                                    |  15 +-
 src/timefns.c                                      |   5 +-
 src/w32.c                                          |  11 +-
 src/w32fns.c                                       |  27 +-
 src/w32font.c                                      |   2 +-
 src/w32font.h                                      |   2 +-
 src/w32gui.h                                       |  43 +-
 src/w32term.c                                      | 214 ++----
 src/w32term.h                                      |  53 +-
 src/window.c                                       |   6 +-
 src/xdisp.c                                        | 346 +++++++--
 src/xfaces.c                                       |  86 +--
 src/xfns.c                                         |   8 +-
 src/xfont.c                                        | 122 +--
 src/xftfont.c                                      | 156 +---
 src/xterm.c                                        | 467 +++++-------
 src/xterm.h                                        |  20 +-
 test/Makefile.in                                   |  13 +-
 test/data/emacs-module/mod-test.c                  |  29 +-
 test/lisp/autorevert-tests.el                      | 255 ++++++-
 test/lisp/delim-col-tests.el                       | 181 +++++
 test/lisp/emacs-lisp/cl-macs-tests.el              |  17 +
 test/lisp/emacs-lisp/eieio-tests/eieio-tests.el    |  56 +-
 test/lisp/emacs-lisp/lisp-mode-tests.el            |  28 +
 test/lisp/emacs-lisp/map-tests.el                  |   1 -
 test/lisp/emacs-lisp/rx-tests.el                   |   8 +-
 test/lisp/emacs-lisp/seq-tests.el                  |   1 -
 test/lisp/emacs-lisp/thunk-tests.el                |   1 -
 test/lisp/filenotify-tests.el                      |  59 +-
 test/lisp/files-tests.el                           |  15 +
 test/lisp/font-lock-tests.el                       |  41 +
 test/lisp/help-fns-tests.el                        |   2 -
 test/lisp/image-file-tests.el                      |  44 ++
 test/lisp/image-tests.el                           |  11 +
 test/lisp/mail/footnote-tests.el                   |  47 ++
 test/lisp/md4-tests.el                             |   1 -
 test/lisp/net/tramp-tests.el                       | 109 ++-
 test/lisp/nxml/nxml-mode-tests.el                  |  82 ++
 test/lisp/org/org-tests.el                         |   2 -
 test/lisp/progmodes/python-tests.el                |  13 +
 test/lisp/soundex-tests.el                         |   2 -
 test/lisp/tempo-tests.el                           | 228 ++++++
 test/lisp/term-tests.el                            | 136 +++-
 test/lisp/textmodes/sgml-mode-tests.el             |  12 +-
 test/lisp/vc/diff-mode-tests.el                    |   1 -
 test/lisp/vc/smerge-mode-tests.el                  |   2 -
 test/lisp/vc/vc-bzr-tests.el                       |   1 -
 test/lisp/vc/vc-hg-tests.el                        |   1 -
 test/lisp/xdg-tests.el                             |   1 -
 test/manual/biditest.el                            |   1 -
 .../etags/el-src/emacs/lisp/progmodes/etags.el     |   1 -
 test/src/emacs-module-tests.el                     |  15 +-
 test/src/lcms-tests.el                             |   2 -
 test/src/timefns-tests.el                          |   6 +
 603 files changed, 8388 insertions(+), 6555 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 92efcf6..df48764 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,7 +21,7 @@
 # any particular service that uses that protocol.  Also, it is intended for
 # evaluation purposes, thus possibly temporary.
 
-# Maintainer: address@hidden
+# Maintainer: Ted Zlatanov <address@hidden>
 # URL: https://emba.gnu.org/emacs/emacs
 
 image: debian:stretch
diff --git a/INSTALL b/INSTALL
index 8022385..6934022 100644
--- a/INSTALL
+++ b/INSTALL
@@ -34,11 +34,12 @@ some of the steps manually.  The more detailed description 
in the other
 sections of this guide will help you do that, so please refer to those
 sections if you need to.
 
-  1. Unpacking the Emacs release requires about 200 MB of free
-  disk space.  Building Emacs uses about another 200 MB of space.
-  The final installed Emacs uses about 150 MB of disk space.
-  This includes the space-saving that comes from automatically
-  compressing the Lisp source files on installation.
+  1.  Obtain and unpack the Emacs release, with commands like this:
+
+                wget https://ftp.gnu.org/gnu/emacs/emacs-VERSION.tar.xz
+                tar -xf emacs-VERSION.tar.xz
+
+      where VERSION is the Emacs version number.
 
   2a. 'cd' to the directory where you unpacked Emacs and invoke the
       'configure' script:
@@ -81,13 +82,17 @@ sections if you need to.
 
                 src/emacs -Q
 
+     To test Emacs further (intended mostly to help developers):
+
+                make check
+
   6. Assuming that the program 'src/emacs' starts and displays its
      opening screen, you can install the program and its auxiliary
      files into their installation directories:
 
                 make install
 
-  You are now ready to use Emacs.  If you wish to conserve disk space,
+  You are now ready to use Emacs.  If you wish to conserve space,
   you may remove the program binaries and object files from the
   directory where you built Emacs:
 
@@ -118,7 +123,7 @@ packages.  Note that if there is a separate 'dev' or 
'devel' package,
 for use at compilation time rather than run time, you will need that
 as well as the corresponding run time package; typically the dev
 package will contain header files and a library archive.  Otherwise,
-you can download the libraries from <http://www.nongnu.org/m17n/>.
+you can download the libraries from <https://www.nongnu.org/m17n/>.
 
 Note that Emacs cannot support complex scripts on a TTY, unless the
 terminal includes such a support.
@@ -162,14 +167,14 @@ can be found (in the unlikely event that your 
distribution does not
 provide them).  By default, libraries marked with an X are required if
 X11 is being used.
 
-    libXaw3d          https://directory.fsf.org/project/xaw3d/
-  X libxpm for XPM:   http://www.x.org/releases/current/src/lib/
+    libXaw3d          https://directory.fsf.org/project/Xaw3d
+  X libxpm for XPM:   https://www.x.org/releases/current/src/lib/
   X libpng for PNG:   http://www.libpng.org/
-    libz (for PNG):   http://www.zlib.net/
-  X libjpeg for JPEG: http://www.ijg.org/
-  X libtiff for TIFF: http://www.remotesensing.org/libtiff/
-  X libgif for GIF:   http://sourceforge.net/projects/giflib/
-    librsvg2 for SVG: http://wiki.gnome.org/action/show/Projects/LibRsvg
+    libz (for PNG):   https://www.zlib.net/
+  X libjpeg for JPEG: https://www.ijg.org/
+  X libtiff for TIFF: http://www.simplesystems.org/libtiff/
+  X libgif for GIF:   http://giflib.sourceforge.net/
+    librsvg2 for SVG: https://wiki.gnome.org/Projects/LibRsvg
 
 If you supply the appropriate --without-LIB option, 'configure' will
 omit the corresponding library from Emacs, even if that makes for a
@@ -213,7 +218,7 @@ DETAILED BUILDING AND INSTALLATION:
 see nextstep/INSTALL.  For non-ancient versions of MS Windows, see
 the file nt/INSTALL.  For MS-DOS and MS Windows 3.X, see msdos/INSTALL.)
 
-1) See the basic installation summary above for the disk space requirements.
+1) See BASIC INSTALLATION above for getting and configuring Emacs.
 
 2) In the unlikely event that 'configure' does not detect your system
 type correctly, consult './etc/MACHINES' to see what --host, --build
@@ -294,7 +299,9 @@ or more of these options:
   --without-gif          for GIF image support
   --without-png          for PNG image support
   --without-rsvg         for SVG image support
-  --without-imagemagick  for Imagemagick support
+
+Although ImageMagick support is disabled by default due to security
+and stability concerns, you can enable it with --with-imagemagick.
 
 Use --without-toolkit-scroll-bars to disable Motif or Xaw3d scroll bars.
 
@@ -352,7 +359,7 @@ Use --enable-link-time-optimization to enable link-time 
optimization.
 With GCC, you need GCC 4.5.0 and later, and 'configure' arranges for
 linking to be parallelized if possible.  With Clang, you need GNU
 binutils with the gold linker and plugin support, along with the LLVM
-gold plugin <http://llvm.org/docs/GoldPlugin.html>.  Link time
+gold plugin <https://llvm.org/docs/GoldPlugin.html>.  Link time
 optimization is not the default as it tends to cause crashes and to
 make Emacs slower.
 
diff --git a/INSTALL.REPO b/INSTALL.REPO
index 6dca9dd..b743385 100644
--- a/INSTALL.REPO
+++ b/INSTALL.REPO
@@ -32,8 +32,8 @@ can invoke './configure -C'.  After configuring, build Emacs 
as follows:
 
   $ make
 
-If you want to install Emacs, type 'make install' instead of 'make' in
-the last command.
+You can also type 'make check' to test and 'make install' to install
+Emacs.
 
 Occasionally the file 'lisp/loaddefs.el' (and similar automatically
 generated files, such as 'esh-groups.el', and '*-loaddefs.el' in some
diff --git a/Makefile.in b/Makefile.in
index 88cbb3d..21362a9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -320,7 +320,8 @@ SUBDIR_MAKEFILES = $(patsubst 
${srcdir}/%,%,${SUBDIR_MAKEFILES_IN:.in=})
 # Non-makefile files created by config.status.
 CONFIG_STATUS_FILES_IN = \
  ${srcdir}/nt/emacs.rc.in ${srcdir}/nt/emacsclient.rc.in \
- ${srcdir}/doc/man/emacs.1.in ${srcdir}/src/emacs-module.h.in
+ ${srcdir}/doc/man/emacs.1.in ${srcdir}/src/emacs-module.h.in \
+ ${srcdir}/src/module-env-*.h
 
 # Subdirectories to install, and where they'll go.  lib-src's and nt's
 # makefiles know how to install them, so we don't do that here.
@@ -949,17 +950,15 @@ extraclean: $(extraclean_dirs:=_extraclean)
 TAGS tags: lib lib-src # src
        $(MAKE) -C src tags
 
-.PHONY: have-tests
-have-tests:
-       @if test ! -d test; then \
-         echo "You do not seem to have the test/ directory."; \
-         echo "Maybe you are using a release tarfile, rather than a repository 
checkout."; \
-        exit 1; \
-       fi
-
-.PHONY: check check-maybe check-expensive check-all
-check check-maybe check-expensive check-all: have-tests all
+CHECK_TARGETS = check check-maybe check-expensive check-all
+.PHONY: $(CHECK_TARGETS)
+$(CHECK_TARGETS): all
+ifeq ($(wildcard test),test)
        $(MAKE) -C test $@
+else
+       @echo "You do not seem to have the test/ directory."
+       @echo "Maybe you used a release tarfile that lacks tests."
+endif
 
 dist:
        cd ${srcdir}; ./make-dist
diff --git a/admin/admin.el b/admin/admin.el
index 030bd54..d3a477f 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -138,10 +138,10 @@ Root must be the root of an Emacs source tree."
                               (if (eq 2 (length newversion)) 0 1))))
          (majorbump (and oldversion (not (equal oldmajor newmajor))))
          (minorbump (and oldversion (not majorbump)
-                         (or (not (equal (cadr oldversion)
-                                         (cadr newversion)))
-                             (and (equal (cadr oldversion) (cadr newversion))
-                                  (equal (nth 2 newversion) 50)))))
+                         (or (not (equal (cadr oldversion) (cadr newversion)))
+                             ;; Eg 26.2 -> 26.2.50.
+                             (and (> (length newversion)
+                                     (length oldversion))))))
          (newsfile (expand-file-name "etc/NEWS" root))
          (oldnewsfile (expand-file-name (format "etc/NEWS.%s" oldmajor) root)))
     (unless (> (length newversion) 2)   ; pretest or release candidate?
diff --git a/admin/authors.el b/admin/authors.el
index a3f8bdd..8329f3f 100644
--- a/admin/authors.el
+++ b/admin/authors.el
@@ -1,10 +1,8 @@
-
 ;;; authors.el --- utility for maintaining Emacs's AUTHORS file
 
 ;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: maint
 ;; Package: emacs
 
diff --git a/admin/find-gc.el b/admin/find-gc.el
index bf93c4e..9b92556 100644
--- a/admin/find-gc.el
+++ b/admin/find-gc.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/admin/last-chance.el b/admin/last-chance.el
index 5f993be..ceed1c7 100644
--- a/admin/last-chance.el
+++ b/admin/last-chance.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Thien-Thi Nguyen <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: maint
 ;; Package: emacs
 
diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index 47b6017..43992a0 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -115,7 +115,7 @@ General steps (for each step, check for possible errors):
     results against the new tar contents.
 
 7.   tar -xf emacs-NEW.tar; cd emacs-NEW
-     ./configure --prefix=/tmp/emacs && make && make install
+     ./configure --prefix=/tmp/emacs && make check && make install
     Use 'script' or M-x compile to save the compilation log in
     compile-NEW.log and compare it against an old one.  The easiest way
     to do that is to visit the old log in Emacs, change the version
diff --git a/admin/update-copyright b/admin/update-copyright
index 44cb84d..9f36090 100755
--- a/admin/update-copyright
+++ b/admin/update-copyright
@@ -50,6 +50,7 @@ repo_files=$(git ls-files) &&
 # Do not update the copyright of files that have one or more of the
 # following problems:
 # . They are license files, maintained by the FSF, with their own dates.
+# . They are GMP files, maintained by the GMP project, with their own dates.
 # . Their format cannot withstand changing the contents of copyright strings.
 
 updatable_files=$(find $repo_files \
@@ -70,6 +71,7 @@ updatable_files=$(find $repo_files \
   ! -name hand.cur \
   ! -name key.pub \
   ! -name key.sec \
+  ! -name 'mini-gmp.[ch]' \
   -print) &&
 
 build-aux/update-copyright $updatable_files
diff --git a/autogen.sh b/autogen.sh
index 40d0c37..cff4a54 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -4,7 +4,6 @@
 ## Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
-## Maintainer: address@hidden
 
 ## This file is part of GNU Emacs.
 
@@ -316,8 +315,16 @@ git_config transfer.fsckObjects true
 
 # Configure 'git diff' hunk header format.
 
+# This xfuncname is based on Git's built-in 'cpp' pattern.
+# The first line rejects jump targets and access declarations.
+# The second line matches top-level functions and methods.
+# The third line matches preprocessor and DEFUN macros.
+git_config diff.cpp.xfuncname \
+'!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])
+^((::[[:space:]]*)?[A-Za-z_][A-Za-z_0-9]*[[:space:]]*\(.*)$
+^((#define[[:space:]]|DEFUN).*)$'
 git_config diff.elisp.xfuncname \
-          '^\(def[^[:space:]]+[[:space:]]+([^()[:space:]]+)'
+           '^\([^[:space:]]*def[^[:space:]]+[[:space:]]+([^()[:space:]]+)'
 git_config 'diff.m4.xfuncname' '^((m4_)?define|A._DEFUN(_ONCE)?)\([^),]*'
 git_config 'diff.make.xfuncname' \
           
'^([$.[:alnum:]_].*:|[[:alnum:]_]+[[:space:]]*([*:+]?[:?]?|!?)=|define .*)'
@@ -332,7 +339,7 @@ git_config diff.texinfo.xfuncname \
 tailored_hooks=
 sample_hooks=
 
-for hook in commit-msg pre-commit; do
+for hook in commit-msg pre-commit prepare-commit-msg; do
     cmp -- build-aux/git-hooks/$hook "$hooks/$hook" >/dev/null 2>&1 ||
        tailored_hooks="$tailored_hooks $hook"
 done
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 79d1317..4cd9454 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -2,7 +2,7 @@
 # Attempt to guess a canonical system name.
 #   Copyright 1992-2019 Free Software Foundation, Inc.
 
-timestamp='2019-03-04'
+timestamp='2019-04-28'
 
 # 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
@@ -1468,6 +1468,14 @@ cat > "$dummy.c" <<EOF
 #include <sys/types.h>
 #include <sys/utsname.h>
 #endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || 
defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || 
defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
 main ()
 {
 #if defined (sony)
@@ -1555,18 +1563,23 @@ main ()
   printf ("vax-dec-bsd\n"); exit (0);
 #endif
 #else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname un;
+  uname (&un);
+  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
   printf ("vax-dec-ultrix\n"); exit (0);
 #endif
 #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);
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname *un;
+  uname (&un);
+  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
 #else
-#if defined(ULTRIX3) || defined(ultrix3) || defined(SIGLOST)
-  printf ("mips-dec-ultrix3\n"); exit (0);
-#endif
+  printf ("mips-dec-ultrix\n"); exit (0);
 #endif
 #endif
 #endif
diff --git a/build-aux/git-hooks/prepare-commit-msg 
b/build-aux/git-hooks/prepare-commit-msg
new file mode 100755
index 0000000..3562a80
--- /dev/null
+++ b/build-aux/git-hooks/prepare-commit-msg
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Check the format of GNU Emacs change log entries.
+
+# Copyright 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/>.
+
+COMMIT_MSG_FILE=$1
+COMMIT_SOURCE=$2
+SHA1=$3
+
+# Prefer gawk if available, as it handles NUL bytes properly.
+if type gawk >/dev/null 2>&1; then
+  awk=gawk
+else
+  awk=awk
+fi
+
+exec $awk '
+  # Catch the case when someone ran git-commit with -s option,
+  # which automatically adds Signed-off-by.
+  /^Signed-off-by: / {
+    print "'\''Signed-off-by:'\'' in commit message"
+    status = 1
+  }
+  END {
+    if (status != 0) {
+      print "Commit aborted; please see the file 'CONTRIBUTE'"
+    }
+    exit status
+  }
+' <"$COMMIT_MSG_FILE"
diff --git a/build-aux/make-info-dir b/build-aux/make-info-dir
index 2dcac87..51f384a 100755
--- a/build-aux/make-info-dir
+++ b/build-aux/make-info-dir
@@ -5,7 +5,6 @@
 ## Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
-## Maintainer: address@hidden
 
 ## This file is part of GNU Emacs.
 
diff --git a/configure.ac b/configure.ac
index 26ffc3e..e9001fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -432,7 +432,7 @@ OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS 
support])
 OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support])
 OPTION_DEFAULT_OFF([cairo],[compile with Cairo drawing (experimental)])
 OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
-OPTION_DEFAULT_ON([imagemagick],[don't compile with ImageMagick image support])
+OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support])
 OPTION_DEFAULT_ON([json], [don't compile with native JSON support])
 
 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
@@ -3708,6 +3708,8 @@ 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"
+emacs_major_version="${PACKAGE_VERSION%%.*}"
+AC_SUBST(emacs_major_version)
 
 ### Use -lpng if available, unless '--with-png=no'.
 HAVE_PNG=no
@@ -5736,9 +5738,8 @@ m4_define([subdir_makefiles],
 SUBDIR_MAKEFILES="subdir_makefiles"
 AC_CONFIG_FILES(subdir_makefiles)
 
-dnl test/ is not present in release tarfiles.
+dnl The test/ directory is missing if './make-dist --no-tests' was used.
 opt_makefile=test/Makefile
-
 if test -f "$srcdir/$opt_makefile.in"; then
   SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
   dnl Again, it's best not to use a variable.  Though you can add
diff --git a/doc/emacs/arevert-xtra.texi b/doc/emacs/arevert-xtra.texi
index cd7c1ff..37e2f9e 100644
--- a/doc/emacs/arevert-xtra.texi
+++ b/doc/emacs/arevert-xtra.texi
@@ -4,8 +4,9 @@
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
 @c printed version) or in the main Emacs manual (for the on-line version).
address@hidden Autorevert
address@hidden Auto Reverting Non-File Buffers
+
address@hidden Non-File Buffers
address@hidden Auto Reverting Non-File Buffers
 
 Global Auto Revert Mode normally only reverts file buffers.  There are
 two ways to auto-revert certain non-file buffers: by enabling Auto
@@ -34,6 +35,14 @@ the Buffer Menu.)  In this case, Auto Revert does not print 
any
 messages while reverting, even when @code{auto-revert-verbose} is
 address@hidden
 
address@hidden buffer-auto-revert-by-notification
+Some non-file buffers can be updated reliably by file notification on
+their default directory; Dired buffers is an example.  The major mode
+can indicate this by setting @code{buffer-auto-revert-by-notification}
+to a address@hidden value in that buffer, allowing Auto Revert to
+avoid periodic polling.  Such notification does not include changes to
+files in that directory, only to the directory itself.
+
 The details depend on the particular types of buffers and are
 explained in the corresponding sections.
 
@@ -43,7 +52,7 @@ explained in the corresponding sections.
 @end menu
 
 @node Auto Reverting the Buffer Menu
address@hidden Auto Reverting the Buffer Menu
address@hidden Auto Reverting the Buffer Menu
 
 If auto-reverting of non-file buffers is enabled, the Buffer Menu
 @iftex
@@ -65,7 +74,7 @@ adding marks sets the buffer's modified flag prevents Auto 
Revert from
 automatically erasing the marks.
 
 @node Auto Reverting Dired
address@hidden Auto Reverting Dired buffers
address@hidden Auto Reverting Dired buffers
 
 Dired buffers only auto-revert when the file list of the buffer's main
 directory changes (e.g., when a new file is added or deleted).  They
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 27fcb73..14a0a01 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -568,10 +568,10 @@ mode in this buffer, as long as it is not marked 
modified.  Global
 Auto Revert mode applies to the @file{*Buffer List*} buffer only if
 @code{global-auto-revert-non-file-buffers} is address@hidden
 @iftex
address@hidden,, emacs-xtra}, for details.
address@hidden Reverting the Buffer Menu,, emacs-xtra}, for details.
 @end iftex
 @ifnottex
address@hidden, global-auto-revert-non-file-buffers}, for details.
address@hidden Reverting the Buffer Menu, global-auto-revert-non-file-buffers}, 
for details.
 @end ifnottex
 
 @node Indirect Buffers
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 518d157..6e16588 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1521,6 +1521,12 @@ library lets Emacs properly set up the hyperlinks in the 
@file{*Help*}
 buffer).  To disable this feature, change the variable
 @code{help-enable-auto-load} to @code{nil}.
 
address@hidden help-enable-completion-auto-load
+Automatic loading also occurs when completing names for
address@hidden and @code{describe-function}, based on the
+prefix being completed.  To disable this feature, change the variable
address@hidden to @code{nil}.
+
 @vindex load-dangerous-libraries
 @cindex Lisp files byte-compiled by XEmacs
   By default, Emacs refuses to load compiled Lisp files which were
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 00d5be7..34a5ff5 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -39,7 +39,7 @@ corresponding long form.
 
   The long forms with @samp{--} are easier to remember, but longer to
 type.  However, you don't have to spell out the whole option name; any
-unambiguous abbreviation is enough.  When a long option takes an
+unambiguous abbreviation is enough.  When a long option requires an
 argument, you can use either a space or an equal sign to separate the
 option name and the argument.  Thus, for the option @samp{--display},
 you can write either @samp{--display sugar-bombs:0.0} or
@@ -347,13 +347,15 @@ Start Emacs with minimum customizations.  This is similar 
to using
 @itemx address@hidden
 @itemx address@hidden
 Start Emacs as a daemon: after Emacs starts up, it starts the Emacs
-server without opening any frames.
-(Optionally, you can specify an explicit @var{name} for the server.)
-You can then use the @command{emacsclient} command to connect to Emacs
-for editing.  @xref{Emacs Server}, for information about using Emacs
-as a daemon.  A ``background'' daemon disconnects from the terminal
-and runs in the background (@samp{--daemon} is an alias for
address@hidden).
+server without opening any frames.  You can then use the
address@hidden command to connect to Emacs for editing.
+(Optionally, you can specify an explicit @var{name} for the server; if
+you do, you will need to specify the same @var{name} when you invoke
address@hidden, via its @option{--socket-name} option, see
address@hidden Options}.)  @xref{Emacs Server}, for information
+about using Emacs as a daemon.  A ``background'' daemon disconnects
+from the terminal and runs in the background (@samp{--daemon} is an
+alias for @samp{--bg-daemon}).
 
 @item --no-desktop
 @opindex --no-desktop
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index c649c17..bdd6dec 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -801,6 +801,7 @@ Its value is 70
   Automatically becomes buffer-local when set.
   This variable is safe as a file local variable if its value
   satisfies the predicate ‘integerp’.
+  Probably introduced at or before Emacs version 18.
 
 Documentation:
 Column beyond which automatic line-wrapping should happen.
@@ -1331,7 +1332,7 @@ On MS-DOS, the name of this file should be 
@file{_dir-locals.el}, due
 to limitations of the DOS filesystems.  If the filesystem is limited
 to 8+3 file names, the name of the file will be truncated by the OS to
 @file{_dir-loc.el}.
-}in a directory.  Whenever Emacs visits any file in that directory or
+} in a directory.  Whenever Emacs visits any file in that directory or
 any of its subdirectories, it will apply the directory-local variables
 specified in @file{.dir-locals.el}, as though they had been defined as
 file-local variables for that file (@pxref{File Variables}).  Emacs
@@ -1377,6 +1378,28 @@ be applied in the current directory, not in any 
subdirectories.
 Finally, it specifies a different @file{ChangeLog} file name for any
 file in the @file{src/imported} subdirectory.
 
+If the @file{.dir-locals.el} file contains multiple different values
+for a variable using different mode names or directories, the values
+will be applied in an order such that the values for more specific
+modes take priority over more generic modes.  Values specified under a
+directory have even more priority.  For example:
+
address@hidden
+((nil . ((fill-column . 40)))
+ (c-mode . ((fill-column . 50)))
+ (prog-mode . ((fill-column . 60)))
+ ("narrow-files" . ((nil . ((fill-column . 20))))))
address@hidden example
+
+Files that use @code{c-mode} also match @code{prog-mode} because the
+former inherits from the latter.  The value used for
address@hidden in C files will however be @code{50} because the
+mode name is more specific than @code{prog-mode}.  Files using other
+modes inheriting from @code{prog-mode} will use @code{60}.  Any file
+under the directory @file{narrow-files} will use the value @code{20}
+even if they use @code{c-mode} because directory entries have priority
+over mode entries.
+
 You can specify the variables @code{mode}, @code{eval}, and
 @code{unibyte} in your @file{.dir-locals.el}, and they have the same
 meanings as they would have in file local variables.  @code{coding}
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index f464a3a..4985fab 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1141,6 +1141,55 @@ right-to-left paragraphs.
 @node Displaying Boundaries
 @section Displaying Boundaries
 
address@hidden mode, display-fill-column-indicator
address@hidden display-fill-column-indicator-mode
address@hidden global-display-fill-column-indicator-mode
+  Emacs can add an indicator to display a fill column position.  The
+fill column indicator is a useful functionality specially in
+prog-mode to indicate the position of an specific column.
+
+  You can set the buffer-local variables @code{display-fill-column-indicator}
+and @code{display-fill-column-indicator-character} to activate the
+indicator and controls how the indicator looks.
+
+Alternatively you can type @address@hidden display-fill-column-indicator-mode}}
+or @address@hidden global-display-fill-column-indicator-mode}} which enables 
the
+indicator locally and globally respectively and also chooses the
+character to use if none is set already.  It is possible to use the
+first one to activate the indicator in a hook or the second one to
+enable it globally.
+
+There are 2 buffer local variables and 1 face to customize this mode:
+
address@hidden @code
address@hidden display-fill-column-indicator-column
address@hidden display-fill-column-indicator-column
+Specifies the column number where the indicator should be set.  It can
+take positive numerical values for the column or the special value
address@hidden which means that the variable @code{fill-column} will be
+used.
+
+Any other value disables the indicator.  The default value is @code{t}.
+
address@hidden display-fill-column-indicator-char
address@hidden display-fill-column-indicator-char
+Specifies the character used for the indicator.  This character can be
+any valid char including unicode ones if the actual font supports
+them.
+
+When the mode is enabled through the functions
address@hidden or
address@hidden, the initialization
+functions check if this variable is @code{non-nil}, otherwise the
+initialization tries to set it to U+2502 or @samp{|}.
+
address@hidden fill-column-indicator
address@hidden fill-column-indicator
+Specifies the face used to display the indicator.  It inherits its
+default values from shadow but without background color.  To change
+the indicator color you need to set only the foreground color of this face.
address@hidden table
+
 @vindex indicate-buffer-boundaries
   On graphical displays, Emacs can indicate the buffer boundaries in
 the fringes.  If you enable this feature, the first line and the last
diff --git a/doc/emacs/emacs-xtra.texi b/doc/emacs/emacs-xtra.texi
index dcd8fae..e9231b4 100644
--- a/doc/emacs/emacs-xtra.texi
+++ b/doc/emacs/emacs-xtra.texi
@@ -59,7 +59,7 @@ modify this GNU manual.''
 * Picture Mode::        Editing pictures made up of characters using
                          the quarter-plane screen model.
 
-* Autorevert::          Auto Reverting non-file buffers.
+* Non-File Buffers::    Auto Reverting non-file buffers.
 * Subdir Switches::     Subdirectory switches in Dired.
 * Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization.
 * Emerge::              A convenient way of merging two versions of a program.
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 58ec373..a34cef2 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -443,9 +443,7 @@ File Handling
 * Visiting::            Visiting a file prepares Emacs to edit the file.
 * Saving::              Saving makes your changes permanent.
 * Reverting::           Reverting cancels all the changes not saved.
address@hidden
-* Autorevert::          Auto Reverting non-file buffers.
address@hidden ifnottex
+* Auto Revert::         Keeping buffers automatically up-to-date.
 * Auto Save::           Auto Save periodically protects against loss of data.
 * File Aliases::        Handling multiple names for one file.
 * Directories::         Creating, deleting, and listing file directories.
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index a574282..36ef1dc 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -25,9 +25,7 @@ on file directories.
 * Visiting::            Visiting a file prepares Emacs to edit the file.
 * Saving::              Saving makes your changes permanent.
 * Reverting::           Reverting cancels all the changes not saved.
address@hidden
-* Autorevert::          Auto Reverting non-file buffers.
address@hidden ifnottex
+* Auto Revert::         Keeping buffers automatically up-to-date.
 * Auto Save::           Auto Save periodically protects against loss of data.
 * File Aliases::        Handling multiple names for one file.
 * Directories::         Creating, deleting, and listing file directories.
@@ -955,6 +953,11 @@ revert it automatically if it has changed---provided the 
buffer itself
 is not modified.  (If you have edited the text, it would be wrong to
 discard your changes.)
 
+  You can also tell Emacs to revert buffers automatically when their
+visited files change on disk; @pxref{Auto Revert}.
+
address@hidden Auto Revert
address@hidden Auto Revert: Keeping buffers automatically up-to-date
 @cindex Global Auto Revert mode
 @cindex mode, Global Auto Revert
 @cindex Auto Revert mode
@@ -962,22 +965,39 @@ discard your changes.)
 @findex global-auto-revert-mode
 @findex auto-revert-mode
 @findex auto-revert-tail-mode
address@hidden auto-revert-interval
address@hidden auto-revert-remote-files
+
+  A buffer can get out of sync with respect to its visited file on
+disk if that file is changed by another program.  To keep it up to
+date, you can enable Auto Revert mode by typing @kbd{M-x auto-revert-mode}.
+This automatically reverts the buffer when its visited file changes on
+disk.  To do the same for all file buffers, type
address@hidden global-auto-revert-mode} to enable Global Auto Revert mode.
+
+  Auto Revert will not revert a buffer if it has unsaved changes, or if
+its file on disk is deleted or renamed.
+
+  One use of Auto Revert mode is to ``tail'' a file such as a system
+log, so that changes made to that file by other programs are
+continuously displayed.  To do this, just move the point to the end of
+the buffer, and it will stay there as the file contents change.
+However, if you are sure that the file will only change by growing at
+the end, use Auto Revert Tail mode instead
+(@code{auto-revert-tail-mode}).  It is more efficient for this.
+Auto Revert Tail mode also works for remote files.
+
 @vindex auto-revert-verbose
-  You can also tell Emacs to revert buffers periodically.  To do this
-for a specific buffer, enable the minor mode Auto-Revert mode by
-typing @kbd{M-x auto-revert-mode}.  This automatically reverts the
-current buffer when its visited file changes on disk.  To do the same
-for all file buffers, type @kbd{M-x global-auto-revert-mode} to enable
-Global Auto-Revert mode.  These minor modes do not check or revert
-remote files, because that is usually too slow.  This behavior can be
-changed by setting the variable @code{auto-revert-remote-files} to
address@hidden
+  When a buffer is auto-reverted, a message is generated.  This can be
+suppressed by setting @code{auto-revert-verbose} to @code{nil}.
+
address@hidden auto-revert-remote-files
+  The Auto Revert modes do not check or revert remote files, because
+that is usually too slow.  This behavior can be changed by setting the
+variable @code{auto-revert-remote-files} to address@hidden
 
 @cindex file notifications
 @vindex auto-revert-use-notify
-  By default, Auto-Revert mode works using @dfn{file notifications},
address@hidden auto-revert-interval
+  By default, Auto Revert mode works using @dfn{file notifications},
 whereby changes in the filesystem are reported to Emacs by the OS.
 You can disable use of file notifications by customizing the variable
 @code{auto-revert-use-notify} to a @code{nil} value, then Emacs will
@@ -988,19 +1008,22 @@ the polling interval through the variable 
@code{auto-revert-interval}.
 supported, @code{auto-revert-use-notify} will be @code{nil} by
 default.
 
-  One use of Auto-Revert mode is to ``tail'' a file such as a system
-log, so that changes made to that file by other programs are
-continuously displayed.  To do this, just move the point to the end of
-the buffer, and it will stay there as the file contents change.
-However, if you are sure that the file will only change by growing at
-the end, use Auto-Revert Tail mode instead
-(@code{auto-revert-tail-mode}).  It is more efficient for this.
-Auto-Revert Tail mode works also for remote files.
-
-  When a buffer is auto-reverted, a message is generated.  This can be
-suppressed by setting @code{auto-revert-verbose} to @code{nil}.
-
-  In Dired buffers (@pxref{Dired}), Auto-Revert mode refreshes the
address@hidden auto-revert-avoid-polling
address@hidden auto-revert-notify-exclude-dir-regexp
+  By default, Auto Revert mode will poll files for changes
+periodically even when file notifications are used.  Polling is
+unnecessary in many cases, and turning it off may save power by
+relying on notifications only.  To do so, set the variable
address@hidden to address@hidden  However,
+notification is ineffective on certain file systems; mainly network
+file system on Unix-like machines, where files can be altered from
+other machines.  For such file systems, polling may be necessary.
+To force polling when
address@hidden is address@hidden, set
address@hidden to match files that
+should be excluded from using notification.
+
+  In Dired buffers (@pxref{Dired}), Auto Revert mode refreshes the
 buffer when a file is created or deleted in the buffer's directory.
 
   @xref{VC Undo}, for commands to revert to earlier versions of files
@@ -1008,6 +1031,9 @@ under version control.  @xref{VC Mode Line}, for Auto 
Revert
 peculiarities when visiting files under version control.
 
 @ifnottex
address@hidden
+* Non-File Buffers::    Auto Reverting Non-File Buffers.
address@hidden menu
 @include arevert-xtra.texi
 @end ifnottex
 
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 4986c11..0fbf91a 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1033,6 +1033,7 @@ systems support modifying change comments.
 Visit the revision indicated at the current line.
 
 @item d
address@hidden =
 Display a diff between the revision at point and the next earlier
 revision, for the specific file.
 
@@ -1047,6 +1048,16 @@ L}), toggle between showing and hiding the full log 
entry for the
 revision at point.
 @end table
 
+To compare two arbitrary revisions, activate the region: set the
+beginning of the region to the line with the first revision and the
+end of the region to the line with the second revision to compare,
+then type @kbd{d} or @kbd{=}.  When the beginning of the region is on
+the top line that has no revision, it uses the current working revision
+as the first revision to compare.  When the end of the region is on
+the bottom non-revision line after the last revision line, then it
+uses the next earlier revision after the last displayed revision as
+the second revision to compare.
+
 @vindex vc-log-show-limit
 Because fetching many log entries can be slow, the
 @file{*vc-change-log*} buffer displays no more than 2000 revisions by
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 7d7065a..cfc50d3 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -775,6 +775,13 @@ documentation for more possibilities.
 displayed only when the command generates output, set
 @code{async-shell-command-display-buffer} to @code{nil}.
 
address@hidden async-shell-command-width
+  The option @code{async-shell-command-width} defines the number of display
+columns available for output of asynchronous shell commands.
+A positive integer tells the shell to use that number of columns for
+command output.  The default value is @code{nil} that means to use
+the same number of columns as provided by the shell.
+
 @kindex M-|
 @findex shell-command-on-region
   @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but
@@ -1976,6 +1983,9 @@ 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.
+You need to use this option if you started Emacs as daemon
+(@pxref{Initial Options}) and specified the name for the server
+started by the daemon.
 
 Alternatively, you can set the @env{EMACS_SOCKET_NAME} environment
 variable to point to the server socket.  (The command-line option
@@ -2475,10 +2485,13 @@ automatically back to binary.
 into hex.  This is useful if you visit a file normally and then discover
 it is a binary file.
 
-  Ordinary text characters overwrite in Hexl mode.  This is to reduce
+  Inserting text always overwrites in Hexl mode.  This is to reduce
 the risk of accidentally spoiling the alignment of data in the file.
-There are special commands for insertion.  Here is a list of the
-commands of Hexl mode:
+Ordinary text characters insert themselves (i.e., overwrite with
+themselves).  There are commands for insertion of special characters
+by their code.  Most cursor motion keys, as well as @kbd{C-x C-s}, are
+bound in Hexl mode to commands that produce the same effect.  Here is
+a list of other important commands special to Hexl mode:
 
 @c I don't think individual index entries for these commands are useful--RMS.
 @table @kbd
@@ -2491,6 +2504,12 @@ Insert a byte with a code typed in octal.
 @item C-M-x
 Insert a byte with a code typed in hex.
 
address@hidden C-M-a
+Move to the beginning of a 512-byte page.
+
address@hidden C-M-e
+Move to the end of a 512-byte page.
+
 @item C-x [
 Move to the beginning of a 1k-byte page.
 
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index c1ad5b5..28bfa5b 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -1298,8 +1298,11 @@ count as blocks.
 @findex hs-show-block
 @findex hs-show-region
 @findex hs-hide-level
address@hidden hs-toggle-hiding
address@hidden hs-mouse-toggle-hiding
 @kindex C-c @@ C-h
 @kindex C-c @@ C-s
address@hidden C-c @@ C-c
 @kindex C-c @@ C-M-h
 @kindex C-c @@ C-M-s
 @kindex C-c @@ C-r
@@ -1312,7 +1315,7 @@ Hide the current block (@code{hs-hide-block}).
 @item C-c @@ C-s
 Show the current block (@code{hs-show-block}).
 @item C-c @@ C-c
address@hidden C-x @@ C-e
address@hidden C-c @@ C-e
 Either hide or show the current block (@code{hs-toggle-hiding}).
 @item S-mouse-2
 Toggle hiding for the block you click on (@code{hs-mouse-toggle-hiding}).
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 9649278..7892b34 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -644,6 +644,10 @@ or before @samp{)}, @samp{:} or @samp{?}); and
 @code{fill-polish-nobreak-p} (don't break after a one letter word,
 even if preceded by a non-whitespace character).
 
+  Emacs can display an indicator in the @code{fill-column} position
+using the Display fill column indicator mode 
+(@pxref{Displaying Boundaries, display-fill-column-indicator}).
+
 @node Fill Prefix
 @subsection The Fill Prefix
 
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index 519decb..46d86ac 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -21858,14 +21858,17 @@ MENU ENTRY: NODE NAME.
 @end ifnottex
 
 @quotation
-Robert J. Chassell has worked with GNU Emacs since 1985.  He writes
-and edits, teaches Emacs and Emacs Lisp, and speaks throughout the
+Robert J. Chassell (1946--2017) started working with GNU Emacs in 1985.  He 
wrote
+and edited, taught Emacs and Emacs Lisp, and spoke throughout the
 world on software freedom.  Chassell was a founding Director and
-Treasurer of the Free Software Foundation, Inc.  He is co-author of
-the @cite{Texinfo} manual, and has edited more than a dozen other
-books.  He graduated from Cambridge University, in England.  He has an
-abiding interest in social and economic history and flies his own
+Treasurer of the Free Software Foundation, Inc.  He was co-author of
+the @cite{Texinfo} manual, and edited more than a dozen other
+books.  He graduated from Cambridge University, in England.  He had an
+abiding interest in social and economic history and flew his own
 airplane.
+
address@hidden://www.fsf.org/blogs/community/goodbye-to-bob-chassell,
+"Goodbye to Bob Chassell"}
 @end quotation
 
 @c @page
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index cd44c1c..5ea0be2 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1047,12 +1047,9 @@ and meaning of input events in detail.
 This function returns address@hidden if @var{object} is an input event
 or event type.
 
-Note that any symbol might be used as an event or an event type.
address@hidden cannot distinguish whether a symbol is intended by Lisp
-code to be used as an event.  Instead, it distinguishes whether the
-symbol has actually been used in an event that has been read as input in
-the current Emacs session.  If a symbol has not yet been so used,
address@hidden returns @code{nil}.
+Note that any address@hidden symbol might be used as an event or an
+event type; @code{eventp} cannot distinguish whether a symbol is
+intended by Lisp code to be used as an event.
 @end defun
 
 @menu
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index 7199246..f775aa4 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -251,6 +251,7 @@ I thought did not need to be mentioned here:
 
 Lisp:
 after-load-functions
+after-set-visited-file-name-hook
 auto-coding-functions
 choose-completion-string-functions
 completing-read-function
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 5ae71af..cfeb492 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -1191,6 +1191,17 @@ grow with new Emacs releases.  Given the version of 
Emacs, the module
 can use only the parts of the module @acronym{API} that existed in
 that version, since those parts are identical in later versions.
 
address@hidden defines a preprocessor macro
address@hidden  It expands to an integer literal which is
+the latest major version of Emacs supported by the header.
address@hidden Info}.  Note that the value of
address@hidden is a compile-time constant and does not
+represent the version of Emacs that is currently running and has
+loaded your module.  If you want your module to be compatible with
+various versions of @file{emacs-module.h} as well as various versions
+of Emacs, you can use conditional compilation based on
address@hidden
+
 We recommend that modules always perform the compatibility
 verification, unless they do their job entirely in the initialization
 function, and don't access any Lisp objects or use any Emacs functions
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 6f1213f..3261e6d 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -466,9 +466,11 @@ first call to the function automatically loads the proper 
library, in
 order to install the real definition and other associated code, then
 runs the real definition as if it had been loaded all along.
 Autoloading can also be triggered by looking up the documentation of
-the function or macro (@pxref{Documentation Basics}).
+the function or macro (@pxref{Documentation Basics}), and completion
+of variable and function names (@pxref{Autoload by Prefix} below).
 
 @menu
+* Autoload by Prefix:: Autoload by Prefix.
 * When to Autoload::   When to Use Autoload.
 @end menu
 
@@ -703,6 +705,25 @@ symbol's new function value.  If the value of the optional 
argument
 function, only a macro.
 @end defun
 
address@hidden Autoload by Prefix
address@hidden Autoload by Prefix
address@hidden autoload by prefix
+
address@hidden definition-prefixes
address@hidden register-definition-prefixes
address@hidden autoload-compute-prefixes
+During completion for the commands @code{describe-variable} and
address@hidden, Emacs will try to load files which may
+contain definitions matching the prefix being completed.  The variable
address@hidden holds a hashtable which maps a prefix to
+the corresponding list of files to load for it.  Entries to this
+mapping are added by calls to @code{register-definition-prefixes}
+which are generated by @code{update-file-autoloads}
+(@pxref{Autoload}).  Files which don't contain any definitions worth
+loading (test files, for examples), should set
address@hidden to @code{nil} as a file-local
+variable.
+
 @node When to Autoload
 @subsection When to Use Autoload
 @cindex autoload, when to use
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 4315b70..97e9be9 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -3238,7 +3238,12 @@ is disabled, @code{font-lock-face} has no effect on the 
display.
   It is ok for a mode to use @code{font-lock-face} for some text and
 also use the normal Font Lock machinery.  But if the mode does not use
 the normal Font Lock machinery, it should not set the variable
address@hidden
address@hidden  In this case the @code{face} property will
+not be overriden, so using the @code{face} property could work too.
+However, using @code{font-lock-face} is generally preferable as it
+allows the user to control the fontification by toggling
address@hidden, and lets the code work regardless of whether
+the mode uses Font Lock machinery or not.
 
 @node Faces for Font Lock
 @subsection Faces for Font Lock
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index 9c64c3c..47206a4 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -1049,7 +1049,7 @@ is like @code{undecided}, but it prefers to choose 
@code{utf-8} when
 possible.
 
   In general, a coding system doesn't guarantee roundtrip identity:
-decoding a byte sequence using coding system, then encoding the
+decoding a byte sequence using a coding system, then encoding the
 resulting text in the same coding system, can produce a different byte
 sequence.  But some coding systems do guarantee that the byte sequence
 will be the same as what you originally decoded.  Here are a few
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 59cd5a8..fef954e 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2197,7 +2197,7 @@ is the character Emacs currently uses for quitting, 
usually @kbd{C-g}.
 @subsection Recording Input
 @cindex recording input
 
address@hidden recent-keys
address@hidden recent-keys &optional include-cmds
 This function returns a vector containing the last 300 input events from
 the keyboard or mouse.  All input events are included, whether or not
 they were used as parts of key sequences.  Thus, you always get the last
@@ -2205,6 +2205,11 @@ they were used as parts of key sequences.  Thus, you 
always get the last
 (These are excluded because they are less interesting for debugging; it
 should be enough to see the events that invoked the macros.)
 
+If @var{include-cmds} is address@hidden, complete key sequences in the
+result vector are interleaved with pseudo-events of the form
address@hidden(nil . @var{COMMAND})}, where @var{COMMAND} is the binding of
+the key sequence (@pxref{Command Overview}).
+
 A call to @code{clear-this-command-keys} (@pxref{Command Loop Info})
 causes this function to return an empty vector immediately afterward.
 @end defun
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 69f781e..b73401a 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1688,7 +1688,7 @@ how to do these things:
         (save-excursion
           ;; @r{Insert the text, advancing the process marker.}
           (goto-char (process-mark proc))
-          (insert string)
+          (insert-before-markers string)
           (set-marker (process-mark proc) (point)))
         (if moving (goto-char (process-mark proc)))))))
 @end group
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 8775254..24f30b4 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1070,6 +1070,13 @@ list of characters @var{chars}.
 
 @c Internal functions: regexp-opt-group
 
address@hidden regexp-unmatchable
+This variable contains a regexp that is guaranteed not to match any
+string at all.  It is particularly useful as default value for
+variables that may be set to a pattern that actually matches
+something.
address@hidden defvar
+
 @node Regexp Search
 @section Regular Expression Searching
 @cindex regular expression searching
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index a7f270c..4b67a5f 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -601,7 +601,7 @@ returned value is a list.
 @defun seq-mapn function &rest sequences
   This function returns the result of applying @var{function} to each
 element of @var{sequences}.  The arity (@pxref{What Is a Function,
-sub-arity}) of @var{function} must match the number of sequences.
+subr-arity}) of @var{function} must match the number of sequences.
 Mapping stops at the end of the shortest sequence, and the returned
 value is a list.
 
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 500df1f..278bc3c 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -2252,9 +2252,11 @@ If it is impossible to move to column @var{column} 
because that is in
 the middle of a multicolumn character such as a tab, point moves to the
 end of that character.  However, if @var{force} is address@hidden, and
 @var{column} is in the middle of a tab, then @code{move-to-column}
-converts the tab into spaces so that it can move precisely to column
address@hidden  Other multicolumn characters can cause anomalies despite
address@hidden, since there is no way to split them.
+either converts the tab into spaces (when @code{indent-tabs-mode} is
address@hidden), or inserts enough spaces before it (otherwise), so that
+point can move precisely to column @var{column}.  Other multicolumn
+characters can cause anomalies despite @var{force}, since there is no
+way to split them.
 
 The argument @var{force} also has an effect if the line isn't long
 enough to reach column @var{column}; if it is @code{t}, that means to
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index aca7d2f..932b7c8 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -2009,7 +2009,7 @@ all files in those directories.  The list in 
@var{variables} can be of
 one of the two forms: @code{(@var{major-mode} . @var{alist})} or
 @code{(@var{directory} . @var{list})}.  With the first form, if the
 file's buffer turns on a mode that is derived from @var{major-mode},
-then the all the variables in the associated @var{alist} are applied;
+then all the variables in the associated @var{alist} are applied;
 @var{alist} should be of the form @code{(@var{name} . @var{value})}.
 A special value @code{nil} for @var{major-mode} means the settings are
 applicable to any mode.  In @var{alist}, you can use a special
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 32e8c2a..96e42a1 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2601,6 +2601,63 @@ window and displaying the buffer in that window.  It can 
fail if all
 windows are dedicated to other buffers (@pxref{Dedicated Windows}).
 @end defun
 
address@hidden display-buffer-in-direction buffer alist
+This function tries to display @var{buffer} at a location specified by
address@hidden  For this purpose, @var{alist} should contain a
address@hidden entry whose value is one of @code{left}, @code{above}
+(or @code{up}), @code{right} and @code{below} (or @code{down}).  Other
+values are usually interpreted as @code{below}.
+
+If @var{alist} also contains a @code{window} entry, its value
+specifies a reference window.  That value can be a special symbol like
address@hidden which stands for the selected frame's main window
+(@pxref{Side Window Options and Functions}) or @code{root} standing
+for the selected frame's root window (@pxref{Windows and Frames}).  It
+can also specify an arbitrary valid window.  Any other value (or
+omitting the @code{window} entry entirely) means to use the selected
+window as reference window.
+
+This function first tries to reuse a window in the specified direction
+that already shows @var{buffer}.  If no such window exists, it tries
+to split the reference window in order to produce a new window in the
+specified direction.  If this fails as well, it will try to display
address@hidden in an existing window in the specified direction.  In
+either case, the window chosen will appear on the side of the
+reference window specified by the @code{direction} entry, sharing at
+least one edge with the reference window.
+
+If the reference window is live, the edge the chosen window will share
+with it is always the opposite of the one specified by the
address@hidden entry.  For example, if the value of the
address@hidden entry is @code{left}, the chosen window's right edge
+coordinate (@pxref{Coordinates and Windows}) will equal the reference
+window's left edge coordinate.
+
+If the reference window is internal, a reused window must share with
+it the edge specified by the @code{direction} entry.  Hence if, for
+example, the reference window is the frame's root window and the value
+of the @code{direction} entry is @code{left}, a reused window must be
+on the left of the frame.  This means that the left edge coordinate of
+the chosen window and that of the reference window are the same.
+
+A new window, however, will be created by splitting the reference
+window such that the chosen window will share the opposite edge with
+the reference window.  In our example, a new root window would be
+created with a new live window and the reference window as its
+children.  The chosen window's right edge coordinate would then equal
+the left edge coordinate of the reference window.  Its left edge
+coordinate would equal the left edge coordinate of the frame's new
+root window.
+
+Four special values for @code{direction} entries allow to implicitly
+specify the selected frame's main window as the reference window:
address@hidden, @code{top}, @code{rightmost} and @code{bottom}.  This
+means that instead of, for example, @address@hidden(direction . left)
+(window . main)}} one can just specify @address@hidden(direction
+. leftmost)}}.  An existing @code{window} @var{alist} entry is ignored
+in such cases.
address@hidden defun
+
 @defun 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
@@ -2934,12 +2991,20 @@ If address@hidden, the value specifies the slot of the 
side window
 supposed to display the buffer.  This entry is used only by
 @code{display-buffer-in-side-window}.
 
address@hidden address@hidden, a buffer display action alist entry}
address@hidden direction
+The value specifies a direction which, together with a @code{window}
+entry, allows @code{display-buffer-in-direction} to determine the
+location of the window to display the buffer.
+
 @vindex address@hidden, a buffer display action alist entry}
 @item 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
 @code{display-buffer-in-atom-window} to indicate the window on whose
-side the new window shall be created.
+side the new window shall be created.  It is also used by
address@hidden to specify the reference window on
+whose side the resulting window shall appear.
 
 @vindex address@hidden, a buffer display action alist entry}
 @item allow-no-window
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index 894203c..ebb89c3 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -88,10 +88,6 @@ the buffer is saved, unless 
@code{flymake-start-on-save-buffer} is
 nil;
 
 @item
-a newline character is added to the buffer, unless
address@hidden is nil;
-
address@hidden
 some changes were made to the buffer more than @code{0.5} seconds ago
 (the delay is configurable in @code{flymake-no-changes-timeout}).
 @end itemize
@@ -222,10 +218,6 @@ If any changes are made to the buffer, syntax check is 
automatically
 started after this many seconds, unless the user makes another change,
 which resets the timer.
 
address@hidden flymake-start-syntax-check-on-newline
-A boolean flag indicating whether to start syntax check immediately
-after a newline character is inserted into the buffer.
-
 @item flymake-start-on-flymake-mode
 A boolean flag indicating whether to start syntax check immediately
 after enabling @code{flymake-mode}.
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 192284c..ccd1129 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,8 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2019-03-03.15}
-
+\def\texinfoversion{2019-04-12.13}
 %
 % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc.
 %
@@ -387,14 +386,8 @@
     % 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
@@ -455,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.
 %
@@ -1131,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
@@ -2173,7 +2175,7 @@ end
 % A few fonts for @defun names and args.
 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
-\setfont\defsl\slshape{10}{\magstep1}{OT1TT}
+\setfont\defsl\slshape{10}{\magstep1}{OT1}
 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
@@ -2321,7 +2323,7 @@ end
 % A few fonts for @defun names and args.
 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
-\setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
+\setfont\defsl\slshape{10}{\magstephalf}{OT1}
 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
@@ -2844,7 +2846,7 @@ end
 
 % @t, explicit typewriter.
 \def\t#1{%
-  {\tt \rawbackslash \plainfrenchspacing #1}%
+  {\tt \plainfrenchspacing #1}%
   \null
 }
 
@@ -2871,7 +2873,6 @@ end
     % Turn off hyphenation.
     \nohyphenation
     %
-    \rawbackslash
     \plainfrenchspacing
     #1%
   }%
@@ -3097,9 +3098,9 @@ end
 % 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
+  \hskip 0pt plus 4 em\relax
   \allowbreak
-  \hskip 0pt plus -1fil\relax
+  \hskip 0pt plus -4 em\relax
 }
 
 \urefbreakstyle after
@@ -3112,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
@@ -3122,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),
@@ -4667,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'']}%
@@ -4708,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
@@ -4858,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
@@ -4904,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{%
   %
@@ -4954,6 +4915,7 @@ end
   % Assorted special characters.
   \definedummyword\atchar
   \definedummyword\arrow
+  \definedummyword\backslashchar
   \definedummyword\bullet
   \definedummyword\comma
   \definedummyword\copyright
@@ -5070,11 +5032,10 @@ end
   \commondummyword\xref
 }
 
-% This does nothing, but for a time it was recommended to use
-% \usebracesinindexestrue to be able to use braces in index entries.
-
 \let\indexlbrace\relax
 \let\indexrbrace\relax
+\let\indexatchar\relax
+\let\indexbackslash\relax
 
 address@hidden
 \catcode`\\=13
@@ -5108,10 +5069,8 @@ end
   }
 
   \gdef\indexnonalnumreappear{%
-    \useindexbackslash
     \let-\normaldash
     \let<\normalless
-    address@hidden@}%
   }
 }
 
@@ -5222,8 +5181,6 @@ end
 
 
 
-\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
-
 % #1 is the index name, #2 is the entry text.
 \def\doind#1#2{%
   \iflinks
@@ -5255,13 +5212,6 @@ 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 sort key.
 {
 \catcode`\-=13
@@ -5273,14 +5223,31 @@ end
   \xdef\indexsortkey{#1}\endgroup}
 }
 
+\def\indexwriteseealso#1{
+  address@hidden
+}
+\def\indexwriteseeentry#1{
+  address@hidden
+}
+
+% The default definitions
+\def\sortas#1{}%
+\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
+\def\putwordSeeAlso{See also}
+\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
+
+
 % 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\splitindexentry#1{%
   \gdef\fullindexsortkey{}%
   \xdef\bracedtext{}%
   \def\sep{}%
+  \def\seealso##1{}%
+  \def\seeentry##1{}%
   \expandafter\doindexsegment#1\subentry\finish\subentry
 }
 
@@ -5292,7 +5259,6 @@ end
     %
     % Fully expand the segment, throwing away any @sortas directives, and 
     % trim spaces.
-    \def\sortas##1{}%
     \edef\trimmed{\segment}%
     \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
     %
@@ -5302,16 +5268,23 @@ end
     % font commands turned off.
     \bgroup
       \let\sortas\indexwritesortas
+      \let\seealso\indexwriteseealso
+      \let\seeentry\indexwriteseeentry
       \indexnofonts
       % The braces around the commands are recognized by texindex.
-      \def\lbracechar{{\indexlbrace}}%
-      \def\rbracechar{{\indexrbrace}}%
+      \def\lbracechar{{\string\indexlbrace}}%
+      \def\rbracechar{{\string\indexrbrace}}%
       \let\{=\lbracechar
       \let\}=\rbracechar
+      address@hidden
+      address@hidden
+      \def\backslashchar{{\string\indexbackslash}}%
+      \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
       %
       \let\indexsortkey\empty
+      \global\let\pagenumbertext\empty
       % Execute the segment and throw away the typeset output.  This executes
-      % any @sortas commands in this segment.
+      % any @sortas or @seealso commands in this segment.
       \setbox\dummybox = \hbox{\segment}%
       \ifx\indexsortkey\empty{%
         \indexnonalnumdisappear
@@ -5332,21 +5305,31 @@ end
   \fi
 }
 \def\isfinish{\finish}%
+\newbox\dummybox % used above
 
 \let\subentry\relax
 
-% Write the entry in \toks0 to the index file.
+% Use \ instead of @ in index files.  To support old texi2dvi and texindex.
+% This works without changing the escape character used in the toc or aux
+% files because the index entries are fully expanded here, and \string uses
+% the current value of \escapechar.
+\def\escapeisbackslash{\escapechar=`\\}
+
+% Write the entry in \indextext to the index file.
 %
 \def\doindwrite{%
-  % Put the index entry in the margin if desired.
-  \ifx\SETmarginindex\relax\else
-    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
+  \maybemarginindex
+  %
+  \atdummies
+  %
+  \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
+    \escapeisbackslash
   \fi
   %
-  % 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.
+  % For texindex which always views { and } as separators.
+  \def\{{\lbracechar{}}%
+  \def\}{\rbracechar{}}%
+  \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
   %
   % Split the entry into primary entry and any subentries, and get the index 
   % sort key.
@@ -5360,11 +5343,21 @@ end
   %
   \edef\temp{%
     \write\writeto{%
-      \string\entry{\fullindexsortkey}{\noexpand\folio}\bracedtext}%
+      \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:
 %
@@ -5452,9 +5445,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.
@@ -5479,14 +5477,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,
@@ -5496,8 +5490,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.
@@ -5505,47 +5497,52 @@ 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{%
+  \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
+    \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
+      \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
+\errmessage{%
+ERROR: A sorted index file in an obsolete format was skipped.  
+To fix this problem, please upgrade your version of 'texi2dvi'
+or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
+If you are using an old version of 'texindex' (part of the Texinfo 
+distribution), you may also need to upgrade to a newer version (at least 6.0).
+You may be able to typeset the index if you run
+'texindex \jobname.\indexname' yourself.
+You could also try setting the 'txiindexescapeisbackslash' flag by 
+running a command like
+'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'.  If you do 
+this, Texinfo will try to use index files in the old format.
+If you continue to have problems, deleting the index files and starting again 
+might help (with 'rm \jobname.?? \jobname.??s')%
+}%
+      \else
+        (Skipped sorted index file in obsolete format)
+      \fi
+    \else
+      \begindoublecolumns
+      \input \jobname.\indexname s
+      \enddoublecolumns
+    \fi
   \else
-    \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
-    \act
+    \message{trying to print index \indexname}%
+    \begindoublecolumns
+    \catcode`\\=0\relax
+    address@hidden
+    \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.
@@ -5554,12 +5551,19 @@ 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
+  \def\indexbackslash{\math{\backslash}}%
+  %
   % 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}}%
@@ -5619,12 +5623,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
@@ -5657,35 +5655,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.
       %
@@ -5751,55 +5745,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.
@@ -5809,24 +5759,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,
@@ -5844,17 +5785,6 @@ end
   \output = {%
     \savetopmark
     %
-    % 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
-    %
     \global\setbox\partialpage = \vbox{%
       % Unvbox the main output page.
       \unvbox\PAGE
@@ -6134,11 +6064,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
@@ -6790,13 +6718,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
 }
 
@@ -7159,11 +7082,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}}
@@ -7178,7 +7097,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
@@ -8050,36 +7980,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
@@ -8180,12 +8092,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
 }
@@ -8749,9 +8663,29 @@ 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}
+
+% Until the next @node or @bye command, divert output to a box that is not 
+% output.
+\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}%
+\ignorenodebye
+}
+
+{\let\bye\relax
+\gdef\ignorenodebye{\let\bye\ignorenodebyedef}
+\gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
+% The redefinition of \bye here is because it is declared \outer
 
-\let\nwnode=\node
 \let\lastnode=\empty
 
 % Write a cross-reference definition for the current node.  #1 is the
@@ -9226,19 +9160,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...
@@ -9256,14 +9177,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
@@ -11534,11 +11448,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.
@@ -11556,10 +11468,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
@@ -11631,7 +11541,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/tramp.texi b/doc/misc/tramp.texi
index ca86458..2eb5b45 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -545,7 +545,7 @@ file system), @address@hidden,user@@host,/path/to/file}} and
 @cindex google drive
 @cindex method @option{nextcloud}
 @cindex @option{nextcloud} method
address@hidden owncloud
address@hidden nextcloud
 
 GVFS-based methods include also @acronym{GNOME} Online Accounts, which
 support the @option{Files} service.  These are the Google Drive file
@@ -1208,7 +1208,7 @@ directory have the same @code{display-name}, such a 
situation must be avoided.
 @cindex @acronym{GNOME} Online Accounts
 @cindex method @option{nextcloud}
 @cindex @option{nextcloud} method
address@hidden owncloud
address@hidden nextcloud
 
 As the name indicates, the method @option{nextcloud} allows you to
 access OwnCloud or NextCloud hosted files and directories.  Like the
@@ -3083,6 +3083,8 @@ host.  Example:
 @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing
 continuous output.
 
address@hidden shell-file-name
address@hidden shell-command-switch
 @code{shell-command} uses the variables @code{shell-file-name} and
 @code{shell-command-switch} in order to determine which shell to run.
 For remote hosts, their default values are @file{/bin/sh} and
@@ -3091,6 +3093,15 @@ uses @file{/system/bin/sh}).  Like the variables in the 
previous
 section, these variables can be changed via connection-local
 variables.
 
address@hidden async-shell-command-width
address@hidden address@hidden, environment variable}
+If Emacs supports the variable @code{async-shell-command-width} (since Emacs
+27.1), @value{tramp} cares about its value for asynchronous shell
+commands.  It specifies the number of display columns for command
+output.  For synchronous shell commands, a similar effect can be
+achieved by adding the environment variable @env{COLUMNS} to
address@hidden
+
 
 @subsection Running @code{eshell} on a remote host
 @cindex @code{eshell}
diff --git a/etc/NEWS b/etc/NEWS
index 091f958..ebffd9b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -43,11 +43,15 @@ functions 'json-serialize', 'json-insert', 
'json-parse-string', and
 'json-parse-buffer' are typically much faster than their Lisp
 counterparts from json.el.
 
+** Emacs no longer defaults to using ImageMagick to display images,
+due to security and stability concerns.  To override the default, use
+'configure --with-imagemagick'.
+
 ** 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.
+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
@@ -103,6 +107,10 @@ option was useful with modern debugging tools such as 
AddressSanitizer.
 (See etc/DEBUG for the details of using the modern replacements of the
 removed configure options.)
 
++++
+** The distribution tarball now has test cases; 'make check' runs them.
+This is intended mostly to help developers.
+
 ---
 ** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
 builds respectively.
@@ -134,13 +142,14 @@ file, which was previously done when Emacs was started.  
As a result
 of this change, it is no longer necessary to call 'package-initialize'
 in your init file.
 
-However, if your init file changes the values of 'package-load-list' or
-'package-user-dir', or sets 'package-enable-at-startup' to nil then it won't
-work right without some adjustment:
-- you can move that code to the early init file (see above), so those settings
-  apply before Emacs tries to activate the packages.
-- you can use the new 'package-quickstart' so activation of packages does not
-  need to pay attention to 'package-load-list' or 'package-user-dir' any more.
+However, if your init file changes the values of 'package-load-list'
+or 'package-user-dir', or sets 'package-enable-at-startup' to nil then
+it won't work right without some adjustment:
+- You can move that code to the early init file (see above), so those
+  settings apply before Emacs tries to activate the packages.
+- You can use the new 'package-quickstart' so activation of packages
+  does not need to pay attention to 'package-load-list' or
+  'package-user-dir' any more.
 
 ---
 ** Emacs now notifies systemd when startup finishes or shutdown begins.
@@ -150,6 +159,12 @@ after Emacs has finished initialization and is ready for 
use.
 emacs.service file to eg "~/.config/systemd/user/", you will need to copy
 the new version of the file again.)
 
++++
+** New option 'help-enable-completion-auto-load'.
+This allows disabling the new feature introduced in Emacs 26.1 which
+loads files during completion of 'C-h f' and 'C-h v' according to
+'definition-prefixes'.
+
 
 * Changes in Emacs 27.1
 
@@ -159,16 +174,16 @@ the new version of the file again.)
 *** 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
+*** 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
+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.
+'EMACS_SOCKET_NAME' environment variable to an appropriate value.
 
 ---
 *** When run by root, emacsclient no longer connects to non-root sockets.
@@ -182,11 +197,11 @@ 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.
+** The function 'read-passwd' uses "*" as default character to hide passwords.
 
-** Lexical binding is now used when evaluating interactive Elisp forms
-More specifically, lexical-binding is now used for M-:, --eval, as well
-as in the *scratch* and *ielm* buffers.
+** Lexical binding is now used when evaluating interactive Elisp forms.
+More specifically, lexical-binding is now used for 'M-:', '--eval', as
+well as in the "*scratch*" and "*ielm*" buffers.
 
 ---
 ** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text
@@ -221,7 +236,7 @@ indirectly, e.g., by checking that functions like
 'libxml-parse-html-region' return nil.
 
 +++
-** 'libxml-parse-xml-region' and 'libxml-parse-html' region take
+** 'libxml-parse-xml-region' and 'libxml-parse-html-region' take
 a parameter that's called DISCARD-COMMENTS, but it really only
 discards the top-level comment.  Therefore this parameter is now
 obsolete, and the new utility function 'xml-remove-comments' can be
@@ -247,7 +262,7 @@ 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
+'gnutls-cli' command.  Call 'open-network-stream' with
 ':client-certificate t' to trigger looking up of per-server
 certificates via 'auth-source'.
 
@@ -327,25 +342,40 @@ and directory-local variables.
 
 +++
 *** The macro 'with-connection-local-variables' has been renamed from
-'with-connection-local-profiles'.  No argument 'profiles' needed any
-longer.
+'with-connection-local-profiles'.  No argument PROFILES needed any longer.
 
 ---
-** New variable next-error-verbose controls when `next-error' outputs
-   a message about the error locus.
+** New variable 'next-error-verbose' controls when 'next-error' outputs
+a message about the error locus.
 
 ---
-** New variable grep-search-path defines the directories searched for
-   grep hits (this used to be controlled by compilation-search-path).
+** New variable 'grep-search-path' defines the directories searched for
+grep hits (this used to be controlled by 'compilation-search-path').
 
 ---
-** New variable emacs-lisp-compilation-search-path defines the
-   directories searched for byte-compiler error messages (this used to
-   be controlled by compilation-search-path).
+** New variable 'emacs-lisp-compilation-search-path' defines the
+directories searched for byte-compiler error messages (this used to
+be controlled by 'compilation-search-path').
 
 ** Multicolor fonts such as "Noto Color Emoji" can be displayed on
 Emacs configured with Cairo drawing and linked with cairo >= 1.16.0.
 
++++
+** Emacs now optionally displays a fill column indicator.
+
+This is similar to what 'fill-column-indicator' package provides, but
+much faster and compatible with 'show-trailing-whitespace'.
+
+Customize the buffer-local variables 'display-fill-column-indicator'
+and 'display-fill-column-indicator-character' to activate the
+indicator.
+
+The indicator is not displayed at all in minibuffer windows and
+in tooltips, as it is not useful there.
+
+There are 2 new buffer local variables and 1 face to customize this
+mode they are described in the manual "(emacs) Display".
+
 
 * Editing Changes in Emacs 27.1
 
@@ -405,39 +435,41 @@ 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.
+** 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.
+asked to use ':host 'local' and ':family 'ipv6'.
 
 +++
-** The new function `replace-region-contents' replaces the current
+** 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').
+(in terms of 'replace-buffer-contents').
 
 +++
-** The command `replace-buffer-contents' now has two optional
+** 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
 
 ** compile.el
 ---
-*** In compilation-error-regexp-alist, 'line' (and 'end-line') can be functions
+*** In 'compilation-error-regexp-alist', 'line' (and 'end-line') can
+be functions.
 
-** cl-lib
+** cl-lib.el
 +++
-*** cl-defstruct has a new :noinline argument to prevent inlining its functions
+*** 'cl-defstruct' has a new ':noinline' argument to prevent inlining
+its functions.
 
-** doc-view-mode
-*** New commands doc-view-presentation and doc-view-fit-window-to-page
+** doc-view.el
+*** New commands 'doc-view-presentation' and 'doc-view-fit-window-to-page'.
 *** Added support for password-protected PDF files
 
 ** Ido
@@ -479,10 +511,10 @@ 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,
+'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.
+displays the "*Messages*" buffer in the same window.
 
 *** Windmove also supports directional window deletion.
 The new command 'windmove-delete-default-keybindings' binds default
@@ -502,8 +534,11 @@ The mode is automatically enabled in files that start with 
the
 'function' keyword.
 
 ** project.el
+
 *** New commands 'project-search' and 'project-query-replace-regexp'.
 
+*** New customizable variable 'project-read-file-name-function'.
+
 ** Etags
 
 +++
@@ -547,7 +582,7 @@ With non-nil, 'vc-find-revision' doesn't write the created 
buffer to file.
 This new variable allows customizing the default arguments passed to
 'git-grep' when 'vc-git-grep' is used.
 
-*** Command 'vc-git-stash' now respects marks in the '*vc-dir*' buffer.
+*** Command 'vc-git-stash' now respects marks in the "*vc-dir*" buffer.
 When some files are marked, only those are stashed.
 When no files are marked, all modified files are stashed, as before.
 
@@ -565,7 +600,7 @@ values.
 and compares their entire trees.
 
 *** New user option 'vc-hg-revert-switches' specifies switches to pass
-to hg revert.
+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
@@ -574,9 +609,10 @@ given revisions.
 ** Diff mode
 +++
 *** Hunks are now automatically refined by font-lock.
-To disable refinement, set the new defcustom 'diff-refine' to nil.
+To disable refinement, set the new user option '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
@@ -589,7 +625,7 @@ 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 user option 'diff-font-lock-prettify' to t.
 
 +++
 *** Prefix arg of 'diff-goto-source' means jump to the old revision
@@ -599,11 +635,11 @@ or to the new revision of the file otherwise.
 ** Texinfo
 
 +++
-*** New function for inserting @pxref, @xref, or @ref commands.
+*** 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.
+surrounding point, namely '@pxref' near a parenthesis, '@xref' at the
+start of a sentence or at '(point-min)', else '@ref'.
 
 ** Browse-url
 
@@ -637,7 +673,6 @@ end.
 ** SQL
 
 *** 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
@@ -659,7 +694,6 @@ 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,
@@ -669,9 +703,9 @@ searched for the password. The 'sql-product', 'sql-server',
 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
+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
+'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.
 
@@ -694,6 +728,10 @@ 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.
 
++++
+*** 'flymake-start-syntax-check-on-newline' is now obsolete,
+use 'post-self-insert-hook' to check on newline.
+
 ** Ruby
 
 *** The Rubocop Flymake diagnostic function will only run Lint cops if
@@ -703,16 +741,23 @@ it can't find the config file.
 
 ** Package
 
+*** Change of 'package-check-signature' for packages with multiple sigs
+In previous Emacsen, 't' checked that all signatures are valid.
+Now 't' only checks that at least one signature is valid and the new 'all'
+value needs to be used if you want to enforce that all signatures
+are valid.  This only affects packages with multiple signatures.
+
 *** New function 'package-get-version' lets packages query their own 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
-consulted when 'package-quickstart-refresh' is run rather than at startup so
-you don't need to set them in your early init file.
+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 consulted when 'package-quickstart-refresh'
+is run rather than at startup so you don't need to set them in your
+early init file.
 
 *** New function 'package-activate-all'.
 
@@ -738,19 +783,19 @@ 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
+*** 'xref-find-definitions' now sets the mark at the buffer position
+where it was invoked.
 
 ---
-*** New xref faces 'xref-file-header', 'xref-line-number', 'xref-match'
+*** New xref faces 'xref-file-header', 'xref-line-number', 'xref-match'.
 
 ** Ecomplete
 
 *** The ecomplete sorting has changed to a decay-based algorithm.
 This can be controlled by the new 'ecomplete-sort-predicate' variable.
 
-*** The 'ecompleterc' file is now placed in ~/.emacs.d/ecompleterc by default.
-Of course it will still find it if you have it in ~/.ecompleterc
+*** The 'ecompleterc' file is now placed in '~/.emacs.d/ecompleterc' by 
default.
+Of course it will still find it if you have it in '~/.ecompleterc'.
 
 ** Gnus
 
@@ -797,7 +842,7 @@ This option controls whether and how to use Gnus search 
groups as
 ** erc
 
 ---
-*** 'erc-button-google-url' has been renamed 'erc-button-search-url'
+*** 'erc-button-google-url' has been renamed to 'erc-button-search-url'
 and its value has been changed to Duck Duck Go.
 
 ** EUDC
@@ -889,7 +934,7 @@ directories in the destination.
 ** Help
 
 ---
-*** Description of variables and functions give an estimated first release
+*** Description of variables and functions give an estimated first release.
 
 ---
 *** Output format of 'C-h l' ('view-lossage') has changed.
@@ -968,7 +1013,7 @@ 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.
+*** 'flush-lines' prints and returns the number of deleted matching lines.
 
 ** Debugger
 
@@ -1011,7 +1056,7 @@ by default.
 ** Grep
 
 +++
-*** rgrep, lgrep and zrgrep now hide part of the command line
+*** 'rgrep', 'lgrep' and 'zrgrep' now hide part of the command line
 that contains a list of ignored directories and files.
 Clicking on the button with ellipsis unhides it.
 The abbreviation can be disabled by the new option
@@ -1070,10 +1115,10 @@ 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).
+*** 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.
@@ -1108,9 +1153,9 @@ variable for remote shells.  It still defaults to 
"/bin/sh".
 
 ** Single shell commands
 
----
-*** 'shell-command-width' defines the number of display columns
-available for output of asynchronous or remote shell commands.
++++
+*** 'async-shell-command-width' defines the number of display columns
+available for output of asynchronous shell commands.
 
 ** Pcomplete
 
@@ -1172,6 +1217,7 @@ Setting this option to an integer causes URLs displayed 
in Rcirc
 buffers to be truncated to that many characters.
 
 ** Register
+
 ---
 *** The return value of method 'register-val-describe' includes the
 names of buffers shown by the windows of a window configuration.
@@ -1253,11 +1299,18 @@ automatically updates.  In the buffer, you can use 's 
q' or 's e' to
 signal a thread with quit or error respectively, or get a snapshot
 backtrace with 'b'.
 
+
+** thingatpt.el
+
 ---
-** thingatpt.el supports a new "thing" called 'uuid'.
+*** 'thing-at-point' supports a new "thing" called 'uuid'.
 A symbol 'uuid' can be passed to 'thing-at-point' and it returns the
 UUID at point.
 
+---
+*** 'word-at-point' and 'sentence-at-point' accept NO-PROPERTIES.
+Just like 'thing-at-point' itself.
+
 ** Interactive automatic highlighting
 
 +++
@@ -1280,6 +1333,12 @@ 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.
 
+*** The rx 'or' and 'seq' forms no longer require any arguments.
+(or) produces a regexp that never matches anything, while (seq)
+matches the empty string, each being an identity for the operation.
+This also works for their aliases: '|' for 'or'; ':', 'and' and
+'sequence' for 'seq'.
+
 ** Frames
 
 +++
@@ -1294,7 +1353,7 @@ frame when making a frame.
 *** New predicates 'display-blink-cursor-p' and 'display-symbol-keys-p'.
 These predicates are to be preferred over 'display-graphic-p' when
 testing for blinking cursor capability and the capability to have
-symbols (e.g., [return], [tab], [backspace]) as keys respectively.
+symbols (e.g., '[return]', '[tab]', '[backspace]') as keys respectively.
 
 ** Tabulated List mode
 
@@ -1315,8 +1374,8 @@ near the current column in Tabulated Lists (see variables
 ** CUA mode
 
 ---
-*** New defcustom 'cua-rectangle-terminal-modifier-key'.
-This defcustom allows for the customization of the modifier key used
+*** New user option 'cua-rectangle-terminal-modifier-key'.
+This user option allows for the customization of the modifier key used
 in a terminal frame.
 
 ** JS mode
@@ -1329,11 +1388,11 @@ will be supported in 'js-mode' and derivative modes.  
('js-jsx-mode'
 no longer needs to be enabled.)
 
 ---
-*** New defcustom 'js-jsx-detect-syntax' disables automatic detection.
+*** New user option 'js-jsx-detect-syntax' disables automatic detection.
 This is turned on by default.
 
 ---
-*** New defcustom 'js-jsx-syntax' enables JSX syntax unconditionally.
+*** New user option 'js-jsx-syntax' enables JSX syntax unconditionally.
 This is off by default.
 
 ---
@@ -1353,7 +1412,7 @@ of the React developer community (see 
'js-jsx-align->-with-<'),
 otherwise still adhering to SGML conventions.
 
 ---
-*** New defcustom 'js-jsx-align->-with-<' controls '>' indents.
+*** New user option 'js-jsx-align->-with-<' controls '>' indents.
 Commonly in JSX code, a '>' on its own line is indented at the same
 level as its opening '<'.  This is the new default for JSX.  This
 behavior is slightly different than that used by SGML in Emacs, where
@@ -1376,12 +1435,12 @@ The old behavior can be emulated by controlling JSX 
indentation
 independently of JS, by setting 'js-jsx-indent-level'.
 
 ---
-*** New defcustom 'js-jsx-indent-level' for different JSX indentation.
+*** New user option 'js-jsx-indent-level' for different JSX indentation.
 If you wish to indent JSX by a different number of spaces than JS, set
-this variable to the desired number.
+this user option to the desired number.
 
 ---
-*** New defcustom 'js-jsx-attribute-offset' for JSX attribute indents.
+*** New user option 'js-jsx-attribute-offset' for JSX attribute indents.
 
 ---
 *** New variable 'js-syntactic-mode-name' controls mode name display.
@@ -1395,6 +1454,22 @@ Packages deriving from 'js-mode' with 
'define-derived-mode' should
 call this function to add enabled syntax extensions to their mode
 name, too.
 
+** Autorevert
+
+*** New variable 'auto-revert-avoid-polling' for saving power.
+When set to a non-nil value, buffers in Auto Revert mode are no longer
+polled for changes periodically.  This reduces the power consumption
+of an idle Emacs, but may fail on some network file systems; set
+'auto-revert-notify-exclude-dir-regexp' to match files where
+notification is not supported.  The default value is nil.
+
+*** New variable 'buffer-auto-revert-by-notification'
+A major mode can declare that notification on the buffer's default
+directory is sufficient to know when updates are required, by setting
+the new variable 'buffer-auto-revert-by-notification' to a non-nil
+value.  Auto Revert mode can use this information to avoid polling the
+buffer periodically when 'auto-revert-avoid-polling' is non-nil.
+
 
 * New Modes and Packages in Emacs 27.1
 
@@ -1425,8 +1500,8 @@ documentation of the new mode and its commands.
 
 * Incompatible Lisp Changes in Emacs 27.1
 
-** In compilation-error-regexp-alist the old undocumented feature where 'line'
-could be a function of 2 arguments has been dropped.
+** In 'compilation-error-regexp-alist' the old undocumented feature
+where 'line' could be a function of 2 arguments has been dropped.
 
 ** 'define-fringe-bitmap' is always defined, even when Emacs is built
 without any GUI support.
@@ -1449,11 +1524,11 @@ its default value changed in Emacs 27.1.
 
 ** 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
+** 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
+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
@@ -1479,7 +1554,7 @@ 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,
+** '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.
 
@@ -1530,11 +1605,11 @@ they are now allocated like any other pseudovector.  As 
a result, the
 removed.
 
 +++
-** Reversed character ranges are no longer permitted in rx.
+** 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.
+Now, such 'rx' expressions generate an error.
 
 +++
 ** 'text-mode' no longer sets the value of 'indent-line-function'.
@@ -1543,16 +1618,21 @@ The global value of 'indent-line-function', which 
defaults to
 'text-mode'.
 
 To get back the old behavior, add a function to 'text-mode-hook' which
-performs (setq-local indent-line-function #'indent-relative).
+performs '(setq-local indent-line-function #'indent-relative)'.
 
 ** 'make-process' no longer accepts a non-nil ':stop' key.  This has
 never worked reliably, and now causes an error.
 
++++
+** 'eventp' no longer returns non-nil for lists whose car is nil.
+This is consistent with the fact that nil, though a symbol, is not a
+valid event type.
+
 
 * Lisp Changes in Emacs 27.1
 
 ** New 'help-fns-describe-variable-functions' hook.
-Makes it possible to add metadata information to describe-variable.
+Makes it possible to add metadata information to 'describe-variable'.
 
 ** i18n (internationalization)
 
@@ -1560,7 +1640,7 @@ Makes it possible to add metadata information to 
describe-variable.
 according to the given numeric value.
 
 +++
-** inhibit-null-byte-detection is renamed to inhibit-nul-byte-detection
+** 'inhibit-null-byte-detection' is renamed to 'inhibit-nul-byte-detection'.
 
 +++
 ** 'self-insert-command' takes the char to insert as (optional) argument.
@@ -1604,8 +1684,10 @@ 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.
 
+** Time values
+
 +++
-** Although the default timestamp format is still (HI LO US PS),
+*** 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
@@ -1614,22 +1696,22 @@ 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
 TICKS is an integer and HZ is a positive integer denoting a clock
 frequency.  The old 'encode-time' API is still supported.
 
 +++
-** 'time-add', 'time-subtract', and 'time-less-p' now accept
+*** 'time-add', 'time-subtract', and 'time-less-p' now accept
 infinities and NaNs too, and propagate them or return nil like
 floating-point operators do.
 
 +++
-** New function 'time-equal-p' compares time values for equality.
+*** New function 'time-equal-p' compares time values for equality.
 
 +++
-** 'format-time-string' supports a new conversion specifier flag '+'
+*** '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.
@@ -1682,7 +1764,6 @@ 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
@@ -1710,11 +1791,16 @@ See the section "(elisp) Window Hooks" in the Elisp 
manual for a
 detailed explanation of the new behavior.
 
 +++
-*** New option 'resize-mini-frames'.
+** New option 'resize-mini-frames'.
 This option allows to automatically resize minibuffer-only frames
 similarly to how minibuffer windows are resized on "normal" frames.
 
 +++
+** New buffer display action function 'display-buffer-in-direction'.
+This function allows to specify the location of the window chosen by
+'display-buffer' in various ways.
+
++++
 ** New buffer display action alist entry 'dedicated'.
 Such an entry allows to specify the dedicated status of a window
 created by 'display-buffer'.
@@ -1726,6 +1812,16 @@ for displaying a buffer.  
'display-buffer-below-selected' is the only
 action function to respect it at the moment.
 
 +++
+** New buffer display action alist entry 'direction'.
+This entry is used to specify the location of the window chosen by
+'display-buffer-in-direction'.
+
++++
+** Additional meaning of display action alist entry 'window'.
+A 'window' entry can now also specify a reference window for
+'display-buffer-in-direction'.
+
++++
 ** The function 'assoc-delete-all' now takes an optional predicate argument.
 
 +++
@@ -1741,7 +1837,7 @@ 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
+<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
@@ -1870,16 +1966,31 @@ some years back.  It now respects 
'imagemagick-types-inhibit' as a way
 to disable that.
 
 ---
-*** Some image-mode variables are now buffer-local.
+*** 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.
+** Modules
+
+*** 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.
 
+*** New module environment function 'process_input' to process user
+input while module code is running.
+
+*** New module environment functions 'make_time' and 'extract_time' to
+convert between timespec structures and Emacs Lisp time values.
+
+*** New module environment functions 'make_big_integer' and
+'extract_big_integer' to create and extract arbitrary-size integer
+values.
+
+*** emacs-module.h now defines a macro 'EMACS_MAJOR_VERSION' that expands
+to the major version of the latest Emacs supported by the header.
+
 +++
 ** The function 'read-variable' now uses its own history list.
 The history of variable names read by 'read-variable' is recorded in
@@ -1912,13 +2023,10 @@ 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.
+** '(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
@@ -1932,12 +2040,9 @@ returns a regexp that never matches anything, which is 
an identity for
 this operation.  Previously, the empty string was returned in this
 case.
 
-** New module environment functions 'make_time' and 'extract_time' to
-convert between timespec structures and Emacs Lisp time values.
-
-** New module environment functions 'make_big_integer' and
-'extract_big_integer' to create and extract arbitrary-size integer
-values.
+** New constant 'regexp-unmatchable' contains a never-matching regexp.
+It is a convenient and readable way to specify a regexp that should
+not match anything, and is as fast as any such regexp can be.
 
 
 * Changes in Emacs 27.1 on Non-Free Operating Systems
diff --git a/etc/NEWS.24 b/etc/NEWS.24
index 9150e49..0490053 100644
--- a/etc/NEWS.24
+++ b/etc/NEWS.24
@@ -1117,6 +1117,8 @@ a non-nil `interactive-only' property.
 The value, if non-nil, is a regexp that specifies what to trim from
 the start and end of each substring.
 
+** New function `delete-consecutive-dups'.
+
 ** Completion
 
 *** The separator used by `completing-read-multiple' is now a regexp.
diff --git a/etc/TODO b/etc/TODO
index ccb82cd..dc594a0 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -143,15 +143,6 @@ See the 'test' directory for examples.
 
 * Small but important fixes needed in existing features:
 
-** Flymake's customization mechanism needs to be both simpler (fewer
-levels of indirection) and better documented, so it is easier to
-understand.  I find it quite hard to figure out what compilation
-command it will use.
-
-I suggest totally rewriting that part of Flymake, using the simplest
-mechanism that suffices for the specific needs.  That will be easy
-for users to customize.
-
 ** Distribute a bar cursor of width > 1 evenly between the two glyphs
    on each side of the bar (what to do at the edges?).
 
diff --git a/etc/tutorials/TUTORIAL.translators 
b/etc/tutorials/TUTORIAL.translators
index 2747d39..b6b9578 100644
--- a/etc/tutorials/TUTORIAL.translators
+++ b/etc/tutorials/TUTORIAL.translators
@@ -41,8 +41,8 @@ Maintainer: Alfredo Finelli <address@hidden>
            Italian GNU Translation Group <address@hidden>
 
 * TUTORIAL.ja:
-Author:     Kenichi Handa <address@hidden>
-Maintainer: Kenichi Handa <address@hidden>
+Author:     Kenichi Handa <address@hidden>
+Maintainer: Kenichi Handa <address@hidden>
 
 * TUTORIAL.ko:
 Author:     Koaunghi Un <address@hidden>
@@ -94,4 +94,3 @@ Maintainer: Chao-Hong Liu <address@hidden>
 ;;; Local Variables:
 ;;; coding: utf-8
 ;;; End:
-
diff --git a/leim/SKK-DIC/README b/leim/SKK-DIC/README
index fa51a57..36236b2 100644
--- a/leim/SKK-DIC/README
+++ b/leim/SKK-DIC/README
@@ -1,6 +1,12 @@
-This directory contains a copy of the following file:
+This directory contains an uncompressed copy of the following file:
 
-http://openlab.ring.gr.jp/skk/skk/dic/SKK-JISYO.L
+https://skk-dev.github.io/dict/SKK-JISYO.L.gz
 
 This file is free software distributed under the terms
 of the GNU General Public License.
+
+For more information about this file, please see:
+
+http://openlab.ring.gr.jp/skk/dic.html
+https://skk-dev.github.io/dict/
+https://github.com/skk-dev/dict
diff --git a/leim/SKK-DIC/SKK-JISYO.L b/leim/SKK-DIC/SKK-JISYO.L
index 44d8644..6b024e3 100644
--- a/leim/SKK-DIC/SKK-JISYO.L
+++ b/leim/SKK-DIC/SKK-JISYO.L
@@ -1,6 +1,6 @@
 ;; -*- mode: fundamental; coding: euc-jp -*-
 ;; Large size dictionary for SKK system
-;; Copyright (C) 1988-1995, 1997, 1999-2010
+;; Copyright (C) 1988-1995, 1997, 1999-2014
 ;;
 ;; Masahiko Sato <address@hidden>
 ;; Hironobu Takahashi <address@hidden>,
@@ -13,9 +13,7 @@
 ;; SKK Development Team <address@hidden>
 ;;
 ;; Maintainer: SKK Development Team <address@hidden>
-;; Version: $Id: SKK-JISYO.L,v 1.1216 2014/12/13 00:10:02 czkmt Exp $
 ;; Keywords: japanese
-;; Last Modified: $Date: 2014/12/13 00:10:02 $
 ;;
 ;; This dictionary is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -669,7 +667,7 @@
 �褤�Ĥ�r /�줤��/
 �褤�ä�r /����ĥ/
 �褤��r /�줤��/
-�褤��m /�줤��;/�줤��/����/
+�褤��m /�줤��/�줤��/����/
 �褤��s /����/
 �褢��k /����/
 �褢��b /��ͷ/
@@ -16076,7 +16074,7 @@
 #d /#0��/
 #door /#0�ɥ�/#1�ɥ�/
 #f /#0��/#1��/#1��/
-#feet /(skk-gadget-units-conversion "feet" (string-to-number (car 
skk-num-list)) "cm")/
+#feet /#1�ե�����/
 #fu /#9��/
 #g /#0G/#1����/
 #gatu /#1��/
@@ -16089,7 +16087,7 @@
 #hi /#9��/
 #hisha /#9���/
 #hu /#9��/
-#inch /#1�����/(skk-gadget-units-conversion "inch" (string-to-number (car 
skk-num-list)) "cm")/(skk-gadget-units-conversion "inch" (string-to-number (car 
skk-num-list)) "feet")/
+#inch /#1�����/
 #ji /#1��/
 #k /#0��/
 #ka /#1��/
@@ -16104,7 +16102,7 @@
 #m#d /#0��#0��/
 #mega /#1�ᥬ/
 #mei /#1̾/
-#mile /(skk-gadget-units-conversion "mile" (string-to-number (car 
skk-num-list)) "km")/(skk-gadget-units-conversion "mile" (string-to-number (car 
skk-num-list)) "yard")/
+#mile /#1�ޥ���/
 #min /#0ʬ/
 #mm /#1���/#2���/
 #narigin /#9����/
@@ -16120,10 +16118,9 @@
 #t /#1��/#0��/
 #to /#9��/
 #uma /#9��/
-#x# /(skk-times)/
 #y /#0ǯ/
 #y#m#d /#0ǯ#0��#0��/
-#yard /(skk-gadget-units-conversion "yard" (string-to-number (car 
skk-num-list)) "cm")/(skk-gadget-units-conversion "yard" (string-to-number (car 
skk-num-list)) "feet")/
+#yard /#1�䡼��/
 #yen /#1��/#0��/#8��/
 #��# /#1��#1/
 #��#�Ƥ� /#1��#1��/
@@ -19316,7 +19313,7 @@ baobab /
 baptisma /�Хץƥ���/
 baptist /�Хץƥ���/�Хץƥ�����/
 baptiste /�Хץƥ�����/�Хƥ�����/
-bar /�С�/�С���;-�Τ褦�ʤ��/��;minus/��;pipe/��/(make-string (- fill-column 1) ?-)/
+bar /�С�/�С���;-�Τ褦�ʤ��/��;minus/��;pipe/��/
 barabbas /���/
 baraja /���/
 barb /����/
@@ -33984,7 +33981,7 @@ november /
 novice /�Ρ��ӥ�/
 novo /�Υ�/
 novosibirsk /�Υܥ��ӥ륹��/�Υ����ӥ륹��/
-now /�ʥ�/(current-time-string)/(substring (current-time-string) 11 
16)/(substring (current-time-string) 11 19)/
+now /�ʥ�/
 nowait /����������/����������/
 nox /�Υå���/���ǻ���ʪ/
 nozzle /����/
@@ -36477,7 +36474,6 @@ putting /
 puyol /�ץ��硼��/
 puzzle /�ѥ���/
 puzzlegame /�ѥ��륲����/
-pwd /(pwd)/
 pygmalion /�ԥ��ޥꥪ��/
 pygmy /�ԥ��ߡ�/
 pyjamas /�ѥ����/
@@ -39142,7 +39138,7 @@ skiresort /
 skirt /��������/
 skit /�����å�/
 skiware /������������/
-skk /SKK/(skk-version)/Simple Kana to Kanji conversion program/
+skk /SKK/Simple Kana to Kanji conversion program/
 skolem /���������/
 skopje /�����ԥ�/
 skryabin /������㡼�ӥ�/
@@ -40970,6 +40966,7 @@ testosterone /
 testpattern /�ƥ��ȥѥ�����/
 testrun /�ƥ��ȥ��/
 testset /�ƥ��ȥ��å�/
+tethering /�ƥ����/
 tetra /�ƥȥ�;4/
 tetrachloroethylene /�ƥȥ饯��������;C2Cl4/
 tetris /�ƥȥꥹ/
@@ -41206,7 +41203,7 @@ tim /
 timbales /�ƥ���Х쥹/
 timber /�ƥ���С�/
 timbre /����֥�/
-time /������/����/(current-time-string)/
+time /������/����/
 timeattack /�����ॢ���å�/
 timecapsule /�����५�ץ���/
 timecard /�����५����/
@@ -41300,7 +41297,7 @@ tocopherol /
 tocotrienol /�ȥ��ȥꥨ�Ρ���/
 tocqueville /�ȥ�����/
 tod /�ȥå�/�ȡ���;(��) ��/
-today /�ȥ��ǥ�/�ȥ��ǥ�/�ȥ��ǡ�/(skk-current-date (lambda (date-information format 
gengo and-time) (skk-default-current-date date-information nil 0 'gengo 0 0 
0)))/(skk-current-date (lambda (date-information format gengo and-time) 
(skk-default-current-date date-information "%s-%s-%s(%s)" 0 nil 0 0 
nil)))/(skk-current-date (lambda (date-information format gengo and-time) 
(skk-default-current-date date-information nil 0 'gengo 1 0 
0)))/(skk-current-date (lambda (date-information format gengo a [...]
+today /�ȥ��ǥ�/�ȥ��ǥ�/�ȥ��ǡ�/
 toe /�ȥ�/�ȥ�/�ȡ�/
 toeic /�ȡ����å�;Test of English for International Communication/TOEIC/
 toeplitz /�ƥץ�å�/
@@ -42379,7 +42376,7 @@ verre /
 versace /���륵����;ww.versace.com/�٥륵����/
 versailles /�٥륵����/���륵����/
 verse /������;�λ�/
-version /�������/���������/��/(skk-version)/
+version /�������/���������/��/
 version-up /�С�����󥢥å�/
 versionup /�С�����󥢥å�/��������󥢥å�/
 versus /������/��������/
@@ -45055,6 +45052,7 @@ zyklus /
 �������֤� /��Ļʸ��/
 ��������� /��Ļ��/
 ������ /­��/
+������������� /­������/
 ������ /���/
 ��������Ӥ󤵤� /��������ӥ��/
 �������夦 /������/
@@ -46601,7 +46599,7 @@ zyklus /
 ����Ȥ� /����/��Ʈ/
 ����Ȥ� /����/
 ����Ȥ��Ƥ�Τ� /����ŷ��/
-����� /����/
+����� /����/��/��/
 ����ɤ� /��ƣ/����/
 ����ɤ����礦���� /��ƣ����/
 ����ɤ��Ǥ� /��ƣ�ŵ�/
@@ -46791,7 +46789,7 @@ zyklus /
 �����褦 /������;¾�ˤ�ä�-�⤢�����/
 �����櫓 /������/����/
 �����錄�� /�����Ϥ�/���Ϥ�/
-������ /�Ѱ�/�屡/���/
+������ /�Ѱ�/�屡/���/����/
 �����󤫤� /�Ѱ���/
 �����󤫤����� /�Ѱ����/
 �����󤫤������ /�Ѱ������/
@@ -47310,7 +47308,7 @@ zyklus /
 ������ /�۸���/
 ������Ӥ礦 /�帶��/
 ���� /����/���/
-�������� /��;equal/
+�������� /��;equal/��/��/
 ������ /�Ƥ�/��/
 ������ /�ʹ�/�ܹ�/�ո�/�乽/���/�Ҹ�/�ܹ�/���/�θ�/�۹�/�θ�/�߹�/�ݹ�/
 ���������� /�ܹ԰�/
@@ -49362,7 +49360,6 @@ zyklus /
 ���Ĥ� /���/�Ż�/
 ���Ĥ��󤽤����� /��¸�ѽ�/
 ���Ĥ��� /��æ/
-���Ĥ��礦�� /��ĥ��/
 ���Ĥ� /�ޤ�/����/5��/
 ���ĤĤФ� /�޶�/
 ���ĤĤܤ� /�ޤ���;���������� ��-�쥹�ȥ���/
@@ -51151,6 +51148,7 @@ zyklus /
 ������ /�⤭��;���֥ס����-��/���/�⤭��;���֥����פ�-��/ͫ����;����-���ह��/
 ������ /ͫ����/
 �����礦 /����/
+�����礦�� /������/
 �����礦���� /������;[Χ����]�����ϩ��¦�ι���ô��/
 �����礦�Τ����� /��������;[Χ����]��������Ĺ��/
 �����礯 /����/
@@ -54521,6 +54519,7 @@ zyklus /
 �������դ��դ� /��������/
 �����뤹�������� /�����륹������/
 ������ /�ϣң�/
+���� /��/��/
 �������� /������/
 �������� /�����/�����/
 �������ˤ����� /��������/
@@ -55126,6 +55125,7 @@ zyklus /
 ����������� /�繾��Τ/
 ���������礦 /�繾Į/
 �������� /�繾��/
+�������ɤ��� /�繾����/
 �������ɤ������⤦ /�繾���ܺ���/
 �������ɤϤʤ� /�繾�Ͳֲ�/
 �������� /���/
@@ -63405,12 +63405,12 @@ zyklus /
 ���ߤ��� /����/
 ���ߤ������� /������/
 ���ߤ������ /���̻�/
-���ߤ��礦�� /�����/
 ���ߤ��� /ȱ�ڤ�/
 ���ߤ���ष /ŷ��/ȱ����/
 ���ߤ��� /���ڤ�/����/
 ���ߤ��� /����;��/
 ���ߤ��礦 /���/
+���ߤ��礦�� /�����/
 ���ߤ��� /���ڤ�/
 ���ߤ��� /ȱ��;������/
 ���ߤ������� /���쿧/
@@ -70803,6 +70803,7 @@ zyklus /
 ���礦�������礯�֤� /���ɿ�ʪ;[���]companion plants/
 ���礦�������󤫡� /���ɥ��󥫡�/
 ���礦�����ɤ� /����Ʋ/
+���礦�����ߤ��� /���˿���/
 ���礦�����⤸ /����ʸ��/
 ���礦���� /����/����;�����礦�䤯�θ��?/
 ���礦�������� /���׸�/
@@ -72780,7 +72781,7 @@ zyklus /
 ���󤷤󤷤夦���� /�ӿ�����/
 ���󤷤󤽤����� /����괯/
 ���󤷤󤾤��� /�������/
-���� /���/���;recent/����/���/���;valet/���/����/�⼡/�⼣/�ֻ�/�ػ�/
+���� /���/��/���;recent/����/���/���;valet/���/����/�⼡/�⼣/�ֻ�/�ػ�/
 ����> /���;-��,-�ؿ�/
 ���󤸤��� /�����/
 ���󤸤����ۤ� /�����ˡ/
@@ -72962,7 +72963,7 @@ zyklus /
 ����������� /������/
 ��������� /����/
 ������������礦���� /���İ����/
-����������������� /���İ�̲�/
+����������������� /���İ�̽�/
 ����������Ϥ�Ҥ� /���İ��ɧ/
 ��������Ƥ� /����Ū/
 ��������Ȥ� /�����Ի�/
@@ -76850,7 +76851,7 @@ zyklus /
 �������Ĥ褦�� /�ٻ��Ѹ�/
 �������Ĥ�Ӥ��� /�ٻ�ͽ����/
 �������Ĥ�礯 /�ٻ���/
-�������� /�׻�/�л�/����/
+�������� /�׻�/�л�/����/��/��/��/��/��/��/��/��/��/��/
 �������󤨤� /������/
 �������󤫤����� /�׻����/
 �������󤫤��� /�׻��ʳ�;��computational SCIENCE/�׻�����;��computational CHEMISTRY/
@@ -79122,6 +79123,7 @@ zyklus /
 ������ /��θ/
 �����礦 /����/����/
 �����礦���� /���̼�/
+�����礦���� /������/
 �����礯 /����/
 �����礯���餽�� /�����褤/
 �����礯�� /���ϲ�/
@@ -87591,7 +87593,6 @@ zyklus /
 �������� /�۵�/�Ƶ�/
 �������礦 /�Ƕ�/����;����/���;��̡����/�з�;[����ƻ]Ȭ�����ΰ졣����/
 �������礦���� /�ƶ���/
-�������礦�� /������/
 �������礦���� /�Ƕ���/
 �������礦���� /�����/
 �������礦���󤫤����� /�������®/
@@ -90318,7 +90319,7 @@ zyklus /
 ���󤫤��� /���ö�/
 ���󤫤��󤿤� /���϶���/
 ���󤫤���Ǥ�� /����������;[����]/
-���󤫤� /����/����/��/��/��/��/����;���/3��/
+���󤫤� /����/����/��/��/��/��/��/��/����;���/3��/
 ���󤫤����� /������/
 ���󤫤��� /���Ѳ�/
 ���󤫤����󤱤� /���Ѵط�/
@@ -92079,6 +92080,7 @@ zyklus /
 ������ /�����/
 �����Τ������䤯 /���������;[���̾]/
 �����Τߤ��� /Į̆/
+�����Τߤ� /����ƻ;���ƻ/
 �����Τ� /��ë/
 �����Ϥ� /����/
 �����Ϥ� /����/
@@ -94707,6 +94709,7 @@ zyklus /
 ���⤭���Ϥ�Ȥ� /����Ⱦ��/
 ���⤭����� /���̻�/
 ���⤮�礦 /����/
+���⤮�礦�� /������/
 ���⤯ /����/
 ���⤯�� /��Ԣ/
 ���⤯���� /������/
@@ -97463,7 +97466,6 @@ zyklus /
 �����Ǥ� /��ť/
 �����Ǥ� /����/
 �����Ȥ� /��Ʈ/
-�����Ȥ����� /���췴/
 �����ɤ� /��ư/��ƣ/
 ������ /����/
 �����ѤĤ�礯 /��ȯ��/
@@ -98743,7 +98745,7 @@ zyklus /
 ���礦���֤�Ƥ������ /����ʸ���/
 ���礦���ݤ� /������/
 ���礦�� 
/����;ǯ��(1926-1989)/����;ǯ��(1312-1317)/����/����/����/����/����;ǯ��(834-848)/����/
-���礦��#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/(skk-gengo-to-ad "" 
"ǯ")/(skk-gengo-to-ad "����" "ǯ")/
+���礦��#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/
 ���礦�狼�褦�� /���²��ػ�/
 ���礦�來 /���´�/
 ���礦�來�� /���´���/
@@ -100856,7 +100858,7 @@ zyklus /
 ���󤷤褦 /�»���/������/
 ���󤷤� /����/
 ���󤷤� /�»�Ͽ/
-���󤷤� 
/����/����/����/�š�;��̣-/����;�㤬-�ȹߤ�/����;mind.��-�Ӽ���/����/����;���󤸤�?/
+���󤷤� 
/����/����/����/�š�;��̣-/����;�㤬-�ȹߤ�/����;mind.��-�Ӽ���/����/����;���󤸤�?/����/
 ���󤷤󤭤��� /���ʵ���/
 ���󤷤󤳤����㤯 /�����׼�/
 ���󤷤󤵤ä� /���ʺ��/
@@ -100946,6 +100948,7 @@ zyklus /
 ���󤸤� /����Ϻ/����Ϻ/
 ���󤸤� /����/����/����/����/����/����/����;=����/
 ���󤸤󤨤󤲤��������礦 /���ͱ�����/
+���󤸤󤪤� /���Ͳ�/
 ���󤸤� /������/
 ���󤸤󤫤��� /���Ͳμ�/
 ���󤸤󤭤��� /���͵���/
@@ -103587,7 +103590,7 @@ zyklus /
 ���ɤ����� /��ưϿ��/
 ���ɤ����� /��ưϪ��/
 ���ɤ������ /��ưϪ��/
-���ɤ� /�Ϸ�/�ϼ��/
+���ɤ� /�Ϸ�/�ϼ��/������;��ʬ����(selfie)/
 ���ʤ� /����/����/����/
 ���ʤ����礦 /����Į/
 ���ʤ餷 /�϶Ѥ�/
@@ -105348,6 +105351,7 @@ zyklus /
 ���礦 
/��/��/��/��/��/��/��/��/��/ġ/��/��/Ƚ��;[Χ����]/��;[Χ����](�ޱ��ܤ�)=Ƚ��/��;10��/��;�Ĥ�/п;����ʼ/��;�ھ�/��;˭��/��;����/��;����/��;�־�פε��/��;�־�פε��(��̾�Ѵ���)/ڷ;º��ڷ��/�;(�Ϥ餦)/��/��/��;�־��פε��(��̾�Ѵ���)/�;�־��פε��(��̾�Ѵ���)/��;�־��פε��(��̾�Ѵ���)/��;��/��;��̮/��;�Ȥ�/��;�־�פε��(��̾�Ѵ���)/��;���šפε��(��̾�Ѵ���)/��;���/��;�־�פε��(��̾�Ѵ���)/Ы;�־�פε��(��̾�Ѵ���)/��;�Ƥ���/��;ļ��/��;����/��;��α/��/��/��;����/�;����/��;������/��;����/��;����/�;���(=����)/��;�־�פε��(��̾�Ѵ���)/��;���Τ�/��;����/�;(
 [...]
 ���礦> /��/̼;̼��,̼��˦/
 ���礦���� /��/���/
+���礦���� /�ﰵ/
 ���礦�� /���/ڷ��/���/����/���;-��ã/���/���/
 ���礦��> /���;-��ǰ,-ʬ��,-�ӥå�/
 ���礦������ /���Ƥ��/
@@ -108764,6 +108768,7 @@ zyklus /
 ����Ƥ� /��Ŵ/
 ����� /��/
 ����Ȥ� /����/
+����Ȥ����� /���췴/
 ����� /����/
 ����ɤ� /���ߤ�/
 ����ˡ��� /����ˡ���/
@@ -110807,7 +110812,7 @@ zyklus /
 �����줤�Ƥ� /����ŵ/
 �����줤�Ȥ� /�����Ի�/
 �����줭 /����/
-�����줭#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/(skk-ad-to-gengo 0 nil 
"ǯ")/(skk-ad-to-gengo 1 nil "ǯ")/
+�����줭#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/
 �����줭�ʤ�ͤ� /����ǯ/
 �����줭�ͤ󤬤ä� /����ǯ����/
 ������� /����;line up/����;limpid/����/
@@ -112168,7 +112173,7 @@ zyklus /
 ���󤱤Ĥ��� /�����/
 ���󤱤Ĥ����� /������/
 ���󤱤ĤϤ�Τ� /����ȿ��/
-���󤱤� 
/�踯/�踫/�츢/�踳/����/�ɸ�;�����׵��/���/��կ;-��������/���/ڣ��/����/������ϣ�����;��abbrev/
+���󤱤� 
/�踯/�踫/�츢/�踳/����/�ɸ�;�����׵��/���/��կ;-��������/���/ڣ��/����/������ϣ�����;��abbrev/
 ���󤱤󤵤����� /����������/
 ���󤱤󤸤��� /�츢����/
 ���󤱤󤻤� /�踫��/
@@ -113415,7 +113420,7 @@ zyklus /
 ���� /��/��/��/��;��-/��;Zen 
Buddhism/��/��;(Ϣ��)/��/��/��;�Ҥ������/��;��©/��;��ư/��;����/��/��;����/��;�����פΰ��λ�/��;����/�;�����פε��(��̾�Ѵ���)/
 ����> /��/��/
 ���󤢤� /����/
-���󤢤� /����/
+���󤢤� /����/����/
 ���� /����/����/����/
 ���󤤤��� /���Ѱ�/
 ���󤤤� /����/
@@ -117112,7 +117117,7 @@ zyklus /
 �������� /�н�/���;������/���/���;[�󽽻��ᵤ]7.23��/���/����/���;��������/���/
 �������礢�� /�н��/
 �������礦 
/�о�;��target.�ָ���-��/����;ǯ��(1912-26)/���/�羭/�о�;��contrast.��-�¸���/�о�;��symmetry.����-��/�羡/���/�о�;-��ˡ/�⾦/�羹;���羡/���/����;[ʩ��]/
-�������礦#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/(skk-gengo-to-ad "" 
"ǯ")/(skk-gengo-to-ad "����" "ǯ")/
+�������礦#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/
 �������礦> /�о�;-��,-��,-����/
 �������礦���� /������/
 �������礦���� /������Ϸ/
@@ -123708,7 +123713,6 @@ zyklus /
 ���夦���夦�ؤ� /�����/
 ���夦���礦 /���/�润/�涧/
 ���夦���礦�������� /�������/
-���夦���礦�� /�����/
 ���夦���礦�����Ф��礦 /������Ͼ�/
 ���夦���礦���� /�����/
 ���夦���礦���� /�涵��;[ά��]������鿳�IJ�/
@@ -127373,6 +127377,7 @@ zyklus /
 �Ĥ�� /������/
 �Ĥ�֤� /����/
 �Ĥ��� /ʼ/����/
+�Ĥ�� /����/
 �Ĥ�ɤ� /����/�Ѥ���/���;���ɡ׵��/
 �Ĥ�� /ϸ/
 �Ĥ�ܤ����� /ϸ����/
@@ -127747,6 +127752,7 @@ zyklus /
 �Ƥ����夦�Ϥ������� /����ȿ��/
 �Ƥ����夫��Ѥ� /������/
 �Ƥ����夯 /���/
+�Ƥ�����ä� /��л�/
 �Ƥ������ /���/���;excel/
 �Ƥ�����Ĥ����� /��д���/
 �Ƥ�����Ĥ� /��и�/
@@ -133759,6 +133765,7 @@ zyklus /
 �Ȥ褸 /˭��/
 �Ȥ褹 /˭��/
 �Ȥ褹���� /˭����/
+�Ȥ褹�����礦 /˭���Ծ�/
 �Ȥ褹�դȤ� /˭����Ƭ/
 �Ȥ褿 /˭��/
 �Ȥ褿�� /˭��;�����פ�̾��/
@@ -135927,6 +135934,7 @@ zyklus /
 �ʤ����� /����/������/
 �ʤ����� /���/
 �ʤ����礦 /���/
+�ʤ����礦�� /�����/
 �ʤ����� /���/���/
 �ʤ��� /���/
 �ʤ����� /��ţ/
@@ -138070,11 +138078,11 @@ zyklus /
 �ˤ����� /�°�/
 �ˤ����ΤߤϤ� /�Ӥθ��/
 �ˤ����� /�Ӹ�/
+�ˤ����礦�� /������/
 �ˤ����礦���� /������/
 �ˤ����礦�������夦���礦 /�����˵��/
 �ˤ�����夦 /������/
 �ˤ�����夦���� /��������/
-�ˤ����礦�� /������/
 �ˤ����� /�����/
 �ˤ��� /����/
 �ˤ������礦 /�����/
@@ -140222,6 +140230,7 @@ zyklus /
 �ˤ�������� /ǧ�ε���/
 �ˤ�����Τ� /ǧ�ε�ǽ/
 �ˤ�����󤴤��� /ǧ�θ����/
+�ˤ�����礦 /ǧ�ξ�/
 �ˤ������� /ǧ�ν���/
 �ˤ������� /ǧ�ο���/
 �ˤ������꤬�� /ǧ�ο�����/
@@ -144351,7 +144360,6 @@ zyklus /
 �Ϥޤʤ� /����/����;���͡׵��/
 �Ϥޤʤ� /��̾��/
 �Ϥޤʤ������Ϥ� /��̾���綶/
-�Ϥޤʤ��ᤤ���� /��̾��̾��/
 �Ϥޤʤ� /����;=�Ϥޤʤ�/
 �Ϥޤʤ� /�Ͳػ�/����/
 �Ϥޤ� /����/����/
@@ -145654,7 +145662,6 @@ zyklus /
 �� /��/��/��/��/��/��/��/��/��/��;�ξ�/��;�־�פΰ��λ�/��;�ֿϡפΰ��λ�/
 �С����ꤦ�� /Bk/Berkelium/
 �С����㡼�Ӥ礦 /�С����㡼��;[��]Buerger's disease/
-������� /(skk-version)/
 �С������Ф󤴤� /�С�������ֹ�/
 �С����Ȥ� /�С�����/
 �� /��/
@@ -146042,7 +146049,7 @@ zyklus /
 �Фä���餯 /ȴ��Ϳ��/
 �Фä��� /ȴ��/
 �Фä� /���/
-�Фä��� /Ȳ��/Ȳ��/
+�Фä��� /Ȳ��/
 �Фä��� /ȴ��/
 �Фä� /ȴ��/ȴ��/����/
 �Фä��� /ȴ����/
@@ -146887,6 +146894,7 @@ zyklus /
 �Ҥ������ /����/
 �Ҥ�����Ĥ��� /��Ȭ��/
 �Ҥ������ /�컳/
+�Ҥ�����ޤ� /�컳��/
 �Ҥ�����ޤ� /�컳��/
 �Ҥ�����ޤ����礦 /�컳�޾�/
 �Ҥ�����ޤ��󤸤礦 /�컳����/
@@ -147046,7 +147054,7 @@ zyklus /
 �Ҥ����ɤ� /�ж�Ļ/
 �Ҥ����� /����/��㿷�/
 �Ҥ��� /���/
-�Ҥ����Ƥ� /�����/�����/
+�Ҥ����Ƥ� /�����/
 �Ҥ����Ϥ��⤸ /�����ʸ��/
 �Ҥ��� /�ܶ�/
 �Ҥ��� /������/
@@ -148446,6 +148454,7 @@ zyklus /
 �Ҥ� /����/
 �ҤФ� /����/����/
 �ҤФ��Ҥ� /������/
+�ҤФ��� /���/
 �ҤФ��� /����/
 �ҤФ� /����;����ȯ�ˤ���/����;���������ˤ��餵���/����;�⤤��/����/
 �ҤФ����� /������;���ָ���-��/������;��������ǽϳ���-��/
@@ -149487,6 +149496,7 @@ zyklus /
 �Ҥ줤�ܤ����� /����˼��/
 �Ҥ줭 /����/���/
 �Ҥ�� /����/
+�Ҥ�Ĥ��� /�����/
 �Ҥ�ˤ� /�ҥ���/
 �Ҥ�� /����/
 �Ҥ�󤱤� /��Ϣ��/
@@ -150943,6 +150953,7 @@ zyklus /
 �դ������礦 /����Ĺ/
 �դ����礦 /����/
 �դ����� /ʢ��/
+�դ��������礦 /ʢ�ж�/
 �դ����ä��� /ʣ����/
 �դ����ߤ������礦 /���ȹ�Ĺ/
 �դ����� /����/
@@ -151264,6 +151275,7 @@ zyklus /
 �դ��Ȥ� /ʡ��/
 �դ��Ȥ�����ޤ� /ʡ������/
 �դ��Ȥ��� /���Կ�/
+�դ��Ȥ��󤻤� /���Կ���/
 �դ��Ȥ� /ʡ��/
 �դ��Ȥ� /ʡα/
 �դ��� /ʤ��/
@@ -154798,7 +154810,7 @@ zyklus /
 �ؤ����� /ʼ��/
 �ؤ����� /ʿ��/ʿʹ/
 �ؤ����� /ʿ��;ǯ��(1989-)/ʿ��/ʼ��/ʾ��/����/
-�ؤ�����#�ͤ� /ʿ��#0ǯ/ʿ��#1ǯ/ʿ��#2ǯ/ʿ��#3ǯ/(skk-gengo-to-ad "" 
"ǯ")/(skk-gengo-to-ad "����" "ǯ")/
+�ؤ�����#�ͤ� /ʿ��#0ǯ/ʿ��#1ǯ/ʿ��#2ǯ/ʿ��#3ǯ/
 �ؤ�����#�ͤ�� /ʿ��#0ǯ��/
 �ؤ����������� /ʿ���ݿ�/
 �ؤ���������ͤ� /ʿ����ǯ/
@@ -159542,6 +159554,7 @@ zyklus /
 �ޤ��礦�Ǥ󤻤� /�ⶭ����/
 �ޤ���� /�ų��/
 �ޤ� /����/
+�ޤ��㤯 /����/
 �ޤ��礦 /�޹�/�޹�/
 �ޤ��� /ʶ��/
 �ޤ���路 /ʶ��路/
@@ -159936,6 +159949,7 @@ zyklus /
 �ޤ����������� /�ְ㤤õ��/
 �ޤ������Ǥ�� /�ְ㤤����/
 �ޤ����� /�ְ㤨/
+�ޤ��� /����/Į��/
 �ޤ����礦��� /�Ԥ�����/�Թ���/
 �ޤ��� /����/
 �ޤ��� /���λ�/Į��/���һ�/���λ�/���һ�/����/���һ�/
@@ -161081,7 +161095,7 @@ zyklus /
 �ߤ��碌�� /������/
 �ߤ��錄�Ϥ館�� /�����ĸ���/
 �ߤ�����ۤ� /��������/
-�ߤ�����䤭 /�������/
+�ߤ�����䤭 /�������/
 �ߤ���٤� /������/
 �ߤ����� /���ϼ�/
 �ߤ����Τ����� /����ʪ��/
@@ -162913,6 +162927,7 @@ zyklus /
 �ߤ勞�Ƥ� /̥��Ū/
 �ߤ櫓 /��ʬ��/��ʬ/
 �ߤ盧 /���»�/
+�ߤ虜 /���/
 �ߤ魯�� /��˺��/
 �ߤ錄 /������/
 �ߤ�� /������/
@@ -164347,7 +164362,7 @@ zyklus /
 �ᤤ���� /�¿���/
 �ᤤ���󤳤����� /̾����®/
 �ᤤ�� /����;ǯ��(1868-1912)/����;specify/̾��;term/
-�ᤤ��#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/(skk-gengo-to-ad "" 
"ǯ")/(skk-gengo-to-ad "����" "ǯ")/
+�ᤤ��#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/
 �ᤤ�������� /�����ʹ�/
 �ᤤ������ /�����ʸ�/
 �ᤤ�������� /�����ݿ�/
@@ -164479,7 +164494,7 @@ zyklus /
 �ᤤ�Ф� /̾��/
 �ᤤ�Ҥ� /̾ɮ/
 �ᤤ�Ҥ礦 /̾ɼ/
-�ᤤ�Ҥ� /̾��/̾��/
+�ᤤ�Ҥ� /̾��/̾��/����/
 �ᤤ�� /��ջ/
 �ᤤ�Ӥ夦 /��ɵ/
 �ᤤ�Ӥ� /����/
@@ -167076,7 +167091,7 @@ zyklus /
 ��ĤϤ����󤮤礦 /Ȭ������;(1614-1685) ䷶ʲȡ���ϻ�ʤ�Ĵ�١�/
 ��ĤФ� /�۸�/
 ��Ĥ� /Ȭ����/
-��Ĥᤦ�ʤ� /Ȭ�ܱ�/��/
+��Ĥᤦ�ʤ� /Ȭ�ܱ�/
 ��Ĥ�� /Ȭ�ÿ�/
 ��Ĥ椦���� /ë��ͷ��/
 ��Ĥ� /����/�ۤ�/
@@ -169410,7 +169425,7 @@ zyklus /
 �褦�Ǥ� /���Ż�/
 �褦�Ǥ󤷤��Τ� /���Ż�ƬǾ/
 �褦�� /����/
-�褦�Ȥ� /��Ƭ/����;���λ�/����;lamp/����/
+�褦�Ȥ� /��Ƭ/����;���λ�/����;lamp/����/����/
 �褦�Ȥ����ˤ� /��Ƭ����/
 �褦�Ȥ��� /��Ȥ���/
 �褦�Ȥ� /���֤�/
@@ -170576,7 +170591,7 @@ zyklus /
 ��⤹���� /����/
 ���� /�����;�֤ġפϡ֤Ρפΰդγʽ���/
 ���Ĥ��� /�����/
-���ĤҤ餵�� /����ʿ��/
+���ĤҤ餵�� /����ʿ��/�������ɺ�;�Ż���/����ʿ��;���ܽ�/
 ����� /������/
 ����ޤФʤ� /��������/
 ��䤯 /ͽ��/Ю��;��ͽ�׵��/
@@ -173618,7 +173633,8 @@ zyklus /
 �줤��礦 /����/
 �줤��礯 /����/
 �줤�� /����/
-�줤�� /����/
+�줤�� /����;ǯ��(2019-)/����/
+�줤��#�ͤ� /����#0ǯ/����#1ǯ/����#2ǯ/����#3ǯ/
 �줪�� /�����/���̾/
 �줭 
/��;��history/��;��calendar/�;����/��;-��/ݬ;���̥�/��;pitch/ݮ;���̥�/��;����/��/��;(��ŷ��)����/�;Ť/
 �줭���� /㪴�/
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 362897f..949ab5a 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -84,10 +84,7 @@ char pot_etags_version[] = "@(#) pot revision number is 
17.38.1.4";
 #  undef DEBUG
 #  define DEBUG true
 #else
-#  define DEBUG  false
-#  ifndef NDEBUG
-#   define NDEBUG              /* disable assert */
-#  endif
+#  define DEBUG false
 #endif
 
 #include <config.h>
@@ -131,11 +128,6 @@ char pot_etags_version[] = "@(#) pot revision number is 
17.38.1.4";
 #include <c-strcase.h>
 
 #include <assert.h>
-#ifdef NDEBUG
-# undef  assert                        /* some systems have a buggy assert.h */
-# define assert(x) ((void) 0)
-#endif
-
 #include <getopt.h>
 #include <regex.h>
 
diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c
index 79bd007..5779e0d 100644
--- a/lib-src/make-fingerprint.c
+++ b/lib-src/make-fingerprint.c
@@ -140,29 +140,25 @@ main (int argc, char **argv)
     }
   else
     {
-      char *finger = memmem (buf, chunksz, fingerprint, sizeof fingerprint);
-      if (!finger)
-       {
-         fprintf (stderr, "%s: %s: missing fingerprint\n", prog, file);
-         return EXIT_FAILURE;
-       }
-      else if (memmem (finger + 1, buf + chunksz - (finger + 1),
-                      fingerprint, sizeof fingerprint))
-       {
-         fprintf (stderr, "%s: %s: two occurrences of fingerprint\n",
-                  prog, file);
-         return EXIT_FAILURE;
-       }
+      bool fingered = false;
 
-      if (fseeko (f, finger - buf, SEEK_SET) != 0)
+      for (char *finger = buf;
+          (finger = memmem (finger, buf + chunksz - finger,
+                            fingerprint, sizeof fingerprint));
+          finger++)
        {
-         perror (file);
-         return EXIT_FAILURE;
+         if (! (fseeko (f, finger - buf, SEEK_SET) == 0
+                && fwrite (digest, 1, sizeof digest, f) == sizeof digest))
+           {
+             perror (file);
+             return EXIT_FAILURE;
+           }
+         fingered = true;
        }
 
-      if (fwrite (digest, 1, sizeof digest, f) != sizeof digest)
+      if (!fingered)
        {
-         perror (file);
+         fprintf (stderr, "%s: %s: missing fingerprint\n", prog, file);
          return EXIT_FAILURE;
        }
     }
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index ade4ff8..1cbbff2 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -1046,6 +1046,7 @@ datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
+emacs_major_version = @emacs_major_version@
 etcdir = @etcdir@
 etcdocdir = @etcdocdir@
 exec_prefix = @exec_prefix@
diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h
index d13d89c..52ab781 100644
--- a/lib/mktime-internal.h
+++ b/lib/mktime-internal.h
@@ -1,40 +1,56 @@
-/* mktime variant that also uses an offset guess
-
+/* Internals of mktime and related functions
    Copyright 2016-2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Paul Eggert <address@hidden>.
 
-   This program is free software; you can redistribute it and/or
+   The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
    License as published by the Free Software Foundation; either
    version 3 of the License, or (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
+   The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.
 
    You should have received a copy of the GNU General Public
-   License along with this program; if not, see
+   License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <time.h>
+#ifndef _LIBC
+# include <time.h>
+#endif
 
 /* mktime_offset_t is a signed type wide enough to hold a UTC offset
    in seconds, and used as part of the type of the offset-guess
-   argument to mktime_internal.  Use time_t on platforms where time_t
+   argument to mktime_internal.  In Glibc, it is always long int.
+   When in Gnulib, use time_t on platforms where time_t
    is signed, to be compatible with platforms like BeOS that export
    this implementation detail of mktime.  On platforms where time_t is
    unsigned, GNU and POSIX code can assume 'int' is at least 32 bits
    which is wide enough for a UTC offset.  */
-
-#if TIME_T_IS_SIGNED
+#ifdef _LIBC
+typedef long int mktime_offset_t;
+#elif defined TIME_T_IS_SIGNED
 typedef time_t mktime_offset_t;
 #else
 typedef int mktime_offset_t;
 #endif
 
-time_t mktime_internal (struct tm *,
-                        struct tm * (*) (time_t const *, struct tm *),
-                        mktime_offset_t *);
+/* The source code uses identifiers like __time64_t for glibc
+   timestamps that can contain 64-bit values even when time_t is only
+   32 bits.  These are just macros for the ordinary identifiers unless
+   compiling within glibc when time_t is 32 bits.  */
+#if ! (defined _LIBC && __TIMESIZE != 64)
+# undef __time64_t
+# define __time64_t time_t
+# define __gmtime64_r __gmtime_r
+# define __localtime64_r __localtime_r
+# define __mktime64 mktime
+# define __timegm64 timegm
+#endif
+
+#ifndef _LIBC
 
 /* Although glibc source code uses leading underscores, Gnulib wants
    ordinary names.
@@ -45,9 +61,19 @@ time_t mktime_internal (struct tm *,
    Similarly for gmtime_r.  See the gnulib time_r module for one way
    to implement this.  */
 
-#undef __gmtime_r
-#undef __localtime_r
-#define __gmtime_r gmtime_r
-#define __localtime_r localtime_r
+# undef __gmtime_r
+# undef __localtime_r
+# define __gmtime_r gmtime_r
+# define __localtime_r localtime_r
+
+# define __mktime_internal mktime_internal
+
+#endif
 
-#define __mktime_internal mktime_internal
+/* Subroutine of mktime.  Return the time_t representation of TP and
+   normalize TP, given that a struct tm * maps to a time_t as performed
+   by FUNC.  Record next guess for localtime-gmtime offset in *OFFSET.  */
+extern __time64_t __mktime_internal (struct tm *tp,
+                                     struct tm *(*func) (__time64_t const *,
+                                                         struct tm *),
+                                     mktime_offset_t *offset) attribute_hidden;
diff --git a/lib/mktime.c b/lib/mktime.c
index e3783d7..b00af96 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -112,11 +112,11 @@ my_tzset (void)
    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
+   Much of the code uses long_int to represent __time64_t values, to
+   lessen the hassle of dealing with platforms where __time64_t is
    unsigned, and because long_int should suffice to represent all
-   time_t values that mktime can generate even on platforms where
-   time_t is excessively wide.  */
+   __time64_t values that mktime can generate even on platforms where
+   __time64_t is wider than the int components of struct tm.  */
 
 #if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60
 typedef long int long_int;
@@ -144,16 +144,15 @@ shr (long_int a, int b)
          : a / (one << b) - (a % (one << b) < 0));
 }
 
-/* Bounds for the intersection of time_t and long_int.  */
+/* Bounds for the intersection of __time64_t and long_int.  */
 
 static long_int const mktime_min
-  = ((TYPE_SIGNED (time_t) && TYPE_MINIMUM (time_t) < TYPE_MINIMUM (long_int))
-     ? TYPE_MINIMUM (long_int) : TYPE_MINIMUM (time_t));
+  = ((TYPE_SIGNED (__time64_t)
+      && TYPE_MINIMUM (__time64_t) < TYPE_MINIMUM (long_int))
+     ? TYPE_MINIMUM (long_int) : TYPE_MINIMUM (__time64_t));
 static long_int const mktime_max
-  = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (time_t)
-     ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (time_t));
-
-verify (TYPE_IS_INTEGER (time_t));
+  = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (__time64_t)
+     ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (__time64_t));
 
 #define EPOCH_YEAR 1970
 #define TM_YEAR_BASE 1900
@@ -252,23 +251,23 @@ tm_diff (long_int year, long_int yday, int hour, int min, 
int 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 (setting errno) on
+   range for __time64_t.  Return TM if successful, NULL (setting errno) on
    failure.  */
 static struct tm *
-convert_time (struct tm *(*convert) (const time_t *, struct tm *),
+convert_time (struct tm *(*convert) (const __time64_t *, struct tm *),
              long_int t, struct tm *tm)
 {
-  time_t x = t;
+  __time64_t x = t;
   return convert (&x, 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 __time64_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 *),
+ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *),
                long_int *t, struct tm *tp)
 {
   long_int t1 = (*t < mktime_min ? mktime_min
@@ -310,7 +309,7 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
 }
 
 
-/* Convert *TP to a time_t value, inverting
+/* Convert *TP to a __time64_t value, inverting
    the monotonic and mostly-unit-linear conversion function CONVERT.
    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.
@@ -318,9 +317,9 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
    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
+__time64_t
 __mktime_internal (struct tm *tp,
-                  struct tm *(*convert) (const time_t *, struct tm *),
+                  struct tm *(*convert) (const __time64_t *, struct tm *),
                   mktime_offset_t *offset)
 {
   struct tm tm;
@@ -520,9 +519,9 @@ __mktime_internal (struct tm *tp,
 
 #if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS
 
-/* Convert *TP to a time_t value.  */
-time_t
-mktime (struct tm *tp)
+/* Convert *TP to a __time64_t value.  */
+__time64_t
+__mktime64 (struct tm *tp)
 {
   /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
      time zone names contained in the external variable 'tzname' shall
@@ -531,7 +530,7 @@ mktime (struct tm *tp)
 
 # if defined _LIBC || NEED_MKTIME_WORKING
   static mktime_offset_t localtime_offset;
-  return __mktime_internal (tp, __localtime_r, &localtime_offset);
+  return __mktime_internal (tp, __localtime64_r, &localtime_offset);
 # else
 #  undef mktime
   return mktime (tp);
@@ -539,11 +538,29 @@ mktime (struct tm *tp)
 }
 #endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
 
-#ifdef weak_alias
-weak_alias (mktime, timelocal)
+#if defined _LIBC && __TIMESIZE != 64
+
+libc_hidden_def (__mktime64)
+
+time_t
+mktime (struct tm *tp)
+{
+  struct tm tm = *tp;
+  __time64_t t = __mktime64 (&tm);
+  if (in_time_t_range (t))
+    {
+      *tp = tm;
+      return t;
+    }
+  else
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+}
+
 #endif
 
-#ifdef _LIBC
+weak_alias (mktime, timelocal)
 libc_hidden_def (mktime)
 libc_hidden_weak (timelocal)
-#endif
diff --git a/lib/timegm.c b/lib/timegm.c
index 2ca5744..c440480 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -18,17 +18,41 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
-# include <config.h>
+# include <libc-config.h>
 #endif
 
 #include <time.h>
+#include <errno.h>
 
 #include "mktime-internal.h"
 
-time_t
-timegm (struct tm *tmp)
+__time64_t
+__timegm64 (struct tm *tmp)
 {
   static mktime_offset_t gmtime_offset;
   tmp->tm_isdst = 0;
-  return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
+  return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset);
 }
+
+#if defined _LIBC && __TIMESIZE != 64
+
+libc_hidden_def (__timegm64)
+
+time_t
+timegm (struct tm *tmp)
+{
+  struct tm tm = *tmp;
+  __time64_t t = __timegm64 (&tm);
+  if (in_time_t_range (t))
+    {
+      *tmp = tm;
+      return t;
+    }
+  else
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+}
+
+#endif
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 3c88ec6..be19da5 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1992, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: abbrev convenience
 ;; Package: emacs
 
diff --git a/lisp/align.el b/lisp/align.el
index 443237b..aeb845a 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: convenience languages lisp
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index d3b8d06..136e69f 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -415,7 +415,11 @@ this."
        ;; if the rest of the region should have a face, put it there
        (funcall ansi-color-apply-face-function
                 start-marker end-marker (ansi-color--find-face codes))
-       (setq ansi-color-context-region (if codes (list codes)))))))
+       (setq ansi-color-context-region (if codes (list codes)))))
+    ;; Clean up our temporary markers.
+    (unless (eq start-marker (cadr ansi-color-context-region))
+      (set-marker start-marker nil))
+    (set-marker end-marker nil)))
 
 (defun ansi-color-apply-overlay-face (beg end face)
   "Make an overlay from BEG to END, and apply face FACE.
@@ -425,6 +429,12 @@ If FACE is nil, do nothing."
      (ansi-color-make-extent beg end)
      face)))
 
+(defun ansi-color-apply-text-property-face (beg end face)
+  "Set the `font-lock-face' property to FACE in region BEG..END.
+If FACE is nil, do nothing."
+  (when face
+    (put-text-property beg end 'font-lock-face face)))
+
 ;; This function helps you look for overlapping overlays.  This is
 ;; useful in comint-buffers.  Overlapping overlays should not happen!
 ;; A possible cause for bugs are the markers.  If you create an overlay
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 1c88f9a..7f435f1 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -417,70 +417,66 @@ file.  Archive and member name will be added."
       (substitute-key-definition 'advertised-undo 'archive-undo map global-map)
       (substitute-key-definition 'undo 'archive-undo map global-map))
 
-    (define-key map
-      (if (featurep 'xemacs) 'button2 [mouse-2]) 'archive-extract)
-
-    (if (featurep 'xemacs)
-        ()                             ; out of luck
-
-      (define-key map [menu-bar immediate]
-        (cons "Immediate" (make-sparse-keymap "Immediate")))
-      (define-key map [menu-bar immediate alternate]
-        '(menu-item "Alternate Display" archive-alternate-display
-          :enable (boundp (archive-name "alternate-display"))
-          :help "Toggle alternate file info display"))
-      (define-key map [menu-bar immediate view]
-        '(menu-item "View This File" archive-view
-          :help "Display file at cursor in View Mode"))
-      (define-key map [menu-bar immediate display]
-        '(menu-item "Display in Other Window" archive-display-other-window
-          :help "Display file at cursor in another window"))
-      (define-key map [menu-bar immediate find-file-other-window]
-        '(menu-item "Find in Other Window" archive-extract-other-window
-          :help "Edit file at cursor in another window"))
-      (define-key map [menu-bar immediate find-file]
-        '(menu-item "Find This File" archive-extract
-          :help "Extract file at cursor and edit it"))
-
-      (define-key map [menu-bar mark]
-        (cons "Mark" (make-sparse-keymap "Mark")))
-      (define-key map [menu-bar mark unmark-all]
-        '(menu-item "Unmark All" archive-unmark-all-files
-          :help "Unmark all marked files"))
-      (define-key map [menu-bar mark deletion]
-        '(menu-item "Flag" archive-flag-deleted
-          :help "Flag file at cursor for deletion"))
-      (define-key map [menu-bar mark unmark]
-        '(menu-item "Unflag" archive-unflag
-          :help "Unmark file at cursor"))
-      (define-key map [menu-bar mark mark]
-        '(menu-item "Mark" archive-mark
-          :help "Mark file at cursor"))
-
-      (define-key map [menu-bar operate]
-        (cons "Operate" (make-sparse-keymap "Operate")))
-      (define-key map [menu-bar operate chown]
-        '(menu-item "Change Owner..." archive-chown-entry
-          :enable (fboundp (archive-name "chown-entry"))
-          :help "Change owner of marked files"))
-      (define-key map [menu-bar operate chgrp]
-        '(menu-item "Change Group..." archive-chgrp-entry
-          :enable (fboundp (archive-name "chgrp-entry"))
-          :help "Change group ownership of marked files"))
-      (define-key map [menu-bar operate chmod]
-        '(menu-item "Change Mode..." archive-chmod-entry
-          :enable (fboundp (archive-name "chmod-entry"))
-          :help "Change mode (permissions) of marked files"))
-      (define-key map [menu-bar operate rename]
-        '(menu-item "Rename to..." archive-rename-entry
-          :enable (fboundp (archive-name "rename-entry"))
-          :help "Rename marked files"))
-      ;;(define-key map [menu-bar operate copy]
-      ;;  '(menu-item "Copy to..." archive-copy))
-      (define-key map [menu-bar operate expunge]
-        '(menu-item "Expunge Marked Files" archive-expunge
-          :help "Delete all flagged files from archive"))
-      map))
+    (define-key map [mouse-2] 'archive-extract)
+
+    (define-key map [menu-bar immediate]
+      (cons "Immediate" (make-sparse-keymap "Immediate")))
+    (define-key map [menu-bar immediate alternate]
+      '(menu-item "Alternate Display" archive-alternate-display
+                  :enable (boundp (archive-name "alternate-display"))
+                  :help "Toggle alternate file info display"))
+    (define-key map [menu-bar immediate view]
+      '(menu-item "View This File" archive-view
+                  :help "Display file at cursor in View Mode"))
+    (define-key map [menu-bar immediate display]
+      '(menu-item "Display in Other Window" archive-display-other-window
+                  :help "Display file at cursor in another window"))
+    (define-key map [menu-bar immediate find-file-other-window]
+      '(menu-item "Find in Other Window" archive-extract-other-window
+                  :help "Edit file at cursor in another window"))
+    (define-key map [menu-bar immediate find-file]
+      '(menu-item "Find This File" archive-extract
+                  :help "Extract file at cursor and edit it"))
+
+    (define-key map [menu-bar mark]
+      (cons "Mark" (make-sparse-keymap "Mark")))
+    (define-key map [menu-bar mark unmark-all]
+      '(menu-item "Unmark All" archive-unmark-all-files
+                  :help "Unmark all marked files"))
+    (define-key map [menu-bar mark deletion]
+      '(menu-item "Flag" archive-flag-deleted
+                  :help "Flag file at cursor for deletion"))
+    (define-key map [menu-bar mark unmark]
+      '(menu-item "Unflag" archive-unflag
+                  :help "Unmark file at cursor"))
+    (define-key map [menu-bar mark mark]
+      '(menu-item "Mark" archive-mark
+                  :help "Mark file at cursor"))
+
+    (define-key map [menu-bar operate]
+      (cons "Operate" (make-sparse-keymap "Operate")))
+    (define-key map [menu-bar operate chown]
+      '(menu-item "Change Owner..." archive-chown-entry
+                  :enable (fboundp (archive-name "chown-entry"))
+                  :help "Change owner of marked files"))
+    (define-key map [menu-bar operate chgrp]
+      '(menu-item "Change Group..." archive-chgrp-entry
+                  :enable (fboundp (archive-name "chgrp-entry"))
+                  :help "Change group ownership of marked files"))
+    (define-key map [menu-bar operate chmod]
+      '(menu-item "Change Mode..." archive-chmod-entry
+                  :enable (fboundp (archive-name "chmod-entry"))
+                  :help "Change mode (permissions) of marked files"))
+    (define-key map [menu-bar operate rename]
+      '(menu-item "Rename to..." archive-rename-entry
+                  :enable (fboundp (archive-name "rename-entry"))
+                  :help "Rename marked files"))
+    ;;(define-key map [menu-bar operate copy]
+    ;;  '(menu-item "Copy to..." archive-copy))
+    (define-key map [menu-bar operate expunge]
+      '(menu-item "Expunge Marked Files" archive-expunge
+                  :help "Delete all flagged files from archive"))
+    map)
   "Local keymap for archive mode listings.")
 (defvar archive-file-name-indent nil "Column where file names start.")
 
@@ -516,17 +512,12 @@ Each descriptor is a vector of the form
 ;; -------------------------------------------------------------------------
 ;;; Section: Support functions.
 
-(eval-when-compile
-  (defsubst byte-after (pos)
-    "Like char-after but an eight-bit char is converted to unibyte."
-    (multibyte-char-to-unibyte (char-after pos)))
-  (defsubst insert-unibyte (&rest args)
-    "Like insert but don't make unibyte string and eight-bit char multibyte."
-    (dolist (elt args)
-      (if (integerp elt)
-         (insert (if (< elt 128) elt (decode-char 'eight-bit elt)))
-       (insert (string-to-multibyte elt)))))
-  )
+(defun arc-insert-unibyte (&rest args)
+  "Like insert but don't make unibyte string and eight-bit char multibyte."
+  (dolist (elt args)
+    (if (integerp elt)
+       (insert (if (< elt 128) elt (decode-char 'eight-bit elt)))
+      (insert elt))))
 
 (defsubst archive-name (suffix)
   (intern (concat "archive-" (symbol-name archive-subtype) "-" suffix)))
@@ -538,7 +529,8 @@ in which case a second argument, length LEN, should be 
supplied."
   (if (stringp str)
       (setq len (length str))
     (setq str (buffer-substring str (+ str len))))
-  (setq str (string-as-unibyte str))
+  (if (multibyte-string-p str)
+      (setq str (encode-coding-string str 'utf-8-emacs-unix)))
   (let ((result 0)
         (i 0))
     (while (< i len)
@@ -842,13 +834,11 @@ when parsing the archive."
        ;; Using `concat' here copies the text also, so we can add
        ;; properties without problems.
        (let ((text (concat (aref fil 0) "\n")))
-         (if (featurep 'xemacs)
-             ()                         ; out of luck
-           (add-text-properties
-            (aref fil 1) (aref fil 2)
-            '(mouse-face highlight
-              help-echo "mouse-2: extract this file into a buffer")
-            text))
+         (add-text-properties
+          (aref fil 1) (aref fil 2)
+          '(mouse-face highlight
+                       help-echo "mouse-2: extract this file into a buffer")
+          text)
          text))
      files)))
   (setq archive-file-list-end (point-marker)))
@@ -1492,8 +1482,8 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
         files
        visual)
     (while (and (< (+ p 29) (point-max))
-               (= (byte-after p) ?\C-z)
-               (> (byte-after (1+ p)) 0))
+               (= (get-byte p) ?\C-z)
+               (> (get-byte (1+ p)) 0))
       (let* ((namefld (buffer-substring (+ p 2) (+ p 2 13)))
             (fnlen   (or (string-match "\0" namefld) 13))
             (efnname (decode-coding-string (substring namefld 0 fnlen)
@@ -1546,7 +1536,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
        (widen)
        (goto-char (+ archive-proper-file-start (aref descr 4) 2))
        (delete-char 13)
-       (insert-unibyte name)))))
+       (arc-insert-unibyte name)))))
 ;; -------------------------------------------------------------------------
 ;;; Section: Lzh Archives
 
@@ -1558,13 +1548,13 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
        visual)
     (while (progn (goto-char p)                ;beginning of a base header.
                  (looking-at "\\(.\\|\n\\)\\(.\\|\n\\)-l[hz][0-9ds]-"))
-      (let* ((hsize   (byte-after p))  ;size of the base header (level 0 and 1)
+      (let* ((hsize   (get-byte p))    ;size of the base header (level 0 and 1)
             (csize   (archive-l-e (+ p 7) 4)) ;size of a compressed file to 
follow (level 0 and 2),
                                        ;size of extended headers + the 
compressed file to follow (level 1).
              (ucsize  (archive-l-e (+ p 11) 4))        ;size of an 
uncompressed file.
             (time1   (archive-l-e (+ p 15) 2)) ;date/time (MSDOS format in 
level 0, 1 headers
             (time2   (archive-l-e (+ p 17) 2)) ;and UNIX format in level 2 
header.)
-            (hdrlvl  (byte-after (+ p 20))) ;header level
+            (hdrlvl  (get-byte (+ p 20))) ;header level
             thsize             ;total header size (base + extensions)
             fnlen efnname osid fiddle ifnname width p2
             neh        ;beginning of next extension header (level 1 and 2)
@@ -1572,7 +1562,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
             gname uname modtime moddate)
        (if (= hdrlvl 3) (error "can't handle lzh level 3 header type"))
        (when (or (= hdrlvl 0) (= hdrlvl 1))
-         (setq fnlen   (byte-after (+ p 21))) ;filename length
+         (setq fnlen   (get-byte (+ p 21))) ;filename length
          (setq efnname (let ((str (buffer-substring (+ p 22) (+ p 22 fnlen)))) 
;filename from offset 22
                        (decode-coding-string
                         str archive-file-name-coding-system)))
@@ -1583,19 +1573,19 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
               (setq neh (+ p 24))))     ;specific to level 2 header
        (if neh         ;if level 1 or 2 we expect extension headers to follow
            (let* ((ehsize (archive-l-e neh 2)) ;size of the extension header
-                  (etype (byte-after (+ neh 2)))) ;extension type
+                  (etype (get-byte (+ neh 2)))) ;extension type
              (while (not (= ehsize 0))
                  (cond
                 ((= etype 1)   ;file name
                  (let ((i (+ neh 3)))
                    (while (< i (+ neh ehsize))
-                     (setq efnname (concat efnname (char-to-string (byte-after 
i))))
+                     (setq efnname (concat efnname (char-to-string (get-byte 
i))))
                      (setq i (1+ i)))))
                 ((= etype 2)   ;directory name
                  (let ((i (+ neh 3)))
                    (while (< i (+ neh ehsize))
                                    (setq dir (concat dir
-                                                      (if (= (byte-after i)
+                                                      (if (= (get-byte i)
                                                              255)
                                                           "/"
                                                         (char-to-string
@@ -1619,7 +1609,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
                   )
                (setq neh (+ neh ehsize))
                (setq ehsize (archive-l-e neh 2))
-               (setq etype (byte-after (+ neh 2))))
+               (setq etype (get-byte (+ neh 2))))
              ;;get total header size for level 1 and 2 headers
              (setq thsize (- neh p))))
        (if (= hdrlvl 0)  ;total header size
@@ -1706,7 +1696,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
   (let ((sum 0))
     (while (> count 0)
       (setq count (1- count)
-           sum (+ sum (byte-after p))
+           sum (+ sum (get-byte p))
            p (1+ p)))
     (logand sum 255)))
 
@@ -1715,8 +1705,8 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
     (save-excursion
       (widen)
       (let* ((p        (+ archive-proper-file-start (aref descr 4)))
-            (oldhsize (byte-after p))
-            (oldfnlen (byte-after (+ p 21)))
+            (oldhsize (get-byte p))
+            (oldfnlen (get-byte (+ p 21)))
             (newfnlen (length newname))
             (newhsize (+ oldhsize newfnlen (- oldfnlen)))
             (inhibit-read-only t))
@@ -1724,10 +1714,10 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
            (error "The file name is too long"))
        (goto-char (+ p 21))
        (delete-char (1+ oldfnlen))
-       (insert-unibyte newfnlen newname)
+       (arc-insert-unibyte newfnlen newname)
        (goto-char p)
        (delete-char 2)
-       (insert-unibyte newhsize (archive-lzh-resum p newhsize))))))
+       (arc-insert-unibyte newhsize (archive-lzh-resum p newhsize))))))
 
 (defun archive-lzh-ogm (newval files errtxt ofs)
   (save-excursion
@@ -1735,10 +1725,10 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
       (widen)
       (dolist (fil files)
        (let* ((p (+ archive-proper-file-start (aref fil 4)))
-              (hsize   (byte-after p))
-              (fnlen   (byte-after (+ p 21)))
+              (hsize   (get-byte p))
+              (fnlen   (get-byte (+ p 21)))
               (p2      (+ p 22 fnlen))
-              (creator (if (>= (- hsize fnlen) 24) (byte-after (+ p2 2)) 0))
+              (creator (if (>= (- hsize fnlen) 24) (get-byte (+ p2 2)) 0))
               (inhibit-read-only t))
          (if (= creator ?U)
              (progn
@@ -1746,10 +1736,10 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
                    (setq newval (funcall newval (archive-l-e (+ p2 ofs) 2))))
                (goto-char (+ p2 ofs))
                (delete-char 2)
-               (insert-unibyte (logand newval 255) (ash newval -8))
+               (arc-insert-unibyte (logand newval 255) (ash newval -8))
                (goto-char (1+ p))
                (delete-char 1)
-               (insert-unibyte (archive-lzh-resum (1+ p) hsize)))
+               (arc-insert-unibyte (archive-lzh-resum (1+ p) hsize)))
            (message "Member %s does not have %s field"
                     (aref fil 1) errtxt)))))))
 
@@ -1821,7 +1811,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
       (setq p (archive-l-e (+ p 48) 8)))
     (setq p (+ p (point-min)))
     (while (string= "PK\001\002" (buffer-substring p (+ p 4)))
-      (let* ((creator (byte-after (+ p 5)))
+      (let* ((creator (get-byte (+ p 5)))
             ;; (method  (archive-l-e (+ p 10) 2))
              (modtime (archive-l-e (+ p 12) 2))
              (moddate (archive-l-e (+ p 14) 2))
@@ -1841,7 +1831,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
                             (logior ?\444
                                     (if isdir (logior 16384 ?\111) 0)
                                     (if (zerop
-                                         (logand 1 (byte-after (+ p 38))))
+                                         (logand 1 (get-byte (+ p 38))))
                                         ?\222 0)))
                            (t nil)))
             (modestr (if mode (archive-int-to-mode mode) "??????????"))
@@ -1918,18 +1908,19 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
       (widen)
       (dolist (fil files)
        (let* ((p (+ archive-proper-file-start (car (aref fil 4))))
-              (creator (byte-after (+ p 5)))
+              (creator (get-byte (+ p 5)))
               (oldmode (aref fil 3))
               (newval  (archive-calc-mode oldmode newmode t))
               (inhibit-read-only t))
          (cond ((memq creator '(2 3)) ; Unix
                 (goto-char (+ p 40))
                 (delete-char 2)
-                (insert-unibyte (logand newval 255) (ash newval -8)))
+                (arc-insert-unibyte (logand newval 255) (ash newval -8)))
                ((memq creator '(0 5 6 7 10 11 15)) ; Dos etc.
                 (goto-char (+ p 38))
-                (insert-unibyte (logior (logand (byte-after (point)) 254)
-                                        (logand (logxor 1 (ash newval -7)) 1)))
+                (arc-insert-unibyte
+                  (logior (logand (get-byte (point)) 254)
+                         (logand (logxor 1 (ash newval -7)) 1)))
                 (delete-char 1))
                (t (message "Don't know how to change mode for this member"))))
         ))))
@@ -1949,9 +1940,9 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
              (modtime (archive-l-e (+ p 16) 2))
              (ucsize  (archive-l-e (+ p 20) 4))
             (namefld (buffer-substring (+ p 38) (+ p 38 13)))
-            (dirtype (byte-after (+ p 4)))
-            (lfnlen  (if (= dirtype 2) (byte-after (+ p 56)) 0))
-            (ldirlen (if (= dirtype 2) (byte-after (+ p 57)) 0))
+            (dirtype (get-byte (+ p 4)))
+            (lfnlen  (if (= dirtype 2) (get-byte (+ p 56)) 0))
+            (ldirlen (if (= dirtype 2) (get-byte (+ p 57)) 0))
             (fnlen   (or (string-match "\0" namefld) 13))
             (efnname (let ((str
                             (concat
diff --git a/lisp/array.el b/lisp/array.el
index 2fffe01..28635d1 100644
--- a/lisp/array.el
+++ b/lisp/array.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1987, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David M. Brown
-;; Maintainer: address@hidden
 ;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index f7ecfe2..c2ebea7 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -6,7 +6,6 @@
 ;; Author: Charlie Martin <address@hidden>
 ;; Adapted-By: Daniel Pfeiffer <address@hidden>
 ;; Keywords: convenience
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 1d20896..2de855b 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -107,7 +107,7 @@
 
 ;; Dependencies:
 
-(eval-when-compile (require 'cl-lib))
+(require 'cl-lib)
 (require 'timer)
 (require 'filenotify)
 
@@ -126,8 +126,6 @@ Global Auto-Revert Mode does so in all buffers."
 
 ;; Variables:
 
-;;; What's this?: ;; Autoload for the benefit of 
`make-mode-line-mouse-sensitive'.
-;;; What's this?: ;;;###autoload
 (defvar auto-revert-mode nil
   "Non-nil when Auto-Revert Mode is active.
 Never set this variable directly, use the command `auto-revert-mode' instead.")
@@ -302,6 +300,27 @@ You should set this variable through Custom."
   :type 'regexp
   :version "24.4")
 
+(defcustom auto-revert-avoid-polling nil
+  "Non-nil to avoid polling files when notification is available.
+
+Set this variable to a non-nil value to save power by avoiding
+polling when possible.  Files on file-systems that do not support
+change notifications must match `auto-revert-notify-exclude-dir-regexp'
+for Auto-Revert to work properly in this case.  This typically
+includes files on network file systems on Unix-like machines,
+when those files are modified from another computer.
+
+When nil, buffers in Auto-Revert Mode will always be polled for
+changes to their files on disk every `auto-revert-interval'
+seconds, in addition to using notification for those files."
+  :group 'auto-revert
+  :type 'boolean
+  :set (lambda (variable value)
+         (set-default variable value)
+        (when (fboundp 'auto-revert-set-timer)
+           (auto-revert-set-timer)))
+  :version "27.1")
+
 ;; Internal variables:
 
 (defvar auto-revert-buffer-list ()
@@ -313,6 +332,9 @@ buffers to this list.
 The timer function `auto-revert-buffers' is responsible for purging
 the list of old buffers.")
 
+(defvar-local auto-revert--global-mode nil
+  "Non-nil if buffer is handled by Global Auto-Revert mode.")
+
 (defvar auto-revert-remaining-buffers ()
   "Buffers not checked when user input stopped execution.")
 
@@ -341,6 +363,9 @@ buffer.")
   "Non-nil when file has been modified on the file system.
 This has been reported by a file notification event.")
 
+(defvar auto-revert-debug nil
+  "Use for debug messages.")
+
 ;; Functions:
 
 (defun auto-revert-remove-current-buffer (&optional buffer)
@@ -476,11 +501,107 @@ specifies in the mode line."
   :global t :group 'auto-revert :lighter global-auto-revert-mode-text
   (auto-revert-set-timer)
   (if global-auto-revert-mode
-      (auto-revert-buffers)
+      ;; Turn global-auto-revert-mode ON.
+      (progn
+        (dolist (buf (buffer-list))
+          (with-current-buffer buf
+            (auto-revert--global-add-current-buffer)))
+        ;; Make sure future buffers are added as well.
+        (add-hook 'find-file-hook #'auto-revert--global-adopt-current-buffer)
+        (add-hook 'after-set-visited-file-name-hook
+                  #'auto-revert--global-set-visited-file-name)
+        ;; To track non-file buffers, we need to listen in to buffer
+        ;; creation in general.  Listening to major-mode changes is
+        ;; suitable, since we then know whether it's a mode that is tracked.
+        (when global-auto-revert-non-file-buffers
+          (add-hook 'after-change-major-mode-hook
+                    #'auto-revert--global-adopt-current-buffer))
+        (auto-revert-buffers))
+    ;; Turn global-auto-revert-mode OFF.
+    (remove-hook 'after-change-major-mode-hook
+                 #'auto-revert--global-adopt-current-buffer)
+    (remove-hook 'after-set-visited-file-name-hook
+                 #'auto-revert--global-set-visited-file-name)
+    (remove-hook 'find-file-hook #'auto-revert--global-adopt-current-buffer)
     (dolist (buf (buffer-list))
       (with-current-buffer buf
-       (when auto-revert-notify-watch-descriptor
-         (auto-revert-notify-rm-watch))))))
+        (when auto-revert--global-mode
+          (setq auto-revert--global-mode nil)
+          (when (and auto-revert-notify-watch-descriptor
+                     (not (or auto-revert-mode auto-revert-tail-mode)))
+           (auto-revert-notify-rm-watch)))))))
+
+(defun auto-revert--global-add-current-buffer ()
+  "Set current buffer to be tracked by Global Auto-Revert if appropriate."
+  (when (and (not auto-revert--global-mode)
+             (or buffer-file-name
+                 (and global-auto-revert-non-file-buffers
+                      (not (string-prefix-p " " (buffer-name)))
+                      ;; Any non-file buffer must have a custom
+                      ;; `buffer-stale-function' to be tracked, since
+                      ;; we wouldn't know when to revert it otherwise.
+                      (not (eq buffer-stale-function
+                               #'buffer-stale--default-function))))
+             (not (memq 'major-mode global-auto-revert-ignore-modes))
+             (not global-auto-revert-ignore-buffer))
+    (setq auto-revert--global-mode t)))
+
+(defun auto-revert--global-adopt-current-buffer ()
+  "Consider tracking current buffer in a running Global Auto-Revert mode."
+  (auto-revert--global-add-current-buffer)
+  (auto-revert-set-timer))
+
+(defun auto-revert--global-set-visited-file-name ()
+  "Update Global Auto-Revert management of the current buffer.
+Called after `set-visited-file-name'."
+  ;; Remove any existing notifier first so that we don't track the
+  ;; wrong file in case the file name was changed.
+  (when auto-revert-notify-watch-descriptor
+    (auto-revert-notify-rm-watch))
+  (auto-revert--global-adopt-current-buffer))
+
+(defun auto-revert--polled-buffers ()
+  "List of buffers that need to be polled."
+  (cond (global-auto-revert-mode
+         (mapcan (lambda (buffer)
+                   (and (not (and auto-revert-avoid-polling
+                                  (buffer-local-value
+                                   'auto-revert-notify-watch-descriptor
+                                   buffer)))
+                        (or (buffer-local-value
+                             'auto-revert--global-mode buffer)
+                            (buffer-local-value 'auto-revert-mode buffer)
+                            (buffer-local-value 'auto-revert-tail-mode buffer))
+                        (list buffer)))
+                 (buffer-list)))
+        (auto-revert-avoid-polling
+         (mapcan (lambda (buffer)
+                   (and (not (buffer-local-value
+                              'auto-revert-notify-watch-descriptor buffer))
+                        (list buffer)))
+                 auto-revert-buffer-list))
+        (t auto-revert-buffer-list)))
+
+;; Same as above in a boolean context, but cheaper.
+(defun auto-revert--need-polling-p ()
+  "Whether periodic polling is required."
+  (cond (global-auto-revert-mode
+         (or (not auto-revert-avoid-polling)
+             (cl-some
+              (lambda (buffer)
+                (and (not (buffer-local-value
+                           'auto-revert-notify-watch-descriptor buffer))
+                     (or (buffer-local-value 'auto-revert--global-mode buffer)
+                         (buffer-local-value 'auto-revert-mode buffer)
+                         (buffer-local-value 'auto-revert-tail-mode buffer))))
+              (buffer-list))))
+        (auto-revert-avoid-polling
+         (not (cl-every
+               (lambda (buffer)
+                 (buffer-local-value
+                  'auto-revert-notify-watch-descriptor buffer))
+               auto-revert-buffer-list)))
+        (t auto-revert-buffer-list)))
 
 (defun auto-revert-set-timer ()
   "Restart or cancel the timer used by Auto-Revert Mode.
@@ -492,10 +613,10 @@ will use an up-to-date value of `auto-revert-interval'"
   (if (timerp auto-revert-timer)
       (cancel-timer auto-revert-timer))
   (setq auto-revert-timer
-       (if (or global-auto-revert-mode auto-revert-buffer-list)
-           (run-with-timer auto-revert-interval
-                           auto-revert-interval
-                           'auto-revert-buffers))))
+       (and (auto-revert--need-polling-p)
+            (run-with-timer auto-revert-interval
+                            auto-revert-interval
+                            'auto-revert-buffers))))
 
 (defun auto-revert-notify-rm-watch ()
   "Disable file notification for current buffer's associated file."
@@ -558,24 +679,20 @@ will use an up-to-date value of `auto-revert-interval'"
 ;; often, we want to skip some revert operations so that we don't spend all our
 ;; time reverting the buffer.
 ;;
-;; We do this by reverting immediately in response to the first in a flurry of
-;; notifications. We suppress subsequent notifications until the next time
-;; `auto-revert-buffers' is called (this happens on a timer with a period set 
by
-;; `auto-revert-interval').
-(defvar auto-revert-buffers-counter 1
-  "Incremented each time `auto-revert-buffers' is called")
-(defvar-local auto-revert-buffers-counter-lockedout 0
-  "Buffer-local value to indicate whether we should immediately
-update the buffer on a notification event or not. If
-
-  (= auto-revert-buffers-counter-lockedout
-     auto-revert-buffers-counter)
-
-then the updates are locked out, and we wait until the next call
-of `auto-revert-buffers' to revert the buffer. If no lockout is
-present, then we revert immediately and set the lockout, so that
-no more reverts are possible until the next call of
-`auto-revert-buffers'")
+;; We do this by reverting immediately in response to the first in a
+;; flurry of notifications. Any notifications during the following
+;; `auto-revert-lockout-interval' seconds are noted but not acted upon
+;; until the end of that interval.
+
+(defconst auto-revert--lockout-interval 2.5
+  "Duration, in seconds, of the Auto-Revert Mode notification lockout.
+This is the quiescence after each notification of a file being
+changed during which no automatic reverting takes place, to
+prevent many updates in rapid succession from overwhelming the
+system.")
+
+(defvar-local auto-revert--lockout-timer nil
+  "Timer awaiting the end of the notification lockout interval, or nil.")
 
 (defun auto-revert-notify-handler (event)
   "Handle an EVENT returned from file notification."
@@ -591,6 +708,8 @@ no more reverts are possible until the next call of
       ;; Since we watch a directory, a file name must be returned.
       (cl-assert (stringp file))
       (when (eq action 'renamed) (cl-assert (stringp file1)))
+      (when auto-revert-debug
+        (message "auto-revert-notify-handler %S" event))
 
       (if (eq action 'stopped)
           ;; File notification has stopped.  Continue with polling.
@@ -604,7 +723,10 @@ no more reverts are possible until the next call of
                            (file-name-nondirectory buffer-file-name)))
                      ;; A buffer w/o a file, like dired.
                      (null buffer-file-name))
-                (auto-revert-notify-rm-watch))))
+                (auto-revert-notify-rm-watch)
+                ;; Restart the timer if it wasn't running.
+                (unless auto-revert-timer)
+                  (auto-revert-set-timer))))
 
         ;; Loop over all buffers, in order to find the intended one.
         (cl-dolist (buffer buffers)
@@ -630,19 +752,27 @@ no more reverts are possible until the next call of
                 (setq auto-revert-notify-modified-p t)
 
                 ;; Revert the buffer now if we're not locked out.
-                (when (/= auto-revert-buffers-counter-lockedout
-                          auto-revert-buffers-counter)
+                (unless auto-revert--lockout-timer
                   (auto-revert-handler)
-                  (setq auto-revert-buffers-counter-lockedout
-                        auto-revert-buffers-counter))))))))))
+                  (setq auto-revert--lockout-timer
+                        (run-with-timer
+                         auto-revert--lockout-interval nil
+                         #'auto-revert--end-lockout buffer)))))))))))
+
+(defun auto-revert--end-lockout (buffer)
+  "End the lockout period after a notification.
+If the buffer needs to be reverted, do it now."
+  (when (buffer-live-p buffer)
+    (with-current-buffer buffer
+      (setq auto-revert--lockout-timer nil)
+      (when auto-revert-notify-modified-p
+        (auto-revert-handler)))))
 
 (defun auto-revert-active-p ()
-  "Check if auto-revert is active (in current buffer or globally)."
+  "Check if auto-revert is active in current buffer."
   (or auto-revert-mode
       auto-revert-tail-mode
-      (and global-auto-revert-mode
-           (not global-auto-revert-ignore-buffer)
-           (not (memq major-mode global-auto-revert-ignore-modes)))))
+      auto-revert--global-mode))
 
 (defun auto-revert-handler ()
   "Revert current buffer, if appropriate.
@@ -755,13 +885,8 @@ This function is also responsible for removing buffers no 
longer in
 Auto-Revert Mode from `auto-revert-buffer-list', and for canceling
 the timer when no buffers need to be checked."
 
-  (setq auto-revert-buffers-counter
-        (1+ auto-revert-buffers-counter))
-
   (save-match-data
-    (let ((bufs (if global-auto-revert-mode
-                   (buffer-list)
-                 auto-revert-buffer-list))
+    (let ((bufs (auto-revert--polled-buffers))
          remaining new)
       ;; Buffers with remote contents shall be reverted only if the
       ;; connection is established already.
@@ -803,15 +928,18 @@ the timer when no buffers need to be checked."
                   (auto-revert-remove-current-buffer))
               (when (auto-revert-active-p)
                 ;; Enable file notification.
+                ;; Don't bother creating a notifier for non-file buffers
+                ;; unless it explicitly indicates that this works.
                 (when (and auto-revert-use-notify
-                           (not auto-revert-notify-watch-descriptor))
+                           (not auto-revert-notify-watch-descriptor)
+                           (or buffer-file-name
+                               buffer-auto-revert-by-notification))
                   (auto-revert-notify-add-watch))
                 (auto-revert-handler)))))
        (setq bufs (cdr bufs)))
       (setq auto-revert-remaining-buffers bufs)
       ;; Check if we should cancel the timer.
-      (when (and (not global-auto-revert-mode)
-                (null auto-revert-buffer-list))
+      (unless (auto-revert--need-polling-p)
         (if (timerp auto-revert-timer)
             (cancel-timer auto-revert-timer))
        (setq auto-revert-timer nil)))))
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 744bcc3..4f09d58 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1992-1996, 1999-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/bs.el b/lisp/bs.el
index 86a19fd..c564da2 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 ;; Author: Olaf Sylvester <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 
 ;; This file is part of GNU Emacs.
@@ -181,12 +180,7 @@ return a string representing the column's value."
    (list (bs--make-header-match-string)
         '(1 font-lock-type-face append) '(1 'bold append))
    ;; Buffername embedded by *
-   (list "^\\(.*\\*.*\\*.*\\)$"
-        1
-        ;; problem in XEmacs with font-lock-constant-face
-        (if (facep 'font-lock-constant-face)
-            'font-lock-constant-face
-          'font-lock-comment-face))
+   (list "^\\(.*\\*.*\\*.*\\)$" 1 'font-lock-constant-face)
    ;; Dired-Buffers
    '("^..\\(.*Dired .*\\)$" 1 font-lock-function-name-face)
    ;; the star for modified buffers
@@ -343,11 +337,6 @@ configuration.
 A value of `never' means to never show the buffer.
 A value of `always' means to show buffer regardless of the configuration.")
 
-;; Make face named region (for XEmacs)
-(unless (facep 'region)
-  (make-face 'region)
-  (set-face-background 'region "gray75"))
-
 (defun bs--sort-by-name (b1 b2)
   "Compare buffers B1 and B2 by buffer name."
   (string< (buffer-name b1)
@@ -448,8 +437,7 @@ Used internally, only.")
     (define-key map "f"       'bs-select)
     (define-key map "v"       'bs-view)
     (define-key map "!"       'bs-select-in-one-window)
-    (define-key map [mouse-2] 'bs-mouse-select)        ;; for GNU EMACS
-    (define-key map [button2] 'bs-mouse-select) ;; for XEmacs
+    (define-key map [mouse-2] 'bs-mouse-select)
     (define-key map "F"       'bs-select-other-frame)
     (let ((key ?1))
       (while (<= key ?9)
@@ -459,10 +447,7 @@ Used internally, only.")
     (define-key map "\e-"     'negative-argument)
     (define-key map "o"       'bs-select-other-window)
     (define-key map "\C-o"    'bs-tmp-select-other-window)
-    ;; for GNU EMACS
     (define-key map [mouse-3] 'bs-mouse-select-other-frame)
-    ;; for XEmacs
-    (define-key map [button3] 'bs-mouse-select-other-frame)
     (define-key map [up]      'bs-up)
     (define-key map "n"       'bs-down)
     (define-key map "p"       'bs-up)
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 5f88986..c8cd25c 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1993-1995, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 ;; Package: emacs
 
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index decb21e..2c0280c 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -156,7 +156,7 @@ If DATE lacks timezone information, GMT is assumed."
      (let ((overflow-error '(error "Specified time is not representable")))
        (if (equal err overflow-error)
           (signal (car err) (cdr err))
-        (condition-case-unless-debug err
+        (condition-case err
             (encode-time (parse-time-string
                           (timezone-make-date-arpa-standard date)))
           (error
diff --git a/lisp/case-table.el b/lisp/case-table.el
index c27e772..7474d63 100644
--- a/lisp/case-table.el
+++ b/lisp/case-table.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1988, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
-;; Maintainer: address@hidden
 ;; Keywords: i18n
 ;; Package: emacs
 
diff --git a/lisp/cdl.el b/lisp/cdl.el
index 752e59b..36f72ef0 100644
--- a/lisp/cdl.el
+++ b/lisp/cdl.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ata Etemadi <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: data
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/cedet.el b/lisp/cedet/cedet.el
index b3d4a5d..9260cfb 100644
--- a/lisp/cedet/cedet.el
+++ b/lisp/cedet/cedet.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
-;; Maintainer: Eric M. Ludlam  <address@hidden>
+;; Maintainer: Eric M. Ludlam <address@hidden>
 ;; Version: 2.0
 ;; Keywords: OO, lisp
 
diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el
index 0fb9eca..15ab50c 100644
--- a/lisp/cedet/semantic/imenu.el
+++ b/lisp/cedet/semantic/imenu.el
@@ -4,7 +4,7 @@
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
-;; Maintainer: Eric Ludlam
+;; Maintainer: Eric M. Ludlam <address@hidden>
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el
index 2462662..79bb4b2 100644
--- a/lisp/cedet/semantic/senator.el
+++ b/lisp/cedet/semantic/senator.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 10 Nov 2000
 ;; Keywords: syntax
 
diff --git a/lisp/cedet/semantic/wisent/python.el 
b/lisp/cedet/semantic/wisent/python.el
index c530329..c5849ff 100644
--- a/lisp/cedet/semantic/wisent/python.el
+++ b/lisp/cedet/semantic/wisent/python.el
@@ -2,8 +2,8 @@
 
 ;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
-;; Author: Richard Kim  <address@hidden>
-;; Maintainer: Richard Kim  <address@hidden>
+;; Author: Richard Kim <address@hidden>
+;; Maintainer: Richard Kim <address@hidden>
 ;; Created: June 2002
 ;; Keywords: syntax
 
diff --git a/lisp/char-fold.el b/lisp/char-fold.el
index e61bc3e..426b1a9 100644
--- a/lisp/char-fold.el
+++ b/lisp/char-fold.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: matching
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/chistory.el b/lisp/chistory.el
index 59bdc00..9c29bb7 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el
index ed6f1bf..f949a8c 100644
--- a/lisp/cmuscheme.el
+++ b/lisp/cmuscheme.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Olin Shivers <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: processes, lisp
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/comint.el b/lisp/comint.el
index d21cc13..3939371 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -4,7 +4,6 @@
 
 ;; Author: Olin Shivers <address@hidden>
 ;;     Simon Marshall <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: processes
 ;; Package: emacs
 
diff --git a/lisp/completion.el b/lisp/completion.el
index 89285c7..ff392dd 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1990, 1993, 1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: abbrev convenience
 ;; Author: Jim Salem <address@hidden> of Thinking Machines Inc.
 ;;  (ideas suggested by Brewster Kahle)
diff --git a/lisp/composite.el b/lisp/composite.el
index 6333481..e0d0721 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -7,7 +7,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
-;; Author: Kenichi HANDA <address@hidden>
+;; Author: Kenichi Handa <address@hidden>
 ;; (according to ack.texi)
 ;; Keywords: mule, multilingual, character composition
 ;; Package: emacs
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index f87b6b6..e65f19d 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1996-1997, 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: help, faces
 ;; Package: emacs
 
@@ -1827,20 +1826,9 @@ item in another window.\n\n"))
                              (" `-" "bottom")))
 
 (defun custom-browse-insert-prefix (prefix)
-  "Insert PREFIX.  On XEmacs convert it to line graphics."
-  ;; Fixme: do graphics.
-  (if nil ; (featurep 'xemacs)
-      (progn
-       (insert "*")
-       (while (not (string-equal prefix ""))
-         (let ((entry (substring prefix 0 3)))
-           (setq prefix (substring prefix 3))
-           (let ((overlay (make-overlay (1- (point)) (point) nil t nil))
-                 (name (nth 1 (assoc entry custom-browse-alist))))
-             (overlay-put overlay 'end-glyph (widget-glyph-find name entry))
-             (overlay-put overlay 'start-open t)
-             (overlay-put overlay 'end-open t)))))
-    (insert prefix)))
+  "Insert PREFIX."
+  (declare (obsolete insert "27.1"))
+  (insert prefix))
 
 ;;; Modification of Basic Widgets.
 ;;
@@ -4043,7 +4031,7 @@ If GROUPS-ONLY is non-nil, return only those members that 
are groups."
     (cond ((and (eq custom-buffer-style 'tree)
                (eq state 'hidden)
                (or members (custom-unloaded-widget-p widget)))
-          (custom-browse-insert-prefix prefix)
+          (insert prefix)
           (push (widget-create-child-and-convert
                  widget 'custom-browse-visibility
                  :tag "+")
@@ -4056,19 +4044,17 @@ If GROUPS-ONLY is non-nil, return only those members 
that are groups."
           (widget-put widget :buttons buttons))
          ((and (eq custom-buffer-style 'tree)
                (zerop (length members)))
-          (custom-browse-insert-prefix prefix)
-          (insert "[ ]-- ")
+          (insert prefix "[ ]-- ")
           (push (widget-create-child-and-convert
                  widget 'custom-browse-group-tag)
                 buttons)
           (insert " " tag "\n")
           (widget-put widget :buttons buttons))
          ((eq custom-buffer-style 'tree)
-          (custom-browse-insert-prefix prefix)
+          (insert prefix)
           (if (zerop (length members))
               (progn
-                (custom-browse-insert-prefix prefix)
-                (insert "[ ]-- ")
+                (insert prefix "[ ]-- ")
                 ;; (widget-glyph-insert nil "[ ]" "empty")
                 ;; (widget-glyph-insert nil "-- " "horizontal")
                 (push (widget-create-child-and-convert
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index baa05d0..4c4d5eb 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -648,6 +648,19 @@ since it could result in memory overflow and make Emacs 
crash."
                                   (const :tag "Count lines from beginning of 
narrowed region"
                                          :value nil))
                                  "26.1")
+
+             (display-fill-column-indicator display-fill-column-indicator
+                                 boolean "27.1")
+             (display-fill-column-indicator-column 
display-fill-column-indicator
+                                 (choice
+                                  (const :tag "Use fill-column variable"
+                                         :value t)
+                                  (const :tag "Fixed column number"
+                                         :value 70
+                                         :format "%v"))
+                                 integer "27.1")
+             (display-fill-column-indicator-character 
display-fill-column-indicator
+                                 character "27.1")
             ;; xfaces.c
             (scalable-fonts-allowed display boolean "22.1")
             ;; xfns.c
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index bc9d1d4..9846aa8 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Alex Schroeder <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: help, faces
 ;; Package: emacs
 
diff --git a/lisp/custom.el b/lisp/custom.el
index 53b8045..e2bf871 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -4,7 +4,6 @@
 ;; Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: help, faces
 ;; Package: emacs
 
@@ -56,8 +55,14 @@ Otherwise, if symbol has a `saved-value' property, it will 
evaluate
 the car of that and use it as the default binding for symbol.
 Otherwise, EXP will be evaluated and used as the default binding for
 symbol."
-  (eval `(defvar ,symbol ,(let ((sv (get symbol 'saved-value)))
-                            (if sv (car sv) exp)))))
+  (condition-case nil
+      (default-toplevel-value symbol)   ;Test presence of default value.
+    (void-variable
+     ;; The var is not initialized yet.
+     (set-default-toplevel-value
+      symbol (eval (let ((sv (get symbol 'saved-value)))
+                     (if sv (car sv) exp))
+                   t)))))
 
 (defun custom-initialize-set (symbol exp)
   "Initialize SYMBOL based on EXP.
@@ -188,18 +193,13 @@ set to nil, as the value is no longer rogue."
                (t
                 (custom-handle-keyword symbol keyword value
                                        'custom-variable))))))
+    ;; Set the docstring, record the var on load-history, as well
+    ;; as set the special-variable-p flag.
+    (internal--define-uninitialized-variable symbol doc)
     (put symbol 'custom-requests requests)
     ;; Do the actual initialization.
     (unless custom-dont-initialize
       (funcall initialize symbol default)))
-  ;; Use defvar to set the docstring as well as the special-variable-p flag.
-  ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning
-  ;; when the var is currently let-bound.
-  (if (not (default-boundp symbol))
-      ;; Don't use defvar to avoid setting a default-value when undesired.
-      (when doc (put symbol 'variable-documentation doc))
-    (eval `(defvar ,symbol nil ,@(when doc (list doc)))))
-  (push symbol current-load-list)
   (run-hooks 'custom-define-hook)
   symbol)
 
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 2159f96..f1fae18 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -6,7 +6,6 @@
 ;; Author: Don Morrison
 ;;     Lars Lindberg
 ;; (according to ack.texi)
-;; Maintainer: address@hidden
 ;; Created: 16 Mars 1992
 ;; Lindberg's last update version: 5.7
 ;; Keywords: abbrev expand completion convenience
diff --git a/lisp/delim-col.el b/lisp/delim-col.el
index a968b32..4b4fc7f 100644
--- a/lisp/delim-col.el
+++ b/lisp/delim-col.el
@@ -1,12 +1,12 @@
-;;; delim-col.el --- prettify all columns in a region or rectangle
+;;; delim-col.el --- prettify all columns in a region or rectangle  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
 ;; Version: 2.1
-;; Keywords: internal
-;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
+;; Keywords: convenience text
+;; X-URL: https://www.emacswiki.org/emacs/ViniciusJoseLatorre
 
 ;; This file is part of GNU Emacs.
 
@@ -27,11 +27,6 @@
 
 ;; delim-col helps to prettify columns in a text region or rectangle.
 ;;
-;; To use it, make sure that this file is in load-path and insert in your
-;; .emacs:
-;;
-;;    (require 'delim-col)
-;;
 ;; If you have, for example, the following columns:
 ;;
 ;;     a       b       c       d
@@ -91,9 +86,9 @@
 ;;     aaa     [ <bbb>, <cccc>    ]    dddd
 ;;     aa      [ <bb> , <ccccccc> ]    ddd
 ;;
-;; Note that `delimit-columns-region' operates over all text region
-;; selected, extending the region start to the beginning of line and the
-;; region end to the end of line.  While `delimit-columns-rectangle'
+;; Note that `delimit-columns-region' operates over the entire selected
+;; text region, extending the region start to the beginning of line and
+;; the region end to the end of line.  While `delimit-columns-rectangle'
 ;; operates over the text rectangle selected which rectangle diagonal is
 ;; given by the region start and end.
 ;;
@@ -117,6 +112,7 @@
 
 ;;; Code:
 
+(require 'rect)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; User Options:
@@ -125,6 +121,7 @@
   "Prettify columns."
   :link '(emacs-library-link :tag "Source Lisp File" "delim-col.el")
   :prefix "delimit-columns-"
+  :group 'convenience
   :group 'text)
 
 (defcustom delimit-columns-str-before ""
@@ -213,10 +210,11 @@ See also `delimit-columns-end' for documentation.
 The following relation must hold:
    0 <= delimit-columns-start <= delimit-columns-end
 
-The column number start from 0 and it's relative to the beginning of selected
-region.  So if you selected a text region, the first column (column 0) is
-located at beginning of line.  If you selected a text rectangle, the first
-column (column 0) is located at left corner."
+The column number starts at 0 and is relative to the beginning of
+the selected region.  So if you select a text region, the first
+column (column 0) is located at the beginning of line.  If you
+select a text rectangle, the first column (column 0) is located
+at the left corner."
   :type '(integer :tag "Column Start")
   :group 'columns)
 
@@ -228,10 +226,11 @@ See also `delimit-columns-start' for documentation.
 The following relation must hold:
    0 <= delimit-columns-start <= delimit-columns-end
 
-The column number start from 0 and it's relative to the beginning of selected
-region.  So if you selected a text region, the first column (column 0) is
-located at beginning of line.  If you selected a text rectangle, the first
-column (column 0) is located at left corner."
+The column number starts at 0 and is relative to the beginning of
+the selected region.  So if you select a text region, the first
+column (column 0) is located at the beginning of line.  If you
+select a text rectangle, the first column (column 0) is located
+at the left corner."
   :type '(integer :tag "Column End")
   :group 'columns)
 
@@ -247,20 +246,20 @@ column (column 0) is located at left corner."
 
 ;;;###autoload
 (defun delimit-columns-customize ()
-  "Customization of `columns' group."
+  "Customize the `columns' group."
   (interactive)
   (customize-group 'columns))
 
 
-(defmacro delimit-columns-str (str)
-  `(if (stringp ,str) ,str ""))
+(defun delimit-columns-str (str)
+  (if (stringp str) str ""))
 
 
 ;;;###autoload
 (defun delimit-columns-region (start end)
   "Prettify all columns in a text region.
 
-START and END delimits the text region."
+START and END delimit the text region."
   (interactive "*r")
   (let ((delimit-columns-str-before
         (delimit-columns-str delimit-columns-str-before))
@@ -273,8 +272,7 @@ START and END delimits the text region."
        (delimit-columns-after
         (delimit-columns-str delimit-columns-after))
        (delimit-columns-start
-        (if (and (integerp delimit-columns-start)
-                 (>= delimit-columns-start 0))
+         (if (natnump delimit-columns-start)
             delimit-columns-start
           0))
        (delimit-columns-end
@@ -309,14 +307,11 @@ START and END delimits the text region."
        (set-marker the-end nil)))))
 
 
-(require 'rect)
-
-
 ;;;###autoload
 (defun delimit-columns-rectangle (start end)
   "Prettify all columns in a text rectangle.
 
-START and END delimits the corners of text rectangle."
+START and END delimit the corners of the text rectangle."
   (interactive "*r")
   (let ((delimit-columns-str-before
         (delimit-columns-str delimit-columns-str-before))
@@ -329,8 +324,7 @@ START and END delimits the corners of text rectangle."
        (delimit-columns-after
         (delimit-columns-str delimit-columns-after))
        (delimit-columns-start
-        (if (and (integerp delimit-columns-start)
-                 (>= delimit-columns-start 0))
+         (if (natnump delimit-columns-start)
             delimit-columns-start
           0))
        (delimit-columns-end
@@ -344,11 +338,11 @@ START and END delimits the corners of text rectangle."
       ;; get maximum length for each column
       (and delimit-columns-format
           (save-excursion
-            (operate-on-rectangle 'delimit-columns-rectangle-max
+             (operate-on-rectangle #'delimit-columns-rectangle-max
                                   start the-end nil)))
       ;; prettify columns
       (save-excursion
-       (operate-on-rectangle 'delimit-columns-rectangle-line
+        (operate-on-rectangle #'delimit-columns-rectangle-line
                              start the-end nil))
       ;; nullify markers
       (set-marker delimit-columns-limit nil)
@@ -359,7 +353,7 @@ START and END delimits the corners of text rectangle."
 ;; Internal Variables and Functions:
 
 
-(defun delimit-columns-rectangle-max (startpos &optional _ignore1 _ignore2)
+(defun delimit-columns-rectangle-max (startpos &optional _begextra _endextra)
   (set-marker delimit-columns-limit (point))
   (goto-char startpos)
   (let ((ncol 1)
@@ -392,7 +386,7 @@ START and END delimits the corners of text rectangle."
       (setq values (cdr values)))))
 
 
-(defun delimit-columns-rectangle-line (startpos &optional _ignore1 _ignore2)
+(defun delimit-columns-rectangle-line (startpos &optional _begextra _endextra)
   (let ((len  (length delimit-columns-max))
        (ncol 0)
        origin)
@@ -442,8 +436,7 @@ START and END delimits the corners of text rectangle."
            ((eq delimit-columns-format 'padding)
             (insert spaces delimit-columns-after delimit-columns-str-after))
            (t
-            (insert delimit-columns-after spaces delimit-columns-str-after))
-           ))
+             (insert delimit-columns-after spaces delimit-columns-str-after))))
     (goto-char (max (point) delimit-columns-limit))))
 
 
@@ -466,8 +459,7 @@ START and END delimits the corners of text rectangle."
         (insert delimit-columns-after
                 delimit-columns-str-separator
                 spaces
-                delimit-columns-before))
-       ))
+                 delimit-columns-before))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 8f71bc6..a815b91 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Matthieu Devin <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 14 Jul 92
 ;; Keywords: convenience emulations
 
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 8be2b94..2976b78 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: faces, i18n, Unicode, multilingual
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index b81c0d1..305cfd4 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <address@hidden>.
-;; Maintainer: address@hidden
 ;; Keywords: files
 ;; Package: emacs
 
@@ -246,9 +245,11 @@ Examples of PREDICATE:
      (lambda ()
        (dired-mark-if
         (member (dired-get-filename nil t) file-list2) nil)))
-    (message "Marked in dir1: %s files, in dir2: %s files"
-             (length file-list1)
-             (length file-list2))))
+    (message "Marked in dir1: %s, in dir2: %s"
+             (format-message (ngettext "%d file" "%d files" (length 
file-list1))
+                             (length file-list1))
+             (format-message (ngettext "%d file" "%d files" (length 
file-list2))
+                             (length file-list2)))))
 
 (defun dired-file-set-difference (list1 list2 predicate)
   "Combine LIST1 and LIST2 using a set-difference operation.
@@ -1065,7 +1066,9 @@ and `dired-compress-files-alist'."
                                              (shell-quote-argument 
(file-name-nondirectory
                                                                     
file-desc)))
                                            in-files " "))))))
-             (message "Compressed %d file(s) to %s"
+             (message (ngettext "Compressed %d file to %s"
+                               "Compressed %d files to %s"
+                               (length in-files))
                       (length in-files)
                       (file-name-nondirectory out-file)))))))
 
@@ -1193,12 +1196,14 @@ Return nil if no change in files."
             (string (if (eq op-symbol 'compress) "Compress or uncompress"
                       (capitalize (symbol-name op-symbol)))))
        (if (not failures)
-           (message "%s: %d file%s."
-                    string total (dired-plural-s total))
+           (message (ngettext "%s: %d file." "%s: %d files." total)
+                    string total)
          ;; end this bunch of errors:
          (dired-log-summary
-          (format "Failed to %s %d of %d file%s"
-                  (downcase string) count total (dired-plural-s total))
+          (format (ngettext "Failed to %s %d of %d file"
+                             "Failed to %s %d of %d files"
+                             total)
+                  (downcase string) count total)
           failures)))))
 
 ;;;###autoload
@@ -1798,32 +1803,36 @@ ESC or `q' to not overwrite any of the remaining files,
                (progn
                  (push (dired-make-relative from)
                        failures)
-                 (dired-log "%s `%s' to `%s' failed:\n%s\n"
+                 (dired-log "%s: `%s' to `%s' failed:\n%s\n"
                             operation from to err))))))))
     (cond
      (dired-create-files-failures
       (setq failures (nconc failures dired-create-files-failures))
       (dired-log-summary
-       (format "%s failed for %d file%s in %d requests"
-               operation (length failures)
-               (dired-plural-s (length failures))
-               total)
+       (format (ngettext "%s failed for %d file in %d requests"
+                        "%s failed for %d files in %d requests"
+                        (length failures))
+              operation (length failures) total)
        failures))
      (failures
       (dired-log-summary
-       (format "%s failed for %d of %d file%s"
-               operation (length failures)
-               total (dired-plural-s total))
+       (format (ngettext "%s: %d of %d file failed"
+                        "%s: %d of %d files failed"
+                        total)
+              operation (length failures) total)
        failures))
      (skipped
       (dired-log-summary
-       (format "%s: %d of %d file%s skipped"
-               operation (length skipped) total
-               (dired-plural-s total))
+       (format (ngettext "%s: %d of %d file skipped"
+                        "%s: %d of %d files skipped"
+                        total)
+              operation (length skipped) total)
        skipped))
      (t
-      (message "%s: %s file%s"
-              operation success-count (dired-plural-s success-count)))))
+      (message (ngettext "%s: %d file done"
+                        "%s: %d files done"
+                        success-count)
+              operation success-count))))
   (dired-move-to-filename))
 
 (defun dired-do-create-files (op-symbol file-creator operation arg
@@ -2839,6 +2848,8 @@ is part of a file name (i.e., has the text property 
`dired-filename')."
   (multi-isearch-files-regexp
    (dired-get-marked-files nil nil 'dired-nondirectory-p nil t)))
 
+(declare-function fileloop-continue "fileloop" ())
+
 ;;;###autoload
 (defun dired-do-search (regexp)
   "Search through all marked files for a match for REGEXP.
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index defc541..3b78ec4 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -159,7 +159,7 @@ See Info node `(dired-x) Omitting Variables' for more 
information."
 
 (put 'dired-omit-mode 'safe-local-variable 'booleanp)
 
-(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
+(defcustom dired-omit-files "\\`[.]?#\\|\\`[.][.]?\\'"
   "Filenames matching this regexp will not be displayed.
 This only has effect when `dired-omit-mode' is t.  See interactive function
 `dired-omit-mode' (\\[dired-omit-mode]) and variable
diff --git a/lisp/dired.el b/lisp/dired.el
index 63082fe..f137d4a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: files
 ;; Package: emacs
 
@@ -2148,6 +2147,7 @@ Keybindings:
     (setq buffer-invisibility-spec (list t)))
   (setq-local revert-buffer-function #'dired-revert)
   (setq-local buffer-stale-function #'dired-buffer-stale-p)
+  (setq-local buffer-auto-revert-by-notification t)
   (setq-local page-delimiter "\n\n")
   (setq-local dired-directory (or dirname default-directory))
   ;; list-buffers uses this to display the dir being edited in this buffer.
@@ -3212,9 +3212,10 @@ non-empty directories is allowed."
            (if (not failures)
                (progress-reporter-done progress-reporter)
              (dired-log-summary
-              (format "%d of %d deletion%s failed"
-                      (length failures) count
-                      (dired-plural-s count))
+              (format (ngettext "%d of %d deletion failed"
+                                "%d of %d deletions failed"
+                                count)
+                      (length failures) count)
               failures)))))
       (message "(No deletions performed)")))
   (dired-move-to-filename))
@@ -3267,8 +3268,9 @@ confirmation.  To disable the confirmation, see
     (let ((buf-list (dired-buffers-for-dir (expand-file-name fn))))
       (and buf-list
            (and dired-clean-confirm-killing-deleted-buffers
-                (y-or-n-p (format "Kill Dired buffer%s of %s, too? "
-                                  (dired-plural-s (length buf-list))
+                (y-or-n-p (format (ngettext "Kill Dired buffer of %s, too? "
+                                           "Kill Dired buffers of %s, too? "
+                                           (length buf-list))
                                   (file-name-nondirectory fn))))
            (dolist (buf buf-list)
              (kill-buffer buf))))))
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index 0925a4d..259d3fd 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -179,8 +179,6 @@ and ends with a forward slash."
     dir))
 
 
-(define-obsolete-function-alias 'dirtrack-toggle 'dirtrack-mode "23.1")
-(define-obsolete-variable-alias 'dirtrackp 'dirtrack-mode "23.1")
 ;;;###autoload
 (define-minor-mode dirtrack-mode
   "Toggle directory tracking in shell buffers (Dirtrack mode).
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index 4a59750..f1676bb 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -5,7 +5,6 @@
 
 ;; Author: Erik Naggum <address@hidden>
 ;; Based on a previous version by Howard Gayle
-;; Maintainer: address@hidden
 ;; Keywords: i18n
 ;; Package: emacs
 
diff --git a/lisp/display-fill-column-indicator.el 
b/lisp/display-fill-column-indicator.el
new file mode 100644
index 0000000..ec89ade
--- /dev/null
+++ b/lisp/display-fill-column-indicator.el
@@ -0,0 +1,77 @@
+;;; display-fill-column-indicator.el --- interface for 
display-fill-column-indicator -*- lexical-binding: t -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; Keywords: convenience
+
+;; 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:
+
+;; Provides a minor mode interface for `display-fill-column-indicator'.
+;;
+;; Toggle display of the column indicator with M-x
+;; display-fill-column-indicator-mode.  To enable the indicator in
+;; all buffers, use M-x global-display-fill-column-indicator-mode.
+
+
+;; NOTE: Customization variables for
+;; `display-fill-column-indicator-column' and
+;; `display-fill-column-indicator-char' itself are defined in
+;; cus-start.el.
+
+;;; Code:
+
+(defgroup display-fill-column-indicator nil
+  "Display a fill column indicator in the buffer."
+  :group 'convenience
+  :group 'display)
+
+
+;;;###autoload
+(define-minor-mode display-fill-column-indicator-mode
+  "Toggle display of fill-column indicator.
+This uses `display-fill-column-indicator' internally.
+
+To change the position of the column displayed by default
+customize `display-fill-column-indicator-column'.  You can change the
+character for the indicator setting `display-fill-column-indicator-character'."
+  :lighter nil
+  (if display-fill-column-indicator-mode
+      (progn
+        (setq display-fill-column-indicator t)
+        (unless display-fill-column-indicator-character
+          (if (and (char-displayable-p ?\u2502)
+                   (or (not (display-graphic-p))
+                       (eq (aref (query-font (car (internal-char-font nil 
?\u2502))) 0)
+                           (face-font 'default))))
+              (setq display-fill-column-indicator-character ?\u2502)
+            (setq display-fill-column-indicator-character ?|))))
+    (setq display-fill-column-indicator nil)))
+
+(defun display-fill-column-indicator--turn-on ()
+  "Turn on `display-fill-column-indicator-mode'."
+  (unless (or (minibufferp)
+              (and (daemonp) (null (frame-parameter nil 'client))))
+    (display-fill-column-indicator-mode)))
+
+;;;###autoload
+(define-globalized-minor-mode global-display-fill-column-indicator-mode
+  display-fill-column-indicator-mode display-fill-column-indicator--turn-on)
+
+(provide 'display-fill-column-indicator)
+
+;;; display-fill-column-indicator.el ends here
diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
index d38f2e6..ac01112 100644
--- a/lisp/display-line-numbers.el
+++ b/lisp/display-line-numbers.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 459a723..82bb7c9 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: window, drag, drop
 ;; Package: emacs
 
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index c575dd4..bffd540 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1991, 1993, 1995-1996, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/dos-vars.el b/lisp/dos-vars.el
index 53de20b..0bf1013 100644
--- a/lisp/dos-vars.el
+++ b/lisp/dos-vars.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el
index cf1a8d3..ea530f9 100644
--- a/lisp/dynamic-setting.el
+++ b/lisp/dynamic-setting.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: font, system-font, tool-bar-style
 ;; Package: emacs
 
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index 6543e5f..ddfad25 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/echistory.el b/lisp/echistory.el
index e932daf..8006d7b 100644
--- a/lisp/echistory.el
+++ b/lisp/echistory.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index 2a24c98..8fc8e1f 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -4,7 +4,6 @@
 
 ;; Author: Richard Mlynarik
 ;; (according to ack.texi and authors.el)
-;; Maintainer: address@hidden
 ;; Keywords: help, extensions
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/electric.el b/lisp/electric.el
index 07da2f1..1f4c132 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 ;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 2034f33..dfd6d2e 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Hans Chalupsky <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 12 Dec 1992
 ;; Keywords: extensions, lisp, tools
 ;; Package: emacs
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index d2a3a13..a173956 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -6,7 +6,6 @@
 ;;         Inge Wallin <address@hidden>
 ;;         Thomas Bellman <address@hidden>
 ;;         Toby Cubitt <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 10 May 1991
 ;; Keywords: extensions, data structures, AVL, tree
 
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index 5e72dc3..344a0ba 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Rick Sladkey <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: extensions, internal
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 44cca61..02a9749 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -4,7 +4,6 @@
 
 ;; Author: Jamie Zawinski <address@hidden>
 ;;     Hallvard Furuseth <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 842d1d4..811b485d 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -4,7 +4,6 @@
 
 ;; Author: Jamie Zawinski <address@hidden>
 ;;     Hallvard Furuseth <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e76baf5..95e287c 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -5,7 +5,6 @@
 
 ;; Author: Jamie Zawinski <address@hidden>
 ;;     Hallvard Furuseth <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: lisp
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 58ca9d5..21af4b6 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Igor Kuzmin <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: lisp
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
index 10af440..ea6efbf 100644
--- a/lisp/emacs-lisp/cl-indent.el
+++ b/lisp/emacs-lisp/cl-indent.el
@@ -4,7 +4,6 @@
 
 ;; Author: Richard Mlynarik <address@hidden>
 ;; Created: July 1987
-;; Maintainer: address@hidden
 ;; Keywords: lisp, tools
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 16e9bd6..c4a1dcb 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2145,16 +2145,26 @@ of `cl-symbol-macrolet' to additionally expand symbol 
macros."
              (let ((symval (assq exp venv)))
                (when symval
                  (setq exp (cadr symval)))))
-            (`(setq . ,_)
+            (`(setq . ,args)
              ;; Convert setq to setf if required by symbol-macro expansion.
-             (let* ((args (mapcar (lambda (f) (macroexpand f env))
-                                  (cdr exp)))
-                    (p args))
-               (while (and p (symbolp (car p))) (setq p (cddr p)))
-               (if p (setq exp (cons 'setf args))
-                 (setq exp (cons 'setq args))
-                 ;; Don't loop further.
-                 nil)))
+             (let ((convert nil)
+                   (rargs nil))
+               (while args
+                 (let ((place (pop args)))
+                   ;; Here, we know `place' should be a symbol.
+                   (while
+                       (let ((symval (assq place venv)))
+                         (when symval
+                           (setq place (cadr symval))
+                           (if (symbolp place)
+                               t        ;Repeat.
+                             (setq convert t)
+                             nil))))
+                   (push place rargs)
+                   (push (pop args) rargs)))
+               (setq exp (cons (if convert 'setf 'setq)
+                               (nreverse rargs)))
+               convert))
             ;; CL's symbol-macrolet used to treat re-bindings as candidates for
             ;; expansion (turning the let into a letf if needed), contrary to
             ;; Common-Lisp where such re-bindings hide the symbol-macro.
@@ -2893,7 +2903,7 @@ non-nil value, that slot cannot be set via `setf'.
              ;; and pred-check, so changing it is not straightforward.
              (push `(,defsym ,accessor (cl-x)
                        ,(format "Access slot \"%s\" of `%s' struct CL-X."
-                                slot struct)
+                                slot name)
                        (declare (side-effect-free t))
                        ,@(and pred-check
                              (list `(or ,pred-check
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 8989aa0..259f240 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: lisp, tools, maint
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 6db0584..9f7beea 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -5,7 +5,6 @@
 ;; Inc.
 
 ;; Author: David Megginson (address@hidden)
-;; Maintainer: address@hidden
 ;; Keywords: extensions
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 3fc2224..ed3c1fb 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -4,7 +4,6 @@
 
 ;; Author: Doug Cutting <address@hidden>
 ;;     Jamie Zawinski <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 6dfcc24..b8da76c 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Daniel LaLiberte <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: lisp, tools, maint
 
 ;; This file is part of GNU Emacs.
@@ -70,8 +69,7 @@ Each time it is set to a new value, Edebug will call those 
functions
 once and then reset `edebug-setup-hook' to nil.  You could use this
 to load up Edebug specifications associated with a package you are
 using, but only when you also use Edebug."
-  :type 'hook
-  :group 'edebug)
+  :type 'hook)
 
 ;; edebug-all-defs and edebug-all-forms need to be autoloaded
 ;; because the byte compiler binds them; as a result, if edebug
@@ -88,8 +86,7 @@ You can use the command `edebug-all-defs' to toggle the value 
of this
 variable.  You may wish to make it local to each buffer with
 \(make-local-variable \\='edebug-all-defs) in your
 `emacs-lisp-mode-hook'."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 ;; edebug-all-defs and edebug-all-forms need to be autoloaded
 ;; because the byte compiler binds them; as a result, if edebug
@@ -100,8 +97,7 @@ variable.  You may wish to make it local to each buffer with
   "Non-nil means evaluation of all forms will instrument for Edebug.
 This doesn't apply to loading or evaluations in the minibuffer.
 Use the command `edebug-all-forms' to toggle the value of this option."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-eval-macro-args nil
   "Non-nil means all macro call arguments may be evaluated.
@@ -110,8 +106,7 @@ macro call arguments as if they will be evaluated.
 For each macro, an `edebug-form-spec' overrides this option.
 So to specify exceptions for macros that have some arguments evaluated
 and some not, use `def-edebug-spec' to specify an `edebug-form-spec'."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-max-depth 150
   "Maximum recursion depth when instrumenting code.
@@ -122,7 +117,6 @@ the error message \"Too deep - perhaps infinite loop in 
spec?\".
 Make this limit larger to countermand that, but you may also need to
 increase `max-lisp-eval-depth' and `max-specpdl-size'."
   :type 'integer
-  :group 'edebug
   :version "26.1")
 
 (defcustom edebug-save-windows t
@@ -134,8 +128,7 @@ If the value is a list, only the listed windows are saved 
and
 restored.
 
 `edebug-toggle-save-windows' may be used to change this variable."
-  :type '(choice boolean (repeat string))
-  :group 'edebug)
+  :type '(choice boolean (repeat string)))
 
 (defcustom edebug-save-displayed-buffer-points nil
   "If non-nil, save and restore point in all displayed buffers.
@@ -148,8 +141,7 @@ window, the buffer's point will be changed to the window's 
point.
 Saving and restoring point in all buffers is expensive, since it
 requires selecting each window twice, so enable this only if you
 need it."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-initial-mode 'step
   "Initial execution mode for Edebug, if non-nil.
@@ -159,8 +151,7 @@ go, Go-nonstop, trace, Trace-fast, continue, and 
Continue-fast."
   :type '(choice (const step) (const next) (const go)
                 (const Go-nonstop) (const trace)
                 (const Trace-fast) (const continue)
-                (const Continue-fast))
-  :group 'edebug)
+                (const Continue-fast)))
 
 (defcustom edebug-trace nil
   "Non-nil means display a trace of function entry and exit.
@@ -169,8 +160,7 @@ function entry or exit per line, indented by the recursion 
level.
 
 You can customize by replacing functions `edebug-print-trace-before'
 and `edebug-print-trace-after'."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-test-coverage nil
   "If non-nil, Edebug tests coverage of all expressions debugged.
@@ -180,36 +170,30 @@ results are found.
 
 Use `edebug-display-freq-count' to display the frequency count and
 coverage information for a definition."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-continue-kbd-macro nil
   "If non-nil, continue defining or executing any keyboard macro.
 Use this with caution since it is not debugged."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 
 (defcustom edebug-print-length 50
   "If non-nil, default value of `print-length' for printing results in Edebug."
-  :type '(choice integer (const nil))
-  :group 'edebug)
+  :type '(choice integer (const nil)))
 (defcustom edebug-print-level 50
   "If non-nil, default value of `print-level' for printing results in Edebug."
-  :type '(choice integer (const nil))
-  :group 'edebug)
+  :type '(choice integer (const nil)))
 (defcustom edebug-print-circle t
   "If non-nil, default value of `print-circle' for printing results in Edebug."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-unwrap-results nil
   "Non-nil if Edebug should unwrap results of expressions.
 That is, Edebug will try to remove its own instrumentation from the result.
 This is useful when debugging macros where the results of expressions
 are instrumented expressions."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-on-error t
   "Value bound to `debug-on-error' while Edebug is active.
@@ -225,30 +209,25 @@ After execution is resumed, the error is signaled again."
                 (repeat :menu-tag "When"
                         :value (nil)
                         (symbol :format "%v"))
-                (const :tag "always" t))
-  :group 'edebug)
+                (const :tag "always" t)))
 
 (defcustom edebug-on-quit t
   "Value bound to `debug-on-quit' while Edebug is active."
-  :type 'boolean
-  :group 'edebug)
+  :type 'boolean)
 
 (defcustom edebug-global-break-condition nil
   "If non-nil, an expression to test for at every stop point.
 If the result is non-nil, then break.  Errors are ignored."
   :type 'sexp
-  :risky t
-  :group 'edebug)
+  :risky t)
 
 (defcustom edebug-sit-for-seconds 1
   "Number of seconds to pause when execution mode is `trace' or `continue'."
-  :type 'number
-  :group 'edebug)
+  :type 'number)
 
 (defcustom edebug-sit-on-break t
   "Whether or not to pause for `edebug-sit-for-seconds' on reaching a break."
   :type 'boolean
-  :group 'edebug
   :version "26.1")
 
 ;;; Form spec utilities.
@@ -547,8 +526,13 @@ already is one.)"
       (edebug-read-top-level-form)))))
 
 
+(defvar edebug-active nil)  ;; Non-nil when edebug is active
+
 (defun edebug-read-top-level-form ()
-  (let ((starting-point (point)))
+  (let ((starting-point (point))
+        ;; Don't enter Edebug while doing that, in case we're trying to
+        ;; instrument things like end-of-defun.
+        (edebug-active t))
     (end-of-defun)
     (beginning-of-defun)
     (prog1
@@ -586,7 +570,7 @@ already is one.)"
 (defun edebug-uninstall-read-eval-functions ()
   (interactive)
   (remove-function load-read-function #'edebug--read)
-  (advice-remove 'eval-defun 'edebug-eval-defun))
+  (advice-remove 'eval-defun #'edebug-eval-defun))
 
 ;;; Edebug internal data
 
@@ -2225,8 +2209,6 @@ into `edebug--cl-macrolet-defs' which is checked in 
`edebug-list-form-args'."
 
 ;;; The debugger itself
 
-(defvar edebug-active nil)  ;; Non-nil when edebug is active
-
 (defvar edebug-stack nil)
 ;; Stack of active functions evaluated via edebug.
 ;; Should be nil at the top level.
@@ -2304,8 +2286,8 @@ and run its entry function, and set up `edebug-before' and
 `edebug-after'."
   (cl-letf* ((behavior (get func 'edebug-behavior))
              (functions (cdr (assoc behavior edebug-behavior-alist)))
-             ((symbol-function #'edebug-before) (nth 1 functions))
-             ((symbol-function #'edebug-after) (nth 2 functions)))
+             ((symbol-function 'edebug-before) (nth 1 functions))
+             ((symbol-function 'edebug-after) (nth 2 functions)))
     (funcall (nth 0 functions) func args body)))
 
 (defun edebug-default-enter (function args body)
@@ -2335,7 +2317,7 @@ and run its entry function, and set up `edebug-before' and
               (debug-on-error (or debug-on-error edebug-on-error))
               (debug-on-quit edebug-on-quit))
           (unwind-protect
-              (let ((signal-hook-function 'edebug-signal))
+              (let ((signal-hook-function #'edebug-signal))
                 (setq edebug-execution-mode (or edebug-next-execution-mode
                                                 edebug-initial-mode
                                                 edebug-execution-mode)
@@ -2905,7 +2887,7 @@ See `edebug-behavior-alist' for implementations.")
              (recursive-edit)          ;  <<<<<<<<<< Recursive edit
 
            ;; Do the following, even if quit occurs.
-           (setq signal-hook-function 'edebug-signal)
+           (setq signal-hook-function #'edebug-signal)
            (if edebug-backtrace-buffer
                (kill-buffer edebug-backtrace-buffer))
 
@@ -3810,7 +3792,7 @@ Options:
             (if (consp setting)
                 (set (car setting) (cdr setting))
               (kill-local-variable setting))))
-        (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t))
+        (remove-hook 'kill-buffer-hook #'edebug-kill-buffer t))
     (pcase-dolist (`(,var . ,val) '((buffer-read-only . t)))
       (push
        (if (local-variable-p var) (cons var (symbol-value var)) var)
@@ -3818,7 +3800,7 @@ Options:
       (set (make-local-variable var) val))
     ;; Append `edebug-kill-buffer' to the hook to avoid interfering with
     ;; other entries that are unguarded against deleted buffer.
-    (add-hook 'kill-buffer-hook 'edebug-kill-buffer t t)))
+    (add-hook 'kill-buffer-hook #'edebug-kill-buffer t t)))
 
 (defun edebug-kill-buffer ()
   "Used on `kill-buffer-hook' when Edebug is operating in a buffer of Lisp 
code."
@@ -4016,7 +3998,7 @@ This should be a list of `edebug---frame' objects.")
   (pop-to-buffer edebug-backtrace-buffer)
   (unless (derived-mode-p 'backtrace-mode)
     (backtrace-mode)
-    (add-hook 'backtrace-goto-source-functions 'edebug--backtrace-goto-source))
+    (add-hook 'backtrace-goto-source-functions 
#'edebug--backtrace-goto-source))
   (setq edebug-instrumented-backtrace-frames
         (backtrace-get-frames 'edebug-debugger
                               :constructor #'edebug--make-frame)
@@ -4396,8 +4378,8 @@ With prefix argument, make it a temporary breakpoint."
       ;; We still want to run unload-feature to completion
       (run-with-idle-timer 0 nil #'(lambda () (unload-feature 'edebug)))))
   (remove-hook 'called-interactively-p-functions
-               'edebug--called-interactively-skip)
-  (remove-hook 'cl-read-load-hooks 'edebug--require-cl-read)
+               #'edebug--called-interactively-skip)
+  (remove-hook 'cl-read-load-hooks #'edebug--require-cl-read)
   (edebug-uninstall-read-eval-functions)
   ;; Continue standard unloading.
   nil)
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 3a01098..7214f8a 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -64,10 +64,18 @@ SLOT-NAME is the offending slot.  FN is the function 
signaling the error."
     ;; Throw the regular signal.
     (cl-call-next-method)))
 
-(cl-defmethod clone ((obj eieio-instance-inheritor) &rest _params)
+(cl-defmethod clone ((obj eieio-instance-inheritor) &rest params)
   "Clone OBJ, initializing `:parent' to OBJ.
 All slots are unbound, except those initialized with PARAMS."
-  (let ((nobj (cl-call-next-method)))
+  ;; call next method without params as we makeunbound slots anyhow
+  (let ((nobj  (if (stringp (car params))
+                   (cl-call-next-method obj (pop params))
+                 (cl-call-next-method obj))))
+    (dolist (descriptor (eieio-class-slots (class-of nobj)))
+      (let ((slot (eieio-slot-descriptor-name descriptor)))
+        (slot-makeunbound nobj slot)))
+    (when params
+      (shared-initialize nobj params))
     (oset nobj parent-instance obj)
     nobj))
 
@@ -510,16 +518,18 @@ instance."
 All slots are unbound, except those initialized with PARAMS."
   (let* ((newname (and (stringp (car params)) (pop params)))
          (nobj (apply #'cl-call-next-method obj params))
-         (nm (slot-value obj 'object-name)))
-    (eieio-oset obj 'object-name
+         (nm (slot-value nobj 'object-name)))
+    (eieio-oset nobj 'object-name
                 (or newname
-                    (save-match-data
-                      (if (and nm (string-match "-\\([0-9]+\\)" nm))
-                          (let ((num (1+ (string-to-number
-                                          (match-string 1 nm)))))
-                            (concat (substring nm 0 (match-beginning 0))
-                                    "-" (int-to-string num)))
-                        (concat nm "-1")))))
+                    (if (equal nm (slot-value obj 'object-name))
+                        (save-match-data
+                          (if (and nm (string-match "-\\([0-9]+\\)" nm))
+                              (let ((num (1+ (string-to-number
+                                              (match-string 1 nm)))))
+                                (concat (substring nm 0 (match-beginning 0))
+                                        "-" (int-to-string num)))
+                            (concat nm "-1")))
+                      nm)))
     nobj))
 
 (cl-defmethod make-instance ((class (subclass eieio-named)) &rest args)
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 188d99e..23f303b 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Noah Friedman <address@hidden>
-;; Maintainer: address@hidden
+;; Maintainer: Noah Friedman <address@hidden>
 ;; Keywords: extensions
 ;; Created: 1995-10-06
 
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index 3f49b51..4a53972 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -937,7 +937,7 @@ Does basic handling of `featurep' tests."
          ((and (memq func '(unless or))
                (equal test '(featurep (quote emacs)))))
          ((and (eq func 'if)
-               (or (null test)       ; eg custom-browse-insert-prefix
+               (or (null test)
                    (member test '((featurep (quote xemacs))
                                   (not (featurep (quote emacs)))))
                    (and (eq (car-safe test) 'and)
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index f0dcb51..1f8d31a 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Barry A. Warsaw
-;; Maintainer: address@hidden
 ;; Created: 26-Feb-1994
 ;; Keywords: debugging lisp tools
 
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index c33b465..597afdd 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -4,7 +4,7 @@
 
 ;; Author: Per Cederqvist <address@hidden>
 ;;     Inge Wallin <address@hidden>
-;; Maintainer: address@hidden
+;; Maintainer: Stefan Monnier <address@hidden>
 ;; Created: 3 Aug 1992
 ;; Keywords: extensions, lisp
 
diff --git a/lisp/emacs-lisp/float-sup.el b/lisp/emacs-lisp/float-sup.el
index 54c8afe..6ee378e 100644
--- a/lisp/emacs-lisp/float-sup.el
+++ b/lisp/emacs-lisp/float-sup.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985-1987, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 4ea3ce8..bdd1574 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -392,18 +392,20 @@ The return value is the last VAL in the list.
                                  ,(funcall setter
                                            `(cons (setq ,p (cons ,k ,v))
                                                   ,getter)))))
-                         (cond
-                          ((null remove) set-exp)
-                          ((or (eql v default)
-                               (and (eq (car-safe v) 'quote)
-                                    (eq (car-safe default) 'quote)
-                                    (eql (cadr v) (cadr default))))
-                           `(if ,p ,(funcall setter `(delq ,p ,getter))))
-                          (t
-                           `(cond
-                             ((not (eql ,default ,v)) ,set-exp)
-                             (,p ,(funcall setter
-                                           `(delq ,p ,getter)))))))))))))))
+                         `(progn
+                            ,(cond
+                             ((null remove) set-exp)
+                             ((or (eql v default)
+                                  (and (eq (car-safe v) 'quote)
+                                       (eq (car-safe default) 'quote)
+                                       (eql (cadr v) (cadr default))))
+                              `(if ,p ,(funcall setter `(delq ,p ,getter))))
+                             (t
+                              `(cond
+                                ((not (eql ,default ,v)) ,set-exp)
+                                (,p ,(funcall setter
+                                              `(delq ,p ,getter))))))
+                            ,v))))))))))
 
 
 ;;; Some occasionally handy extensions.
diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el
index d1bd46f..4a84cfa 100644
--- a/lisp/emacs-lisp/helper.el
+++ b/lisp/emacs-lisp/helper.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 ;; Keywords: help
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index 91c7615..81adbd5 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 14 Jul 1992
 ;; Keywords: docs
 ;; X-Bogus-Bureaucratic-Cruft: Gruad will get you if you don't watch out!
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4c7a8be..021708c 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985-1986, 1999-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: lisp, languages
 ;; Package: emacs
 
@@ -1210,19 +1209,25 @@ ENDPOS is encountered."
                     ;; Get error now if we don't have a complete sexp
                     ;; after point.
                     (save-excursion
+                      (forward-sexp 1)
                       (let ((eol (line-end-position)))
-                        (forward-sexp 1)
                         ;; We actually look for a sexp which ends
                         ;; after the current line so that we properly
                         ;; indent things like #s(...).  This might not
                         ;; be needed if Bug#15998 is fixed.
-                        (condition-case ()
-                            (while (and (< (point) eol) (not (eobp)))
-                              (forward-sexp 1))
-                          ;; But don't signal an error for incomplete
-                          ;; sexps following the first complete sexp
-                          ;; after point.
-                          (scan-error nil)))
+                        (when (and (< (point) eol)
+                                   ;; Check if eol is within a sexp.
+                                   (> (nth 0 (save-excursion
+                                               (parse-partial-sexp
+                                                (point) eol)))
+                                      0))
+                          (condition-case ()
+                              (while (< (point) eol)
+                                (forward-sexp 1))
+                            ;; But don't signal an error for incomplete
+                            ;; sexps following the first complete sexp
+                            ;; after point.
+                            (scan-error nil))))
                       (point)))))
     (save-excursion
       (while (let ((indent (lisp-indent-calc-next parse-state))
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index d10d5f0..f653f6c 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1994, 2000-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: lisp, languages
 ;; Package: emacs
 
@@ -645,7 +644,7 @@ Interactively, the behavior depends on 
`narrow-to-defun-include-comments'."
       (re-search-backward "^\n" (- (point) 1) t)
       (narrow-to-region beg end))))
 
-(defvar insert-pair-alist
+(defcustom insert-pair-alist
   '((?\( ?\)) (?\[ ?\]) (?\{ ?\}) (?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\'))
   "Alist of paired characters inserted by `insert-pair'.
 Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR
@@ -655,7 +654,16 @@ or without modifiers, are inserted by `insert-pair'.
 
 If COMMAND-CHAR is specified, it is a character that triggers the
 insertion of the open/close pair, and COMMAND-CHAR itself isn't
-inserted.")
+inserted."
+  :type '(repeat (choice (list :tag "Pair"
+                               (character :tag "Open")
+                               (character :tag "Close"))
+                         (list :tag "Triple"
+                               (character :tag "Command")
+                               (character :tag "Open")
+                               (character :tag "Close"))))
+  :group 'lisp
+  :version "27.1")
 
 (defun insert-pair (&optional arg open close)
   "Enclose following ARG sexps in a pair of OPEN and CLOSE characters.
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index a688330..e8337a9 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1991-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: lisp, extensions
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index 54e802e..774df3f 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -8,8 +8,6 @@
 ;; Package-Requires: ((emacs "25"))
 ;; Package: map
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 61cf690..6b92916 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -334,16 +334,22 @@ default directory."
            (epg-find-configuration 'OpenPGP))
       'allow-unsigned)
   "Non-nil means to check package signatures when installing.
-The value `allow-unsigned' means to still install a package even if
-it is unsigned.
+More specifically the value can be:
+- nil: package signatures are ignored.
+- `allow-unsigned': install a package even if it is unsigned,
+  but if it is signed and we have the key for it, verify the signature.
+- t: accept a package only if it comes with at least one verified signature.
+- `all': same as t, except when the package has several signatures,
+  in which case we verify all the signatures.
 
 This also applies to the \"archive-contents\" file that lists the
 contents of the archive."
   :type '(choice (const nil :tag "Never")
                  (const allow-unsigned :tag "Allow unsigned")
-                 (const t :tag "Check always"))
+                 (const t :tag "Check always")
+                 (const all :tag "Check all signatures"))
   :risky t
-  :version "24.4")
+  :version "27.1")
 
 (defcustom package-unsigned-archives nil
   "List of archives where we do not check for package signatures."
@@ -1191,45 +1197,66 @@ errors signaled by ERROR-FORM or by BODY).
   (declare (indent defun) (debug t))
   (while (keywordp (car body))
     (setq body (cdr (cdr body))))
-  (macroexp-let2* nil ((url-1 url)
-                       (noerror-1 noerror))
-    (let ((url-sym (make-symbol "url"))
-          (b-sym (make-symbol "b-sym")))
-      `(cl-macrolet ((unless-error (body-2 &rest before-body)
-                                   (let ((err (make-symbol "err")))
-                                     `(with-temp-buffer
-                                        (when (condition-case ,err
-                                                  (progn ,@before-body t)
-                                                ,(list 'error ',error-form
-                                                       (list 'unless 
',noerror-1
-                                                             `(signal (car 
,err) (cdr ,err)))))
-                                          ,@body-2)))))
-         (if (string-match-p "\\`https?:" ,url-1)
-             (let ((,url-sym (concat ,url-1 ,file)))
-               (if ,async
-                   (unless-error nil
-                                 (url-retrieve ,url-sym
-                                               (lambda (status)
-                                                 (let ((,b-sym 
(current-buffer)))
-                                                   (require 'url-handlers)
-                                                   (unless-error ,body
-                                                                 (when-let* 
((er (plist-get status :error)))
-                                                                   (error 
"Error retrieving: %s %S" ,url-sym er))
-                                                                 
(with-current-buffer ,b-sym
-                                                                   (goto-char 
(point-min))
-                                                                   (unless 
(search-forward-regexp "^\r?\n\r?" nil 'noerror)
-                                                                     (error 
"Error retrieving: %s %S" ,url-sym "incomprehensible buffer")))
-                                                                 
(url-insert-buffer-contents ,b-sym ,url-sym)
-                                                                 (kill-buffer 
,b-sym)
-                                                                 (goto-char 
(point-min)))))
-                                               nil
-                                               'silent))
-                 (unless-error ,body (url-insert-file-contents ,url-sym))))
-           (unless-error ,body
-                         (let ((url (expand-file-name ,file ,url-1)))
-                           (unless (file-name-absolute-p url)
-                             (error "Location %s is not a url nor an absolute 
file name" url))
-                           (insert-file-contents url))))))))
+  `(package--with-response-buffer-1 ,url (lambda () ,@body)
+                                    :file ,file
+                                    :async ,async
+                                    :error-function (lambda () ,error-form)
+                                    :noerror ,noerror))
+
+(defmacro package--unless-error (body &rest before-body)
+  (declare (debug t) (indent 1))
+  (let ((err (make-symbol "err")))
+    `(with-temp-buffer
+       (set-buffer-multibyte nil)
+       (when (condition-case ,err
+                 (progn ,@before-body t)
+               (error (funcall error-function)
+                      (unless noerror
+                        (signal (car ,err) (cdr ,err)))))
+         (funcall ,body)))))
+
+(cl-defun package--with-response-buffer-1 (url body &key async file 
error-function noerror &allow-other-keys)
+  (if (string-match-p "\\`https?:" url)
+        (let ((url (concat url file)))
+          (if async
+              (package--unless-error #'ignore
+                (url-retrieve
+                 url
+                 (lambda (status)
+                   (let ((b (current-buffer)))
+                     (require 'url-handlers)
+                     (package--unless-error body
+                       (when-let* ((er (plist-get status :error)))
+                         (error "Error retrieving: %s %S" url er))
+                       (with-current-buffer b
+                         (goto-char (point-min))
+                         (unless (search-forward-regexp "^\r?\n\r?" nil t)
+                           (error "Error retrieving: %s %S"
+                                  url "incomprehensible buffer")))
+                       (url-insert b)
+                       (kill-buffer b)
+                       (goto-char (point-min)))))
+                 nil
+                 'silent))
+            (package--unless-error body
+              ;; Copy&pasted from url-insert-file-contents,
+              ;; except it calls `url-insert' because we want the contents
+              ;; literally (but there's no url-insert-file-contents-literally).
+              (let ((buffer (url-retrieve-synchronously url)))
+                (unless buffer (signal 'file-error (list url "No Data")))
+                (when (fboundp 'url-http--insert-file-helper)
+                  ;; XXX: This is HTTP/S specific and should be moved
+                  ;; to url-http instead.  See bug#17549.
+                  (url-http--insert-file-helper buffer url))
+                (url-insert buffer)
+                (kill-buffer buffer)
+                (goto-char (point-min))))))
+      (package--unless-error body
+        (let ((url (expand-file-name file url)))
+          (unless (file-name-absolute-p url)
+            (error "Location %s is not a url nor an absolute file name"
+                   url))
+          (insert-file-contents-literally url)))))
 
 (define-error 'bad-signature "Failed to verify signature")
 
@@ -1257,7 +1284,9 @@ errors."
           (unless (and (eq package-check-signature 'allow-unsigned)
                        (eq (epg-signature-status sig) 'no-pubkey))
             (setq had-fatal-error t))))
-      (when (or (null good-signatures) had-fatal-error)
+      (when (or (null good-signatures)
+                (and (eq package-check-signature 'all)
+                     had-fatal-error))
         (package--display-verify-error context sig-file)
         (signal 'bad-signature (list sig-file)))
       good-signatures)))
@@ -1286,7 +1315,8 @@ else, even if an error is signaled."
     (package--with-response-buffer location :file sig-file
       :async async :noerror t
       ;; Connection error is assumed to mean "no sig-file".
-      :error-form (let ((allow-unsigned (eq package-check-signature 
'allow-unsigned)))
+      :error-form (let ((allow-unsigned
+                         (eq package-check-signature 'allow-unsigned)))
                     (when (and callback allow-unsigned)
                       (funcall callback nil))
                     (when unwind (funcall unwind))
@@ -1295,8 +1325,9 @@ else, even if an error is signaled."
       ;; OTOH, an error here means "bad signature", which we never
       ;; suppress.  (Bug#22089)
       (unwind-protect
-          (let ((sig (package--check-signature-content (buffer-substring 
(point) (point-max))
-                                                       string sig-file)))
+          (let ((sig (package--check-signature-content
+                      (buffer-substring (point) (point-max))
+                      string sig-file)))
             (when callback (funcall callback sig))
             sig)
         (when unwind (funcall unwind))))))
@@ -1573,15 +1604,18 @@ 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 (let ((coding-system-for-write 'utf-8))
-                     (write-region content nil local-file nil 'silent))
-                   (package--update-downloads-in-progress archive))
+            (progn
+             (cl-assert (not enable-multibyte-characters))
+             (let ((coding-system-for-write 'binary))
+               (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)
-             (let ((coding-system-for-write 'utf-8))
+             (cl-assert (not enable-multibyte-characters))
+             (let ((coding-system-for-write 'binary))
                (write-region content nil local-file nil 'silent))
              ;; Write out good signatures into archive-contents.signed file.
              (when good-sigs
@@ -1617,7 +1651,7 @@ downloads in the background."
     (make-directory package-user-dir t))
   (let ((default-keyring (expand-file-name "package-keyring.gpg"
                                            data-directory))
-        (inhibit-message async))
+        (inhibit-message (or inhibit-message async)))
     (when (and package-check-signature (file-exists-p default-keyring))
       (condition-case-unless-debug error
           (package-import-keyring default-keyring)
@@ -1895,7 +1929,8 @@ if all the in-between dependencies are also in 
PACKAGE-LIST."
                ;; Update the old pkg-desc which will be shown on the 
description buffer.
                (setf (package-desc-signed pkg-desc) t)
                ;; Update the new (activated) pkg-desc as well.
-               (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc) 
package-alist))))
+               (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc)
+                                                 package-alist))))
                  (setf (package-desc-signed (car pkg-descs)) t))))))))))
 
 (defun package-installed-p (package &optional min-version)
@@ -2469,10 +2504,12 @@ The description is read from the installed package 
files."
               (replace-match ""))))
 
       (if (package-installed-p desc)
-          ;; For installed packages, get the description from the installed 
files.
+          ;; 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.
+        ;; For non-built-in, non-installed packages, get description from
+        ;; the archive.
         (let* ((basename (format "%s-readme.txt" name))
                readme-string)
 
@@ -2482,7 +2519,10 @@ The description is read from the installed package 
files."
               (goto-char (point-max))
               (unless (bolp)
                 (insert ?\n)))
-            (setq readme-string (buffer-string))
+            (cl-assert (not enable-multibyte-characters))
+            (setq readme-string
+                  ;; The readme.txt files are defined to contain utf-8 text.
+                  (decode-coding-region (point-min) (point-max) 'utf-8 t))
             t)
           (insert (or readme-string
                       "This package does not provide a description.")))
@@ -3253,7 +3293,7 @@ objects removed."
     (redisplay 'force)
     (dolist (elt (package--sort-by-dependence delete-list))
       (condition-case-unless-debug err
-          (let ((inhibit-message package-menu-async))
+          (let ((inhibit-message (or inhibit-message package-menu-async)))
             (package-delete elt nil 'nosave))
         (error (message "Error trying to delete `%s': %S"
                  (package-desc-full-name elt)
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index d883752..2753bbd 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: strings, regexps, extensions
 
 ;; This file is part of GNU Emacs.
@@ -144,9 +143,9 @@ usually more efficient than that of a simplified version:
                            (sort (copy-sequence strings) 'string-lessp)))
           (re
             (cond
-             ;; No strings: return a\` which cannot match anything.
+             ;; No strings: return an unmatchable regexp.
              ((null strings)
-              (concat (or open "\\(?:") "a\\`\\)"))
+              (concat (or open "\\(?:") regexp-unmatchable "\\)"))
              ;; 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))
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index c7d0268..91c043f 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 6d1adae..4c90f47 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index fdd2431..ed32490 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: strings, regexps, extensions
 
 ;; This file is part of GNU Emacs.
@@ -107,15 +106,16 @@
 ;;; Code:
 
 (require 'cl-lib)
+(require 'cl-extra)
 
 ;; FIXME: support macros.
 
 (defvar rx-constituents              ;Not `const' because some modes extend it.
-  '((and               . (rx-and 1 nil))
+  '((and               . (rx-and 0 nil))
     (seq               . and)          ; SRE
     (:                 . and)          ; SRE
     (sequence          . and)          ; sregex
-    (or                        . (rx-or 1 nil))
+    (or                        . (rx-or 0 nil))
     (|                 . or)           ; SRE
     (not-newline       . ".")
     (nonl              . not-newline)  ; SRE
@@ -391,9 +391,11 @@ FORM is of the form `(and FORM1 ...)'."
   "Parse and produce code from FORM, which is `(or FORM1 ...)'."
   (rx-check form)
   (rx-group-if
-   (if (memq nil (mapcar 'stringp (cdr form)))
-       (mapconcat (lambda (x) (rx-form x '|)) (cdr form) "\\|")
+   (cond
+    ((null (cdr form)) regexp-unmatchable)
+    ((cl-every #'stringp (cdr form))
      (regexp-opt (cdr form) nil t))
+    (t (mapconcat (lambda (x) (rx-form x '|)) (cdr form) "\\|")))
    (and (memq rx-parent '(: * t)) rx-parent)))
 
 
@@ -1122,6 +1124,7 @@ CHAR
 `(seq SEXP1 SEXP2 ...)'
 `(sequence SEXP1 SEXP2 ...)'
      matches what SEXP1 matches, followed by what SEXP2 matches, etc.
+     Without arguments, matches the empty string.
 
 `(submatch SEXP1 SEXP2 ...)'
 `(group SEXP1 SEXP2 ...)'
@@ -1137,7 +1140,7 @@ CHAR
 `(| SEXP1 SEXP2 ...)'
      matches anything that matches SEXP1 or SEXP2, etc.  If all
      args are strings, use `regexp-opt' to optimize the resulting
-     regular expression.
+     regular expression.  Without arguments, never matches anything.
 
 `(minimal-match SEXP)'
      produce a non-greedy regexp for SEXP.  Normally, regexps matching
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 3413cd1..8997b75 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -7,8 +7,6 @@
 ;; Version: 2.21
 ;; Package: seq
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index b9ffe6a..3344583 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 ;; Package: emacs
 
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index d09d6c1..f488bed 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
@@ -286,7 +285,7 @@ END) suitable for `syntax-propertize-function'."
 (defun syntax-propertize (pos)
   "Ensure that syntax-table properties are set until POS (a buffer point)."
   (when (< syntax-propertize--done pos)
-    (if (null syntax-propertize-function)
+    (if (memq syntax-propertize-function '(nil ignore))
         (setq syntax-propertize--done (max (point-max) pos))
       ;; (message "Needs to syntax-propertize from %s to %s"
       ;;          syntax-propertize--done pos)
@@ -404,7 +403,8 @@ These are valid when the buffer has no restriction.")
 (defvar-local syntax-ppss-narrow-start nil
   "Start position of the narrowing for `syntax-ppss-narrow'.")
 
-(defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache)
+(define-obsolete-function-alias 'syntax-ppss-after-change-function
+  #'syntax-ppss-flush-cache "27.1")
 (defun syntax-ppss-flush-cache (beg &rest ignored)
   "Flush the cache of `syntax-ppss' starting at position BEG."
   ;; Set syntax-propertize to refontify anything past beg.
diff --git a/lisp/emacs-lisp/tcover-ses.el b/lisp/emacs-lisp/tcover-ses.el
index 29b4818..8d2f821 100644
--- a/lisp/emacs-lisp/tcover-ses.el
+++ b/lisp/emacs-lisp/tcover-ses.el
@@ -2,8 +2,8 @@
 
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
-;; Author: Jonathan Yavner <address@hidden>
-;; Maintainer: Jonathan Yavner <address@hidden>
+;; Author: Jonathan Yavner <address@hidden>
+;; Maintainer: Jonathan Yavner <address@hidden>
 ;; Keywords: spreadsheet lisp utility
 ;; Package: testcover
 
diff --git a/lisp/emacs-lisp/tcover-unsafep.el 
b/lisp/emacs-lisp/tcover-unsafep.el
index 571f53c..daae3ad 100644
--- a/lisp/emacs-lisp/tcover-unsafep.el
+++ b/lisp/emacs-lisp/tcover-unsafep.el
@@ -2,8 +2,8 @@
 
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
-;; Author: Jonathan Yavner <address@hidden>
-;; Maintainer: Jonathan Yavner <address@hidden>
+;; Author: Jonathan Yavner <address@hidden>
+;; Maintainer: Jonathan Yavner <address@hidden>
 ;; Keywords: safety lisp utility
 ;; Package: testcover
 
diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el
index e1370c4..968dc71 100644
--- a/lisp/emacs-lisp/thunk.el
+++ b/lisp/emacs-lisp/thunk.el
@@ -7,8 +7,6 @@
 ;; Version: 1.0
 ;; Package: thunk
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index 55aa56b..3a791c2 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 22ccc35..668da42 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lisp/tq.el b/lisp/emacs-lisp/tq.el
index 4249305..ca2d2a2 100644
--- a/lisp/emacs-lisp/tq.el
+++ b/lisp/emacs-lisp/tq.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Scott Draves <address@hidden>
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR
 ;; Keywords: extensions
 
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index 2f271c1..0a83511 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993, 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Hans Chalupsky <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 15 Dec 1992
 ;; Keywords: tools, lisp
 
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 13ca605..70d6b07 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 0cded29..05b4c01 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -4,7 +4,6 @@
 
 ;; Author: Juanma Barranquero <address@hidden>
 ;; Inspired by emacs-lock.el by Tom Wurgler <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: extensions, processes
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/env.el b/lisp/env.el
index 5a4130e..30b63a8 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1991, 1994, 2000-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: processes, unix
 ;; Package: emacs
 
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 35cd1ec..d9886d3 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -105,9 +105,7 @@ encryption is used."
   (if (fboundp 'decode-coding-inserted-region)
       (save-restriction
        (narrow-to-region (point) (point))
-       (insert (if enable-multibyte-characters
-                   (string-to-multibyte string)
-                 string))
+       (insert string)
        (decode-coding-inserted-region
         (point-min) (point-max)
         (substring file 0 (string-match epa-file-name-regexp file))
diff --git a/lisp/epa.el b/lisp/epa.el
index c8abff4..59c11ab 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -1282,29 +1282,6 @@ If no one is selected, default public key is exported.  
")))
        (epa-display-error context)
        (signal (car error) (cdr error))))))
 
-;; (defun epa-sign-keys (keys &optional local)
-;;   "Sign selected KEYS.
-;; If a prefix-arg is specified, the signature is marked as non exportable.
-
-;; Don't use this command in Lisp programs!"
-;;   (declare (interactive-only t))
-;;   (interactive
-;;    (let ((keys (epa--marked-keys)))
-;;      (unless keys
-;;        (error "No keys selected"))
-;;      (list keys current-prefix-arg)))
-;;   (let ((context (epg-make-context epa-protocol)))
-;;     (epg-context-set-passphrase-callback context
-;;                                         #'epa-passphrase-callback-function)
-;;     (epg-context-set-progress-callback context
-;;                                       (cons
-;;                                         #'epa-progress-callback-function
-;;                                         "Signing keys..."))
-;;     (message "Signing keys...")
-;;     (epg-sign-keys context keys local)
-;;     (message "Signing keys...done")))
-;; (make-obsolete 'epa-sign-keys "Do not use.")
-
 (provide 'epa)
 
 ;;; epa.el ends here
diff --git a/lisp/epg.el b/lisp/epg.el
index e06cc06..0400716 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1936,40 +1936,6 @@ If you are unsure, use synchronous version of this 
function
                            (epg-errors-to-string errors))))))
     (epg-reset context)))
 
-(defun epg-start-sign-keys (context keys &optional local)
-  "Initiate a sign keys operation.
-
-If you use this function, you will need to wait for the completion of
-`epg-gpg-program' by using `epg-wait-for-completion' and call
-`epg-reset' to clear a temporary output file.
-If you are unsure, use synchronous version of this function
-`epg-sign-keys' instead."
-  (declare (obsolete nil "23.1"))
-  (setf (epg-context-operation context) 'sign-keys)
-  (setf (epg-context-result context) nil)
-  (epg--start context (cons (if local
-                              "--lsign-key"
-                            "--sign-key")
-                          (mapcar
-                           (lambda (key)
-                             (epg-sub-key-id
-                              (car (epg-key-sub-key-list key))))
-                           keys))))
-
-(defun epg-sign-keys (context keys &optional local)
-  "Sign KEYS from the key ring."
-  (declare (obsolete nil "23.1"))
-  (unwind-protect
-      (progn
-       (epg-start-sign-keys context keys local)
-       (epg-wait-for-completion context)
-       (let ((errors (epg-context-result-for context 'error)))
-         (if errors
-             (signal 'epg-error
-                     (list "Sign keys failed"
-                           (epg-errors-to-string errors))))))
-    (epg-reset context)))
-
 (defun epg-start-generate-key (context parameters)
   "Initiate a key generation.
 PARAMETERS is a string which specifies parameters of the generated key.
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
index 9e224e0..298cffb 100644
--- a/lisp/erc/erc-autoaway.el
+++ b/lisp/erc/erc-autoaway.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <address@hidden>
-;; Maintainer: address@hidden
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoAway
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 210830a..eb441c2 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -4,7 +4,6 @@
 
 ;; Filename: erc-backend.el
 ;; Author: Lawrence Mitchell <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 2004-05-7
 ;; Keywords: IRC chat client internet
 
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index c8aa887..8e2a6b9 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1996-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: irc, button, url, regexp
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcButton
 
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
index 210a773..3d99c25 100644
--- a/lisp/erc/erc-capab.el
+++ b/lisp/erc/erc-capab.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index e724e36..3b36277 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
-;; Maintainer: address@hidden
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/ERC
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index a6b7532..b835191 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -6,7 +6,6 @@
 ;; Author: Ben A. Mesander <address@hidden>
 ;;         Noah Friedman <address@hidden>
 ;;         Per Persson <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, processes
 ;; Created: 1994-01-23
 
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
index a2c9336..5784e63 100644
--- a/lisp/erc/erc-ezbounce.el
+++ b/lisp/erc/erc-ezbounce.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
index 934b52a..ef876f4 100644
--- a/lisp/erc/erc-fill.el
+++ b/lisp/erc/erc-fill.el
@@ -4,7 +4,6 @@
 
 ;; Author: Andreas Fuchs <address@hidden>
 ;;         Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcFilling
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 884c594..0d16aaf 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <address@hidden>
-;; Maintainer: address@hidden
 
 ;; Most code is taken verbatim from erc.el, see there for the original
 ;; authors.
diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el
index 149c858..ce0104b 100644
--- a/lisp/erc/erc-ibuffer.el
+++ b/lisp/erc/erc-ibuffer.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcIbuffer
 
diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el
index d95e0ea..96b4589 100644
--- a/lisp/erc/erc-identd.el
+++ b/lisp/erc/erc-identd.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2003, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, processes
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el
index 08f52f1..e40dc1f 100644
--- a/lisp/erc/erc-imenu.el
+++ b/lisp/erc/erc-imenu.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcImenu
 
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 896521e..18cc8b5 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: irc
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoJoin
 
diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el
index f0dbe69..765898d 100644
--- a/lisp/erc/erc-lang.el
+++ b/lisp/erc/erc-lang.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
-;; Maintainer: address@hidden
 ;; Old-Version: 1.0.0
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcLang
 ;; Keywords: comm languages processes
diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el
index d8d9e17..6a2ba78 100644
--- a/lisp/erc/erc-list.el
+++ b/lisp/erc/erc-list.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <address@hidden>
-;; Maintainer: address@hidden
 ;; Old-Version: 0.1
 ;; Keywords: comm
 
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 4153f5c..fc12dc7 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Lawrence Mitchell <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: IRC, chat, client, Internet, logging
 
 ;; Created 2003-04-26
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index cc4b4a8..98ddebd 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, faces
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcMatch
 
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index 8173829..e13404c 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2001-2002, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, processes, menu
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index 87c3a61..252af71 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index eca8ad6..e92da7b 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index 45dae89..9bd062a 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index cb57883..4e7fed7 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
index dd2da85..e2489a8 100644
--- a/lisp/erc/erc-pcomplete.el
+++ b/lisp/erc/erc-pcomplete.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Sacha Chua <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, convenience
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcCompletion
 
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index 2e0e54a..e1c495c 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: IRC, client, Internet
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el
index 5459d8b..54f91d1 100644
--- a/lisp/erc/erc-ring.el
+++ b/lisp/erc/erc-ring.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcHistory
 
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index 886ba60..f500f4c 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el
index 34f7ce6..38e0b28 100644
--- a/lisp/erc/erc-sound.el
+++ b/lisp/erc/erc-sound.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index 0a1e38f..833ad2f 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -4,7 +4,6 @@
 
 ;; Author: Mario Lang <address@hidden>
 ;; Contributor: Eric M. Ludlam <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
index 69a83fa..8df7ea9 100644
--- a/lisp/erc/erc-spelling.el
+++ b/lisp/erc/erc-spelling.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: irc
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcSpelling
 
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 860fdbb..541c67a 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, processes, timestamp
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcStamp
 
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index e51e605..14e86c1 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, faces
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcChannelTracking
 
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el
index 0417429..73c7316 100644
--- a/lisp/erc/erc-truncate.el
+++ b/lisp/erc/erc-truncate.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: IRC, chat, client, Internet, logging
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el
index 162b22e..20a91b7 100644
--- a/lisp/erc/erc-xdcc.el
+++ b/lisp/erc/erc-xdcc.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, processes
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index d1fa5c7..fc0f612 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -10,7 +10,6 @@
 ;;               Gergely Nagy (address@hidden)
 ;;               David Edmondson (address@hidden)
 ;;               Kelvin White (address@hidden)
-;; Maintainer: address@hidden
 ;; Keywords: IRC, chat, client, Internet
 
 ;; Version: 5.3
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index cff29be..a36ac96 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -1014,11 +1014,13 @@ This function could be in the list 
`eshell-output-filter-functions'."
                   'eshell-handle-control-codes)
 
 (autoload 'ansi-color-apply-on-region "ansi-color")
+(defvar ansi-color-apply-face-function)
 
 (defun eshell-handle-ansi-color ()
   "Handle ANSI color codes."
-  (ansi-color-apply-on-region eshell-last-output-start
-                              eshell-last-output-end))
+  (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face))
+    (ansi-color-apply-on-region eshell-last-output-start
+                                eshell-last-output-end)))
 
 (custom-add-option 'eshell-output-filter-functions
                   'eshell-handle-ansi-color)
diff --git a/lisp/expand.el b/lisp/expand.el
index 0c4d343..7eaf7fd 100644
--- a/lisp/expand.el
+++ b/lisp/expand.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Frederic Lepied <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: abbrev
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/faces.el b/lisp/faces.el
index fa526c3..137ce99 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1992-1996, 1998-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
@@ -2500,6 +2499,18 @@ unwanted effects."
   :group 'basic-faces
   :group 'display-line-numbers)
 
+;; Definition stolen from display-line-numbers.
+(defface fill-column-indicator
+  '((t :inherit shadow :weight normal :slant normal
+       :underline nil :overline nil :strike-through nil
+       :box nil :inverse-video nil :stipple nil))
+  "Face for displaying fill column indicator.
+This face is used when `display-fill-column-indicator-mode' is
+non-nil."
+  :version "27.1"
+  :group 'basic-faces
+  :group 'display-fill-column-indicator)
+
 (defface escape-glyph
   '((((background dark)) :foreground "cyan")
     ;; See the comment in minibuffer-prompt for
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 36e37e9..4e91a7a 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1995-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michelangelo Grigni <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 29 Mar 1993
 ;; Keywords: files, hypermedia, matching, mouse, convenience
 
@@ -513,7 +512,9 @@ When using jka-compr (a.k.a. `auto-compression-mode'), the 
returned
 name may have a suffix added from `ffap-compression-suffixes'.
 The optional NOMODIFY argument suppresses the extra search."
   (cond
-   ((not file) nil)                    ; quietly reject nil
+   ((or (not file)                     ; quietly reject nil
+       (zerop (length file)))          ; and also ""
+    nil)
    ((file-exists-p file) file)         ; try unmodified first
    ;; three reasons to suppress search:
    (nomodify nil)
@@ -1326,6 +1327,7 @@ which may actually result in an URL rather than a 
filename."
         ;; If it contains a colon, get rid of it (and return if exists)
         ((and (string-match path-separator name)
               (setq name (ffap-string-at-point 'nocolon))
+              (> (length name) 0)
               (ffap-file-exists-string name)))
         ;; File does not exist, try the alist:
         ((let ((alist ffap-alist) tem try case-fold-search)
@@ -2042,19 +2044,19 @@ This hook is intended to be put in 
`file-name-at-point-functions'."
    '((global-set-key [S-mouse-3] 'ffap-at-mouse)
      (global-set-key [C-S-mouse-3] 'ffap-menu)
 
-     (global-set-key "\C-x\C-f" 'find-file-at-point)
-     (global-set-key "\C-x\C-r" 'ffap-read-only)
-     (global-set-key "\C-x\C-v" 'ffap-alternate-file)
+     (global-set-key [remap find-file] 'find-file-at-point)
+     (global-set-key [remap find-file-read-only] 'ffap-read-only)
+     (global-set-key [remap find-alternate-file] 'ffap-alternate-file)
 
-     (global-set-key "\C-x4f"   'ffap-other-window)
-     (global-set-key "\C-x5f"   'ffap-other-frame)
-     (global-set-key "\C-x4r"   'ffap-read-only-other-window)
-     (global-set-key "\C-x5r"   'ffap-read-only-other-frame)
+     (global-set-key [remap find-file-other-window] 'ffap-other-window)
+     (global-set-key [remap find-file-other-frame] 'ffap-other-frame)
+     (global-set-key [remap find-file-read-only-other-window] 
'ffap-read-only-other-window)
+     (global-set-key [remap find-file-read-only-other-frame] 
'ffap-read-only-other-frame)
 
-     (global-set-key "\C-xd"    'dired-at-point)
-     (global-set-key "\C-x4d"   'ffap-dired-other-window)
-     (global-set-key "\C-x5d"   'ffap-dired-other-frame)
-     (global-set-key "\C-x\C-d" 'ffap-list-directory)
+     (global-set-key [remap dired] 'dired-at-point)
+     (global-set-key [remap dired-other-window] 'ffap-dired-other-window)
+     (global-set-key [remap dired-other-frame] 'ffap-dired-other-frame)
+     (global-set-key [remap list-directory] 'ffap-list-directory)
 
      (add-hook 'gnus-summary-mode-hook 'ffap-gnus-hook)
      (add-hook 'gnus-article-mode-hook 'ffap-gnus-hook)
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 62dd1cd..d77046d 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -30,6 +30,9 @@
 (require 'cl-lib)
 (eval-when-compile (require 'subr-x))
 
+(defvar file-notify-debug nil
+  "Use for debug messages.")
+
 (defconst file-notify--library
   (cond
    ((featurep 'inotify) 'inotify)
@@ -93,7 +96,8 @@ If EVENT is a filewatch event, call its callback.  It has the 
format
 
 Otherwise, signal a `file-notify-error'."
   (interactive "e")
-  ;;(message "file-notify-handle-event %S" event)
+  (when file-notify-debug
+    (message "file-notify-handle-event %S" event))
   (if (and (consp event)
            (eq (car event) 'file-notify)
           (>= (length event) 3))
@@ -157,12 +161,14 @@ EVENT is the cadr of the event in 
`file-notify-handle-event'
       (while actions
         (let ((action (pop actions)))
           ;; Send pending event, if it doesn't match.
+          ;; We only handle {renamed,moved}-{from,to} pairs when these
+          ;; arrive in order without anything else in-between.
           (when (and file-notify--pending-event
-                     ;; The cookie doesn't match.
-                     (not (equal (file-notify--event-cookie
-                                  (car file-notify--pending-event))
-                                 (file-notify--event-cookie event)))
                      (or
+                      ;; The cookie doesn't match.
+                      (not (equal (file-notify--event-cookie
+                                   (car file-notify--pending-event))
+                                  (file-notify--event-cookie event)))
                       ;; inotify.
                       (and (eq (nth 1 (car file-notify--pending-event))
                                'moved-from)
@@ -232,21 +238,28 @@ EVENT is the cadr of the event in 
`file-notify-handle-event'
                       (string-equal
                        (file-notify--watch-filename watch)
                        (file-name-nondirectory file))
+
                       ;; Directory matches.
-                      (string-equal
-                       (file-name-nondirectory file)
-                       (file-name-nondirectory
-                        (file-notify--watch-directory watch)))
+                      ;;  FIXME: What purpose would this condition serve?
+                      ;;  Doesn't it just slip through events for files
+                      ;;  having the same name as the last component of the
+                      ;;  directory of the file that we are really watching?
+                      ;;(string-equal
+                      ;; (file-name-nondirectory file)
+                      ;; (file-name-nondirectory
+                      ;;  (file-notify--watch-directory watch)))
+
                       ;; File1 matches.
                       (and (stringp file1)
                            (string-equal
                             (file-notify--watch-filename watch)
                             (file-name-nondirectory file1)))))
-            ;;(message
-            ;;"file-notify-callback %S %S %S %S %S %S %S"
-            ;;desc action file file1 watch
-            ;;(file-notify--event-watched-file event)
-            ;;(file-notify--watch-directory watch))
+            (when file-notify-debug
+              (message
+               "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)
@@ -262,9 +275,49 @@ EVENT is the cadr of the event in 
`file-notify-handle-event'
                           file (file-notify--event-watched-file event))))
             (file-notify-rm-watch desc)))))))
 
-;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor
-;; for every `file-notify-add-watch', while `inotify' returns a unique
-;; descriptor per inode only.
+(declare-function inotify-add-watch "inotify.c" (file flags callback))
+(declare-function kqueue-add-watch "kqueue.c" (file flags callback))
+(declare-function w32notify-add-watch "w32notify.c" (file flags callback))
+(declare-function gfile-add-watch "gfilenotify.c" (file flags callback))
+
+(defun file-notify--add-watch-inotify (_file dir flags)
+  "Add a watch for FILE in DIR with FLAGS, using inotify."
+  (inotify-add-watch dir
+                     (append
+                      (and (memq 'change flags)
+                           '(create delete delete-self modify move-self move))
+                      (and (memq 'attribute-change flags)
+                           '(attrib)))
+                     #'file-notify-callback))
+
+(defun file-notify--add-watch-kqueue (file _dir flags)
+  "Add a watch for FILE in DIR with FLAGS, using kqueue."
+  ;; kqueue does not report changes to file contents when watching
+  ;; directories, so we watch each file directly.
+  (kqueue-add-watch file
+                    (append
+                     (and (memq 'change flags)
+                         '(create delete write extend rename))
+                     (and (memq 'attribute-change flags)
+                          '(attrib)))
+                    #'file-notify-callback))
+
+(defun file-notify--add-watch-w32notify (_file dir flags)
+  "Add a watch for FILE in DIR with FLAGS, using w32notify."
+  (w32notify-add-watch dir
+                       (append
+                        (and (memq 'change flags)
+                             '(file-name directory-name size last-write-time))
+                        (and (memq 'attribute-change flags)
+                             '(attributes)))
+                       #'file-notify-callback))
+
+(defun file-notify--add-watch-gfilenotify (_file dir flags)
+  "Add a watch for FILE in DIR with FLAGS, using gfilenotify."
+  (gfile-add-watch dir
+                   (append '(watch-mounts send-moved) flags)
+                   #'file-notify-callback))
+
 (defun file-notify-add-watch (file flags callback)
   "Add a watch for filesystem events pertaining to FILE.
 This arranges for filesystem events pertaining to FILE to be reported
@@ -315,70 +368,34 @@ FILE is the name of the file whose event is being 
reported."
        (dir (directory-file-name
              (if (file-directory-p file)
                  file
-               (file-name-directory file))))
-        desc func l-flags)
+               (file-name-directory file)))))
 
     (unless (file-directory-p dir)
       (signal 'file-notify-error `("Directory does not exist" ,dir)))
 
-    (if handler
-       ;; A file name handler could exist even if there is no local
-       ;; file notification support.
-       (setq desc (funcall handler 'file-notify-add-watch dir flags callback))
-
-      ;; Check, whether Emacs has been compiled with file notification
-      ;; support.
-      (unless file-notify--library
-       (signal 'file-notify-error
-               '("No file notification package available")))
-
-      ;; Determine low-level function to be called.
-      (setq func
-           (cond
-            ((eq file-notify--library 'inotify) 'inotify-add-watch)
-            ((eq file-notify--library 'kqueue) 'kqueue-add-watch)
-            ((eq file-notify--library 'gfilenotify) 'gfile-add-watch)
-            ((eq file-notify--library 'w32notify) 'w32notify-add-watch)))
-
-      ;; Determine respective flags.
-      (if (eq file-notify--library 'gfilenotify)
-         (setq l-flags (append '(watch-mounts send-moved) flags))
-       (when (memq 'change flags)
-         (setq
-          l-flags
-          (cond
-           ((eq file-notify--library 'inotify)
-            '(create delete delete-self modify move-self move))
-           ((eq file-notify--library 'kqueue)
-            '(create delete write extend rename))
-           ((eq file-notify--library 'w32notify)
-            '(file-name directory-name size last-write-time)))))
-       (when (memq 'attribute-change flags)
-         (push (cond
-                 ((eq file-notify--library 'inotify) 'attrib)
-                 ((eq file-notify--library 'kqueue) 'attrib)
-                 ((eq file-notify--library 'w32notify) 'attributes))
-                l-flags)))
-
-      ;; Call low-level function.
-      (setq desc (funcall
-                  ;; kqueue does not report file changes in directory
-                  ;; monitor.  So we must watch the file itself.
-                  func (if (eq file-notify--library 'kqueue) file dir)
-                  l-flags 'file-notify-callback)))
-
-    ;; We do not want to enter quoted file names into the hash.
-    (setq file (file-name-unquote file)
-          dir  (file-name-unquote dir))
-
-    ;; Modify `file-notify-descriptors'.
-    (let ((watch (file-notify--watch-make
-                  dir
-                  (unless (file-directory-p file) (file-name-nondirectory 
file))
-                  callback)))
-      (puthash desc watch file-notify-descriptors))
-    ;; Return descriptor.
-    desc))
+    (let ((desc
+           (if handler
+               (funcall handler 'file-notify-add-watch dir flags callback)
+             (funcall
+              (pcase file-notify--library
+                ('inotify     #'file-notify--add-watch-inotify)
+                ('kqueue      #'file-notify--add-watch-kqueue)
+                ('w32notify   #'file-notify--add-watch-w32notify)
+                ('gfilenotify #'file-notify--add-watch-gfilenotify)
+                (_ (signal 'file-notify-error
+                          '("No file notification package available"))))
+              file dir flags))))
+
+      ;; Modify `file-notify-descriptors'.
+      (let ((watch (file-notify--watch-make
+                    ;; We do not want to enter quoted file names into the hash.
+                    (file-name-unquote dir)
+                    (unless (file-directory-p file)
+                      (file-name-nondirectory file))
+                    callback)))
+        (puthash desc watch file-notify-descriptors))
+      ;; Return descriptor.
+      desc)))
 
 (defun file-notify-rm-watch (descriptor)
   "Remove an existing watch specified by its DESCRIPTOR.
diff --git a/lisp/files-x.el b/lisp/files-x.el
index b71e920..0d156db 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: files
 ;; Package: emacs
 
diff --git a/lisp/files.el b/lisp/files.el
index c05d70a..989d1cb 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985-1987, 1992-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This file is part of GNU Emacs.
@@ -3590,7 +3589,9 @@ 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)
+      (when (and (file-remote-p default-directory)
+                 (fboundp 'hack-connection-local-variables)
+                 (fboundp 'connection-local-criteria-for-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
@@ -4108,6 +4109,52 @@ This function returns either:
 (declare-function map-merge-with "map" (type function &rest maps))
 (declare-function map-merge "map" (type &rest maps))
 
+(defun dir-locals--get-sort-score (node)
+  "Return a number used for sorting the definitions of dir locals.
+NODE is assumed to be a cons cell where the car is either a
+string or a symbol representing a mode name.
+
+If it is a mode then the the depth of the mode (ie, how many
+parents that mode has) will be returned.
+
+If it is a string then the length of the string plus 1000 will be
+returned.
+
+Otherwise it returns -1.
+
+That way the value can be used to sort the list such that deeper
+modes will be after the other modes.  This will be followed by
+directory entries in order of length.  If the entries are all
+applied in order then that means the more specific modes will
+  override the values specified by the earlier modes and directory
+variables will override modes."
+  (let ((key (car node)))
+    (cond ((null key) -1)
+          ((symbolp key)
+           (let ((mode key)
+                 (depth 0))
+             (while (setq mode (get mode 'derived-mode-parent))
+               (setq depth (1+ depth)))
+             depth))
+          ((stringp key)
+           (+ 1000 (length key)))
+          (t -2))))
+
+(defun dir-locals--sort-variables (variables)
+  "Sorts VARIABLES so that applying them in order has the right effect.
+The variables are compared by dir-locals--get-sort-score.
+Directory entries are then recursively sorted using the same
+criteria."
+  (setq variables (sort variables
+                        (lambda (a b)
+                          (< (dir-locals--get-sort-score a)
+                             (dir-locals--get-sort-score b)))))
+  (dolist (n variables)
+    (when (stringp (car n))
+      (setcdr n (dir-locals--sort-variables (cdr n)))))
+
+  variables)
+
 (defun dir-locals-read-from-dir (dir)
   "Load all variables files in DIR and register a new class and instance.
 DIR is the absolute name of a directory which must contain at
@@ -4145,6 +4192,7 @@ Return the new class name, which is a symbol named DIR."
                                     variables
                                     newvars))))))
       (setq success latest))
+    (setq variables (dir-locals--sort-variables variables))
     (dir-locals-set-class-variables class-name variables)
     (dir-locals-set-directory-class dir class-name success)
     class-name))
@@ -4220,6 +4268,9 @@ However, the mode will not be changed if
   :type 'boolean
   :group 'editing-basics)
 
+(defvar after-set-visited-file-name-hook nil
+  "Normal hook run just after setting visited file name of current buffer.")
+
 (defun set-visited-file-name (filename &optional no-query along-with-file)
   "Change name of file visited in current buffer to FILENAME.
 This also renames the buffer to correspond to the new file.
@@ -4340,7 +4391,8 @@ the old visited file has been renamed to the new name 
FILENAME."
              (set-auto-mode t)
              (or (eq old major-mode)
                  (hack-local-variables))))
-    (error nil))))
+      (error nil))
+    (run-hooks 'after-set-visited-file-name-hook)))
 
 (defun write-file (filename &optional confirm)
   "Write current buffer into file FILENAME.
@@ -5256,7 +5308,7 @@ Before and after saving the buffer, this function runs
                     (set-file-extended-attributes buffer-file-name
                                                   (nth 1 setmodes)))
                 (set-file-modes buffer-file-name
-                                (logior (car setmodes) 128))))))
+                                (logior (car setmodes) 128)))))
        (let (success)
          (unwind-protect
              (progn
@@ -5272,7 +5324,7 @@ Before and after saving the buffer, this function runs
            (and setmodes (not success)
                 (progn
                   (rename-file (nth 2 setmodes) buffer-file-name t)
-                  (setq buffer-backed-up nil))))))
+                  (setq buffer-backed-up nil)))))))
     setmodes))
 
 (declare-function diff-no-select "diff"
@@ -5841,6 +5893,16 @@ This should not be relied upon.
 For more information on how this variable is used by Auto Revert mode,
 see Info node `(emacs)Supporting additional buffers'.")
 
+(defvar-local buffer-auto-revert-by-notification nil
+  "Whether a buffer can rely on notification in Auto-Revert mode.
+If non-nil, monitoring changes to the directory of the current
+buffer is sufficient for knowing when that buffer needs to be
+updated in Auto Revert Mode.  Such notification does not include
+changes to files in that directory, only to the directory itself.
+
+This variable only applies to buffers where `buffer-file-name' is
+nil; other buffers are tracked by their files.")
+
 (defvar before-revert-hook nil
   "Normal hook for `revert-buffer' to run before reverting.
 The function `revert-buffer--default' runs this.
diff --git a/lisp/filesets.el b/lisp/filesets.el
index b74b4a8..05c30de 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Thomas Link <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: filesets convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index ef137be..578f765 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -5,7 +5,6 @@
 
 ;; Author: Roland McGrath <address@hidden>,
 ;;        Sebastian Kremer <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: unix
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/find-file.el b/lisp/find-file.el
index 8731408..f93d2a0 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -1,7 +1,6 @@
 ;;; find-file.el --- find a file corresponding to this one given a pattern
 
 ;; Author: Henry Guillaume <address@hidden, address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: c, matching, tools
 
 ;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
diff --git a/lisp/flow-ctrl.el b/lisp/flow-ctrl.el
index e92b6b4..0b95efa 100644
--- a/lisp/flow-ctrl.el
+++ b/lisp/flow-ctrl.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Kevin Gallagher
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR
 ;; Keywords: hardware
 
diff --git a/lisp/foldout.el b/lisp/foldout.el
index 3ef88fe..2eae65a 100644
--- a/lisp/foldout.el
+++ b/lisp/foldout.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kevin Broadey <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 27 Jan 1994
 ;; Version: 1.10
 ;; Keywords: folding, outlines
diff --git a/lisp/follow.el b/lisp/follow.el
index acc2b26..47e7aa4 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Anders Lindgren
-;; Maintainer: address@hidden
 ;; Created: 1995-05-25
 ;; Keywords: display, window, minor-mode, convenience
 
diff --git a/lisp/font-core.el b/lisp/font-core.el
index 6b26f0c..da6c91b 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: languages, faces
 ;; Package: emacs
 
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 1475911..b0e4598 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -5,7 +5,6 @@
 ;; Author: Jamie Zawinski
 ;;     Richard Stallman
 ;;     Stefan Monnier
-;; Maintainer: address@hidden
 ;; Keywords: languages, faces
 ;; Package: emacs
 
@@ -1096,7 +1095,7 @@ accessible portion of the current buffer."
   (lambda (beg end)
     (unless font-lock-fontified
       (save-excursion
-        (font-lock-fontify-region (or beg (point-min)) (or end (point-max))))))
+        (font-lock-fontify-region beg end))))
   "Function to make sure a region has been fontified.
 Called with two arguments BEG and END.")
 
@@ -1387,12 +1386,19 @@ delimit the region to fontify."
 ;; below and given a `font-lock-' prefix.  Those that are not used are defined
 ;; in Lisp below and commented out.  sm.
 
-(defun font-lock-prepend-text-property (start end prop value &optional object)
-  "Prepend to one property of the text from START to END.
-Arguments PROP and VALUE specify the property and value to prepend to the value
-already in place.  The resulting property values are always lists.
-Optional argument OBJECT is the string or buffer containing the text."
-  (let ((val (if (listp value) value (list value))) next prev)
+(defun font-lock--add-text-property (start end prop value object append)
+  "Add an element to a property of the text from START to END.
+Arguments PROP and VALUE specify the property and value to add to
+the value already in place.  The resulting property values are
+always lists.  Argument OBJECT is the string or buffer containing
+the text.  If argument APPEND is non-nil, VALUE will be appended,
+otherwise it will be prepended."
+  (let ((val (if (and (listp value) (not (keywordp (car value))))
+                 ;; Already a list of faces.
+                 value
+               ;; A single face (e.g. a plist of face properties).
+               (list value)))
+        next prev)
     (while (/= start end)
       (setq next (next-single-property-change start prop object end)
            prev (get-text-property start prop object))
@@ -1402,30 +1408,26 @@ Optional argument OBJECT is the string or buffer 
containing the text."
           (or (keywordp (car prev))
               (memq (car prev) '(foreground-color background-color)))
           (setq prev (list prev)))
-      (put-text-property start next prop
-                        (append val (if (listp prev) prev (list prev)))
-                        object)
+      (let* ((list-prev (if (listp prev) prev (list prev)))
+             (new-value (if append
+                           (append list-prev val)
+                         (append val list-prev))))
+        (put-text-property start next prop new-value object))
       (setq start next))))
 
+(defun font-lock-prepend-text-property (start end prop value &optional object)
+  "Prepend to one property of the text from START to END.
+Arguments PROP and VALUE specify the property and value to prepend to the value
+already in place.  The resulting property values are always lists.
+Optional argument OBJECT is the string or buffer containing the text."
+  (font-lock--add-text-property start end prop value object nil))
+
 (defun font-lock-append-text-property (start end prop value &optional object)
   "Append to one property of the text from START to END.
 Arguments PROP and VALUE specify the property and value to append to the value
 already in place.  The resulting property values are always lists.
 Optional argument OBJECT is the string or buffer containing the text."
-  (let ((val (if (listp value) value (list value))) next prev)
-    (while (/= start end)
-      (setq next (next-single-property-change start prop object end)
-           prev (get-text-property start prop object))
-      ;; Canonicalize old forms of face property.
-      (and (memq prop '(face font-lock-face))
-          (listp prev)
-          (or (keywordp (car prev))
-              (memq (car prev) '(foreground-color background-color)))
-          (setq prev (list prev)))
-      (put-text-property start next prop
-                        (append (if (listp prev) prev (list prev)) val)
-                        object)
-      (setq start next))))
+  (font-lock--add-text-property start end prop value object t))
 
 (defun font-lock-fillin-text-property (start end prop value &optional object)
   "Fill in one property of the text from START to END.
@@ -1496,7 +1498,7 @@ see `font-lock-syntactic-keywords'."
       ;; Flush the syntax-cache.  I believe this is not necessary for
       ;; font-lock's use of syntax-ppss, but I'm not 100% sure and it can
       ;; still be necessary for other users of syntax-ppss anyway.
-      (syntax-ppss-after-change-function start)
+      (syntax-ppss-flush-cache start)
       (cond
        ((not override)
        ;; Cannot override existing fontification.
diff --git a/lisp/frame.el b/lisp/frame.el
index 539a0f4..8e0738f 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1994, 1996-1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
@@ -2682,6 +2681,9 @@ See also `toggle-frame-maximized'."
         display-line-numbers-width
         display-line-numbers-current-absolute
         display-line-numbers-widen
+        display-fill-column-indicator
+        display-fill-column-indicator-column
+        display-fill-column-indicator-character
         bidi-paragraph-direction
         bidi-display-reordering))
 
diff --git a/lisp/fringe.el b/lisp/fringe.el
index 92387a2..632efa8 100644
--- a/lisp/fringe.el
+++ b/lisp/fringe.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: frames
 ;; Package: emacs
 
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 9f7d2c9..bed480f 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -2439,7 +2439,7 @@ modified) original contents, they are first saved to 
their own file."
           ;; Parse them and see which articles we want to fetch.
           (setq gnus-newsgroup-dependencies
                 (or gnus-newsgroup-dependencies
-                    (make-vector (length articles) 0)))
+                    (gnus-make-hashtable (length articles))))
           (setq gnus-newsgroup-headers
                 (or gnus-newsgroup-headers
                     (gnus-get-newsgroup-headers-xover articles nil nil
@@ -3929,7 +3929,7 @@ If REREAD is not nil, downloaded articles are marked as 
unread."
                     (nnheader-insert-file-contents file)
                     (nnheader-remove-body)
                     (setq header (nnheader-parse-naked-head)))
-                  (mail-header-set-number header (car downloaded))
+                  (setf (mail-header-number header) (car downloaded))
                   (if nov-arts
                       (let ((key (concat "^" (int-to-string (car nov-arts))
                                          "\t")))
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index baa8a24..a1b82f8 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3733,7 +3733,7 @@ is to run."
   "Stop the Date timer."
   (interactive)
   (when article-lapsed-timer
-    (nnheader-cancel-timer article-lapsed-timer)
+    (cancel-timer article-lapsed-timer)
     (setq article-lapsed-timer nil)))
 
 (defun article-date-user (&optional highlight)
diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el
index 4e2723e..b3da350 100644
--- a/lisp/gnus/gnus-async.el
+++ b/lisp/gnus/gnus-async.el
@@ -146,7 +146,7 @@ that was fetched."
        (when next
          (when gnus-async-timer
            (ignore-errors
-             (nnheader-cancel-timer 'gnus-async-timer)))
+             (cancel-timer 'gnus-async-timer)))
          (setq gnus-async-timer
                (run-with-idle-timer
                 0.1 nil 'gnus-async-prefetch-article
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 5e6483d..afe8a8a 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -187,9 +187,9 @@ it's not cached."
              (setq lines-chars (nnheader-get-lines-and-char))
              (nnheader-remove-body)
              (setq headers (nnheader-parse-naked-head))
-             (mail-header-set-number headers number)
-             (mail-header-set-lines headers (car lines-chars))
-             (mail-header-set-chars headers (cadr lines-chars))
+             (setf (mail-header-number headers) number)
+             (setf (mail-header-lines headers) (car lines-chars))
+             (setf (mail-header-chars headers) (cadr lines-chars))
              (gnus-cache-change-buffer group)
              (set-buffer (cdr gnus-cache-buffer))
              (goto-char (point-max))
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index 6c5e0b7..cb70d95 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -111,7 +111,7 @@ marked with SPECIAL."
                                               func idle time))))
             ((and idle (> idle (gnus-demon-idle-since)))
              (when time
-               (nnheader-cancel-timer (plist-get gnus-demon-timers func))
+               (cancel-timer (plist-get gnus-demon-timers func))
                (setq gnus-demon-timers
                      (plist-put gnus-demon-timers func
                                (run-with-idle-timer idle nil
@@ -202,7 +202,7 @@ marked with SPECIAL."
   "Cancel any Gnus daemons."
   (interactive)
   (dotimes (i (/ (length gnus-demon-timers) 2))
-    (nnheader-cancel-timer (nth (1+ (* i 2)) gnus-demon-timers)))
+    (cancel-timer (nth (1+ (* i 2)) gnus-demon-timers)))
   (setq gnus-demon-timers nil))
 
 (defun gnus-demon-add-disconnection ()
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index c757c82..4a14de3 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -3300,21 +3300,31 @@ If REVERSE (the prefix), reverse the sorting order."
   (funcall gnus-group-sort-alist-function
           (gnus-make-sort-function func) reverse)
   (gnus-group-unmark-all-groups)
+  ;; Redisplay all groups according to the newly-sorted order of
+  ;; `gnus-group-list'.
   (gnus-group-list-groups)
   (gnus-dribble-touch))
 
 (defun gnus-group-sort-flat (func reverse)
-  ;; We peel off the dummy group from the alist.
+  "Sort groups in a flat list using sorting function FUNC.
+If REVERSE is non-nil, reverse the sort order.
+
+This function sets a new value for `gnus-group-list'; its return
+value is disregarded."
   (when func
-    (when (equal (gnus-info-group (car gnus-newsrc-alist)) "dummy.group")
-      (pop gnus-newsrc-alist))
-    ;; Do the sorting.
-    (setq gnus-newsrc-alist
-         (sort gnus-newsrc-alist func))
-    (when reverse
-      (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)))
-    ;; Regenerate the hash table.
-    (gnus-make-hashtable-from-newsrc-alist)))
+    (let* ((groups (remove "dummy.group" gnus-group-list))
+          (sorted-infos
+           (sort (mapcar (lambda (g)
+                           (gnus-get-info g))
+                         groups)
+                 func)))
+      (setq gnus-group-list
+           (mapcar (lambda (i)
+                     (gnus-info-group i))
+                   sorted-infos))
+      (when reverse
+       (setq gnus-group-list (nreverse gnus-group-list)))
+      (setq gnus-group-list (cons "dummy.group" gnus-group-list)))))
 
 (defun gnus-group-sort-groups-by-alphabet (&optional reverse)
   "Sort the group buffer alphabetically by group name.
@@ -3377,27 +3387,26 @@ If REVERSE, sort in reverse order."
     (gnus-dribble-touch)))
 
 (defun gnus-group-sort-selected-flat (groups func reverse)
-  (let (entries infos)
-    ;; First find all the group entries for these groups.
-    (while groups
-      (push (nthcdr 2 (gnus-group-entry (pop groups)))
-           entries))
-    ;; Then sort the infos.
-    (setq infos
-         (sort
-          (mapcar
-           (lambda (entry) (car entry))
-           (setq entries (nreverse entries)))
-          func))
+  "Sort only the selected GROUPS, using FUNC.
+If REVERSE is non-nil, reverse the sorting."
+  (let ((infos (sort
+               (mapcar (lambda (g)
+                         (gnus-get-info g))
+                       groups)
+               func))
+       sorted-groups)
     (when reverse
       (setq infos (nreverse infos)))
-    ;; Go through all the infos and replace the old entries
-    ;; with the new infos.
-    (while infos
-      (setcar (car entries) (pop infos))
-      (pop entries))
-    ;; Update the hashtable.
-    (gnus-make-hashtable-from-newsrc-alist)))
+    (setq sorted-groups (mapcar (lambda (i) (gnus-info-group i)) infos))
+
+    ;; Find the original locations of GROUPS in `gnus-group-list', and
+    ;; replace each one, in order, with a group from SORTED-GROUPS.
+    (dolist (i (sort (mapcar (lambda (g)
+                              (seq-position gnus-group-list g))
+                            groups)
+                    #'<))
+      (setf (nth i gnus-group-list)
+           (pop sorted-groups)))))
 
 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse)
   "Sort the group buffer alphabetically by group name.
diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el
index a7ded39..442d26c 100644
--- a/lisp/gnus/gnus-kill.el
+++ b/lisp/gnus/gnus-kill.el
@@ -350,8 +350,7 @@ Returns the number of articles marked as read."
            (let ((headers gnus-newsgroup-headers))
              (if gnus-kill-killed
                  (setq gnus-newsgroup-kill-headers
-                       (mapcar (lambda (header) (mail-header-number header))
-                               headers))
+                       (mapcar #'mail-header-number headers))
                (while headers
                  (unless (gnus-member-of-range
                           (mail-header-number (car headers))
@@ -600,8 +599,7 @@ marked as read or ticked are ignored."
        ((cond ((fboundp
                (setq function
                      (intern-soft
-                      (concat "mail-header-" (downcase field)))))
-              (setq function `(lambda (h) (,function h))))
+                      (concat "mail-header-" (downcase field))))))
              ((when (setq extras
                           (member (downcase field)
                                   (mapcar (lambda (header)
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index b6d649d..b7a97f1 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -158,9 +158,9 @@ if a regexp and matches the Gcc group name, attach files as 
external parts;
 if nil, attach files as normal parts."
   :version "22.1"
   :group 'gnus-message
-  :type '(choice (const nil :tag "None")
-                (const all :tag "Any")
-                (string :tag "Regexp")))
+  :type '(choice (const :tag "None" nil)
+                 (const :tag "Any"  all)
+                 regexp))
 
 (defcustom gnus-gcc-self-resent-messages 'no-gcc-self
   "Like `gcc-self' group parameter, only for unmodified resent messages.
@@ -232,7 +232,9 @@ List of charsets that are permitted to be unencoded.")
   "Files whose variables will be reported in `gnus-bug'."
   :version "22.1"
   :group 'gnus-message
-  :type '(repeat (string :tag "File")))
+  :type '(repeat file))
+
+(make-obsolete-variable 'gnus-debug-files "it is no longer used." "24.1")
 
 (defcustom gnus-debug-exclude-variables
   '(mm-mime-mule-charset-alist
@@ -240,7 +242,10 @@ List of charsets that are permitted to be unencoded.")
   "Variables that should not be reported in `gnus-bug'."
   :version "22.1"
   :group 'gnus-message
-  :type '(repeat (symbol :tag "Variable")))
+  :type '(repeat variable))
+
+(make-obsolete-variable
+ 'gnus-debug-exclude-variables "it is no longer used." "24.1")
 
 (defcustom gnus-discouraged-post-methods
   '(nndraft nnml nnimap nnmaildir nnmh nnfolder nndir)
@@ -340,7 +345,6 @@ only affect the Gcc copy, but not the original message."
 (defvar gnus-article-yanked-articles nil)
 (defvar gnus-message-buffer "*Mail Gnus*")
 (defvar gnus-article-copy nil)
-(defvar gnus-check-before-posting nil)
 (defvar gnus-last-posting-server nil)
 (defvar gnus-message-group-art nil)
 
diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el
index 58c05e0..529cd8a 100644
--- a/lisp/gnus/gnus-salt.el
+++ b/lisp/gnus/gnus-salt.el
@@ -573,9 +573,9 @@ Two predefined functions are available:
         (header (if (vectorp header) header
                   (progn
                     (setq header (make-mail-header "*****"))
-                    (mail-header-set-number header 0)
-                    (mail-header-set-lines header 0)
-                    (mail-header-set-chars header 0)
+                    (setf (mail-header-number header) 0)
+                    (setf (mail-header-lines header) 0)
+                    (setf (mail-header-chars header) 0)
                     header)))
         (gnus-tmp-from (mail-header-from header))
         (gnus-tmp-subject (mail-header-subject header))
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 2faf0f9..476c360 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -2341,9 +2341,7 @@ score in `gnus-newsgroup-scored' by SCORE."
                                  "references"
                                (symbol-name (caar elem)))
                              (cdar elem)))
-               (setcar (car elem)
-                       `(lambda (h)
-                          (,func h))))
+               (setcar (car elem) func))
              (setq elem (cdr elem)))
            (setq malist (cdr malist)))
          ;; Then we score away.
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 2f8a260..ef07dcd 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -583,12 +583,9 @@ Can be used to turn version control on or off."
 
 (defun gnus-subscribe-alphabetically (newgroup)
   "Subscribe new NEWGROUP and insert it in alphabetical order."
-  (let ((groups (cdr gnus-newsrc-alist))
-       before)
-    (while (and (not before) groups)
-      (if (string< newgroup (caar groups))
-         (setq before (caar groups))
-       (setq groups (cdr groups))))
+  (let ((before (seq-find (lambda (group)
+                           (string< newgroup group))
+                         (cdr gnus-group-list))))
     (gnus-subscribe-newsgroup newgroup before)))
 
 (defun gnus-subscribe-hierarchically (newgroup)
@@ -618,15 +615,15 @@ It is inserted in hierarchical newsgroup order if 
subscribed.  If not,
 it is killed."
   (if (gnus-y-or-n-p (format "Subscribe new newsgroup %s? " group))
       (gnus-subscribe-hierarchically group)
-    (push group gnus-killed-list)))
+    (gnus-subscribe-killed group)))
 
 (defun gnus-subscribe-zombies (group)
   "Make the new GROUP into a zombie group."
-  (push group gnus-zombie-list))
+  (cl-pushnew group gnus-zombie-list :test #'equal))
 
 (defun gnus-subscribe-killed (group)
   "Make the new GROUP a killed group."
-  (push group gnus-killed-list))
+  (cl-pushnew group gnus-killed-list :test #'equal))
 
 (defun gnus-subscribe-newsgroup (newsgroup &optional next)
   "Subscribe new NEWSGROUP.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index b8aa302..31958ff 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1,4 +1,4 @@
-;;; gnus-sum.el --- summary mode commands for Gnus
+;;; gnus-sum.el --- summary mode commands for Gnus  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
@@ -42,6 +42,7 @@
 (defvar gnus-tmp-indentation)
 (defvar gnus-tmp-level)
 (defvar gnus-tmp-lines)
+(defvar gnus-tmp-name)
 (defvar gnus-tmp-number)
 (defvar gnus-tmp-opening-bracket)
 (defvar gnus-tmp-process)
@@ -50,6 +51,7 @@
 (defvar gnus-tmp-score-char)
 (defvar gnus-tmp-subject)
 (defvar gnus-tmp-subject-or-nil)
+(defvar gnus-tmp-thread)
 (defvar gnus-tmp-unread)
 (defvar gnus-tmp-unread-and-unselected)
 (defvar gnus-tmp-unread-and-unticked)
@@ -243,7 +245,7 @@ fill in all gaps that Gnus manages to guess."
                 (sexp :menu-tag "all" t)))
 
 (defcustom gnus-summary-thread-gathering-function
-  'gnus-gather-threads-by-subject
+  #'gnus-gather-threads-by-subject
   "Function used for gathering loose threads.
 There are two pre-defined functions: `gnus-gather-threads-by-subject',
 which only takes Subjects into consideration; and
@@ -539,7 +541,7 @@ this variable specifies group names."
                         (cons :value ("" "") regexp (repeat string))
                         (sexp :value nil))))
 
-(defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
+(defcustom gnus-move-group-prefix-function #'gnus-group-real-prefix
   "Function used to compute default prefix for article move/copy/etc prompts.
 The function should take one argument, a group name, and return a
 string with the suggested prefix."
@@ -947,7 +949,7 @@ according to the value of `gnus-thread-sort-functions'."
                    (function :tag "other"))
            (boolean :tag "Reverse order")))))
 
-(defcustom gnus-thread-score-function '+
+(defcustom gnus-thread-score-function #'+
   "Function used for calculating the total score of a thread.
 
 The function is called with the scores of the article and each
@@ -1014,10 +1016,9 @@ following hook:
  (add-hook gnus-select-group-hook
           (lambda ()
             (mapcar (lambda (header)
-                      (mail-header-set-subject
-                       header
-                       (gnus-simplify-subject
-                        (mail-header-subject header) \\='re-only)))
+                      (setf (mail-header-subject header)
+                            (gnus-simplify-subject
+                             (mail-header-subject header) \\='re-only)))
                     gnus-newsgroup-headers)))"
   :group 'gnus-group-select
   :type 'hook)
@@ -1171,11 +1172,11 @@ which it may alter in any way."
                 function)
   :group 'gnus-summary)
 
-(defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
+(defvar gnus-decode-encoded-word-function #'mail-decode-encoded-word-string
   "Function used to decode a string with encoded words.")
 
 (defvar gnus-decode-encoded-address-function
-  'mail-decode-encoded-address-string
+  #'mail-decode-encoded-address-string
   "Function used to decode addresses with encoded words.")
 
 (defcustom gnus-extra-headers '(To Cc Keywords Gcc Newsgroups X-GM-LABELS)
@@ -1373,7 +1374,7 @@ the normal Gnus MIME machinery."
 
 (defvar gnus-thread-indent-array nil)
 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
-(defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
+(defvar gnus-sort-gathered-threads-function #'gnus-thread-sort-by-number
   "Function called to sort the articles within a thread after it has been 
gathered together.")
 
 (defvar gnus-summary-save-parts-type-history nil)
@@ -1444,15 +1445,17 @@ the normal Gnus MIME machinery."
     (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
     (?i gnus-tmp-score ?d)
     (?z gnus-tmp-score-char ?c)
-    (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
+    (?V (gnus-thread-total-score
+         (and (boundp 'gnus-tmp-thread) (car gnus-tmp-thread)))
+        ?d)
     (?U gnus-tmp-unread ?c)
     (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
        ?s)
     (?t (gnus-summary-number-of-articles-in-thread
-        (and (boundp 'thread) (car thread)) gnus-tmp-level)
+        (and (boundp 'gnus-tmp-thread) (car gnus-tmp-thread)) gnus-tmp-level)
        ?d)
     (?e (gnus-summary-number-of-articles-in-thread
-        (and (boundp 'thread) (car thread)) gnus-tmp-level t)
+        (and (boundp 'gnus-tmp-thread) (car gnus-tmp-thread)) gnus-tmp-level t)
        ?c)
     (?u gnus-tmp-user-defined ?s)
     (?P (gnus-pick-line-number) ?d)
@@ -1706,6 +1709,7 @@ For example:
   ;; already been loaded (avoids infinite recursion)
   (with-no-warnings (defvar features))  ;Not just a local variable.
   (let ((features (cons 'gnus-sum features)))
+    ;; FIXME: Break this mutual dependency.
     (require 'gnus-art)))
 
 ;; MIME stuff.
@@ -1812,7 +1816,7 @@ matter is removed.  Additional things can be deleted by 
setting
       (setq modified-tick (buffer-modified-tick))
       (cond
        ((listp regexp)
-       (mapc 'gnus-simplify-buffer-fuzzy-step regexp))
+       (mapc #'gnus-simplify-buffer-fuzzy-step regexp))
        (regexp
        (gnus-simplify-buffer-fuzzy-step regexp)))
       (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
@@ -2482,13 +2486,13 @@ increase the score of each group you read."
                     (let ((command (intern (format "\
 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
                       (fset command
-                            `(lambda ()
-                               (interactive)
-                               (let ((gnus-summary-show-article-charset-alist
-                                      '((1 . ,cs))))
-                                 (gnus-summary-show-article 1))))
+                            (lambda ()
+                              (interactive)
+                              (let ((gnus-summary-show-article-charset-alist
+                                     `((1 . ,cs))))
+                                (gnus-summary-show-article 1))))
                       `[,(symbol-name cs) ,command t]))
-                  (sort (coding-system-list) 'string<)))))
+                  (sort (coding-system-list) #'string<)))))
             ("Washing"
              ("Remove Blanks"
               ["Leading" gnus-article-strip-leading-blank-lines t]
@@ -2676,15 +2680,15 @@ gnus-summary-show-article-from-menu-as-charset-%s" 
cs))))
           (interactive)
           (setq message-cite-function
                 (if (eq message-cite-function
-                        'message-cite-original-without-signature)
-                    'message-cite-original
-                  'message-cite-original-without-signature)))
+                        #'message-cite-original-without-signature)
+                    #'message-cite-original
+                  #'message-cite-original-without-signature)))
         :visible (memq message-cite-function
                        '(message-cite-original-without-signature
                          message-cite-original))
         :style toggle
         :selected (eq message-cite-function
-                      'message-cite-original-without-signature)
+                      #'message-cite-original-without-signature)
         :help "Strip signature from cited article when replying."]))
 
     (cond
@@ -3026,7 +3030,7 @@ When FORCE, rebuild the tool bar."
          header)
       (list
        (apply
-       'nconc
+       #'nconc
        (list
         (if (eq type 'lower)
             "Lower score"
@@ -3037,7 +3041,7 @@ When FORCE, rebuild the tool bar."
            (setq outh
                  (cons
                   (apply
-                   'nconc
+                   #'nconc
                    (list (car header))
                    (let ((ts (cdr (assoc (nth 2 header) types)))
                          outt)
@@ -3045,7 +3049,7 @@ When FORCE, rebuild the tool bar."
                        (setq outt
                              (cons
                               (apply
-                               'nconc
+                               #'nconc
                                (list (caar ts))
                                (let ((ps perms)
                                      outp)
@@ -3133,10 +3137,10 @@ The following commands are available:
   (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)
+  (add-hook 'pre-command-hook #'gnus-set-global-variables nil t)
   (mm-enable-multibyte)
   (set (make-local-variable 'bookmark-make-record-function)
-       'gnus-summary-bookmark-make-record))
+       #'gnus-summary-bookmark-make-record))
 
 (defun gnus-summary-make-local-variables ()
   "Make all the local summary buffer variables."
@@ -3267,7 +3271,7 @@ The following commands are available:
 
 (defun gnus-summary-article-pseudo-p (article)
   "Say whether this article is a pseudo article or not."
-  (not (vectorp (gnus-data-header (gnus-data-find article)))))
+  (not (mail-header-p (gnus-data-header (gnus-data-find article)))))
 
 (defmacro gnus-summary-article-sparse-p (article)
   "Say whether this article is a sparse article or not."
@@ -3309,10 +3313,12 @@ article number."
      (or (get-text-property (point) 'gnus-number)
         (gnus-summary-last-subject))))
 
-(defmacro gnus-summary-article-header (&optional number)
+(define-inline gnus-summary-article-header (&optional number)
   "Return the header of article NUMBER."
-  `(gnus-data-header (gnus-data-find
-                     ,(or number '(gnus-summary-article-number)))))
+  (inline-quote
+   (gnus-data-header (gnus-data-find
+                     ,(or number
+                           (inline-quote (gnus-summary-article-number)))))))
 
 (defmacro gnus-summary-thread-level (&optional number)
   "Return the level of thread that starts with article NUMBER."
@@ -3341,7 +3347,7 @@ article number."
             '(gnus-data-header (assq (gnus-summary-article-number)
                                      gnus-newsgroup-data)))))
      (and headers
-         (vectorp headers)
+         (mail-header-p headers)
          (mail-header-subject headers))))
 
 (defmacro gnus-summary-article-score (&optional number)
@@ -3409,14 +3415,13 @@ marks of articles."
 
 (defmacro gnus-save-hidden-threads (&rest forms)
   "Save hidden threads, eval FORMS, and restore the hidden threads."
+  (declare (indent 0) (debug t))
   (let ((config (make-symbol "config")))
     `(let ((,config (gnus-hidden-threads-configuration)))
        (unwind-protect
           (save-excursion
             ,@forms)
         (gnus-restore-hidden-threads-configuration ,config)))))
-(put 'gnus-save-hidden-threads 'lisp-indent-function 0)
-(put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
 
 (defun gnus-data-compute-positions ()
   "Compute the positions of all articles."
@@ -3599,6 +3604,9 @@ buffer that was in action when the last article was 
fetched."
       t
     (not (cdr (gnus-data-find-list article)))))
 
+(defconst gnus--dummy-mail-header
+  (make-full-mail-header 0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" 
nil))
+
 (defun gnus-make-thread-indent-array (&optional n)
   (when (or n
            (progn (setq n 200) nil)
@@ -3627,10 +3635,9 @@ buffer that was in action when the last article was 
fetched."
              (gnus-undownloaded-mark ?Z)
              (gnus-summary-line-format-spec spec)
              (gnus-newsgroup-downloadable '(0))
-             (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
              case-fold-search ignores)
          ;; Here, all marks are bound to Z.
-         (gnus-summary-insert-line header
+         (gnus-summary-insert-line gnus--dummy-mail-header
                                    0 nil t gnus-tmp-unread t nil "" nil 1)
          (goto-char (point-min))
          ;; Memorize the positions of the same characters as dummy marks.
@@ -3644,7 +3651,7 @@ buffer that was in action when the last article was 
fetched."
                gnus-score-below-mark ?C
                gnus-score-over-mark ?C
                gnus-undownloaded-mark ?D)
-         (gnus-summary-insert-line header
+         (gnus-summary-insert-line gnus--dummy-mail-header
                                    0 nil t gnus-tmp-unread t nil "" nil 1)
          ;; Ignore characters which aren't dummy marks.
          (dolist (p ignores)
@@ -3783,9 +3790,9 @@ buffer that was in action when the last article was 
fetched."
       (setq gnus-tmp-name gnus-tmp-from))
     (unless (numberp gnus-tmp-lines)
       (setq gnus-tmp-lines -1))
-    (if (= gnus-tmp-lines -1)
-       (setq gnus-tmp-lines "?")
-      (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
+    (setq gnus-tmp-lines (if (= gnus-tmp-lines -1)
+                            "?"
+                           (number-to-string gnus-tmp-lines)))
     (condition-case ()
        (put-text-property
         (point)
@@ -3843,8 +3850,8 @@ the thread are to be displayed."
            1)
           ((and (consp thread) (cdr thread))
            (apply
-            '+ 1 (mapcar
-                  'gnus-summary-number-of-articles-in-thread (cdr thread))))
+            #'+ 1 (mapcar
+                   #'gnus-summary-number-of-articles-in-thread (cdr thread))))
           ((null thread)
            1)
           ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
@@ -3852,9 +3859,9 @@ the thread are to be displayed."
           (t 0))))
     (when (and level (zerop level) gnus-tmp-new-adopts)
       (cl-incf number
-           (apply '+ (mapcar
-                      'gnus-summary-number-of-articles-in-thread
-                      gnus-tmp-new-adopts))))
+           (apply #'+ (mapcar
+                       #'gnus-summary-number-of-articles-in-thread
+                       gnus-tmp-new-adopts))))
     (if char
        (if (> number 1) gnus-not-empty-thread-mark
          gnus-empty-thread-mark)
@@ -4074,9 +4081,10 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
       (unless no-display
        (gnus-summary-prepare))
       (when gnus-use-trees
-       (gnus-tree-open)
+       (gnus-tree-open)                ;Autoloaded from gnus-salt.
+        (declare-function gnus-tree-highlight-article "gnus-salt" (article 
face))
        (setq gnus-summary-highlight-line-function
-             'gnus-tree-highlight-article))
+             #'gnus-tree-highlight-article))
       ;; If the summary buffer is empty, but there are some low-scored
       ;; articles or some excluded dormants, we include these in the
       ;; buffer.
@@ -4338,7 +4346,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
                (when (and (car refs)
                           (not (zerop
                                 (apply
-                                 '+
+                                 #'+
                                  (mapcar
                                   (lambda (thread)
                                     (gnus-thread-loop-p
@@ -4398,7 +4406,7 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
       (setq id-dep (puthash (setq id (nnmail-message-id))
                            (list header)
                            dependencies))
-      (mail-header-set-id header id))
+      (setf (mail-header-id header) id))
 
      ;; The last case ignores an existing entry, except it adds any
      ;; additional Xrefs (in case the two articles came from different
@@ -4406,11 +4414,10 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
      ;; Also sets `header' to nil meaning that the `dependencies'
      ;; table was *not* modified.
      (t
-      (mail-header-set-xref
-       (car id-dep)
-       (concat (or (mail-header-xref (car id-dep))
-                  "")
-              (or (mail-header-xref header) "")))
+      (setf (mail-header-xref (car id-dep))
+            (concat (or (mail-header-xref (car id-dep))
+                       "")
+                   (or (mail-header-xref header) "")))
       (setq header nil)))
 
     (when (and header (not replaced))
@@ -4424,7 +4431,7 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
            ;; Yuk!  This is a reference loop.  Make the article be a
            ;; root article.
            (progn
-             (mail-header-set-references (car id-dep) "none")
+             (setf (mail-header-references (car id-dep)) "none")
              (setq ref nil)
              (setq parent-id nil))
          (setq ref (gnus-parent-id (mail-header-references ref-header)))))
@@ -4479,7 +4486,7 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
          (erase-buffer)))
       (kill-buffer (current-buffer)))
     ;; Sort over trustworthiness.
-    (dolist (relation (sort relations 'car-less-than-car))
+    (dolist (relation (sort relations #'car-less-than-car))
       (when (gnus-dependencies-add-header
             (make-full-mail-header
              gnus-reffed-article-number
@@ -4562,8 +4569,8 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
     (when (and (string= references "")
               (setq in-reply-to (mail-header-extra header))
               (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
-      (mail-header-set-references
-       header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
+      (setf (mail-header-references header)
+            (gnus-extract-message-id-from-in-reply-to in-reply-to)))
 
     (when gnus-alter-header-function
       (funcall gnus-alter-header-function header))
@@ -4828,7 +4835,7 @@ If LINE, insert the rebuilt thread starting on line LINE."
 (defun gnus-articles-in-thread (thread)
   "Return the list of articles in THREAD."
   (cons (mail-header-number (car thread))
-       (mapcan 'gnus-articles-in-thread (cdr thread))))
+       (mapcan #'gnus-articles-in-thread (cdr thread))))
 
 (defun gnus-remove-thread (id &optional dont-remove)
   "Remove the thread that has ID in it."
@@ -4916,7 +4923,8 @@ If LINE, insert the rebuilt thread starting on line LINE."
                          (and (cdr thread)
                               (gnus-sort-subthreads-recursive
                                (cdr thread) subthread-sort-func))))
-                 threads) func)))
+                 threads)
+          func)))
 
 (defun gnus-sort-subthreads-recursive (threads func)
   ;; Responsible for sorting subthreads.
@@ -4924,7 +4932,8 @@ If LINE, insert the rebuilt thread starting on line LINE."
                  (cons (car thread)
                        (and (cdr thread)
                             (gnus-sort-subthreads-recursive (cdr thread) 
func))))
-               threads) func))
+               threads)
+        func))
 
 (defun gnus-sort-threads-loop (threads func)
   (let* ((superthread (cons nil threads))
@@ -4999,14 +5008,12 @@ using some other form will lead to serious barfage."
   (gnus-article-sort-by-number
    (gnus-thread-header h1) (gnus-thread-header h2)))
 
-(defsubst gnus-article-sort-by-random (h1 h2)
+(defsubst gnus-article-sort-by-random (_h1 _h2)
   "Sort articles randomly."
   (zerop (random 2)))
 
-(defun gnus-thread-sort-by-random (h1 h2)
-  "Sort threads randomly."
-  (gnus-article-sort-by-random
-   (gnus-thread-header h1) (gnus-thread-header h2)))
+(defalias 'gnus-thread-sort-by-random #'gnus-article-sort-by-random
+  "Sort threads randomly.")
 
 (defsubst gnus-article-sort-by-lines (h1 h2)
   "Sort articles by article Lines header."
@@ -5122,7 +5129,7 @@ Unscored articles will be counted as having a score of 
zero."
    ((consp thread)
     (if (stringp (car thread))
        (apply gnus-thread-score-function 0
-              (mapcar 'gnus-thread-total-score-1 (cdr thread)))
+              (mapcar #'gnus-thread-total-score-1 (cdr thread)))
       (gnus-thread-total-score-1 thread)))
    (t
     (gnus-thread-total-score-1 (list thread)))))
@@ -5137,7 +5144,7 @@ Unscored articles will be counted as having a score of 
zero."
 
 (defun gnus-thread-highest-number (thread)
   "Return the highest article number in THREAD."
-  (apply 'max (mapcar (lambda (header)
+  (apply #'max (mapcar (lambda (header)
                        (mail-header-number header))
                      (flatten-tree thread))))
 
@@ -5155,7 +5162,7 @@ Unscored articles will be counted as having a score of 
zero."
 ; quite a bit to use gnus-date-get-time, which caches the time value.
 (defun gnus-thread-latest-date (thread)
   "Return the highest article date in THREAD."
-  (apply 'max
+  (apply #'max
         (mapcar (lambda (header) (float-time
                                   (gnus-date-get-time
                                    (mail-header-date header))))
@@ -5166,7 +5173,7 @@ Unscored articles will be counted as having a score of 
zero."
   (setq root (car root))
   (apply gnus-thread-score-function
         (or (append
-             (mapcar 'gnus-thread-total-score
+             (mapcar #'gnus-thread-total-score
                      (cdr (gnus-id-to-thread (mail-header-id root))))
              (when (> (mail-header-number root) 0)
                (list (or (cdr (assq (mail-header-number root)
@@ -5262,7 +5269,7 @@ or a straight list of headers."
        gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
        gnus-tmp-replied gnus-tmp-subject-or-nil
        gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
-       gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
+       gnus-tmp-score-char gnus-tmp-from gnus-tmp-name gnus-tmp-thread
        gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
        tree-stack)
 
@@ -5500,7 +5507,7 @@ or a straight list of headers."
                     (t
                      (or gnus-sum-thread-tree-single-indent subject))))
              (t
-              (concat (apply 'concat
+              (concat (apply #'concat
                              (mapcar (lambda (item)
                                        (if (= item 1)
                                            gnus-sum-thread-tree-vertical
@@ -5513,9 +5520,10 @@ or a straight list of headers."
              (setq gnus-tmp-name gnus-tmp-from))
            (unless (numberp gnus-tmp-lines)
              (setq gnus-tmp-lines -1))
-           (if (= gnus-tmp-lines -1)
-               (setq gnus-tmp-lines "?")
-             (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
+           (setq gnus-tmp-lines (if (= gnus-tmp-lines -1)
+                                    "?"
+                                   (number-to-string gnus-tmp-lines)))
+            (setq gnus-tmp-thread thread)
            (put-text-property
             (point)
             (progn (eval gnus-summary-line-format-spec) (point))
@@ -5594,7 +5602,7 @@ or a straight list of headers."
   "Get list identifier regexp for GROUP."
   (or (gnus-parameter-list-identifier group)
       (if (consp gnus-list-identifiers)
-          (mapconcat 'identity gnus-list-identifiers " *\\|")
+          (mapconcat #'identity gnus-list-identifiers " *\\|")
         gnus-list-identifiers)))
 
 (defun gnus-summary-remove-list-identifiers ()
@@ -5616,7 +5624,7 @@ or a straight list of headers."
            (setq subject
                  (concat (substring subject 0 (match-beginning 1))
                          (substring subject (match-end 1)))))
-         (mail-header-set-subject header subject))))))
+         (setf (mail-header-subject header) subject))))))
 
 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
   "Fetch headers of ARTICLES."
@@ -5695,11 +5703,11 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
             ((not (zerop (or (car-safe read-all) 0)))
              ;; The user entered the group with C-u SPC/RET, let's show
              ;; all articles.
-             'gnus-not-ignore)
+             #'gnus-not-ignore)
             ((eq display 'all)
-             'gnus-not-ignore)
+             #'gnus-not-ignore)
             ((arrayp display)
-             (gnus-summary-display-make-predicate (mapcar 'identity display)))
+             (gnus-summary-display-make-predicate (mapcar #'identity display)))
             ((numberp display)
              ;; The following is probably the "correct" solution, but
              ;; it makes Gnus fetch all headers and then limit the
@@ -5707,9 +5715,8 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
              ;; select-articles parameter instead. -- Simon Josefsson
              ;; <address@hidden>
              ;;
-             ;; (gnus-byte-compile
-             ;;  `(lambda () (> number ,(- (cdr (gnus-active group))
-             ;;                         display)))))
+             ;;  (let ((n (cdr (gnus-active group))))
+             ;;    (lambda () (> number (- n display))))
              (setq select-articles
                    (gnus-uncompress-range
                     (cons (let ((tmp (- (cdr (gnus-active group)) display)))
@@ -5773,8 +5780,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
       (setq gnus-newsgroup-limit (copy-sequence articles))
       ;; Remove canceled articles from the list of unread articles.
       (setq fetched-articles
-           (mapcar (lambda (headers) (mail-header-number headers))
-                   gnus-newsgroup-headers))
+           (mapcar #'mail-header-number gnus-newsgroup-headers))
       (setq gnus-newsgroup-articles fetched-articles)
       (setq gnus-newsgroup-unreads
            (gnus-sorted-nintersection
@@ -5833,8 +5839,8 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
                            (unseen . unseen))
                          gnus-article-mark-lists))
       (push (cons (cdr elem)
-                 (gnus-byte-compile    ;Why bother?
-                  `(lambda () (gnus-article-marked-p ',(cdr elem)))))
+                  (let ((x (cdr elem)))
+                   (lambda () (gnus-article-marked-p x))))
            gnus-summary-display-cache)))
   (let ((gnus-category-predicate-alist gnus-summary-display-cache)
        (gnus-category-predicate-cache gnus-summary-display-cache))
@@ -5974,7 +5980,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
        select
       (if (and (not (zerop scored)) (<= (abs select) scored))
          (progn
-           (setq articles (sort scored-list '<))
+           (setq articles (sort scored-list #'<))
            (setq number (length articles)))
        (setq articles (copy-sequence articles)))
 
@@ -5991,7 +5997,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
              (sort
               (funcall gnus-alter-articles-to-read-function
                        gnus-newsgroup-name articles)
-              '<)))
+              #'<)))
       articles)))
 
 (defun gnus-killed-articles (killed articles)
@@ -6137,7 +6143,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
          (setq list (gnus-range-add list gnus-newsgroup-unseen)))
 
        (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
-         (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
+         (setq list (gnus-compress-sequence (set symbol (sort list #'<)) t)))
 
        (when (and (gnus-check-backend-function
                    'request-set-mark gnus-newsgroup-name)
@@ -6220,7 +6226,7 @@ If WHERE is `summary', the summary mode line format will 
be used."
                                 gnus-tmp-unselected))))
               (gnus-tmp-subject
                (if (and gnus-current-headers
-                        (vectorp gnus-current-headers))
+                        (mail-header-p gnus-current-headers))
                    (gnus-mode-string-quote
                     (mail-header-subject gnus-current-headers))
                  ""))
@@ -6343,7 +6349,7 @@ The resulting hash table is returned, or nil if no Xrefs 
were found."
        (setq ninfo (gnus-info-read info)))
       ;; Then we add the read articles to the range.
       (gnus-add-to-range
-       ninfo (setq articles (sort articles '<))))))
+       ninfo (setq articles (sort articles #'<))))))
 
 (defun gnus-group-make-articles-read (group articles)
   "Update the info of GROUP to say that ARTICLES are read."
@@ -6437,7 +6443,7 @@ The resulting hash table is returned, or nil if no Xrefs 
were found."
          ;; doesn't always go hand in hand.
          (setq
           header
-          (vector
+          (make-full-mail-header
            ;; Number.
            (prog1
                (setq number (read cur))
@@ -6567,7 +6573,7 @@ Return a list of headers that match SEQUENCE (see
 `nntp-retrieve-headers')."
   ;; Get the Xref when the users reads the articles since most/some
   ;; NNTP servers do not include Xrefs when using XOVER.
-  (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
+  (setq gnus-article-internal-prepare-hook (list #'gnus-article-get-xrefs))
   (let ((mail-parse-charset gnus-newsgroup-charset)
        (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
        (cur nntp-server-buffer)
@@ -6640,7 +6646,7 @@ This is meant to be called in 
`gnus-article-internal-prepare-hook'."
                      (search-forward "\nXref:" nil t))
              (goto-char (1+ (match-end 0)))
              (setq xref (buffer-substring (point) (point-at-eol)))
-             (mail-header-set-xref headers xref)))))))
+             (setf (mail-header-xref headers) xref)))))))
 
 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
   "Find article ID and insert the summary line for that article.
@@ -6650,7 +6656,7 @@ If USE-OLD-HEADER is non-nil, then OLD-HEADER should be a 
header,
 and OLD-HEADER will be used when the summary line is inserted,
 too, instead of trying to fetch new headers."
   (let* ((line (and (numberp old-header) old-header))
-        (old-header (and (vectorp old-header) old-header))
+        (old-header (and (mail-header-p old-header) old-header))
         (header (cond ((and old-header use-old-header)
                        old-header)
                       ((and (numberp id)
@@ -6678,7 +6684,7 @@ too, instead of trying to fetch new headers."
       (let ((gnus-newsgroup-headers (list header)))
         (gnus-summary-remove-list-identifiers))
       (when old-header
-       (mail-header-set-number header (mail-header-number old-header)))
+       (setf (mail-header-number header) (mail-header-number old-header)))
       (setq gnus-newsgroup-sparse
            (delq (setq number (mail-header-number header))
                  gnus-newsgroup-sparse))
@@ -6752,6 +6758,7 @@ current article will be taken into consideration."
   "Iterate over the process/prefixed articles and do FORMS.
 ARG is the interactive prefix given to the command.  FORMS will be
 executed with point over the summary line of the articles."
+  (declare (indent 1) (debug t))
   (let ((articles (make-symbol "gnus-summary-iterate-articles")))
     `(let ((,articles (gnus-summary-work-articles ,arg)))
        (while ,articles
@@ -6759,9 +6766,6 @@ executed with point over the summary line of the 
articles."
         ,@forms
         (pop ,articles)))))
 
-(put 'gnus-summary-iterate 'lisp-indent-function 1)
-(put 'gnus-summary-iterate 'edebug-form-spec '(form body))
-
 (defun gnus-summary-save-process-mark ()
   "Push the current set of process marked articles on the stack."
   (interactive)
@@ -6784,7 +6788,7 @@ executed with point over the summary line of the 
articles."
 (defun gnus-summary-process-mark-set (set)
   "Make SET into the current process marked articles."
   (gnus-summary-unmark-all-processable)
-  (mapc 'gnus-summary-set-process-mark set))
+  (mapc #'gnus-summary-set-process-mark set))
 
 ;;; Searching and stuff
 
@@ -6890,7 +6894,7 @@ If EXCLUDE-GROUP, do not go to this group."
     (while arts
       (and (or (not unread)
               (gnus-data-unread-p (car arts)))
-          (vectorp (gnus-data-header (car arts)))
+          (mail-header-p (gnus-data-header (car arts)))
           (gnus-subject-equal
            simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
           (setq result (car arts)
@@ -7166,7 +7170,7 @@ buffer."
   (gnus-summary-position-point))
 
 (define-obsolete-function-alias
-    'gnus-summary-toggle-truncation 'toggle-truncate-lines "26.1")
+    'gnus-summary-toggle-truncation #'toggle-truncate-lines "26.1")
 
 (defun gnus-summary-find-for-reselect ()
   "Return the number of an article to stay on across a reselect.
@@ -7727,7 +7731,7 @@ If FORCE, also allow jumping to articles not currently 
shown."
         force
         (gnus-summary-insert-subject
          article
-         (if (or (numberp force) (vectorp force)) force)
+         (if (or (numberp force) (mail-header-p force)) force)
          t)
         (setq data (gnus-data-find article)))
     (goto-char b)
@@ -7772,9 +7776,9 @@ Given a prefix, will force an `article' buffer 
configuration."
   (if (null article)
       nil
     (prog1
-       (if gnus-summary-display-article-function
-           (funcall gnus-summary-display-article-function article all-header)
-         (gnus-article-prepare article all-header))
+       (funcall (or gnus-summary-display-article-function
+                     #'gnus-article-prepare)
+                 article all-header)
       (gnus-run-hooks 'gnus-select-article-hook)
       (when (and gnus-current-article
                 (not (zerop gnus-current-article)))
@@ -8229,7 +8233,7 @@ is a number, it is the line the article is to be 
displayed on."
    (list
     (gnus-completing-read
      "Article number or Message-ID"
-     (mapcar 'int-to-string gnus-newsgroup-limit))
+     (mapcar #'int-to-string gnus-newsgroup-limit))
     current-prefix-arg
     t))
   (prog1
@@ -8281,8 +8285,7 @@ If given a prefix, remove all limits."
   (interactive "P")
   (when total
     (setq gnus-newsgroup-limits
-         (list (mapcar (lambda (h) (mail-header-number h))
-                       gnus-newsgroup-headers))))
+         (list (mapcar #'mail-header-number gnus-newsgroup-headers))))
   (unless gnus-newsgroup-limits
     (error "No limit to pop"))
   (prog1
@@ -8410,9 +8413,9 @@ in `nnmail-extra-headers'."
                           (if (eq to t)
                               from
                             (mapcar (lambda (a) (car (memq a from))) to))
-                        (if (eq to t)
-                            (mapcar (lambda (a) (car (memq a from))) cc)
-                          (mapcar (lambda (a) (car (memq a from)))
+                        (mapcar (lambda (a) (car (memq a from)))
+                                 (if (eq to t)
+                                    cc
                                   (mapcar (lambda (a) (car (memq a to)))
                                           cc))))
                     (nconc (if (eq to t) nil to)
@@ -8473,7 +8476,7 @@ articles that are younger than AGE days."
            (cutoff (days-to-time age))
            articles d date is-younger)
        (while (setq d (pop data))
-         (when (and (vectorp (gnus-data-header d))
+         (when (and (mail-header-p (gnus-data-header d))
                     (setq date (mail-header-date (gnus-data-header d))))
            (setq is-younger (time-less-p
                              (time-since (gnus-date-get-time date))
@@ -8494,7 +8497,7 @@ articles that are younger than AGE days."
            (if current-prefix-arg
                "Exclude extra header"
              "Limit extra header")
-           (mapcar 'symbol-name gnus-extra-headers)
+           (mapcar #'symbol-name gnus-extra-headers)
            t nil nil
             (symbol-name (car gnus-extra-headers))))))
      (list header
@@ -8787,12 +8790,11 @@ fetched for this group."
   "Mark all unread excluded articles as read.
 If ALL, mark even excluded ticked and dormants as read."
   (interactive "P")
-  (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
+  (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit #'<))
   (let ((articles (gnus-sorted-ndifference
                   (sort
-                   (mapcar (lambda (h) (mail-header-number h))
-                           gnus-newsgroup-headers)
-                   '<)
+                   (mapcar #'mail-header-number gnus-newsgroup-headers)
+                   #'<)
                   gnus-newsgroup-limit))
        article)
     (setq gnus-newsgroup-unreads
@@ -8907,7 +8909,7 @@ fetch-old-headers verbiage, and so on."
   ;; Most groups have nothing to remove.
   (unless (or gnus-inhibit-limiting
              (and (null gnus-newsgroup-dormant)
-                  (eq gnus-newsgroup-display 'gnus-not-ignore)
+                  (eq gnus-newsgroup-display #'gnus-not-ignore)
                   (not (eq gnus-fetch-old-headers 'some))
                   (not (numberp gnus-fetch-old-headers))
                   (not (eq gnus-fetch-old-headers 'invisible))
@@ -8948,7 +8950,7 @@ fetch-old-headers verbiage, and so on."
     (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
           (children
           (if (cdr thread)
-              (apply '+ (mapcar 'gnus-summary-limit-children
+              (apply #'+ (mapcar #'gnus-summary-limit-children
                                 (cdr thread)))
             0))
           (number (mail-header-number (car thread)))
@@ -9018,7 +9020,7 @@ fetch-old-headers verbiage, and so on."
       (push (cons number gnus-low-score-mark)
            gnus-newsgroup-reads)))
   ;; Go recursively through all subthreads.
-  (mapcar 'gnus-expunge-thread (cdr thread)))
+  (mapcar #'gnus-expunge-thread (cdr thread)))
 
 ;; Summary article oriented commands
 
@@ -9137,11 +9139,13 @@ non-numeric or nil fetch the number specified by the
                   (refs (split-string (or (mail-header-references header)
                                           "")))
                   (gnus-parse-headers-hook
-                   `(lambda () (goto-char (point-min))
-                     (keep-lines
-                      (regexp-opt ',(append refs (list id subject)))))))
+                    (let ((refs (append refs (list id subject))))
+                     (lambda ()
+                        (goto-char (point-min))
+                       (keep-lines (regexp-opt refs))))))
              (gnus-fetch-headers (list last) (if (numberp limit)
-                                                 (* 2 limit) limit) t))))
+                                                 (* 2 limit) limit)
+                                  t))))
         article-ids new-unreads)
     (when (listp new-headers)
       (dolist (header new-headers)
@@ -9423,8 +9427,11 @@ With optional ARG, move across that many fields."
   (interactive "p")
   (gnus-summary-select-article)
   (gnus-configure-windows 'article)
-  (select-window (gnus-get-buffer-window gnus-article-buffer))
-  (widget-forward arg))
+  (let ((win (or (gnus-get-buffer-window gnus-article-buffer t)
+                 (error "No article window found"))))
+    (select-window win)
+    (select-frame-set-input-focus (window-frame win))
+    (widget-forward arg)))
 
 (defun gnus-summary-widget-backward (arg)
   "Move point to the previous field or button in the article.
@@ -9432,10 +9439,13 @@ With optional ARG, move across that many fields."
   (interactive "p")
   (gnus-summary-select-article)
   (gnus-configure-windows 'article)
-  (select-window (gnus-get-buffer-window gnus-article-buffer))
-  (unless (widget-at (point))
-    (goto-char (point-max)))
-  (widget-backward arg))
+  (let ((win (or (gnus-get-buffer-window gnus-article-buffer t)
+                 (error "No article window found"))))
+    (select-window win)
+    (select-frame-set-input-focus (window-frame win))
+    (unless (widget-at (point))
+      (goto-char (point-max)))
+    (widget-backward arg)))
 
 (defun gnus-summary-isearch-article (&optional regexp-p)
   "Do incremental search forward on the current article.
@@ -9572,8 +9582,7 @@ Optional argument BACKWARD means do search for backward.
 This search includes all articles in the current group that Gnus has
 fetched headers for, whether they are displayed or not."
   (let ((articles nil)
-       ;; Can't eta-reduce because it's a macro.
-       (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
+       (func (intern (concat "mail-header-" header)))
        (case-fold-search t))
     (dolist (header gnus-newsgroup-headers)
       ;; FIXME: when called from gnus-summary-limit-include-thread via
@@ -9597,13 +9606,14 @@ not match REGEXP on HEADER."
     (if (consp header)
        (if (eq (car header) 'extra)
            (setq func
-                 `(lambda (h)
-                    (or (cdr (assq ',(cdr header) (mail-header-extra h)))
-                        "")))
+                  (let ((x (cdr header)))
+                   (lambda (h)
+                     (or (cdr (assq x (mail-header-extra h)))
+                         ""))))
          (error "%s is an invalid header" header))
       (unless (fboundp (intern (concat "mail-header-" header)))
        (error "%s is not a valid header" header))
-      (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
+      (setq func (intern (concat "mail-header-" header))))
     (dolist (d (if (eq backward 'all)
                   gnus-newsgroup-data
                 (gnus-data-find-list
@@ -9611,7 +9621,7 @@ not match REGEXP on HEADER."
                  (gnus-data-list backward))))
       (when (and (or (not unread)      ; We want all articles...
                     (gnus-data-unread-p d)) ; Or just unreads.
-                (vectorp (gnus-data-header d)) ; It's not a pseudo.
+                (mail-header-p (gnus-data-header d)) ; It's not a pseudo.
                 (if not-matching
                     (not (string-match
                           regexp
@@ -9629,7 +9639,7 @@ article.  If BACKWARD (the prefix) is non-nil, search 
backward instead."
    (list (let ((completion-ignore-case t))
           (gnus-completing-read
            "Header name"
-           (mapcar 'symbol-name
+           (mapcar #'symbol-name
                    (append
                     '(Number Subject From Lines Date
                       Message-ID Xref References Body)
@@ -10143,7 +10153,7 @@ ACTION can be either `move' (the default), `crosspost' 
or `copy'."
             (setq xref (list (system-name))))
           (setq new-xref
                 (concat
-                 (mapconcat 'identity
+                 (mapconcat #'identity
                             (delete "Xref:" (delete new-xref xref))
                             " ")
                  " " new-xref))
@@ -10302,7 +10312,7 @@ ACTION can be either `move' (the default), `crosspost' 
or `copy'."
       (push article articles-to-update-marks))
 
     (save-excursion
-      (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
+      (apply #'gnus-summary-remove-process-mark articles-to-update-marks))
     ;; Re-activate all groups that have been moved to.
     (with-current-buffer gnus-group-buffer
       (let ((gnus-group-marked to-groups))
@@ -10494,7 +10504,7 @@ This will be the case if the article has both been 
mailed and posted."
                   (gnus-summary-update-info)
                   (gnus-list-of-read-articles gnus-newsgroup-name))
               (setq gnus-newsgroup-expirable
-                    (sort gnus-newsgroup-expirable '<)))
+                    (sort gnus-newsgroup-expirable #'<)))
             gnus-newsgroup-unexist))
           (expiry-wait (if now 'immediate
                          (gnus-group-find-parameter
@@ -10573,7 +10583,7 @@ confirmation before the articles are deleted."
   (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
     (error "Couldn't open server"))
   ;; Compute the list of articles to delete.
-  (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
+  (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) #'<))
        (nnmail-expiry-target 'delete)
        not-deleted)
     (if (and gnus-novice-user
@@ -10654,15 +10664,15 @@ groups."
            (setq raw t))
        (gnus-article-edit-article
         (if raw 'ignore
-          `(lambda ()
-             (let ((mbl mml-buffer-list))
-               (setq mml-buffer-list nil)
-               (let ((rfc2047-quote-decoded-words-containing-tspecials t))
-                 (mime-to-mml ',current-handles))
-               (let ((mbl1 mml-buffer-list))
-                 (setq mml-buffer-list mbl)
-                 (set (make-local-variable 'mml-buffer-list) mbl1))
-               (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
+          (lambda ()
+            (let ((mbl mml-buffer-list))
+              (setq mml-buffer-list nil)
+              (let ((rfc2047-quote-decoded-words-containing-tspecials t))
+                (mime-to-mml current-handles))
+              (let ((mbl1 mml-buffer-list))
+                (setq mml-buffer-list mbl)
+                (set (make-local-variable 'mml-buffer-list) mbl1))
+              (add-hook 'kill-buffer-hook #'mml-destroy-buffers t t))))
         `(lambda (no-highlight)
            (let ((mail-parse-charset ',gnus-newsgroup-charset)
                  (message-options message-options)
@@ -10682,7 +10692,7 @@ groups."
                                (mml-to-mime)
                                (mml-destroy-buffers)
                                (remove-hook 'kill-buffer-hook
-                                            'mml-destroy-buffers t)
+                                            #'mml-destroy-buffers t)
                                (kill-local-variable 'mml-buffer-list)))
              (gnus-summary-edit-article-done
               ,(or (mail-header-references gnus-current-headers) "")
@@ -10817,7 +10827,7 @@ groups."
        (unless silent
          (if groups
              (message "This message would go to %s"
-                      (mapconcat 'car groups ", "))
+                      (mapconcat #'car groups ", "))
            (message "This message would go to no groups"))
          groups)))))
 
@@ -11148,7 +11158,7 @@ If NO-EXPIRE, auto-expiry will be inhibited."
 
        ;; See whether the article is to be put in the cache.
        (and gnus-use-cache
-            (vectorp (gnus-summary-article-header article))
+            (mail-header-p (gnus-summary-article-header article))
             (save-excursion
               (gnus-cache-possibly-enter-article
                gnus-newsgroup-name article
@@ -11195,7 +11205,7 @@ If NO-EXPIRE, auto-expiry will be inhibited."
        ;; See whether the article is to be put in the cache.
        (and gnus-use-cache
             (not (= mark gnus-canceled-mark))
-            (vectorp (gnus-summary-article-header article))
+            (mail-header-p (gnus-summary-article-header article))
             (save-excursion
               (gnus-cache-possibly-enter-article
                gnus-newsgroup-name article
@@ -11625,6 +11635,7 @@ read."
 (defmacro gnus-with-article (article &rest forms)
   "Select ARTICLE and perform FORMS in the original article buffer.
 Then replace the article with the result."
+  (declare (indent 1) (debug t))
   `(progn
      ;; We don't want the article to be marked as read.
      (let (gnus-mark-article-hook)
@@ -11646,9 +11657,6 @@ Then replace the article with the result."
        (gnus-cache-update-article
        (car gnus-article-current) (cdr gnus-article-current)))))
 
-(put 'gnus-with-article 'lisp-indent-function 1)
-(put 'gnus-with-article 'edebug-form-spec '(form body))
-
 ;; Thread-based commands.
 
 (defun gnus-summary-articles-in-thread (&optional article)
@@ -11815,9 +11823,8 @@ Returns nil if no thread was there to be shown."
 
 (defun gnus-map-articles (predicate articles)
   "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
-  (apply 'gnus-or (mapcar predicate
-                         (mapcar (lambda (number)
-                                   (gnus-summary-article-header number))
+  (apply #'gnus-or (mapcar predicate
+                         (mapcar #'gnus-summary-article-header
                                  articles))))
 
 (defun gnus-summary-hide-all-threads (&optional predicate)
@@ -12095,15 +12102,15 @@ Argument REVERSE means reverse order."
         (gnus-thread-sort-functions
          (if (not reverse)
              thread
-           `(lambda (t1 t2)
-              (,thread t2 t1))))
+           (lambda (t1 t2)
+              (funcall thread t2 t1))))
         (gnus-sort-gathered-threads-function
          gnus-thread-sort-functions)
         (gnus-article-sort-functions
          (if (not reverse)
              article
-           `(lambda (t1 t2)
-              (,article t2 t1))))
+           (lambda (t1 t2)
+             (funcall article t2 t1))))
         (inhibit-read-only t)
         (gnus-summary-prepare-hook nil))
     ;; We do the sorting by regenerating the threads.
@@ -12147,7 +12154,7 @@ performed."
         header file)
     (dolist (article articles)
       (setq header (gnus-summary-article-header article))
-      (if (not (vectorp header))
+      (if (not (mail-header-p header))
          ;; This is a pseudo-article.
          (if (assq 'name header)
              (gnus-copy-file (cdr (assq 'name header)))
@@ -12488,7 +12495,7 @@ If REVERSE, save parts that do not match TYPE."
     ;; If all commands are to be bunched up on one line, we collect
     ;; them here.
     (unless gnus-view-pseudos-separately
-      (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
+      (let ((ps (setq pslist (sort pslist #'gnus-pseudos<)))
            files action)
        (while ps
          (setq action (cdr (assq 'action (car ps))))
@@ -12505,7 +12512,7 @@ If REVERSE, save parts that do not match TYPE."
            (when (assq 'execute (car ps))
              (setcdr (assq 'execute (car ps))
                      (funcall (if (string-match "%s" action)
-                                  'format 'concat)
+                                  #'format #'concat)
                               action
                               (mapconcat
                                (lambda (f)
@@ -12643,7 +12650,7 @@ If REVERSE, save parts that do not match TYPE."
              ;; If we fetched by Message-ID and the article came from
              ;; a different group (or server), we fudge some bogus
              ;; article numbers for this article.
-             (mail-header-set-number header gnus-reffed-article-number))
+             (setf (mail-header-number header) gnus-reffed-article-number))
            (with-current-buffer gnus-summary-buffer
              (cl-decf gnus-reffed-article-number)
              (gnus-remove-header (mail-header-number header))
@@ -12932,7 +12939,7 @@ treated as multipart/mixed."
 (defun gnus-summary-make-all-marking-commands ()
   (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
   (dolist (elem gnus-summary-marking-alist)
-    (apply 'gnus-summary-make-marking-command elem)))
+    (apply #'gnus-summary-make-marking-command elem)))
 
 (defun gnus-summary-make-marking-command (name mark keystroke)
   (let ((map (make-sparse-keymap)))
@@ -13046,7 +13053,7 @@ If ALL is non-nil, already read articles become 
readable.
 If ALL is a number, fetch this number of articles."
   (interactive "P")
   (prog1
-      (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
+      (let ((old (sort (mapcar #'car gnus-newsgroup-data) #'<))
            older len)
        (setq older
              ;; Some nntp servers lie about their active range.  When
@@ -13116,7 +13123,7 @@ If ALL is a number, fetch this number of articles."
 (defun gnus-summary-insert-new-articles ()
   "Insert all new articles in this group."
   (interactive)
-  (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
+  (let ((old (sort (mapcar #'car gnus-newsgroup-data) #'<))
        (old-high gnus-newsgroup-highest)
        (nnmail-fetched-sources (list t))
        (new-active (gnus-activate-group gnus-newsgroup-name 'scan))
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index 5f7154c..40c5b42 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -28,6 +28,7 @@
 
 (require 'gnus)
 (require 'gnus-util)
+(require 'seq)
 
 (defgroup gnus-windows nil
   "Window configuration."
@@ -284,7 +285,7 @@ See the Gnus manual for an explanation of the syntax used.")
                 ;; from a hard-dedicated frame, it creates (and
                 ;; configures) a new frame, leaving the dedicated frame alone.
                 (pop-to-buffer buf))
-               (t (switch-to-buffer buf)))))
+               (t (pop-to-buffer-same-window buf)))))
          (when (memq 'frame-focus split)
            (setq gnus-window-frame-focus window))
          ;; We return the window if it has the `point' spec.
@@ -509,15 +510,15 @@ should have point."
              (delq lowest-buf bufs)))))
 
 (defun gnus-get-buffer-window (buffer &optional frame)
-  (cond ((and (null gnus-use-frames-on-any-display)
-             (memq frame '(t 0 visible)))
-        (car
-         (let ((frames (frames-on-display-list)))
-           (seq-remove (lambda (win) (not (memq (window-frame win)
-                                                    frames)))
-                           (get-buffer-window-list buffer nil frame)))))
-       (t
-        (get-buffer-window buffer frame))))
+  "Return a window currently displaying BUFFER, or nil if none.
+Like `get-buffer-window', but respecting
+`gnus-use-frames-on-any-display'."
+  (if (and (not gnus-use-frames-on-any-display)
+           (memq frame '(t 0 visible)))
+      (let ((frames (frames-on-display-list)))
+        (seq-find (lambda (win) (memq (window-frame win) frames))
+                  (get-buffer-window-list buffer nil frame)))
+    (get-buffer-window buffer frame)))
 
 (provide 'gnus-win)
 
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 989347c..7538274 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -2892,7 +2892,7 @@ See Info node `(gnus)Formatting Variables'."
 
 (defun gnus-set-info (group info)
   (setcdr (gethash group gnus-newsrc-hashtb)
-         info))
+         (list info)))
 
 
 ;;;
@@ -3143,7 +3143,7 @@ that that variable is buffer-local to the summary 
buffers."
         t)                                 ;is news of course.
        ((not (gnus-member-of-valid 'post-mail group)) ;Non-combined.
         nil)                           ;must be mail then.
-       ((vectorp article)              ;Has header info.
+       ((mail-header-p article)                ;Has header info.
         (eq (gnus-request-type group (mail-header-id article)) 'news))
        ((null article)                        ;Hasn't header info
         (eq (gnus-request-type group) 'news)) ;(unknown ==> mail)
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 7514e64..9d70bd5 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -31,7 +31,6 @@
 (autoload 'auth-source-search "auth-source")
 (autoload 'pop3-movemail "pop3")
 (autoload 'pop3-get-message-count "pop3")
-(autoload 'nnheader-cancel-timer "nnheader")
 (require 'mm-util)
 (require 'message) ;; for `message-directory'
 
@@ -989,9 +988,9 @@ This only works when `display-time' is enabled."
              (> (prefix-numeric-value arg) 0))))
     (setq mail-source-report-new-mail on)
     (and mail-source-report-new-mail-timer
-        (nnheader-cancel-timer mail-source-report-new-mail-timer))
+        (cancel-timer mail-source-report-new-mail-timer))
     (and mail-source-report-new-mail-idle-timer
-        (nnheader-cancel-timer mail-source-report-new-mail-idle-timer))
+        (cancel-timer mail-source-report-new-mail-idle-timer))
     (setq mail-source-report-new-mail-timer nil)
     (setq mail-source-report-new-mail-idle-timer nil)
     (if on
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c8b6f0e..8b72ef8 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1078,13 +1078,15 @@ point and mark around the citation text as modified."
 
 (defcustom message-signature mail-signature
   "String to be inserted at the end of the message buffer.
-If t, the `message-signature-file' file will be inserted instead.
-If a function, the result from the function will be used instead.
-If a form, the result from the form will be used instead."
+If nil, don't insert a signature.
+If t, insert `message-signature-file'.
+If a function or form, insert its result.
+See `mail-signature' for the recommended format of a signature."
   :version "23.2"
-  :type '(choice string (const :tag "Contents of signature file" t)
-                function
-                sexp)
+  :type '(choice string
+                 (const :tag "None" nil)
+                 (const :tag "Contents of signature file" t)
+                 function sexp)
   :risky t
   :link '(custom-manual "(message)Insertion Variables")
   :group 'message-insertion)
@@ -1599,19 +1601,21 @@ starting with `not' and followed by regexps."
        (progn (goto-char (match-beginning 0)) (match-end 0)) nil
         (1 'message-header-name)
         (2 'message-header-other nil t)))
-      ,@(if (and mail-header-separator
-                (not (equal mail-header-separator "")))
-           `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
-              1 'message-separator))
-         nil)
-      ((lambda (limit)
-        (re-search-forward (concat "^\\("
-                                   message-cite-prefix-regexp
-                                   "\\).*")
-                           limit t))
-       (0 'message-cited-text))
-      ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
-       (0 'message-mml))))
+      (,(lambda (limit)
+          (and mail-header-separator
+               (not (equal mail-header-separator ""))
+               (re-search-forward
+                (concat "^" (regexp-quote mail-header-separator) "$")
+                limit t)))
+       0 'message-separator)
+      (,(lambda (limit)
+          (re-search-forward (concat "^\\(?:"
+                                     message-cite-prefix-regexp
+                                     "\\).*")
+                             limit t))
+       0 'message-cited-text)
+      ("<#/?\\(?:multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
+       0 'message-mml)))
   "Additional expressions to highlight in Message mode.")
 
 (defvar message-face-alist
@@ -2051,8 +2055,9 @@ see `message-narrow-to-headers-or-head'."
   (let ((regexp (if (stringp gnus-list-identifiers)
                    gnus-list-identifiers
                  (mapconcat 'identity gnus-list-identifiers " *\\|"))))
-    (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
-                             " *\\)\\)+\\(Re: +\\)?\\)") subject)
+    (if (and (not (equal regexp ""))
+             (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
+                                   " *\\)\\)+\\(Re: +\\)?\\)") subject))
        (concat (substring subject 0 (match-beginning 1))
                (or (match-string 3 subject)
                    (match-string 5 subject))
@@ -2894,42 +2899,9 @@ See also `message-forbidden-properties'."
 ;;;###autoload
 (define-derived-mode message-mode text-mode "Message"
   "Major mode for editing mail and news to be sent.
-Like Text Mode but with these additional commands:\\<message-mode-map>
-C-c C-s  `message-send' (send the message)  C-c C-c  `message-send-and-exit'
-C-c C-d  Postpone sending the message       C-c C-k  Kill the message
-C-c C-f  move to a header field (and create it if there isn't):
-        C-c C-f C-t  move to To        C-c C-f C-s  move to Subject
-        C-c C-f C-c  move to Cc        C-c C-f C-b  move to Bcc
-        C-c C-f C-w  move to Fcc       C-c C-f C-r  move to Reply-To
-        C-c C-f C-u  move to Summary   C-c C-f C-n  move to Newsgroups
-        C-c C-f C-k  move to Keywords  C-c C-f C-d  move to Distribution
-        C-c C-f C-o  move to From (\"Originator\")
-        C-c C-f C-f  move to Followup-To
-        C-c C-f C-m  move to Mail-Followup-To
-        C-c C-f C-e  move to Expires
-        C-c C-f C-i  cycle through Importance values
-        C-c C-f s    change subject and append \"(was: <Old Subject>)\"
-        C-c C-f x    crossposting with FollowUp-To header and note in body
-        C-c C-f t    replace To: header with contents of Cc: or Bcc:
-        C-c C-f a    Insert X-No-Archive: header and a note in the body
-C-c C-t  `message-insert-to' (add a To header to a news followup)
-C-c C-l  `message-to-list-only' (removes all but list address in to/cc)
-C-c C-n  `message-insert-newsgroups' (add a Newsgroup header to a news reply)
-C-c C-b  `message-goto-body' (move to beginning of message text).
-C-c C-i  `message-goto-signature' (move to the beginning of the signature).
-C-c C-w  `message-insert-signature' (insert `message-signature-file' file).
-C-c C-y  `message-yank-original' (insert current message, if any).
-C-c C-q  `message-fill-yanked-message' (fill what was yanked).
-C-c C-e  `message-elide-region' (elide the text between point and mark).
-C-c C-v  `message-delete-not-region' (remove the text outside the region).
-C-c C-z  `message-kill-to-signature' (kill the text up to the signature).
-C-c C-r  `message-caesar-buffer-body' (rot13 the message body).
-C-c C-a  `mml-attach-file' (attach a file as MIME).
-C-c C-u  `message-insert-or-toggle-importance'  (insert or cycle importance).
-C-c M-n  `message-insert-disposition-notification-to'  (request receipt).
-C-c M-m  `message-mark-inserted-region' (mark region with enclosing tags).
-C-c M-f  `message-mark-insert-file' (insert file marked with enclosing tags).
-M-RET    `message-newline-and-reformat' (break the line and reformat)."
+Like `text-mode', but with these additional commands:
+
+\\{message-mode-map}"
   (set (make-local-variable 'message-reply-buffer) nil)
   (set (make-local-variable 'message-inserted-headers) nil)
   (set (make-local-variable 'message-send-actions) nil)
@@ -3847,13 +3819,14 @@ This function uses `mail-citation-hook' if that is 
non-nil."
              (narrow-to-region start end)
              (message-narrow-to-head-1)
              (setq x-no-archive (message-fetch-field "x-no-archive"))
-             (vector 0
-                     (or (message-fetch-field "subject") "none")
-                     (or (message-fetch-field "from") "nobody")
-                     (message-fetch-field "date")
-                     (message-fetch-field "message-id" t)
-                     (message-fetch-field "references")
-                     0 0 ""))))
+             (make-full-mail-header
+               0
+              (or (message-fetch-field "subject") "none")
+              (or (message-fetch-field "from") "nobody")
+              (message-fetch-field "date")
+              (message-fetch-field "message-id" t)
+              (message-fetch-field "references")
+              0 0 ""))))
       (mml-quote-region start end)
       (when strip-signature
        ;; Allow undoing.
@@ -4588,8 +4561,7 @@ This function could be useful in `message-setup-hook'."
              (message-generate-headers '(Lines)))
            ;; Remove some headers.
            (message-remove-header message-ignored-mail-headers t)
-           (let ((mail-parse-charset message-default-charset))
-             (mail-encode-encoded-word-buffer)))
+            (mail-encode-encoded-word-buffer))
          (goto-char (point-max))
          ;; require one newline at the end.
          (or (= (preceding-char) ?\n)
@@ -4962,8 +4934,7 @@ Otherwise, generate and save a value for 
`canlock-password' first."
                  (message-generate-headers '(Lines)))
                ;; Remove some headers.
                (message-remove-header message-ignored-news-headers t)
-               (let ((mail-parse-charset message-default-charset))
-                 (mail-encode-encoded-word-buffer)))
+                (mail-encode-encoded-word-buffer))
              (goto-char (point-max))
              ;; require one newline at the end.
              (or (= (preceding-char) ?\n)
@@ -5441,8 +5412,7 @@ The result is a fixnum."
          (while (setq file (message-fetch-field "fcc" t))
            (push file list)
            (message-remove-header "fcc" nil t))
-         (let ((mail-parse-charset message-default-charset)
-               (rfc2047-header-encoding-alist
+          (let ((rfc2047-header-encoding-alist
                 (cons '("Newsgroups" . default)
                       rfc2047-header-encoding-alist)))
            (mail-encode-encoded-word-buffer)))
@@ -6951,21 +6921,12 @@ Useful functions to put in this list include:
   :type '(repeat function))
 
 (defun message-simplify-subject (subject &optional functions)
-  "Return simplified SUBJECT."
-  (unless functions
-    ;; Simplify fully:
-    (setq functions message-simplify-subject-functions))
-  (when (and (memq 'message-strip-list-identifiers functions)
-            gnus-list-identifiers)
-    (setq subject (message-strip-list-identifiers subject)))
-  (when (memq 'message-strip-subject-re functions)
-    (setq subject (concat "Re: " (message-strip-subject-re subject))))
-  (when (and (memq 'message-strip-subject-trailing-was functions)
-            message-subject-trailing-was-query)
-    (setq subject (message-strip-subject-trailing-was subject)))
-  (when (memq 'message-strip-subject-encoded-words functions)
-    (setq subject (message-strip-subject-encoded-words subject)))
-  subject)
+  "Return simplified SUBJECT.
+Do so by calling each one-argument function in the list of functions
+specified by FUNCTIONS, if non-nil, or by the variable
+`message-simplify-subject-functions' otherwise."
+  (dolist (fun (or functions message-simplify-subject-functions) subject)
+    (setq subject (funcall fun subject))))
 
 ;;;###autoload
 (defun message-reply (&optional to-address wide switch-function)
@@ -6998,7 +6959,7 @@ Useful functions to put in this list include:
            subject (or (message-fetch-field "subject") "none"))
 
       ;; Strip list identifiers, "Re: ", and "was:"
-      (setq subject (message-simplify-subject subject))
+      (setq subject (concat "Re: " (message-simplify-subject subject)))
 
       (when (and (setq gnus-warning (message-fetch-field "gnus-warning"))
                 (string-match "<[^>]+>" gnus-warning))
@@ -7017,8 +6978,8 @@ Useful functions to put in this list include:
          (if wide to-address nil))
         switch-function))
       (setq message-reply-headers
-           (vector 0 (cdr (assq 'Subject headers))
-                   from date message-id references 0 0 ""))
+           (make-full-mail-header 0 (cdr (assq 'Subject headers))
+                                  from date message-id references 0 0 ""))
       (message-setup headers cur))))
 
 ;;;###autoload
@@ -7069,13 +7030,14 @@ If TO-NEWSGROUPS, use that as the new Newsgroups line."
                   (string-match "world" distribution)))
        (setq distribution nil))
       ;; Strip list identifiers, "Re: ", and "was:"
-      (setq subject (message-simplify-subject subject))
+      (setq subject (concat "Re: " (message-simplify-subject subject)))
       (widen))
 
     (message-pop-to-buffer (message-buffer-name "followup" from newsgroups))
 
     (setq message-reply-headers
-         (vector 0 subject from date message-id references 0 0 ""))
+         (make-full-mail-header
+           0 subject from date message-id references 0 0 ""))
 
     (message-setup
      `((Subject . ,subject)
@@ -8101,9 +8063,7 @@ regexp VARSTR."
 
 (defun message-encode-message-body ()
   (unless message-inhibit-body-encoding
-    (let ((mail-parse-charset (or mail-parse-charset
-                                 message-default-charset))
-         (case-fold-search t)
+    (let ((case-fold-search t)
          lines content-type-p)
       (message-goto-body)
       (save-restriction
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 3f25541..0b9cdde 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -236,6 +236,7 @@ before the external MIME handler is invoked."
     ("text/x-patch" mm-display-patch-inline identity)
     ;; In case mime.types uses x-diff (as does Debian's mime-support-3.40).
     ("text/x-diff" mm-display-patch-inline identity)
+    ("application/x-patch" mm-display-patch-inline identity)
     ("application/emacs-lisp" mm-display-elisp-inline identity)
     ("application/x-emacs-lisp" mm-display-elisp-inline identity)
     ("application/x-shellscript" mm-display-shell-script-inline identity)
@@ -261,15 +262,6 @@ before the external MIME handler is invoked."
     ("text/.*" mm-inline-text identity)
     ("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 (fboundp 'device-sound-enabled-p)
-           (device-sound-enabled-p))))
-    ("audio/au"
-     mm-inline-audio
-     ,(lambda (_handle)
-       (and (fboundp 'device-sound-enabled-p)
-           (device-sound-enabled-p))))
     ("application/pgp-signature" ignore identity)
     ("application/x-pkcs7-signature" ignore identity)
     ("application/pkcs7-signature" ignore identity)
@@ -303,8 +295,9 @@ before the external MIME handler is invoked."
 
 (defcustom mm-inlined-types
   '("image/.*" "text/.*" "message/delivery-status" "message/rfc822"
-    "message/partial" "message/external-body" "application/emacs-lisp"
-    "application/x-emacs-lisp"
+    "message/partial" "message/external-body"
+    "application/x-patch"
+    "application/emacs-lisp" "application/x-emacs-lisp"
     "application/pgp-signature" "application/x-pkcs7-signature"
     "application/pkcs7-signature" "application/x-pkcs7-mime"
     "application/pkcs7-mime"
@@ -1118,7 +1111,7 @@ external if displayed external."
          (mm-remove-part handle)))))))
 
 (defun mm-destroy-parts (handles)
-  "Remove the displayed MIME parts represented by HANDLES."
+  "Destroy the displayed MIME parts represented by HANDLES."
   (if (and (listp handles)
           (bufferp (car handles)))
       (mm-destroy-part handles)
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 1e1d264..8494882 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -472,10 +472,8 @@ If MODE is not set, try to find mode automatically."
                       (buffer-string)))
                    (coding-system
                     (decode-coding-string text coding-system))
-                   (charset
-                    (mm-decode-string text charset))
-                   (t
-                    text)))
+                    (t
+                     (mm-decode-string text (or charset 'undecided)))))
       (let ((font-lock-verbose nil)     ; font-lock is a bit too verbose.
            (enable-local-variables nil))
         ;; We used to set font-lock-mode-hook to nil to avoid enabling
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index f6d358d..1df4e28 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -48,7 +48,6 @@
 
 (defvar gnus-article-mime-handles)
 (defvar gnus-newsrc-hashtb)
-(defvar message-default-charset)
 (defvar message-deletable-headers)
 (defvar message-options)
 (defvar message-posting-charset)
@@ -703,9 +702,7 @@ be \"related\" or \"alternate\"."
                                  filename)))))
               (t
                (let ((contents (cdr (assq 'contents cont))))
-                 (if (if (featurep 'xemacs)
-                         (string-match "[^\000-\377]" contents)
-                       (multibyte-string-p contents))
+                 (if (multibyte-string-p contents)
                      (progn
                        (set-buffer-multibyte t)
                        (insert contents)
@@ -907,8 +904,14 @@ be \"related\" or \"alternate\"."
              (or disposition
                  (mml-content-disposition type (cdr (assq 'filename cont)))))
       (when parameters
-       (mml-insert-parameter-string
-        cont mml-content-disposition-parameters))
+       (let ((cont (copy-sequence cont)))
+         ;; Set the file name to what's specified by the user.
+         (when-let ((recipient-filename (cdr (assq 'recipient-filename cont))))
+           (setcdr cont
+                   (cons (cons 'filename recipient-filename)
+                         (cdr cont))))
+         (mml-insert-parameter-string
+          cont mml-content-disposition-parameters)))
       (insert "\n"))
     (unless (eq encoding '7bit)
       (insert (format "Content-Transfer-Encoding: %s\n" encoding)))
@@ -1015,8 +1018,7 @@ If HANDLES is non-nil, use it instead reparsing the 
buffer."
     ;; Skip past any From_ headers.
     (while (looking-at "From ")
       (forward-line 1))
-    (let ((mail-parse-charset message-default-charset))
-      (mail-encode-encoded-word-buffer)))
+    (mail-encode-encoded-word-buffer))
   (message-encode-message-body))
 
 (defun mml-insert-mime (handle &optional no-markup)
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index c8b7eed..aca29fe 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -979,7 +979,7 @@ all.  This may very well take some time.")
   "Add a nov line for the GROUP base."
   (with-current-buffer (nndiary-open-nov group)
     (goto-char (point-max))
-    (mail-header-set-number headers article)
+    (setf (mail-header-number headers) article)
     (nnheader-insert-nov headers)))
 
 (defsubst nndiary-header-value ()
@@ -994,8 +994,8 @@ all.  This may very well take some time.")
         (goto-char (point-min))
         (if (search-forward "\n\n" nil t) (1- (point)) (point-max))))
       (let ((headers (nnheader-parse-naked-head)))
-       (mail-header-set-chars headers chars)
-       (mail-header-set-number headers number)
+       (setf (mail-header-chars  headers) chars)
+       (setf (mail-header-number headers) number)
        headers))))
 
 (defun nndiary-open-nov (group)
diff --git a/lisp/gnus/nnfolder.el b/lisp/gnus/nnfolder.el
index 1c83045..41963f3 100644
--- a/lisp/gnus/nnfolder.el
+++ b/lisp/gnus/nnfolder.el
@@ -1162,15 +1162,15 @@ This command does not work if you use short group 
names."
       (with-temp-buffer
        (insert-buffer-substring buf b e)
        (let ((headers (nnheader-parse-naked-head)))
-         (mail-header-set-chars headers chars)
-         (mail-header-set-number headers number)
+         (setf (mail-header-chars  headers) chars)
+         (setf (mail-header-number headers) number)
          headers)))))
 
 (defun nnfolder-add-nov (group article headers)
   "Add a nov line for the GROUP base."
   (with-current-buffer (nnfolder-open-nov group)
     (goto-char (point-max))
-    (mail-header-set-number headers article)
+    (setf (mail-header-number headers) article)
     (nnheader-insert-nov headers)))
 
 (provide 'nnfolder)
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 090b842..6ef324a 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -121,7 +121,6 @@ on your system, you could say something like:
 
 (autoload 'nnmail-message-id "nnmail")
 (autoload 'mail-position-on-field "sendmail")
-(autoload 'gnus-buffer-live-p "gnus-util")
 
 ;;; Header access macros.
 
@@ -136,97 +135,31 @@ on your system, you could say something like:
 ;; (That next-to-last entry is defined as "misc" in the NOV format,
 ;; but Gnus uses it for xrefs.)
 
-(defmacro mail-header-number (header)
-  "Return article number in HEADER."
-  `(aref ,header 0))
-
-(defmacro mail-header-set-number (header number)
-  "Set article number of HEADER to NUMBER."
-  `(aset ,header 0 ,number))
-
-(defmacro mail-header-subject (header)
-  "Return subject string in HEADER."
-  `(aref ,header 1))
-
-(defmacro mail-header-set-subject (header subject)
-  "Set article subject of HEADER to SUBJECT."
-  `(aset ,header 1 ,subject))
-
-(defmacro mail-header-from (header)
-  "Return author string in HEADER."
-  `(aref ,header 2))
-
-(defmacro mail-header-set-from (header from)
-  "Set article author of HEADER to FROM."
-  `(aset ,header 2 ,from))
-
-(defmacro mail-header-date (header)
-  "Return date in HEADER."
-  `(aref ,header 3))
-
-(defmacro mail-header-set-date (header date)
-  "Set article date of HEADER to DATE."
-  `(aset ,header 3 ,date))
-
-(defalias 'mail-header-message-id 'mail-header-id)
-(defmacro mail-header-id (header)
-  "Return Id in HEADER."
-  `(aref ,header 4))
-
-(defalias 'mail-header-set-message-id 'mail-header-set-id)
-(defmacro mail-header-set-id (header id)
-  "Set article Id of HEADER to ID."
-  `(aset ,header 4 ,id))
-
-(defmacro mail-header-references (header)
-  "Return references in HEADER."
-  `(aref ,header 5))
-
-(defmacro mail-header-set-references (header ref)
-  "Set article references of HEADER to REF."
-  `(aset ,header 5 ,ref))
-
-(defmacro mail-header-chars (header)
-  "Return number of chars of article in HEADER."
-  `(aref ,header 6))
-
-(defmacro mail-header-set-chars (header chars)
-  "Set number of chars in article of HEADER to CHARS."
-  `(aset ,header 6 ,chars))
-
-(defmacro mail-header-lines (header)
-  "Return lines in HEADER."
-  `(aref ,header 7))
-
-(defmacro mail-header-set-lines (header lines)
-  "Set article lines of HEADER to LINES."
-  `(aset ,header 7 ,lines))
-
-(defmacro mail-header-xref (header)
-  "Return xref string in HEADER."
-  `(aref ,header 8))
-
-(defmacro mail-header-set-xref (header xref)
-  "Set article XREF of HEADER to xref."
-  `(aset ,header 8 ,xref))
-
-(defmacro mail-header-extra (header)
-  "Return the extra headers in HEADER."
-  `(aref ,header 9))
-
-(defun mail-header-set-extra (header extra)
-  "Set the extra headers in HEADER to EXTRA."
-  (aset header 9 extra))
+(defalias 'mail-header-p #'vectorp)     ;For lack of tag, it's all we have.
+(cl-defstruct (mail-header
+               (:type vector)
+               (:constructor nil)
+               (:constructor make-full-mail-header
+                (&optional number subject from date id
+                          references chars lines xref
+                          extra)))
+  number
+  subject
+  from
+  date
+  id
+  references
+  chars
+  lines
+  xref
+  extra)
+
+(defalias 'mail-header-message-id #'mail-header-id)
 
 (defsubst make-mail-header (&optional init)
   "Create a new mail header structure initialized with INIT."
-  (make-vector 10 init))
-
-(defsubst make-full-mail-header (&optional number subject from date id
-                                          references chars lines xref
-                                          extra)
-  "Create a new mail header structure initialized with the parameters given."
-  (vector number subject from date id references chars lines xref extra))
+  (make-full-mail-header init init init init init
+                         init init init init init))
 
 ;; fake message-ids: generation and detection
 
@@ -1036,8 +969,9 @@ See `find-file-noselect' for the arguments."
   "Strip all \r's from the current buffer."
   (nnheader-skeleton-replace "\r"))
 
-(defalias 'nnheader-cancel-timer 'cancel-timer)
-(defalias 'nnheader-cancel-function-timers 'cancel-function-timers)
+(define-obsolete-function-alias 'nnheader-cancel-timer 'cancel-timer "27.1")
+(define-obsolete-function-alias 'nnheader-cancel-function-timers
+  'cancel-function-timers "27.1")
 
 ;; When changing this function, consider changing `pop3-accept-process-output'
 ;; as well.
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 37a38a5..9d59a4d 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -723,7 +723,7 @@ skips all prompting."
                               (mail-header-number novitem)))
                   (art (car (rassq artno articleids))))
              (when art
-               (mail-header-set-number novitem art)
+               (setf (mail-header-number novitem) art)
                (push novitem headers))
              (forward-line 1)))))
       (setq headers
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index b6dbbea..37f6e75 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -34,8 +34,6 @@
 (require 'mm-util)
 (require 'gnus-int)
 
-(autoload 'gnus-add-buffer "gnus")
-(autoload 'gnus-kill-buffer "gnus")
 (autoload 'mail-send-and-exit "sendmail" nil t)
 
 (defgroup nnmail nil
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 9d02773..ac125c9 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -1490,7 +1490,7 @@ This variable is set by `nnmaildir-request-article'.")
                       'excl)
         (when (fboundp 'unix-sync)
           (unix-sync)))) ;; no fsync :(
-      (nnheader-cancel-timer 24h)
+      (cancel-timer 24h)
       (condition-case err
          (add-name-to-file tmpfile curfile)
        (error
diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el
index 501ea1d..1b42d3b 100644
--- a/lisp/gnus/nnmairix.el
+++ b/lisp/gnus/nnmairix.el
@@ -1419,12 +1419,12 @@ TYPE is either 'nov or 'headers."
             (setq cur (nnheader-parse-nov))
             (when corr
               (setq article (+ (mail-header-number cur) numc))
-              (mail-header-set-number cur article))
+              (setf (mail-header-number cur) article))
             (setq xref (mail-header-xref cur))
             (when (and (stringp xref)
                        (string-match (format "[ \t]%s:[0-9]+" backendgroup) 
xref))
               (setq xref (replace-match (format " %s:%d" mairixgroup article) 
t nil xref))
-              (mail-header-set-xref cur xref))
+              (setf (mail-header-xref cur) xref))
             (set-buffer buf)
             (nnheader-insert-nov cur)
             (set-buffer nntp-server-buffer)
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 205e9e4..1d9d166 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -792,14 +792,14 @@ article number.  This function is called narrowed to an 
article."
   "Add a nov line for the GROUP nov headers, incrementally."
   (with-current-buffer (nnml-open-incremental-nov group)
     (goto-char (point-max))
-    (mail-header-set-number headers article)
+    (setf (mail-header-number headers) article)
     (nnheader-insert-nov headers)))
 
 (defun nnml-add-nov (group article headers)
   "Add a nov line for the GROUP base."
   (with-current-buffer (nnml-open-nov group)
     (goto-char (point-max))
-    (mail-header-set-number headers article)
+    (setf (mail-header-number headers) article)
     (nnheader-insert-nov headers)))
 
 (defsubst nnml-header-value ()
@@ -816,8 +816,8 @@ article number.  This function is called narrowed to an 
article."
             (1- (point))
           (point-max))))
       (let ((headers (nnheader-parse-naked-head)))
-       (mail-header-set-chars headers chars)
-       (mail-header-set-number headers number)
+       (setf (mail-header-chars  headers) chars)
+       (setf (mail-header-number headers) number)
        headers))))
 
 (defun nnml-get-nov-buffer (group &optional incrementalp)
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index e2fa1d8..0e5057e 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -647,7 +647,7 @@ command whose response triggered the error."
                               (nntp-close-server))
                             (signal 'quit nil))))
                  (when -timer
-                   (nnheader-cancel-timer -timer)))
+                   (cancel-timer -timer)))
                nil))
       (setq nntp--report-1 nntp-report-n))
     nntp-with-open-group-internal))
@@ -1280,7 +1280,7 @@ If SEND-IF-FORCE, only send authinfo to the server if the
             (signal 'quit nil)
             nil))))
     (when timer
-      (nnheader-cancel-timer timer))
+      (cancel-timer timer))
     (when (and process
               (not (memq (process-status process) '(open run))))
       (with-current-buffer pbuffer
@@ -1339,7 +1339,7 @@ If SEND-IF-FORCE, only send authinfo to the server if the
 (defun nntp-async-stop (proc)
   (setq nntp-async-process-list (delq proc nntp-async-process-list))
   (when (and nntp-async-timer (not nntp-async-process-list))
-    (nnheader-cancel-timer nntp-async-timer)
+    (cancel-timer nntp-async-timer)
     (setq nntp-async-timer nil)))
 
 (defun nntp-after-change-function (beg end len)
diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el
index c80bbf6..25f3413 100644
--- a/lisp/gnus/nnvirtual.el
+++ b/lisp/gnus/nnvirtual.el
@@ -491,9 +491,9 @@ If UPDATE-P is not nil, call gnus-group-update-group on the 
components."
 
 
 
-;;; This is currently O(kn^2) to merge n lists of length k.
-;;; You could do it in O(knlogn), but we have a small n, and the
-;;; overhead of the other approach is probably greater.
+;; This is currently O(kn^2) to merge n lists of length k.
+;; You could do it in O(knlogn), but we have a small n, and the
+;; overhead of the other approach is probably greater.
 (defun nnvirtual-merge-sorted-lists (&rest lists)
   "Merge many sorted lists of numbers."
   (if (null (cdr lists))
@@ -501,68 +501,68 @@ If UPDATE-P is not nil, call gnus-group-update-group on 
the components."
     (sort (apply 'nconc lists) '<)))
 
 
-;;; We map between virtual articles and real articles in a manner
-;;; which keeps the size of the virtual active list the same as the
-;;; sum of the component active lists.
-
-;;; To achieve fair mixing of the groups, the last article in each of
-;;; N component groups will be in the last N articles in the virtual
-;;; group.
-
-;;; If you have 3 components A, B and C, with articles 1-8, 1-5, and
-;;; 6-7 respectively, then the virtual article numbers look like:
-;;;
-;;;  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
-;;;  A1 A2 A3 A4 B1 A5 B2 A6 B3 A7 B4 C6 A8 B5 C7
-
-;;; To compute these mappings we generate a couple tables and then
-;;; do some fast operations on them.  Tables for the example above:
-;;;
-;;; Offsets - [(A 0) (B -3) (C -1)]
-;;;
-;;;               a  b  c  d  e
-;;; Mapping - ([  3  0  1  3  0 ]
-;;;            [  6  3  2  9  3 ]
-;;;            [  8  6  3 15  9 ])
-;;;
-;;; (note column 'e' is different in real algorithm, which is slightly
-;;;  different than described here, but this gives you the methodology.)
-;;;
-;;; The basic idea is this, when going from component->virtual, apply
-;;; the appropriate offset to the article number.  Then search the first
-;;; column of the table for a row where 'a' is less than or equal to the
-;;; modified number.  You can see that only group A can therefore go to
-;;; the first row, groups A and B to the second, and all to the last.
-;;; The third column of the table is telling us the number of groups
-;;; which might be able to reach that row (it might increase by more than
-;;; 1 if several groups have the same size).
-;;; Then column 'b' provides an additional offset you apply when you have
-;;; found the correct row.  You then multiply by 'c' and add on the groups
-;;; _position_ in the offset table.  The basic idea here is that on
-;;; any given row we are going to map back and forth using X'=X*c+Y and
-;;; X=(X'/c), Y=(X' mod c).  Then once you've done this transformation,
-;;; you apply a final offset from column 'e' to give the virtual article.
-;;;
-;;; Going the other direction, you instead search on column 'd' instead
-;;; of 'a', and apply everything in reverse order.
-
-;;; Convert component -> virtual:
-;;; set num = num - Offset(group)
-;;; find first row in Mapping where num <= 'a'
-;;; num = (num-'b')*c + Position(group) + 'e'
-
-;;; Convert virtual -> component:
-;;; find first row in Mapping where num <= 'd'
-;;; num = num - 'e'
-;;; group_pos = num mod 'c'
-;;; num = (num / 'c') + 'b' + Offset(group_pos)
-
-;;; Easy no? :)
-;;;
-;;; Well actually, you need to keep column e offset smaller by the 'c'
-;;; column for that line, and always add 1 more when going from
-;;; component -> virtual.  Otherwise you run into a problem with
-;;; unique reverse mapping.
+;; We map between virtual articles and real articles in a manner
+;; which keeps the size of the virtual active list the same as the
+;; sum of the component active lists.
+
+;; To achieve fair mixing of the groups, the last article in each of
+;; N component groups will be in the last N articles in the virtual
+;; group.
+
+;; If you have 3 components A, B and C, with articles 1-8, 1-5, and
+;; 6-7 respectively, then the virtual article numbers look like:
+;;
+;;  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
+;;  A1 A2 A3 A4 B1 A5 B2 A6 B3 A7 B4 C6 A8 B5 C7
+
+;; To compute these mappings we generate a couple tables and then
+;; do some fast operations on them.  Tables for the example above:
+;;
+;; Offsets - [(A 0) (B -3) (C -1)]
+;;
+;;               a  b  c  d  e
+;; Mapping - ([  3  0  1  3  0 ]
+;;            [  6  3  2  9  3 ]
+;;            [  8  6  3 15  9 ])
+;;
+;; (note column 'e' is different in real algorithm, which is slightly
+;;  different than described here, but this gives you the methodology.)
+;;
+;; The basic idea is this, when going from component->virtual, apply
+;; the appropriate offset to the article number.  Then search the first
+;; column of the table for a row where 'a' is less than or equal to the
+;; modified number.  You can see that only group A can therefore go to
+;; the first row, groups A and B to the second, and all to the last.
+;; The third column of the table is telling us the number of groups
+;; which might be able to reach that row (it might increase by more than
+;; 1 if several groups have the same size).
+;; Then column 'b' provides an additional offset you apply when you have
+;; found the correct row.  You then multiply by 'c' and add on the groups
+;; _position_ in the offset table.  The basic idea here is that on
+;; any given row we are going to map back and forth using X'=X*c+Y and
+;; X=(X'/c), Y=(X' mod c).  Then once you've done this transformation,
+;; you apply a final offset from column 'e' to give the virtual article.
+;;
+;; Going the other direction, you instead search on column 'd' instead
+;; of 'a', and apply everything in reverse order.
+
+;; Convert component -> virtual:
+;; set num = num - Offset(group)
+;; find first row in Mapping where num <= 'a'
+;; num = (num-'b')*c + Position(group) + 'e'
+
+;; Convert virtual -> component:
+;; find first row in Mapping where num <= 'd'
+;; num = num - 'e'
+;; group_pos = num mod 'c'
+;; num = (num / 'c') + 'b' + Offset(group_pos)
+
+;; Easy no? :)
+;;
+;; Well actually, you need to keep column e offset smaller by the 'c'
+;; column for that line, and always add 1 more when going from
+;; component -> virtual.  Otherwise you run into a problem with
+;; unique reverse mapping.
 
 (defun nnvirtual-map-article (article)
   "Return a cons of the component group and article corresponding to the given 
virtual ARTICLE."
diff --git a/lisp/gnus/nnweb.el b/lisp/gnus/nnweb.el
index 7b87502..b08b27d 100644
--- a/lisp/gnus/nnweb.el
+++ b/lisp/gnus/nnweb.el
@@ -461,22 +461,21 @@ Valid types include `google', `dejanews', and `gmane'.")
                    (subject (mail-header-subject header))
                    (rfc2047-encoding-type 'mime))
                (when (string-match " \\([^:]+\\)[:/]\\([0-9]+\\)" xref)
-                 (mail-header-set-xref
-                  header
-                  (format "http://article.gmane.org/%s/%s/raw";
-                          (match-string 1 xref)
-                          (match-string 2 xref))))
+                 (setf (mail-header-xref header)
+                       (format "http://article.gmane.org/%s/%s/raw";
+                               (match-string 1 xref)
+                               (match-string 2 xref))))
 
                ;; Add host part to gmane-encrypted addresses
                (when (string-match "@$" from)
-                 (mail-header-set-from header
-                                       (concat from "public.gmane.org")))
+                 (setf (mail-header-from header)
+                       (concat from "public.gmane.org")))
 
-               (mail-header-set-subject header
-                                        (rfc2047-encode-string subject))
+               (setf (mail-header-subject header)
+                     (rfc2047-encode-string subject))
 
                (unless (nnweb-get-hashtb (mail-header-xref header))
-                 (mail-header-set-number header (cl-incf (cdr active)))
+                 (setf (mail-header-number header) (cl-incf (cdr active)))
                  (push (list (mail-header-number header) header) map)
                  (nnweb-set-hashtb (cadar map) (car map))))))
          (forward-line 1)))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 50d69e7..91b4104 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1993-1994, 1998-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help, internal
 ;; Package: emacs
 
@@ -104,11 +103,23 @@ and the output should go to `standard-output'.")
         (with-demoted-errors "while loading: %S"
           (load file 'noerror 'nomessage))))))
 
+(defcustom help-enable-completion-auto-load t
+  "Whether completion for Help commands can perform autoloading.
+If non-nil, whenever invoking completion for `describe-function'
+or `describe-variable' load files that might contain definitions
+with the current prefix.  The files are chosen according to
+`definition-prefixes'."
+  :type 'boolean
+  :group 'help
+  :version "26.3")
+
 (defun help--symbol-completion-table (string pred action)
-  (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
-    (help--load-prefixes prefixes))
+  (when help-enable-completion-auto-load
+    (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
+      (help--load-prefixes prefixes)))
   (let ((prefix-completions
-         (mapcar #'intern (all-completions string definition-prefixes))))
+         (and help-enable-completion-auto-load
+              (mapcar #'intern (all-completions string definition-prefixes)))))
     (complete-with-action action obarray string
                           (if pred (lambda (sym)
                                      (or (funcall pred sym)
diff --git a/lisp/help-macro.el b/lisp/help-macro.el
index a16d1e3..9c90d6d 100644
--- a/lisp/help-macro.el
+++ b/lisp/help-macro.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Lynn Slater <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: Mon Oct  1 11:42:39 1990
 ;; Adapted-By: ESR
 ;; Package: emacs
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 6cc3f0d..304c45d 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1993-1994, 1998-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help, internal
 ;; Package: emacs
 
diff --git a/lisp/help.el b/lisp/help.el
index d1f4735..0677368 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1993-1994, 1998-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help, internal
 ;; Package: emacs
 
@@ -265,17 +264,19 @@ If that doesn't give a function, return nil."
         (condition-case ()
             (save-excursion
               (save-restriction
-                (narrow-to-region (max (point-min)
-                                       (- (point) 1000)) (point-max))
-                ;; Move up to surrounding paren, then after the open.
-                (backward-up-list 1)
-                (forward-char 1)
-                ;; If there is space here, this is probably something
-                ;; other than a real Lisp function call, so ignore it.
-                (if (looking-at "[ \t]")
-                    (error "Probably not a Lisp function call"))
-                (let ((obj (read (current-buffer))))
-                  (and (symbolp obj) (fboundp obj) obj))))
+                (let ((forward-sexp-function nil)) ;Use elisp-mode's value
+                  (narrow-to-region (max (point-min)
+                                         (- (point) 1000))
+                                    (point-max))
+                  ;; Move up to surrounding paren, then after the open.
+                  (backward-up-list 1)
+                  (forward-char 1)
+                  ;; If there is space here, this is probably something
+                  ;; other than a real Lisp function call, so ignore it.
+                  (if (looking-at "[ \t]")
+                      (error "Probably not a Lisp function call"))
+                  (let ((obj (read (current-buffer))))
+                    (and (symbolp obj) (fboundp obj) obj)))))
           (error nil))
         (let* ((str (find-tag-default))
                (sym (if str (intern-soft str))))
@@ -478,7 +479,7 @@ To record all your input, use `open-dribble-file'."
         (while (not (eobp))
           (comment-indent)
          (forward-line 1)))
-      ;; jidanni wants to see the last keystrokes immediately.
+      ;; Show point near the end of "lossage", as we did in Emacs 24.
       (set-marker help-window-point-marker (point)))))
 
 
@@ -743,6 +744,7 @@ If NO-MOUSE-MOVEMENT is non-nil, ignore key sequences 
starting
 with `mouse-movement' events."
   (let ((enable-disabled-menus-and-buttons t)
         (cursor-in-echo-area t)
+        (side-event nil)
         saved-yank-menu)
     (unwind-protect
         (let (last-modifiers key-list)
@@ -761,7 +763,8 @@ with `mouse-movement' events."
                   (and (memq 'click last-modifiers)
                        (not (sit-for (/ double-click-time 1000.0) t))))
             (let* ((seq (read-key-sequence "\
-Describe the following key, mouse click, or menu item: "))
+Describe the following key, mouse click, or menu item: "
+                                           nil nil 'can-return-switch-frame))
                    (raw-seq (this-single-command-raw-keys))
                    (keyn (when (> (length seq) 0)
                            (aref seq (1- (length seq)))))
@@ -770,11 +773,18 @@ Describe the following key, mouse click, or menu item: "))
               (cond
                ((zerop (length seq)))   ;FIXME: Can this happen?
                ((and no-mouse-movement (eq base 'mouse-movement)) nil)
+               ((memq base '(mouse-movement switch-frame select-window))
+                ;; Mostly ignore these events since it's sometimes difficult to
+                ;; generate the event you care about without also generating
+                ;; these side-events along the way.
+                (setq side-event (cons seq raw-seq)))
                ((eq base 'help-echo) nil)
                (t
                 (setq last-modifiers modifiers)
                 (push (cons seq raw-seq) key-list)))))
-          (nreverse key-list))
+          (if side-event
+              (cons side-event (nreverse key-list))
+            (nreverse key-list)))
       ;; Put yank-menu back as it was, if we changed it.
       (when saved-yank-menu
         (setq yank-menu (copy-sequence saved-yank-menu))
diff --git a/lisp/hexl.el b/lisp/hexl.el
index c1c2d70..df501df 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Keith Gabryelski <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: data
 
 ;; This file is part of GNU Emacs.
@@ -877,17 +876,18 @@ and their encoded form is inserted byte by byte."
            "0x%x -- invalid character code; use \\[hexl-insert-hex-string]"
            ch))
          (t
-          (let ((encoded (encode-coding-char ch coding))
-                (internal (string-as-unibyte (char-to-string ch)))
-                internal-hex)
-            ;; If encode-coding-char returns nil, it means our character
-            ;; cannot be safely encoded with buffer-file-coding-system.
-            ;; In that case, we offer to insert the internal representation
-            ;; of that character, byte by byte.
-            (when (null encoded)
-              (setq internal-hex
-                    (mapconcat (function (lambda (c) (format "%x" c)))
-                               internal " "))
+           (let ((encoded (encode-coding-char ch coding))
+                (internal (char-to-string ch))
+                internal-hex)
+             ;; If encode-coding-char returns nil, it means our character
+             ;; cannot be safely encoded with buffer-file-coding-system.
+             ;; In that case, we offer to insert the internal representation
+             ;; of that character, byte by byte.
+             (when (null encoded)
+              (setq internal (encode-coding-string internal 'utf-8-emacs)
+                    internal-hex
+                    (mapconcat (function (lambda (c) (format "%x" c)))
+                               internal " "))
               (if (yes-or-no-p
                    (format-message
                     "Insert char 0x%x's internal representation \"%s\"? "
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index 404f448..17d3dc7 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Holst <address@hidden>
-;; Maintainer: address@hidden
 ;; Version: 1.6
 ;; Keywords: abbrev convenience
 
diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index 1c09bc2..e4fef21 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:  Dave Love <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 1998-09-13
 ;; Keywords: faces, frames, emulations
 
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 2d3c140..628e884 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2507,8 +2507,8 @@ particular subset of them, and sorting by various 
criteria.
 
 Operations on marked buffers:
 \\<ibuffer-mode-map>
-  `\\[ibuffer-do-save]' - Save the marked buffers
-  `\\[ibuffer-do-view]' - View the marked buffers in this frame.
+  `\\[ibuffer-do-save]' - Save the marked buffers.
+  `\\[ibuffer-do-view]' - View the marked buffers in the selected frame.
   `\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
   `\\[ibuffer-do-revert]' - Revert the marked buffers.
   `\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
@@ -2531,7 +2531,7 @@ Operations on marked buffers:
           buffer's file as an argument.
   `\\[ibuffer-do-eval]' - Evaluate a form in each of the marked buffers.  This
           is a very flexible command.  For example, if you want to make all
-          of the marked buffers read only, try using (read-only-mode 1) as
+          of the marked buffers read-only, try using (read-only-mode 1) as
           the input form.
   `\\[ibuffer-do-view-and-eval]' - As above, but view each buffer while the 
form
           is evaluated.
@@ -2546,21 +2546,20 @@ Marking commands:
           all unmarked buffers.
   `\\[ibuffer-change-marks]' - Change the mark used on marked buffers.
   `\\[ibuffer-unmark-forward]' - Unmark the buffer at point.
-  `\\[ibuffer-unmark-backward]' - Unmark the buffer at point, and move to the
-          previous line.
+  `\\[ibuffer-unmark-backward]' - Unmark the previous buffer.
   `\\[ibuffer-unmark-all]' - Unmark buffers marked with MARK.
   `\\[ibuffer-unmark-all-marks]' - Unmark all marked buffers.
   `\\[ibuffer-mark-by-mode]' - Mark buffers by major mode.
   `\\[ibuffer-mark-unsaved-buffers]' - Mark all \"unsaved\" buffers.
           This means that the buffer is modified, and has an associated file.
   `\\[ibuffer-mark-modified-buffers]' - Mark all modified buffers,
-          regardless of whether or not they have an associated file.
+          regardless of whether they have an associated file.
   `\\[ibuffer-mark-special-buffers]' - Mark all buffers whose name begins and
           ends with `*'.
   `\\[ibuffer-mark-dissociated-buffers]' - Mark all buffers which have
           an associated file, but that file doesn't currently exist.
   `\\[ibuffer-mark-read-only-buffers]' - Mark all read-only buffers.
-  `\\[ibuffer-mark-dired-buffers]' - Mark buffers in `dired' mode.
+  `\\[ibuffer-mark-dired-buffers]' - Mark buffers in `dired-mode'.
   `\\[ibuffer-mark-help-buffers]' - Mark buffers in `help-mode', 
`apropos-mode', etc.
   `\\[ibuffer-mark-old-buffers]' - Mark buffers older than `ibuffer-old-time'.
   `\\[ibuffer-mark-for-delete]' - Mark the buffer at point for deletion.
@@ -2639,17 +2638,17 @@ Other commands:
 
 ** Information on Filtering:
 
- You can filter your ibuffer view via different criteria.  Each Ibuffer
+You can filter your Ibuffer view via different criteria.  Each Ibuffer
 buffer has its own stack of active filters.  For example, suppose you
 are working on an Emacs Lisp project.  You can create an Ibuffer
-buffer displays buffers in just `emacs-lisp' modes via
+buffer displaying only `emacs-lisp-mode' buffers via
 `\\[ibuffer-filter-by-mode] emacs-lisp-mode RET'.  In this case, there
 is just one entry on the filtering stack.
 
 You can also combine filters.  The various filtering commands push a
 new filter onto the stack, and the filters combine to show just
 buffers which satisfy ALL criteria on the stack.  For example, suppose
-you only want to see buffers in `emacs-lisp' mode, whose names begin
+you only want to see buffers in `emacs-lisp-mode', whose names begin
 with \"gnus\".  You can accomplish this via:
 
   \\[ibuffer-filter-by-mode] emacs-lisp-mode RET
@@ -2693,8 +2692,8 @@ will not be displayed multiple times if they would be 
included in
 multiple filter groups; instead, the first filter group is used.  The
 filter groups are displayed in this order of precedence.
 
-You may rearrange filter groups by using the regular
-`\\[ibuffer-kill-line]' and `\\[ibuffer-yank]' pair.  Yanked groups
+You may rearrange filter groups by using the usual pair
+`\\[ibuffer-kill-line]' and `\\[ibuffer-yank]'.  Yanked groups
 will be inserted before the group at point."
   ;; Include state info next to the mode name.
   (set (make-local-variable 'mode-line-process)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 10fd3a6..698025e 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -3,8 +3,8 @@
 ;; Copyright (C) 1992-1994, 1997, 1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Author: Ken Manheimer <address@hidden>
-;; Maintainer: Ken Manheimer <address@hidden>
+;; Author: Ken Manheimer <ken dot manheimer at gmail...>
+;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
 ;; Created: Mar 1993 Ken Manheimer, address@hidden - first release to usenet
 ;; Keywords: help, abbrev
 
diff --git a/lisp/ielm.el b/lisp/ielm.el
index c7a31a2..1531415 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Smith <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 25 Feb 1994
 ;; Keywords: lisp
 
diff --git a/lisp/iimage.el b/lisp/iimage.el
index e51108e..17b715a 100644
--- a/lisp/iimage.el
+++ b/lisp/iimage.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: KOSEKI Yoshinori <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: multimedia
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/image-file.el b/lisp/image-file.el
index abc4686..6cadc42 100644
--- a/lisp/image-file.el
+++ b/lisp/image-file.el
@@ -110,11 +110,8 @@ absolute file name and number of characters inserted."
       (let* ((ibeg (point))
             (iend (+ (point) (cadr rval)))
             (visitingp (and visit (= ibeg (point-min)) (= iend (point-max))))
-            (data
-             (string-make-unibyte
-              (buffer-substring-no-properties ibeg iend)))
-            (image
-             (create-image data nil t))
+             (image (create-image (encode-coding-region ibeg iend 'binary t)
+                                  nil t))
             (props
              `(display ,image
                        yank-handler
diff --git a/lisp/image.el b/lisp/image.el
index ba87d7f..6cc2cc3 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: multimedia
 ;; Package: emacs
 
@@ -315,7 +314,7 @@ be determined."
                                        (buffer-substring
                                         (point-min)
                                         (min (point-max)
-                                             (+ (point-min) 256))))))
+                                             (+ (point-min) 8192))))))
                     (setq image-type (cdr image-type))))
            (setq type image-type
                  types nil)
@@ -339,7 +338,7 @@ be determined."
        (file-readable-p file)
        (with-temp-buffer
         (set-buffer-multibyte nil)
-        (insert-file-contents-literally file nil 0 256)
+        (insert-file-contents-literally file nil 0 8192)
         (image-type-from-buffer))))
 
 
diff --git a/lisp/imenu.el b/lisp/imenu.el
index df39ff3..6e16e13 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -4,7 +4,6 @@
 
 ;; Author: Ake Stenhoff <address@hidden>
 ;;         Lars Lindberg <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 8 Feb 1994
 ;; Keywords: tools convenience
 
@@ -348,98 +347,6 @@ Don't move point."
   (signal 'imenu-unavailable
           (list (apply #'format-message format args))))
 
-(defun imenu-example--lisp-extract-index-name ()
-  ;; Example of a candidate for `imenu-extract-index-name-function'.
-  ;; This will generate a flat index of definitions in a lisp file.
-  (declare (obsolete nil "23.2"))
-  (save-match-data
-    (and (looking-at "(def")
-        (condition-case nil
-            (progn
-              (down-list 1)
-              (forward-sexp 2)
-              (let ((beg (point))
-                    (end (progn (forward-sexp -1) (point))))
-                (buffer-substring beg end)))
-          (error nil)))))
-
-(defun imenu-example--create-lisp-index ()
-  ;; Example of a candidate for `imenu-create-index-function'.
-  ;; It will generate a nested index of definitions.
-  (declare (obsolete nil "23.2"))
-  (let ((index-alist '())
-       (index-var-alist '())
-       (index-type-alist '())
-       (index-unknown-alist '()))
-    (goto-char (point-max))
-    ;; Search for the function
-    (while (beginning-of-defun)
-         (save-match-data
-           (and (looking-at "(def")
-                (save-excursion
-              (down-list 1)
-                  (cond
-               ((looking-at "def\\(var\\|const\\)")
-                    (forward-sexp 2)
-                    (push (imenu-example--name-and-position)
-                          index-var-alist))
-               ((looking-at "def\\(un\\|subst\\|macro\\|advice\\)")
-                    (forward-sexp 2)
-                    (push (imenu-example--name-and-position)
-                          index-alist))
-               ((looking-at "def\\(type\\|struct\\|class\\|ine-condition\\)")
-                    (forward-sexp 2)
-                (if (= (char-after (1- (point))) ?\))
-                        (progn
-                      (forward-sexp -1)
-                          (down-list 1)
-                      (forward-sexp 1)))
-                    (push (imenu-example--name-and-position)
-                          index-type-alist))
-                   (t
-                    (forward-sexp 2)
-                    (push (imenu-example--name-and-position)
-                      index-unknown-alist)))))))
-    (and index-var-alist
-        (push (cons "Variables" index-var-alist)
-              index-alist))
-    (and index-type-alist
-        (push (cons "Types" index-type-alist)
-              index-alist))
-    (and index-unknown-alist
-        (push (cons "Syntax-unknown" index-unknown-alist)
-              index-alist))
-    index-alist))
-
-;; Regular expression to find C functions
-(defvar imenu-example--function-name-regexp-c
-  (concat
-   "^[a-zA-Z0-9]+[ \t]?"               ; Type specs; there can be no
-   "\\([a-zA-Z0-9_*]+[ \t]+\\)?"       ; more than 3 tokens, right?
-   "\\([a-zA-Z0-9_*]+[ \t]+\\)?"
-   "\\([*&]+[ \t]*\\)?"                        ; Pointer.
-   "\\([a-zA-Z0-9_*]+\\)[ \t]*("       ; Name.
-   ))
-
-(defun imenu-example--create-c-index (&optional regexp)
-  (declare (obsolete nil "23.2"))
-  (let ((index-alist '())
-       char)
-    (goto-char (point-min))
-    ;; Search for the function
-    (save-match-data
-      (while (re-search-forward
-             (or regexp imenu-example--function-name-regexp-c)
-             nil t)
-       (backward-up-list 1)
-       (save-excursion
-         (goto-char (scan-sexps (point) 1))
-         (setq char (following-char)))
-       ;; Skip this function name if it is a prototype declaration.
-       (if (not (eq char ?\;))
-           (push (imenu-example--name-and-position) index-alist))))
-    (nreverse index-alist)))
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Internal variables
diff --git a/lisp/indent.el b/lisp/indent.el
index bf87d6a..1dbece7 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 1995, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/info.el b/lisp/info.el
index 2882262..6180395 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985-1986, 1992-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help
 
 ;; This file is part of GNU Emacs.
@@ -380,12 +379,6 @@ with wrapping around the current Info node."
   :type 'hook
   :group 'info)
 
-(defvar Info-edit-mode-hook nil
-  "Hook run when `Info-edit-mode' is activated.")
-
-(make-obsolete-variable 'Info-edit-mode-hook
-                       "editing Info nodes by hand is not recommended." "24.4")
-
 (defvar-local Info-current-file nil
   "Info file that Info is now looking at, or nil.
 This is the name that was specified in Info, not the actual file name.
@@ -4384,59 +4377,6 @@ Advanced commands:
                  (copy-marker (marker-position m)))
              (make-marker))))))
 
-(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1")
-(defvar Info-edit-mode-map (let ((map (make-sparse-keymap)))
-                             (set-keymap-parent map text-mode-map)
-                             (define-key map "\C-c\C-c" 'Info-cease-edit)
-                             map)
-  "Local keymap used within `e' command of Info.")
-
-(make-obsolete-variable 'Info-edit-mode-map
-                       "editing Info nodes by hand is not recommended."
-                       "24.4")
-
-;; Info-edit mode is suitable only for specially formatted data.
-(put 'Info-edit-mode 'mode-class 'special)
-
-(define-derived-mode Info-edit-mode text-mode "Info Edit"
-  "Major mode for editing the contents of an Info node.
-Like text mode with the addition of `Info-cease-edit'
-which returns to Info mode for browsing."
-  (setq buffer-read-only nil)
-  (force-mode-line-update)
-  (buffer-enable-undo (current-buffer)))
-
-(make-obsolete 'Info-edit-mode
-              "editing Info nodes by hand is not recommended." "24.4")
-
-(defun Info-edit ()
-  "Edit the contents of this Info node."
-  (interactive)
-  (Info-edit-mode)
-  (message "%s" (substitute-command-keys
-                "Editing: Type \\<Info-edit-mode-map>\\[Info-cease-edit] to 
return to info")))
-
-(put 'Info-edit 'disabled "Editing Info nodes by hand is not recommended.
-This feature will be removed in future.")
-
-(make-obsolete 'Info-edit
-              "editing Info nodes by hand is not recommended." "24.4")
-
-(defun Info-cease-edit ()
-  "Finish editing Info node; switch back to Info proper."
-  (interactive)
-  ;; Do this first, so nothing has changed if user C-g's at query.
-  (and (buffer-modified-p)
-       (y-or-n-p "Save the file? ")
-       (save-buffer))
-  (Info-mode)
-  (force-mode-line-update)
-  (and (marker-position Info-tag-table-marker)
-       (buffer-modified-p)
-       (message "Tags may have changed.  Use Info-tagify if necessary")))
-
-(make-obsolete 'Info-cease-edit
-              "editing Info nodes by hand is not recommended." "24.4")
 
 (defvar Info-file-list-for-emacs
   '("ediff" "eudc" "forms" "gnus" "info" ("Info" . "info") ("mh" . "mh-e")
diff --git a/lisp/informat.el b/lisp/informat.el
index 8108ffe..246b3b9 100644
--- a/lisp/informat.el
+++ b/lisp/informat.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1986, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el
index 6c2a2dc..c12e7b3 100644
--- a/lisp/international/isearch-x.el
+++ b/lisp/international/isearch-x.el
@@ -8,8 +8,8 @@
 
 ;; Keywords: i18n, multilingual, isearch
 
-;; Author: Kenichi HANDA <address@hidden>
-;; Maintainer: Kenichi HANDA <address@hidden>
+;; Author: Kenichi Handa <address@hidden>
+;; Maintainer: Kenichi Handa <address@hidden>
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/international/iso-ascii.el b/lisp/international/iso-ascii.el
index 395e6c4..b317b8a 100644
--- a/lisp/international/iso-ascii.el
+++ b/lisp/international/iso-ascii.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Howard Gayle
-;; Maintainer: address@hidden
 ;; Keywords: i18n
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el
index b573e1e..14da02c 100644
--- a/lisp/international/iso-transl.el
+++ b/lisp/international/iso-transl.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Howard Gayle
-;; Maintainer: address@hidden
 ;; Keywords: i18n
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index dfa9e4e..27296ec 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1029,7 +1029,13 @@ It is highly recommended to fix it before writing to a 
file."
                 ;; This check perhaps isn't ideal, but is probably
                 ;; the best thing to do.
                 (not (auto-coding-alist-lookup (or file buffer-file-name "")))
-                (not (coding-system-equal coding-system auto-cs)))
+                (not (coding-system-equal coding-system auto-cs))
+                 ;; coding-system-equal barfs on 'charset'.
+                 (or (equal (coding-system-type auto-cs) 'charset)
+                     (equal (coding-system-type coding-system) 'charset)
+                     (not (coding-system-equal (coding-system-type auto-cs)
+                                               (coding-system-type
+                                                coding-system)))))
            (unless (yes-or-no-p
                     (format "Selected encoding %s disagrees with \
 %s specified by file contents.  Really save (else edit coding cookies \
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index 8ad2127..de5e7d8 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -456,7 +456,7 @@ QUALITY can be:
          (lineno (if (= eol 1) (1- (line-number-at-pos position)) 0))
          (type (coding-system-type coding-system))
          (base (coding-system-base coding-system))
-         byte)
+         (point-min 1))                 ;Clarify what the `1' means.
     (and (eq type 'utf-8)
          ;; Any post-read/pre-write conversions mean it's not really UTF-8.
          (not (null (coding-system-get coding-system :post-read-conversion)))
@@ -471,19 +471,17 @@ QUALITY can be:
          (setq type 'single-byte))
     (pcase type
       ('utf-8
-       (setq byte (position-bytes position))
-       (when (null byte)
-         (if (<= position 0)
-             (setq byte 1)
-           (setq byte (position-bytes (point-max)))))
-       (setq byte (1- byte))
-       (+ byte
+       (+ (or (position-bytes position)
+              (if (<= position 0)
+                  point-min
+                (position-bytes (point-max))))
           ;; Account for BOM, if any.
           (if (coding-system-get coding-system :bom) 3 0)
           ;; Account for CR in CRLF pairs.
-          lineno))
+          lineno
+          (- point-min)))
       ('single-byte
-       (+ position -1 lineno))
+       (+ position (- point-min) lineno))
       ((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
@@ -491,14 +489,14 @@ QUALITY can be:
             (guard (not (eq quality 'exact))))
        ;; In approximate mode, assume all characters are within the
        ;; BMP, i.e. each one takes up 2 bytes.
-       (+ (* (1- position) 2)
+       (+ (* (- position point-min) 2)
           ;; Account for BOM, if any.
           (if (coding-system-get coding-system :bom) 2 0)
           ;; Account for CR in CRLF pairs.
           lineno))
       (_
        (pcase quality
-         ('approximate (+ (position-bytes position) -1 lineno))
+         ('approximate (+ (position-bytes position) (- point-min) lineno))
          ('exact
           ;; Rather than assume that the file exists and still holds the right
           ;; data, we reconstruct its relevant portion.
@@ -511,7 +509,7 @@ QUALITY can be:
                     (widen)
                     (encode-coding-region (point-min) (min (point-max) 
position)
                                           coding-system tmp-buf)))
-                (1- (point-max)))))))))))
+                (buffer-size))))))))))
 
 (provide 'mule-util)
 
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index ba30fee..21f3118 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1345,8 +1345,11 @@ just set the variable `buffer-file-coding-system' 
directly."
       (setq coding-system
            (merge-coding-systems coding-system buffer-file-coding-system)))
   (when (and (called-interactively-p 'interactive)
-            (not (memq 'emacs (coding-system-get coding-system
-                                                 :charset-list))))
+             ;; FIXME: For some reason
+             ;;     (coding-system-get 'iso-2022-7bit :charset-list)
+             ;; returns `iso-2022' rather than returning a list!
+             (let ((css (coding-system-get coding-system :charset-list)))
+               (not (and (listp css) (memq 'emacs css)))))
     ;; Check whether save would succeed, and jump to the offending char(s)
     ;; if not.
     (let ((css (find-coding-systems-region (point-min) (point-max))))
@@ -2495,7 +2498,18 @@ This function is intended to be added to 
`auto-coding-functions'."
       (when end
        (if (re-search-forward "encoding=[\"']\\(.+?\\)[\"']" end t)
            (let* ((match (match-string 1))
-                  (sym (intern (downcase match))))
+                   (sym-name (downcase match))
+                   (sym-name
+                    ;; https://www.w3.org/TR/xml/#charencoding says:
+                    ;; "Entities encoded in UTF-16 MUST [...] begin
+                    ;; with the Byte Order Mark."  The trick below is
+                    ;; based on the fact that utf-16be/le don't
+                    ;; specify BOM, while utf-16-be/le do.
+                    (cond
+                     ((equal sym-name "utf-16le") "utf-16-le")
+                     ((equal sym-name "utf-16be") "utf-16-be")
+                     (t sym-name)))
+                  (sym (intern sym-name)))
              (if (coding-system-p sym)
                   ;; If the encoding tag is UTF-8 and the buffer's
                   ;; encoding is one of the variants of UTF-8, use the
@@ -2584,9 +2598,14 @@ added by processing software."
       (let ((detected
              (with-coding-priority '(utf-8)
                (coding-system-base
-                (detect-coding-region (point-min) (point-max) t)))))
-        ;; Pure ASCII always comes back as undecided.
+                (detect-coding-region (point-min) (point-max) t))))
+            (bom (list (char-after 1) (char-after 2))))
         (cond
+         ((equal bom '(#xFE #xFF))
+          'utf-16be-with-signature)
+         ((equal bom '(#xFF #xFE))
+          'utf-16le-with-signature)
+         ;; Pure ASCII always comes back as undecided.
          ((memq detected '(utf-8 undecided))
           'utf-8)
          ((eq detected 'utf-16le-with-signature) 'utf-16le-with-signature)
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el
index 543f2e3..fd68137 100644
--- a/lisp/international/ogonek.el
+++ b/lisp/international/ogonek.el
@@ -4,7 +4,6 @@
 
 ;; Author: Włodek Bzyl
 ;;        Ryszard Kubiak
-;; Maintainer: address@hidden
 ;; Keywords: i18n
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 3266b93..2683118 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -6,9 +6,9 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
-;; Author: Kenichi HANDA <address@hidden>
-;;        Naoto TAKAHASHI <address@hidden>
-;; Maintainer: Kenichi HANDA <address@hidden>
+;; Author: Kenichi Handa <address@hidden>
+;;        Naoto Takahashi <address@hidden>
+;; Maintainer: Kenichi Handa <address@hidden>
 ;; Keywords: mule, multilingual, input method, i18n
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/international/utf7.el b/lisp/international/utf7.el
index 0e67a62..f22fb8d 100644
--- a/lisp/international/utf7.el
+++ b/lisp/international/utf7.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Jon K Hellan <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 6280afe..5aaeae4 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-1997, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: matching
 ;; Package: emacs
 
@@ -832,12 +831,20 @@ This is like `describe-bindings', but displays only 
Isearch keys."
   'isearch-regexp-function "25.1")
 (defvar isearch-regexp-function nil
   "Regexp-based search mode for words/symbols.
-If the value is a function (e.g. `isearch-symbol-regexp'), it is
-called to convert a plain search string to a regexp used by
-regexp search functions.
+If non-nil, a function to convert a search string to a regexp
+used by regexp search functions.
+
+The function should accept 1 or 2 arguments: the original string
+to convert, and a flag, whose non-nil value means the match
+doesn't have to start or end on a word boundary.  The function
+should return the corresponding regexp, a string.
+
 The symbol property `isearch-message-prefix' put on this function
 specifies the prefix string displayed in the search message.
 
+Existing functions you could use as values are `word-search-regexp',
+`isearch-symbol-regexp', and `char-fold-to-regexp'.
+
 This variable is set and changed during isearch.  To change the
 default behavior used for searches, see `search-default-mode'
 instead.")
diff --git a/lisp/isearchb.el b/lisp/isearchb.el
index ee392b3..dc18368 100644
--- a/lisp/isearchb.el
+++ b/lisp/isearchb.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 16 Apr 2004
 ;; Version: 1.5
 ;; Keywords: lisp
diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el
index 3aa84f4..b6ff9f1 100644
--- a/lisp/jka-cmpr-hook.el
+++ b/lisp/jka-cmpr-hook.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Jay K. Adams <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: data
 ;; Package: emacs
 
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 63fb449..8c9dd8a 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Jay K. Adams <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: data
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/kermit.el b/lisp/kermit.el
index f6ed1fb..77c2cbd 100644
--- a/lisp/kermit.el
+++ b/lisp/kermit.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jeff Norden <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 15 Feb 1988
 ;; Keywords: comm
 
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index fc34e16..01dc058 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -776,6 +776,7 @@ If kbd macro currently being defined end it before 
activating it."
 ;; letters and digits, provided that we inhibit the keymap while
 ;; executing the macro later on (but that's controversial...)
 
+;;;###autoload
 (defun kmacro-lambda-form (mac &optional counter format)
   "Create lambda form for macro bound to symbol or key."
   (if counter
diff --git a/lisp/language/cyrillic.el b/lisp/language/cyrillic.el
index 75d4249..564ac5f 100644
--- a/lisp/language/cyrillic.el
+++ b/lisp/language/cyrillic.el
@@ -9,7 +9,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
 
-;; Author: Kenichi Handa <address@hidden>
+;; Author: Kenichi Handa <address@hidden>
 ;; Keywords: multilingual, Cyrillic, i18n
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/language/european.el b/lisp/language/european.el
index 8c38175..fedbca4 100644
--- a/lisp/language/european.el
+++ b/lisp/language/european.el
@@ -525,7 +525,7 @@ method and applying Turkish case rules for the characters 
i, I, ı, İ.")))
     (set-case-syntax ?ı "w" table)))
 
 ;; Polish ISO 8859-2 environment.
-;; Maintainer: Wlodek Bzyl <address@hidden>
+;; Maintainer: Włodek Bzyl <address@hidden>
 ;; Keywords: multilingual, Polish
 
 (set-language-info-alist
diff --git a/lisp/language/indian.el b/lisp/language/indian.el
index d63e9b4..894a015 100644
--- a/lisp/language/indian.el
+++ b/lisp/language/indian.el
@@ -5,7 +5,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
-;; Maintainer:  Kenichi Handa <address@hidden>
+;; Maintainer:  Kenichi Handa <address@hidden>
 ;;             KAWABATA, Taichi <address@hidden>
 ;; Keywords:   multilingual, i18n, Indian
 
diff --git a/lisp/language/thai-word.el b/lisp/language/thai-word.el
index e67dd09..94c6ab9 100644
--- a/lisp/language/thai-word.el
+++ b/lisp/language/thai-word.el
@@ -4,7 +4,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
-;; Author: Kenichi HANDA <address@hidden>
+;; Author: Kenichi Handa <address@hidden>
 
 ;; Keywords: thai, word break, emacs
 
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index ccf2cdc..45c72ff 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -1799,7 +1799,7 @@ If `global-auto-revert-non-file-buffers' is non-nil, this 
mode
 may also revert some non-file buffers, as described in the
 documentation of that variable.  It ignores buffers with modes
 matching `global-auto-revert-ignore-modes', and buffers with a
-non-nil vale of `global-auto-revert-ignore-buffer'.
+non-nil value of `global-auto-revert-ignore-buffer'.
 
 When a buffer is reverted, a message is generated.  This can be
 suppressed by setting `auto-revert-verbose' to nil.
@@ -5200,17 +5200,17 @@ If nil, use Emacs default.")
 
 (custom-autoload 'compilation-window-height "compile" t)
 
-(defvar compilation-process-setup-function nil "\
+(defvar compilation-process-setup-function #'ignore "\
 Function to call to customize the compilation process.
 This function is called immediately before the compilation process is
 started.  It can be used to set any variables or functions that are used
 while processing the output of the compilation process.")
 
-(defvar compilation-buffer-name-function nil "\
+(defvar compilation-buffer-name-function #'compilation--default-buffer-name "\
 Function to compute the name of a compilation buffer.
 The function receives one argument, the name of the major mode of the
 compilation buffer.  It should return a string.
-If nil, compute the name with `(concat \"*\" (downcase major-mode) \"*\")'.")
+By default, it returns `(concat \"*\" (downcase name-of-mode) \"*\")'.")
 
 (defvar compilation-finish-functions nil "\
 Functions to call when a compilation process finishes.
@@ -7632,14 +7632,14 @@ Display character C using printable string S.
 (autoload 'standard-display-g1 "disp-table" "\
 Display character C as character SC in the g1 character set.
 This function assumes that your terminal uses the SO/SI characters;
-it is meaningless for an X frame.
+it is meaningless for a graphical frame.
 
 \(fn C SC)" nil nil)
 
 (autoload 'standard-display-graphic "disp-table" "\
 Display character C as character GC in graphics character set.
-This function assumes VT100-compatible escapes; it is meaningless for an
-X frame.
+This function assumes VT100-compatible escapes; it is meaningless
+for a graphical frame.
 
 \(fn C GC)" nil nil)
 
@@ -7734,7 +7734,44 @@ See `display-line-numbers-mode' for more information on 
Display-Line-Numbers mod
 
 \(fn &optional ARG)" t nil)
 
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"display-line-numbers" '("display-line-numbers-")))
+(if (fboundp 'register-definition-prefixes)
+    (register-definition-prefixes "display-line-numbers" 
'("display-line-numbers-")))
+
+;;;***
+
+;;;### (autoloads nil "display-fill-column-indicator" 
"display-fill-column-indicator.el"
+;;;;;;  (0 0 0 0))
+;;; Generated autoloads from display-fill-column-indicator.el
+
+(autoload 'display-fill-column-indicator-mode "display-fill-column-indicator" 
"\
+Toggle display fill column indicator.
+This uses `display-fill-column-indicator' internally.
+
+To change the position of the line displayed by default,
+customize `display-fill-column-indicator-column'.
+
+\(fn &optional ARG)" t nil)
+
+(defvar global-display-fill-column-indicator-mode nil "\
+Non-nil if Global Display-fill-column-indicator mode is enabled.
+See the `global-display-fill-column-indicator-mode' command
+for a description of this minor mode.")
+
+(custom-autoload 'global-display-fill-column-indicator-mode
+                 "display-fill-column-indicator" nil)
+
+(autoload 'global-display-fill-column-indicator-mode
+  "display-fill-column-indicator" "\
+Toggle display fill column indicator.
+This uses `display-fill-column-indicator' internally.
+
+To change the position of the line displayed by default,
+customize `display-fill-column-indicator-column'.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes)
+    (register-definition-prefixes "display-fill-column-indicator" 
'("display-fill-column-indicator-")))
 
 ;;;***
 
@@ -17538,8 +17575,9 @@ 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.
-Optional arguments VISIT, BEG, END, and REPLACE are interpreted as for
-the command `insert-file-contents'.
+Optional arguments VISIT, BEG, END, and REPLACE are interpreted
+as for the command `insert-file-contents'.  Return list of
+absolute file name and number of characters inserted.
 
 \(fn FILE &optional VISIT BEG END REPLACE)" nil nil)
 
@@ -18691,15 +18729,17 @@ Major mode for editing JavaScript.
 \(fn)" t nil)
 
 (autoload 'js-jsx-mode "js" "\
-Major mode for editing JSX.
+Major mode for editing JavaScript+JSX.
 
-To customize the indentation for this mode, set the SGML offset
-variables (`sgml-basic-offset', `sgml-attribute-offset' et al.)
-locally, like so:
+Simply makes `js-jsx-syntax' buffer-local and sets it to t.
 
-  (defun set-jsx-indentation ()
-    (setq-local sgml-basic-offset js-indent-level))
-  (add-hook \\='js-jsx-mode-hook #\\='set-jsx-indentation)
+`js-mode' may detect and enable support for JSX automatically if
+it appears to be used in a JavaScript file.  You could also
+customize `js-jsx-regexps' to improve that detection; or, you
+could set `js-jsx-syntax' to t in your init file, or in a
+.dir-locals.el file, or using file variables; or, you could call
+`js-jsx-enable' in `js-mode-hook'.  You may be better served by
+one of the aforementioned options instead of using this mode.
 
 \(fn)" t nil)
  (defalias 'javascript-mode 'js-mode)
@@ -35307,7 +35347,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 REV1 and REV2 revisions of the fileset.
+Report diffs between revisions REV1 and REV2 in the repository history.
+This compares two revisions of the current fileset.
+If REV1 is nil, it defaults to the current revision, i.e. revision
+of the last commit.
+If REV2 is nil, it defaults to the work tree, i.e. the current
+state of each file in the fileset.
 
 \(fn FILES REV1 REV2)" t nil)
 
@@ -35334,8 +35379,14 @@ The merge base is a common ancestor between REV1 and 
REV2 revisions.
 \(fn FILES REV1 REV2)" t nil)
 
 (autoload 'vc-version-ediff "vc" "\
-Show differences between revisions of the fileset in the
-repository history using ediff.
+Show differences between REV1 and REV2 of FILES using ediff.
+This compares two revisions of the files in FILES.  Currently,
+only a single file's revisions can be compared, i.e. FILES can
+specify only one file name.
+If REV1 is nil, it defaults to the current revision, i.e. revision
+of the last commit.
+If REV2 is nil, it defaults to the work tree, i.e. the current
+state of each file in FILES.
 
 \(fn FILES REV1 REV2)" t nil)
 
@@ -38171,43 +38222,45 @@ Zone out, completely." t nil)
 ;;;;;;  "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/sami.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/sami.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/py-punct.el b/lisp/leim/quail/py-punct.el
index eed70a8..49ea66e 100644
--- a/lisp/leim/quail/py-punct.el
+++ b/lisp/leim/quail/py-punct.el
@@ -6,7 +6,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
-;; Author: Ken'ichi HANDA <address@hidden>
+;; Author: Ken'ichi Handa <address@hidden>
 
 ;; Keywords: multilingual, input method, Chinese
 
diff --git a/lisp/leim/quail/pypunct-b5.el b/lisp/leim/quail/pypunct-b5.el
index 45597a4..9f4e73c 100644
--- a/lisp/leim/quail/pypunct-b5.el
+++ b/lisp/leim/quail/pypunct-b5.el
@@ -5,7 +5,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
-;; Author: Ken'ichi HANDA <address@hidden>
+;; Author: Ken'ichi Handa <address@hidden>
 
 ;; Keywords: multilingual, input method, Chinese
 
diff --git a/lisp/linum.el b/lisp/linum.el
index 0b4b008..6fe3057 100644
--- a/lisp/linum.el
+++ b/lisp/linum.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Markus Triska <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 ;; Version: 0.9x
 
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 4e5d8e0..69f2c0b 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1995, 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 67e8aa7..c43d147 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1992, 1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/lpr.el b/lisp/lpr.el
index 436f9e3..17a37f1 100644
--- a/lisp/lpr.el
+++ b/lisp/lpr.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: unix
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 1f2c468..7ab97eb 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -4,7 +4,6 @@
 
 ;; Author: Sebastian Kremer <address@hidden>
 ;; Modified by: Francis J. Wright <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: unix, dired
 ;; Package: emacs
 
diff --git a/lisp/macros.el b/lisp/macros.el
index ba6a840..b9020a2 100644
--- a/lisp/macros.el
+++ b/lisp/macros.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1992, 1994-1995, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: abbrev
 ;; Package: emacs
 
@@ -36,6 +35,16 @@
 ;;;###autoload
 (defalias 'name-last-kbd-macro #'kmacro-name-last-macro)
 
+(defun macros--insert-vector-macro (definition)
+  "Print DEFINITION, a vector, into the current buffer."
+  (dotimes (i (length definition))
+    (let ((char (aref definition i)))
+      (insert (if (zerop i) ?\[ ?\s))
+      (if (characterp char)
+          (princ (prin1-char char) (current-buffer))
+        (prin1 char (current-buffer)))))
+  (insert ?\]))
+
 ;;;###autoload
 (defun insert-kbd-macro (macroname &optional keys)
   "Insert in buffer the definition of kbd macro MACRONAME, as Lisp code.
@@ -111,19 +120,17 @@ use this command, and then save the file."
                     (delete-region (point) (1+ (point)))
                     (insert "\\M-\\C-?"))))))
       (if (vectorp definition)
-         (let ((len (length definition)) (i 0) char)
-           (while (< i len)
-             (insert (if (zerop i) ?\[ ?\s))
-             (setq char (aref definition i)
-                   i (1+ i))
-             (if (not (numberp char))
-                  (prin1 char (current-buffer))
-                (princ (prin1-char char) (current-buffer))))
-           (insert ?\]))
-        ;; FIXME: For kmacros, we shouldn't write the (lambda ...)
-        ;; gunk but instead we should write something more abstract like
-        ;; (kmacro-create [<keys>] 0 "%d").
-       (prin1 definition (current-buffer))))
+          (macros--insert-vector-macro definition)
+        (pcase (kmacro-extract-lambda definition)
+          (`(,vecdef ,counter ,format)
+           (insert "(kmacro-lambda-form ")
+           (macros--insert-vector-macro vecdef)
+           (insert " ")
+           (prin1 counter (current-buffer))
+           (insert " ")
+           (prin1 format (current-buffer))
+           (insert ")"))
+          (_ (prin1 definition (current-buffer))))))
     (insert ")\n")
     (if keys
         (let ((keys (or (where-is-internal (symbol-function macroname)
diff --git a/lisp/mail/blessmail.el b/lisp/mail/blessmail.el
index 62094bf..2a2ff3d 100644
--- a/lisp/mail/blessmail.el
+++ b/lisp/mail/blessmail.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index c637e24..2cd6d56 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 ;; Keywords: maint mail
 ;; Package: emacs
 
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index a90d9c4..180e32b 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -1657,7 +1657,7 @@ local gurus."
 (declare-function smtp-via-smtp "ext:smtp" (sender recipients 
smtp-text-buffer))
 (defvar smtp-server)
 
-;; FLIM's smtp.el pointed out to me by Kenichi Handa <address@hidden>
+;; FLIM's smtp.el pointed out to me by Kenichi Handa <address@hidden>
 (defun feedmail-buffer-to-smtp (prepped errors-to addr-listoid)
   "Function which actually calls smtp-via-smtp to send buffer as e-mail."
   (feedmail-say-debug ">in-> feedmail-buffer-to-smtp %s" addr-listoid)
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index 81dc11d..bbc42e1 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -73,50 +73,38 @@
 
 (defcustom footnote-mode-line-string " FN"
   "String to display in modes section of the mode-line."
-  :type 'string
-  :group 'footnote)
-
-(defcustom footnote-mode-hook nil
-  "Hook functions run when footnote-mode is activated."
-  :type 'hook
-  :group 'footnote)
+  :type 'string)
 
 (defcustom footnote-narrow-to-footnotes-when-editing nil
   "If non-nil, narrow to footnote text body while editing a footnote."
-  :type 'boolean
-  :group 'footnote)
+  :type 'boolean)
 
 (defcustom footnote-prompt-before-deletion t
   "If non-nil, prompt before deleting a footnote.
 There is currently no way to undo deletions."
-  :type 'boolean
-  :group 'footnote)
+  :type 'boolean)
 
 (defcustom footnote-spaced-footnotes t
   "If non-nil, insert an empty line between footnotes.
 Customizing this variable has no effect on buffers already
 displaying footnotes."
-  :type 'boolean
-  :group 'footnote)
+  :type 'boolean)
 
 (defcustom footnote-use-message-mode t ; Nowhere used.
   "If non-nil, assume Footnoting will be done in `message-mode'."
-  :type 'boolean
-  :group 'footnote)
+  :type 'boolean)
 
 (defcustom footnote-body-tag-spacing 2
   "Number of spaces separating a footnote body tag and its text.
 Customizing this variable has no effect on buffers already
 displaying footnotes."
-  :type 'integer
-  :group 'footnote)
+  :type 'integer)
 
 (defcustom footnote-prefix [(control ?c) ?!]
-  "Prefix key to use for Footnote command in Footnote minor mode.
+  "Prefix key to use for Footnote commands in Footnote minor mode.
 The value of this variable is checked as part of loading Footnote mode.
 After that, changing the prefix key requires manipulating keymaps."
-  :type 'key-sequence
-  :group 'footnote)
+  :type 'key-sequence)
 
 ;;; Interface variables that probably shouldn't be changed
 
@@ -127,8 +115,7 @@ value of `footnote-section-tag-regexp' is ignored.  
Customizing
 this variable has no effect on buffers already displaying
 footnotes."
   :version "27.1"
-  :type 'string
-  :group 'footnote)
+  :type 'string)
 
 (defcustom footnote-section-tag-regexp
   ;; Even if `footnote-section-tag' has a trailing space, let's not require it
@@ -139,31 +126,27 @@ This variable is disregarded when `footnote-section-tag' 
is the
 empty string.  Customizing this variable has no effect on buffers
 already displaying footnotes."
   :version "27.1"
-  :type 'regexp
-  :group 'footnote)
+  :type 'regexp)
 
 ;; The following three should be consumed by footnote styles.
 (defcustom footnote-start-tag "["
   "String used to denote start of numbered footnote.
 Should not be set to the empty string.  Customizing this variable
 has no effect on buffers already displaying footnotes."
-  :type 'string
-  :group 'footnote)
+  :type 'string)
 
 (defcustom footnote-end-tag "]"
   "String used to denote end of numbered footnote.
 Should not be set to the empty string.  Customizing this variable
 has no effect on buffers already displaying footnotes."
-  :type 'string
-  :group 'footnote)
+  :type 'string)
 
 (defcustom footnote-signature-separator
   (if (boundp 'message-signature-separator)
       message-signature-separator
     "^-- $")
   "Regexp used by Footnote mode to recognize signatures."
-  :type 'regexp
-  :group 'footnote)
+  :type 'regexp)
 
 (defcustom footnote-align-to-fn-text t
   "How to left-align footnote text.
@@ -174,19 +157,19 @@ left with the first character of footnote text."
 
 ;;; Private variables
 
-(defvar footnote-style-number nil
-  "Footnote style represented as an index into footnote-style-alist.")
-(make-variable-buffer-local 'footnote-style-number)
-
-(defvar footnote-text-marker-alist nil
-  "List of markers pointing to text of footnotes in message buffer.")
-(make-variable-buffer-local 'footnote-text-marker-alist)
+(defvar-local footnote-style-number nil
+  "Footnote style represented as an index into `footnote-style-alist'.")
 
-(defvar footnote-pointer-marker-alist nil
-  "List of markers pointing to footnote pointers in message buffer.")
-(make-variable-buffer-local 'footnote-pointer-marker-alist)
+(defvar-local footnote--markers-alist nil
+  "List of (FN TEXT . POINTERS).
+Where FN is the footnote number, TEXT is a marker pointing to
+the footnote's text, and POINTERS is a list of markers pointing
+to the places from which the footnote is referenced.
+Both TEXT and POINTERS points right *before* the [...]")
 
 (defvar footnote-mouse-highlight 'highlight
+  ;; FIXME: This `highlight' property is not currently used.
+  ;; We should use `mouse-face' and make mouse clicks work on them.
   "Text property name to enable mouse over highlight.")
 
 (defvar footnote-mode)
@@ -365,7 +348,7 @@ Use Unicode characters for footnoting."
 (defconst footnote-hebrew-numeric-regex
   (let ((numchars (string-to-list
                   (apply #'concat (apply #'append footnote-hebrew-numeric)))))
-    (concat (regexp-opt-charset (cons ?' numchars)) "+")))
+    (rx-to-string `(1+ (in ?' ,@numchars)))))
 ;; (defconst footnote-hebrew-numeric-regex 
"\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
 
 (defun footnote--hebrew-numeric (n)
@@ -441,159 +424,122 @@ Customizing this variable has no effect on buffers 
already
 displaying footnotes.  To change the style of footnotes in such a
 buffer use the command `footnote-set-style'."
   :type (cons 'choice (mapcar (lambda (x) (list 'const (car x)))
-                             footnote-style-alist))
-  :group 'footnote)
+                             footnote-style-alist)))
 
 ;;; Style utilities & functions
-(defun footnote--style-p (style)
-  "Return non-nil if style is a valid style known to `footnote-mode'."
-  (assq style footnote-style-alist))
 
 (defun footnote--index-to-string (index)
   "Convert a binary index into a string to display as a footnote.
 Conversion is done based upon the current selected style."
-  (let ((alist (if (footnote--style-p footnote-style)
-                  (assq footnote-style footnote-style-alist)
-                (nth 0 footnote-style-alist))))
+  (let ((alist (or (assq footnote-style footnote-style-alist)
+                  (nth 0 footnote-style-alist))))
     (funcall (nth 1 alist) index)))
 
-(defun footnote--current-regexp ()
+(defun footnote--current-regexp (&optional index-regexp)
   "Return the regexp of the index of the current style."
-  (let ((regexp (nth 2 (or (assq footnote-style footnote-style-alist)
-                          (nth 0 footnote-style-alist)))))
+  (let ((regexp (or index-regexp
+                    (nth 2 (or (assq footnote-style footnote-style-alist)
+                              (nth 0 footnote-style-alist))))))
     (concat
+     (regexp-quote footnote-start-tag) "\\("
      ;; 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)
-     "*")))
+     "*\\)" (regexp-quote footnote-end-tag))))
 
 (defun footnote--refresh-footnotes (&optional index-regexp)
   "Redraw all footnotes.
-You must call this or arrange to have this called after changing footnote
-styles."
-  (unless index-regexp
-    (setq index-regexp (footnote--current-regexp)))
-  (save-excursion
-    ;; Take care of the pointers first
-    (let ((i 0) locn alist)
-      (while (setq alist (nth i footnote-pointer-marker-alist))
-       (setq locn (cdr alist))
-       (while locn
-         (goto-char (car locn))
+You must call this or arrange to have this called after changing
+footnote styles."
+  (let ((fn-regexp (footnote--current-regexp index-regexp)))
+    (save-excursion
+      (pcase-dolist (`(,fn ,text . ,pointers) footnote--markers-alist)
+        ;; Take care of the pointers first.
+       (dolist (locn pointers)
+         (goto-char locn)
          ;; Try to handle the case where `footnote-start-tag' and
          ;; `footnote-end-tag' are the same string.
-         (when (looking-back (concat
-                              (regexp-quote footnote-start-tag)
-                              "\\(" index-regexp "+\\)"
-                              (regexp-quote footnote-end-tag))
-                             (line-beginning-position))
+         (when (looking-at fn-regexp)
            (replace-match
             (propertize
              (concat
               footnote-start-tag
-              (footnote--index-to-string (1+ i))
+              (footnote--index-to-string fn)
               footnote-end-tag)
-             'footnote-number (1+ i) footnote-mouse-highlight t)
-            nil "\\1"))
-         (setq locn (cdr locn)))
-       (setq i (1+ i))))
-
-    ;; Now take care of the text section
-    (let ((i 0) alist)
-      (while (setq alist (nth i footnote-text-marker-alist))
-       (goto-char (cdr alist))
-       (when (looking-at (concat
-                          (regexp-quote footnote-start-tag)
-                          "\\(" index-regexp "+\\)"
-                          (regexp-quote footnote-end-tag)))
+             'footnote-number fn footnote-mouse-highlight t)
+            t t)))
+
+        ;; Now take care of the text section
+       (goto-char text)
+       (when (looking-at fn-regexp)
          (replace-match
           (propertize
            (concat
             footnote-start-tag
-            (footnote--index-to-string (1+ i))
+            (footnote--index-to-string fn)
             footnote-end-tag)
-           'footnote-number (1+ i))
-          nil "\\1"))
-       (setq i (1+ i))))))
-
-(defun footnote--assoc-index (key alist)
-  "Give index of key in alist."
-  (let ((i 0) (max (length alist)) rc)
-    (while (and (null rc)
-               (< i max))
-      (when (eq key (car (nth i alist)))
-       (setq rc i))
-      (setq i (1+ i)))
-    rc))
+           'footnote-number fn)
+          t t))))))
 
 (defun footnote-cycle-style ()
   "Select next defined footnote style."
   (interactive)
-  (let ((old (footnote--assoc-index footnote-style footnote-style-alist))
-       (max (length footnote-style-alist))
-       idx)
-    (setq idx (1+ old))
-    (when (>= idx max)
-      (setq idx 0))
-    (setq footnote-style (car (nth idx footnote-style-alist)))
-    (footnote--refresh-footnotes (nth 2 (nth old footnote-style-alist)))))
-
-(defun footnote-set-style (&optional style)
+  (let ((old-desc (assq footnote-style footnote-style-alist)))
+    (setq footnote-style (caar (or (cdr (memq old-desc footnote-style-alist))
+                                   footnote-style-alist)))
+    (footnote--refresh-footnotes (nth 2 old-desc))
+    (message "Style set to %s" footnote-style)))
+
+(defun footnote-set-style (style)
   "Select a specific style."
   (interactive
    (list (intern (completing-read
                  "Footnote Style: "
-                 obarray #'footnote--style-p 'require-match))))
-  (let ((old (footnote--assoc-index footnote-style footnote-style-alist)))
+                 footnote-style-alist nil 'require-match))))
+  (let ((old-desc (assq footnote-style footnote-style-alist)))
     (setq footnote-style style)
-    (footnote--refresh-footnotes (nth 2 (nth old footnote-style-alist)))))
+    (footnote--refresh-footnotes (nth 2 old-desc))))
 
 ;; Internal functions
 (defun footnote--insert-numbered-footnote (arg &optional mousable)
-  "Insert numbered footnote at (point)."
+  "Insert numbered footnote at point.
+Return a marker pointing to the beginning of the [...]."
   (let ((string (concat footnote-start-tag
                        (footnote--index-to-string arg)
-                       footnote-end-tag)))
-    (insert-before-markers
+                       footnote-end-tag))
+        (pos (point)))
+    (insert
      (if mousable
         (propertize
          string 'footnote-number arg footnote-mouse-highlight t)
-       (propertize string 'footnote-number arg)))))
+       (propertize string 'footnote-number arg)))
+    (copy-marker pos t)))
 
-(defun footnote--renumber (_from to pointer-alist text-alist)
+(defun footnote--renumber (to alist-elem)
   "Renumber a single footnote."
-  (let* ((posn-list (cdr pointer-alist)))
-    (setcar pointer-alist to)
-    (setcar text-alist to)
-    (while posn-list
-      (goto-char (car posn-list))
-      (when (looking-back (concat (regexp-quote footnote-start-tag)
-                                 (footnote--current-regexp)
-                                 (regexp-quote footnote-end-tag))
-                         (line-beginning-position))
-       (replace-match
-        (propertize
+  (unless (equal to (car alist-elem))   ;Nothing to do.
+    (let* ((fn-regexp (footnote--current-regexp)))
+      (setcar alist-elem to)
+      (dolist (posn (cddr alist-elem))
+        (goto-char posn)
+        (when (looking-at fn-regexp)
+         (replace-match
+          (propertize
+           (concat footnote-start-tag
+                   (footnote--index-to-string to)
+                   footnote-end-tag)
+           'footnote-number to footnote-mouse-highlight t))))
+      (goto-char (cadr alist-elem))
+      (when (looking-at fn-regexp)
+        (replace-match
+         (propertize
          (concat footnote-start-tag
                  (footnote--index-to-string to)
                  footnote-end-tag)
-         'footnote-number to footnote-mouse-highlight t)))
-      (setq posn-list (cdr posn-list)))
-    (goto-char (cdr text-alist))
-    (when (looking-at (concat (regexp-quote footnote-start-tag)
-                             (footnote--current-regexp)
-                             (regexp-quote footnote-end-tag)))
-      (replace-match
-       (propertize
-       (concat footnote-start-tag
-               (footnote--index-to-string to)
-               footnote-end-tag)
-       'footnote-number to)))))
+         'footnote-number to))))))
 
 (defun footnote--narrow-to-footnotes ()
   "Restrict text in buffer to show only text of footnotes."
@@ -607,93 +553,66 @@ styles."
   (or (re-search-backward footnote-signature-separator nil t)
       (point)))
 
-(defun footnote--insert-text-marker (arg locn)
-  "Insert a marker pointing to footnote ARG, at buffer location LOCN."
-  (let ((marker (make-marker)))
-    (unless (assq arg footnote-text-marker-alist)
-      (set-marker marker locn)
-      (setq footnote-text-marker-alist
-           (cons (cons arg marker) footnote-text-marker-alist))
-      (setq footnote-text-marker-alist
-           (footnote--sort footnote-text-marker-alist)))))
-
-(defun footnote--insert-pointer-marker (arg locn)
-  "Insert a marker pointing to footnote ARG, at buffer location LOCN."
-  (let ((marker (make-marker))
-       alist)
-    (set-marker marker locn)
-    (if (setq alist (assq arg footnote-pointer-marker-alist))
-       (setf alist
-             (cons marker (cdr alist)))
-      (setq footnote-pointer-marker-alist
-           (cons (cons arg (list marker)) footnote-pointer-marker-alist))
-      (setq footnote-pointer-marker-alist
-           (footnote--sort footnote-pointer-marker-alist)))))
+(defun footnote--insert-markers (arg text ptr)
+  "Insert the markers of new footnote ARG."
+  (cl-assert (and (numberp arg) (markerp text) (markerp ptr)))
+  (cl-assert (not (assq arg footnote--markers-alist)))
+  (push `(,arg ,text ,ptr) footnote--markers-alist)
+  (setq footnote--markers-alist
+       (footnote--sort footnote--markers-alist)))
+
+(defun footnote--goto-first ()
+  "Go to beginning of footnote area and return non-nil if successful.
+Presumes we're within the footnote area already."
+  (cond
+   ((not (string-equal footnote-section-tag ""))
+    (re-search-backward
+     (concat "^" footnote-section-tag-regexp) nil t))
+   (footnote--markers-alist
+    (goto-char (cadr (car footnote--markers-alist))))))
 
 (defun footnote--insert-footnote (arg)
   "Insert a footnote numbered ARG, at (point)."
   (push-mark)
-  (footnote--insert-pointer-marker arg (point))
-  (footnote--insert-numbered-footnote arg t)
-  (footnote--goto-char-point-max)
-  (if (cond
-       ((not (string-equal footnote-section-tag ""))
-       (re-search-backward (concat "^" footnote-section-tag-regexp) nil t))
-       (footnote-text-marker-alist
-       (goto-char (cdar footnote-text-marker-alist))))
-      (save-restriction
-       (when footnote-narrow-to-footnotes-when-editing
-         (footnote--narrow-to-footnotes))
-       (footnote-goto-footnote (1- arg)) ; evil, FIXME (less evil now)
-       ;; (message "Inserting footnote %d" arg)
-       (unless
-           (or (eq arg 1)
-               (when (re-search-forward
-                      (if footnote-spaced-footnotes
-                          "\n\n"
-                        (concat "\n"
-                                (regexp-quote footnote-start-tag)
-                                (footnote--current-regexp)
-                                (regexp-quote footnote-end-tag)))
-                      nil t)
-                 (unless (beginning-of-line) t))
-               (footnote--goto-char-point-max)
-               (cond
-                ((not (string-equal footnote-section-tag ""))
-                 (re-search-backward
-                  (concat "^" footnote-section-tag-regexp) nil t))
-                (footnote-text-marker-alist
-                 (goto-char (cdar footnote-text-marker-alist)))))))
-    (unless (looking-at "^$")
-      (insert "\n"))
-    (when (eobp)
-      (insert "\n"))
-    (unless (string-equal footnote-section-tag "")
-      (insert footnote-section-tag "\n")))
-  (let ((old-point (point)))
-    (footnote--insert-numbered-footnote arg nil)
-    (footnote--insert-text-marker arg old-point)))
+  (let ((ptr (footnote--insert-numbered-footnote arg t)))
+    (footnote--goto-char-point-max)
+    (if (footnote--goto-first)
+        (save-restriction
+         (when footnote-narrow-to-footnotes-when-editing
+           (footnote--narrow-to-footnotes))
+         (footnote-goto-footnote (1- arg)) ; evil, FIXME (less evil now)
+         ;; (message "Inserting footnote %d" arg)
+         (or (eq arg 1)
+             (when (re-search-forward
+                    (if footnote-spaced-footnotes
+                        "\n\n"
+                      (concat "\n" (footnote--current-regexp)))
+                    nil t)
+               (beginning-of-line)
+                t)
+             (footnote--goto-char-point-max)
+             (footnote--goto-first)))
+      (unless (looking-at "^$")
+        (insert "\n"))
+      (when (eobp)
+        (insert "\n"))
+      (unless (string-equal footnote-section-tag "")
+        (insert footnote-section-tag "\n")))
+    (let ((text (footnote--insert-numbered-footnote arg nil)))
+      (footnote--insert-markers arg text ptr))))
 
 (defun footnote--sort (list)
-  (sort list (lambda (e1 e2)
-              (< (car e1) (car e2)))))
+  (sort list #'car-less-than-car))
 
 (defun footnote--text-under-cursor ()
   "Return the number of the current footnote if in footnote text.
 Return nil if the cursor is not positioned over the text of
 a footnote."
-  (when (and footnote-text-marker-alist
-             (<= (footnote--get-area-point-min)
-                 (point)
-                 (footnote--get-area-point-max)))
-    (let ((i 1) alist-txt result)
-      (while (and (setq alist-txt (nth i footnote-text-marker-alist))
-                  (null result))
-        (when (< (point) (cdr alist-txt))
-          (setq result (car (nth (1- i) footnote-text-marker-alist))))
-        (setq i (1+ i)))
-      (when (and (null result) (null alist-txt))
-        (setq result (car (nth (1- i) footnote-text-marker-alist))))
+  (when (<= (point) (footnote--get-area-point-max))
+    (let ((result nil))
+      (pcase-dolist (`(,fn ,text . ,_) footnote--markers-alist)
+        (if (<= text (point))
+            (setq result fn)))
       result)))
 
 (defun footnote--under-cursor ()
@@ -710,7 +629,7 @@ Return nil if the cursor is not over a footnote."
      (string-width
       (concat footnote-start-tag  footnote-end-tag
               (footnote--index-to-string
-               (caar (last footnote-text-marker-alist)))))))
+               (caar (last footnote--markers-alist)))))))
 
 (defun footnote--fill-prefix-string ()
   "Return the fill prefix to be used by footnote mode."
@@ -730,15 +649,14 @@ With optional arg BEFORE-TAG, return position of the 
`footnote-section-tag'
 instead, if applicable."
   (cond
    ;; FIXME: Shouldn't we use `footnote--get-area-point-max' instead?
-   ((not footnote-text-marker-alist) (point-max))
-   ((not before-tag) (cdr (car footnote-text-marker-alist)))
-   ((string-equal footnote-section-tag "")
-    (cdr (car footnote-text-marker-alist)))
+   ((not footnote--markers-alist) (point-max))
+   ((not before-tag) (cadr (car footnote--markers-alist)))
+   ((string-equal footnote-section-tag "") (cadr (car 
footnote--markers-alist)))
    (t
     (save-excursion
-      (goto-char (cdr (car footnote-text-marker-alist)))
+      (goto-char (cadr (car footnote--markers-alist)))
       (if (re-search-backward (concat "^" footnote-section-tag-regexp) nil t)
-          (match-beginning 0)
+          (point)
         (message "Footnote section tag not found!")
         ;; This `else' should never happen, and indicates an error,
         ;; ie. footnotes already exist and a footnote-section-tag is defined,
@@ -756,7 +674,7 @@ instead, if applicable."
         ;; function, and repeat.
         ;;
         ;; TODO: integrate sanity checks at reasonable operational points.
-        (cdr (car footnote-text-marker-alist)))))))
+        (point))))))
 
 (defun footnote--get-area-point-max ()
   "Return the end of footnote area.
@@ -780,27 +698,23 @@ footnote area, returns `point-max'."
 ;;; User functions
 
 (defun footnote--make-hole ()
+  "Make room in the alist for a new footnote at point.
+Return the footnote number to use."
   (save-excursion
-    (let ((i 0)
-         (notes (length footnote-pointer-marker-alist))
-         alist-ptr alist-txt rc)
-      (while (< i notes)
-       (setq alist-ptr (nth i footnote-pointer-marker-alist))
-       (setq alist-txt (nth i footnote-text-marker-alist))
-       (when (< (point) (- (cadr alist-ptr) 3))
+    (let (rc)
+      (dolist (alist-elem footnote--markers-alist)
+       (when (<= (point) (cl-caddr alist-elem))
          (unless rc
-           (setq rc (car alist-ptr)))
+           (setq rc (car alist-elem)))
          (save-excursion
            (message "Renumbering from %s to %s"
-                    (footnote--index-to-string (car alist-ptr))
+                    (footnote--index-to-string (car alist-elem))
                     (footnote--index-to-string
-                     (1+ (car alist-ptr))))
-           (footnote--renumber (car alist-ptr)
-                              (1+ (car alist-ptr))
-                              alist-ptr
-                              alist-txt)))
-       (setq i (1+ i)))
-      rc)))
+                     (1+ (car alist-elem))))
+           (footnote--renumber (1+ (car alist-elem))
+                               alist-elem))))
+      (or rc
+          (1+ (or (caar (last footnote--markers-alist)) 0))))))
 
 (defun footnote-add-footnote ()
   "Add a numbered footnote.
@@ -810,26 +724,17 @@ If the variable 
`footnote-narrow-to-footnotes-when-editing' is set,
 the buffer is narrowed to the footnote body.  The restriction is removed
 by using `footnote-back-to-message'."
   (interactive "*")
-  (let ((num
-         (if footnote-text-marker-alist
-             (if (< (point) (cl-cadar (last footnote-pointer-marker-alist)))
-                 (footnote--make-hole)
-               (1+ (caar (last footnote-text-marker-alist))))
-           1)))
+  (let ((num (footnote--make-hole)))
     (message "Adding footnote %d" num)
     (footnote--insert-footnote num)
-    (insert-before-markers (make-string footnote-body-tag-spacing ? ))
-    (let ((opoint (point)))
-      (save-excursion
-       (insert-before-markers
-        (if footnote-spaced-footnotes
-            "\n\n"
-          "\n"))
-       (when footnote-narrow-to-footnotes-when-editing
-         (footnote--narrow-to-footnotes)))
-      ;; Emacs/XEmacs bug?  save-excursion doesn't restore point when using
-      ;; insert-before-markers.
-      (goto-char opoint))))
+    (insert (make-string footnote-body-tag-spacing ? ))
+    (save-excursion
+      (insert
+       (if footnote-spaced-footnotes
+          "\n\n"
+        "\n"))
+      (when footnote-narrow-to-footnotes-when-editing
+       (footnote--narrow-to-footnotes)))))
 
 (defun footnote-delete-footnote (&optional arg)
   "Delete a numbered footnote.
@@ -841,23 +746,16 @@ delete the footnote with that number."
   (when (and arg
             (or (not footnote-prompt-before-deletion)
                 (y-or-n-p (format "Really delete footnote %d?" arg))))
-    (let (alist-ptr alist-txt locn)
-      (setq alist-ptr (assq arg footnote-pointer-marker-alist))
-      (setq alist-txt (assq arg footnote-text-marker-alist))
-      (unless (and alist-ptr alist-txt)
-       (error "Can't delete footnote %d" arg))
-      (setq locn (cdr alist-ptr))
-      (while (car locn)
+    (let ((alist-elem (or (assq arg footnote--markers-alist)
+                          (error "Can't delete footnote %d" arg)))
+          (fn-regexp (footnote--current-regexp)))
+      (dolist (locn (cddr alist-elem))
        (save-excursion
-         (goto-char (car locn))
-         (when (looking-back (concat (regexp-quote footnote-start-tag)
-                                     (footnote--current-regexp)
-                                     (regexp-quote footnote-end-tag))
-                             (line-beginning-position))
-           (delete-region (match-beginning 0) (match-end 0))))
-       (setq locn (cdr locn)))
+         (goto-char locn)
+         (when (looking-at fn-regexp)
+           (delete-region (match-beginning 0) (match-end 0)))))
       (save-excursion
-       (goto-char (cdr alist-txt))
+       (goto-char (cadr alist-elem))
        (delete-region
         (point)
         (if footnote-spaced-footnotes
@@ -866,13 +764,10 @@ delete the footnote with that number."
             (end-of-line)
             (next-single-char-property-change
              (point) 'footnote-number nil (footnote--goto-char-point-max))))))
-      (setq footnote-pointer-marker-alist
-           (delq alist-ptr footnote-pointer-marker-alist))
-      (setq footnote-text-marker-alist
-           (delq alist-txt footnote-text-marker-alist))
-      (footnote-renumber-footnotes)
-      (when (and (null footnote-text-marker-alist)
-                (null footnote-pointer-marker-alist))
+      (setq footnote--markers-alist
+           (delq alist-elem footnote--markers-alist))
+      (if footnote--markers-alist
+          (footnote-renumber-footnotes)
        (save-excursion
          (if (not (string-equal footnote-section-tag ""))
              (let* ((end (footnote--goto-char-point-max))
@@ -893,14 +788,9 @@ delete the footnote with that number."
   "Renumber footnotes, starting from 1."
   (interactive "*")
   (save-excursion
-    (let ((i 0)
-         (notes (length footnote-pointer-marker-alist))
-         alist-ptr alist-txt)
-      (while (< i notes)
-       (setq alist-ptr (nth i footnote-pointer-marker-alist))
-       (setq alist-txt (nth i footnote-text-marker-alist))
-       (unless (= (1+ i) (car alist-ptr))
-         (footnote--renumber (car alist-ptr) (1+ i) alist-ptr alist-txt))
+    (let ((i 1))
+      (dolist (alist-elem footnote--markers-alist)
+       (footnote--renumber i alist-elem)
        (setq i (1+ i))))))
 
 (defun footnote-goto-footnote (&optional arg)
@@ -910,18 +800,18 @@ specified, jump to the text of that footnote."
   (interactive "P")
   (unless arg
     (setq arg (footnote--under-cursor)))
-  (let ((footnote (assq arg footnote-text-marker-alist)))
+  (let ((footnote (assq arg footnote--markers-alist)))
     (cond
      (footnote
-      (goto-char (cdr footnote)))
+      (goto-char (cadr footnote)))
      ((eq arg 0)
       (goto-char (point-max))
       (cond
        ((not (string-equal footnote-section-tag ""))
        (re-search-backward (concat "^" footnote-section-tag-regexp))
        (forward-line 1))
-       (footnote-text-marker-alist
-       (goto-char (cdar footnote-text-marker-alist)))))
+       (footnote--markers-alist
+       (goto-char (cadr (car footnote--markers-alist))))))
      (t
       (error "I don't see a footnote here")))))
 
@@ -935,17 +825,19 @@ being set it is automatically widened."
     (when note
       (when footnote-narrow-to-footnotes-when-editing
        (widen))
-      (goto-char (cadr (assq note footnote-pointer-marker-alist))))))
+      (goto-char (cl-caddr (assq note footnote--markers-alist)))
+      (when (looking-at (footnote--current-regexp))
+        (goto-char (match-end 0))))))
 
 (defvar footnote-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "a" 'footnote-add-footnote)
-    (define-key map "b" 'footnote-back-to-message)
-    (define-key map "c" 'footnote-cycle-style)
-    (define-key map "d" 'footnote-delete-footnote)
-    (define-key map "g" 'footnote-goto-footnote)
-    (define-key map "r" 'footnote-renumber-footnotes)
-    (define-key map "s" 'footnote-set-style)
+    (define-key map "a" #'footnote-add-footnote)
+    (define-key map "b" #'footnote-back-to-message)
+    (define-key map "c" #'footnote-cycle-style)
+    (define-key map "d" #'footnote-delete-footnote)
+    (define-key map "g" #'footnote-goto-footnote)
+    (define-key map "r" #'footnote-renumber-footnotes)
+    (define-key map "s" #'footnote-set-style)
     map))
 
 (defvar footnote-minor-mode-map
@@ -984,8 +876,7 @@ play around with the following keys:
     (add-function :around (local 'adaptive-fill-function)
                   #'footnote--adaptive-fill-function)
 
-    ;; filladapt is an XEmacs package which AFAIK has never been ported
-    ;; to Emacs.
+    ;; Filladapt was an XEmacs package which is now in GNU ELPA.
     (when (boundp 'filladapt-token-table)
       ;; add tokens to filladapt to match footnotes
       ;; 1] xxxxxxxxxxx x x x or [1] x x x x x x x
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el
index 6068952..ec17d66 100644
--- a/lisp/mail/hashcash.el
+++ b/lisp/mail/hashcash.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2003-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Written by: Paul Foley <address@hidden> (1997-2002)
-;; Maintainer: address@hidden
 ;; Keywords: mail, hashcash
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el
index c1e90c3..e610806 100644
--- a/lisp/mail/mail-extr.el
+++ b/lisp/mail/mail-extr.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Joe Wells <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: mail-utils
 
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index cbcbdfa..f561c08 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail, news
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index d59df88..17f4f0c 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -4,7 +4,6 @@
 ;; Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden; now address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 19 Oct 90
 ;; Keywords: mail
 
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index 42896c1..68e44f8 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1987, 1995-1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el
index 10db110..3172c97 100644
--- a/lisp/mail/reporter.el
+++ b/lisp/mail/reporter.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:          1993-1998 Barry A. Warsaw
-;; Maintainer: address@hidden
 ;; Created:         19-Apr-1993
 ;; Keywords: maint mail tools
 
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index a53a77e..4cf624c 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 91291b8..d0ebf7d 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1988, 1993-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el
index 01d5524..a9ce1e6 100644
--- a/lisp/mail/rmailedit.el
+++ b/lisp/mail/rmailedit.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index 9427796..ee71ab4 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1988, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index af52813..d32147f 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -4,7 +4,6 @@
 
 ;; Author: Alexander Pohoyda
 ;;     Alex Schroeder
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/rmailmsc.el b/lisp/mail/rmailmsc.el
index ba0c2ae..4c42935 100644
--- a/lisp/mail/rmailmsc.el
+++ b/lisp/mail/rmailmsc.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index 12d3761..d956708 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1987, 1993-1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el
index 4a70103..18185ec 100644
--- a/lisp/mail/rmailsort.el
+++ b/lisp/mail/rmailsort.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 79a322c..80cfbfd 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1993-1996, 2000-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 ;; Package: rmail
 
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 93b6c90..0db0557 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1992-1996, 1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
@@ -370,6 +369,7 @@ By default, this is the file specified by 
`mail-personal-alias-file'." t)
 ;;;###autoload
 (defcustom mail-signature t
   "Text inserted at end of mail buffer when a message is initialized.
+If nil, no signature is inserted.
 If t, it means to insert the contents of the file `mail-signature-file'.
 If a string, that string is inserted.
  (To make a proper signature, the string should begin with \\n\\n-- \\n,
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f31e0b4..05ef29a 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -101,9 +101,9 @@ don't define this value."
 
 (defcustom smtpmail-stream-type nil
   "Type of SMTP connections to use.
-This may be either nil (possibly upgraded to STARTTLS if possible),
-or `starttls' (refuse to send if STARTTLS isn't available), or `plain'
-\(never use STARTTLS), or `ssl' (to use TLS/SSL)."
+This may be either nil (upgrade with STARTTLS if possible),
+`starttls' (refuse to send if STARTTLS isn't available),
+`plain' (never use STARTTLS), or `ssl' (to use TLS/SSL)."
   :version "24.1"
   :group 'smtpmail
   :type '(choice (const :tag "Possibly upgrade to STARTTLS" nil)
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index ad69dca..3173246 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: February 1993
 ;; Keywords: mail, news
 
diff --git a/lisp/mail/undigest.el b/lisp/mail/undigest.el
index bbf3c83..499f16e 100644
--- a/lisp/mail/undigest.el
+++ b/lisp/mail/undigest.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1994, 1996, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el
index 4d9ad67..c409210 100644
--- a/lisp/mail/unrmail.el
+++ b/lisp/mail/unrmail.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/makesum.el b/lisp/makesum.el
index 10ad78e..847e304 100644
--- a/lisp/makesum.el
+++ b/lisp/makesum.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/man.el b/lisp/man.el
index b1d0fd3..feb0e09 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: help
 ;; Adapted-By: ESR, pot
 
@@ -1206,10 +1205,7 @@ Same for the ANSI bold and normal escape sequences."
   (interactive)
   (goto-char (point-min))
   ;; Fontify ANSI escapes.
-  (let ((ansi-color-apply-face-function
-        (lambda (beg end face)
-          (when face
-            (put-text-property beg end 'face face))))
+  (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face)
        (ansi-color-map Man-ansi-color-map))
     (ansi-color-apply-on-region (point-min) (point-max)))
   ;; Other highlighting.
@@ -1220,31 +1216,33 @@ Same for the ANSI bold and normal escape sequences."
          (goto-char (point-min))
          (while (and (search-forward "__\b\b" nil t) (not (eobp)))
            (backward-delete-char 4)
-           (put-text-property (point) (1+ (point)) 'face 'Man-underline))
+            (put-text-property (point) (1+ (point))
+                               'font-lock-face 'Man-underline))
          (goto-char (point-min))
          (while (search-forward "\b\b__" nil t)
            (backward-delete-char 4)
-           (put-text-property (1- (point)) (point) 'face 'Man-underline))))
+            (put-text-property (1- (point)) (point)
+                               'font-lock-face 'Man-underline))))
     (goto-char (point-min))
     (while (and (search-forward "_\b" nil t) (not (eobp)))
       (backward-delete-char 2)
-      (put-text-property (point) (1+ (point)) 'face 'Man-underline))
+      (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline))
     (goto-char (point-min))
     (while (search-forward "\b_" nil t)
       (backward-delete-char 2)
-      (put-text-property (1- (point)) (point) 'face 'Man-underline))
+      (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline))
     (goto-char (point-min))
     (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t)
       (replace-match "\\1")
-      (put-text-property (1- (point)) (point) 'face 'Man-overstrike))
+      (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike))
     (goto-char (point-min))
     (while (re-search-forward "o\b\\+\\|\\+\bo" nil t)
       (replace-match "o")
-      (put-text-property (1- (point)) (point) 'face 'bold))
+      (put-text-property (1- (point)) (point) 'font-lock-face 'bold))
     (goto-char (point-min))
     (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t)
       (replace-match "+")
-      (put-text-property (1- (point)) (point) 'face 'bold))
+      (put-text-property (1- (point)) (point) 'font-lock-face 'bold))
     ;; When the header is longer than the manpage name, groff tries to
     ;; condense it to a shorter line interspersed with ^H.  Remove ^H with
     ;; their preceding chars (but don't put Man-overstrike).  (Bug#5566)
@@ -1258,7 +1256,7 @@ Same for the ANSI bold and normal escape sequences."
     (while (re-search-forward Man-heading-regexp nil t)
       (put-text-property (match-beginning 0)
                         (match-end 0)
-                        'face 'Man-overstrike))))
+                        'font-lock-face 'Man-overstrike))))
 
 (defun Man-highlight-references (&optional xref-man-type)
   "Highlight the references on mouse-over.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 4ff60ed..d12cdd7 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard M. Stallman
-;; Maintainer: address@hidden
 ;; Keywords: internal, mouse
 ;; Package: emacs
 
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index dbd24df..ed610c1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -846,6 +846,8 @@ styles for specific categories, such as files, buffers, 
etc."
 (defvar completion-category-defaults
   '((buffer (styles . (basic substring)))
     (unicode-name (styles . (basic substring)))
+    ;; A new style that combines substring and pcm might be better,
+    ;; e.g. one that does not anchor to bos.
     (project-file (styles . (substring)))
     (info-menu (styles . (basic substring))))
   "Default settings for specific completion categories.
@@ -2969,28 +2971,6 @@ or a symbol, see `completion-pcm--merge-completions'."
       ;; It should be avoided properly, but it's so easy to remove it here.
       (delete "" (nreverse pattern)))))
 
-(defun completion-pcm--optimize-pattern (p)
-  ;; Remove empty strings in a separate phase since otherwise a ""
-  ;; might prevent some other optimization, as in '(any "" any).
-  (setq p (delete "" p))
-  (let ((n '()))
-    (while p
-      (pcase p
-        (`(,(and s1 (pred stringp)) ,(and s2 (pred stringp)) . ,rest)
-         (setq p (cons (concat s1 s2) rest)))
-        (`(,(and p1 (pred symbolp)) ,(and p2 (guard (eq p1 p2))) . ,_)
-         ;; Unused lexical variable warning due to body not using p1, p2.
-         ;; https://debbugs.gnu.org/16771
-         (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)))
-        (`(,(pred symbolp)) (setq p nil)) ;Implicit terminating `any'.
-        (_ (push (pop p) n))))
-    (nreverse n)))
-
 (defun completion-pcm--pattern->regex (pattern &optional group)
   (let ((re
          (concat "\\`"
diff --git a/lisp/misc.el b/lisp/misc.el
index 4cf6cad..0080762 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 ;; Package: emacs
 
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 835eaa3..af53c05 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993-1995, 1999-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: hardware, mouse
 ;; Package: emacs
 
@@ -2402,6 +2401,10 @@ highlight the original region when
 `mouse-drag-and-drop-region-show-cursor' is non-nil."
   :version "26.1")
 
+(declare-function rectangle-dimensions "rect" (start end))
+(declare-function rectangle-position-as-coordinates "rect" (position))
+(declare-function rectangle-intersect-p "rect" (pos1 size1 pos2 size2))
+
 (defun mouse-drag-and-drop-region (event)
   "Move text in the region to point where mouse is dragged to.
 The transportation of text is also referred as `drag and drop'.
diff --git a/lisp/msb.el b/lisp/msb.el
index 7a1a338..b626624 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1995, 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Lindberg <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 8 Oct 1993
 ;; Lindberg's last update version: 3.34
 ;; Keywords: mouse buffer menu
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 23f491d..86788fc 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -1,7 +1,7 @@
 ;;; mwheel.el --- Wheel mouse support
 
 ;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
-;; Maintainer: William M. Perry <address@hidden>
+;; Maintainer: Bill Perry <address@hidden>
 ;; Keywords: mouse
 ;; Package: emacs
 
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 5af9ea7..81b654c 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Andy Norman (address@hidden)
-;; Maintainer: address@hidden
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
@@ -1989,7 +1988,7 @@ on the gateway machine to do the FTP instead."
   (make-local-variable 'comint-password-prompt-regexp)
   ;; This is a regexp that can't match anything.
   ;; ange-ftp has its own ways of handling passwords.
-  (setq comint-password-prompt-regexp "\\`a\\`")
+  (setq comint-password-prompt-regexp regexp-unmatchable)
   (make-local-variable 'paragraph-start)
   (setq paragraph-start comint-prompt-regexp))
 
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index aa31e25..0c63cbd 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Denis Howe <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 03 Apr 1995
 ;; Keywords: hypertext, hypermedia, mouse
 
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 3e93345..206f9cf 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -29,7 +29,7 @@
 (require 'shr)
 (require 'url)
 (require 'url-queue)
-(require 'url-util)                    ; for url-get-url-at-point
+(require 'thingatpt)
 (require 'mm-url)
 (require 'puny)
 (eval-when-compile (require 'subr-x)) ;; for string-trim
@@ -64,17 +64,17 @@
 ;;;###autoload
 (defcustom eww-suggest-uris
   '(eww-links-at-point
-    url-get-url-at-point
+    thing-at-point-url-at-point
     eww-current-url)
   "List of functions called to form the list of default URIs for `eww'.
 Each of the elements is a function returning either a string or a list
 of strings.  The results will be joined into a single list with
 duplicate entries (if any) removed."
-  :version "25.1"
+  :version "27.1"
   :group 'eww
   :type 'hook
   :options '(eww-links-at-point
-             url-get-url-at-point
+             thing-at-point-url-at-point
              eww-current-url))
 
 (defcustom eww-bookmarks-directory user-emacs-directory
@@ -223,6 +223,10 @@ See also `eww-form-checkbox-selected-symbol'."
 (defvar eww-local-regex "localhost"
   "When this regex is found in the URL, it's not a keyword but an address.")
 
+(defvar eww-accept-content-types
+  "text/html, text/plain, text/sgml, text/css, application/xhtml+xml, 
*/*;q=0.01"
+  "Value used for the HTTP 'Accept' header.")
+
 (defvar eww-link-keymap
   (let ((map (copy-keymap shr-map)))
     (define-key map "\r" 'eww-follow-link)
@@ -290,8 +294,9 @@ the default EWW buffer."
   (let ((inhibit-read-only t))
     (insert (format "Loading %s..." url))
     (goto-char (point-min)))
-  (url-retrieve url 'eww-render
-                (list url nil (current-buffer))))
+  (let ((url-mime-accept-string eww-accept-content-types))
+    (url-retrieve url 'eww-render
+                  (list url nil (current-buffer)))))
 
 (defun eww--dwim-expand-url (url)
   (setq url (string-trim url))
@@ -952,8 +957,9 @@ just re-display the HTML already fetched."
            (error "No current HTML data")
          (eww-display-html 'utf-8 url (plist-get eww-data :dom)
                            (point) (current-buffer)))
-      (url-retrieve url 'eww-render
-                   (list url (point) (current-buffer) encode)))))
+      (let ((url-mime-accept-string eww-accept-content-types))
+        (url-retrieve url 'eww-render
+                     (list url (point) (current-buffer) encode))))))
 
 ;; Form support.
 
@@ -1519,6 +1525,7 @@ If EXTERNAL is double prefix, browse in new buffer."
           (eww-same-page-p url (plist-get eww-data :url)))
       (let ((dom (plist-get eww-data :dom)))
        (eww-save-history)
+       (plist-put eww-data :url url)
        (eww-display-html 'utf-8 url dom nil (current-buffer))))
      (t
       (eww-browse-url url external)))))
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index c25d787..d7fd058 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ding <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 15 Aug 1995
 ;; Keywords: mh-e, www, mouse, mail
 
diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el
index 75fc7d6..2df473c 100644
--- a/lisp/net/ldap.el
+++ b/lisp/net/ldap.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: April 1998
 ;; Keywords: comm
 
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el
index 599e230..1911450 100644
--- a/lisp/net/pop3.el
+++ b/lisp/net/pop3.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard L. Pieri <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index b1a6c1c..e8710be 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -679,16 +679,24 @@ last ping."
   "If non-nil, write information to `rcirc-debug-buffer'.")
 (defun rcirc-debug (process text)
   "Add an entry to the debug log including PROCESS and TEXT.
-Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag'
-is non-nil."
+Debug text is appended to `rcirc-debug-buffer' if `rcirc-debug-flag'
+is non-nil.
+
+For convenience, the read-only state of the debug buffer is ignored.
+When the point is at the end of the visible portion of the buffer, it
+is moved to after the text inserted.  Otherwise the point is not moved."
   (when rcirc-debug-flag
     (with-current-buffer (get-buffer-create rcirc-debug-buffer)
-      (goto-char (point-max))
-      (insert (concat
-              "["
-              (format-time-string "%Y-%m-%dT%T ") (process-name process)
-              "] "
-              text)))))
+      (let ((old (point-marker)))
+        (set-marker-insertion-type old t)
+        (goto-char (point-max))
+        (let ((inhibit-read-only t))
+          (terpri (current-buffer) t)
+          (insert "["
+                  (format-time-string "%FT%T ") (process-name process)
+                  "] "
+                  text))
+        (goto-char old)))))
 
 (define-obsolete-variable-alias 'rcirc-sentinel-hooks
   'rcirc-sentinel-functions "24.3")
diff --git a/lisp/net/rfc2104.el b/lisp/net/rfc2104.el
index 68c35aa..9d4957d 100644
--- a/lisp/net/rfc2104.el
+++ b/lisp/net/rfc2104.el
@@ -84,14 +84,6 @@
       (setq ls (cdr ls)))
     v))
 
-(eval-when-compile
-  (defmacro rfc2104-string-make-unibyte (string)
-    "Return the unibyte equivalent of STRING.
-In XEmacs return just STRING."
-    (if (featurep 'xemacs)
-       string
-      `(string-make-unibyte ,string))))
-
 (defun rfc2104-hash (hash block-length hash-length key text)
   (let* (;; if key is longer than B, reset it to HASH(key)
         (key (if (> (length key) block-length)
@@ -107,7 +99,7 @@ In XEmacs return just STRING."
       (aset ipad i (logxor rfc2104-ipad c))
       (aset opad i (logxor rfc2104-opad c)))
     ;; Perform inner hash.
-    (setq partial (rfc2104-string-make-unibyte
+    (setq partial (string-make-unibyte
                   (funcall hash (concat ipad text))))
     ;; Pack latter part of opad.
     (cl-do ((r 0 (+ 2 r))
@@ -117,7 +109,7 @@ In XEmacs return just STRING."
             (+ (* 16 (aref rfc2104-nybbles (aref partial     r)))
                (      aref rfc2104-nybbles (aref partial (1+ r))))))
     ;; Perform outer hash.
-    (rfc2104-string-make-unibyte (funcall hash opad))))
+    (string-make-unibyte (funcall hash opad))))
 
 (provide 'rfc2104)
 
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 2f628e1..c1e9fdd 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1101,8 +1101,7 @@ WIDTH and HEIGHT are the sizes given in the HTML data, if 
any.
 The size of the displayed image will not exceed
 MAX-WIDTH/MAX-HEIGHT.  If not given, use the current window
 width/height instead."
-  (if (or (not (fboundp 'imagemagick-types))
-          (not (get-buffer-window (current-buffer))))
+  (if (not (get-buffer-window (current-buffer)))
       (create-image data nil t :ascent 100)
     (let* ((edges (window-inside-pixel-edges
                    (get-buffer-window (current-buffer))))
@@ -1123,13 +1122,13 @@ width/height instead."
                (< (* width scaling) max-width)
                (< (* height scaling) max-height))
           (create-image
-           data 'imagemagick t
+           data nil t
            :ascent 100
            :width width
            :height height
            :format content-type)
         (create-image
-         data 'imagemagick t
+         data nil t
          :ascent 100
          :max-width max-width
          :max-height max-height
@@ -1790,7 +1789,10 @@ The preference is a float determined from 
`shr-prefer-media-type'."
 
 (defun shr-mark-fill (start)
   ;; We may not have inserted any text to fill.
-  (unless (= start (point))
+  (when (and (/= start (point))
+             ;; Tables insert themselves with the correct indentation,
+             ;; so don't do anything if we're at the start of a table.
+             (not (get-text-property start 'shr-table-id)))
     (put-text-property start (1+ start)
                       'shr-indentation shr-indentation)))
 
@@ -2087,7 +2089,8 @@ flags that control whether to collect or render objects."
                        (setq max (max max (nth 2 column))))
                      max)))
        (dotimes (_ (max height 1))
-         (shr-indent)
+          (when (bolp)
+           (shr-indent))
          (insert shr-table-vertical-line "\n"))
        (dolist (column row)
          (when (> (nth 2 column) -1)
diff --git a/lisp/net/socks.el b/lisp/net/socks.el
index 6356707..c9f7419 100644
--- a/lisp/net/socks.el
+++ b/lisp/net/socks.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1996-2000, 2002, 2007-2019 Free Software Foundation,
 ;; Inc.
 
-;; Author: William M. Perry <address@hidden>
+;; Author: Bill Perry <address@hidden>
 ;;         Dave Love <address@hidden>
 ;; Keywords: comm, firewalls
 
diff --git a/lisp/net/telnet.el b/lisp/net/telnet.el
index cf3634f..465927d 100644
--- a/lisp/net/telnet.el
+++ b/lisp/net/telnet.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: William F. Schelter
-;; Maintainer: address@hidden
 ;; Keywords: unix, comm
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index bd66ab4..008a5ce 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -975,9 +975,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                (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)
+              (i 0))
 
          (while (get-process name1)
            ;; NAME must be unique as process name.
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index b096edc..e6ae73a 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -129,6 +129,8 @@
 (setq tramp-archive-enabled tramp-gvfs-enabled)
 
 ;; <https://github.com/libarchive/libarchive/wiki/LibarchiveFormats>
+;; Note: "arc" and "zoo" are supported by `archive-mode', but they
+;; don't work here.
 ;;;###autoload
 (defconst tramp-archive-suffixes
   ;; "cab", "lzh", "msu" and "zip" are included with lower and upper
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index ae743b2..21a819f 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -35,15 +35,11 @@
 (defun tramp-unload-file-name-handlers ())
 
 (require 'auth-source)
-(require 'advice)
-(require 'cl-lib)
-(require 'custom)
 (require 'format-spec)
 (require 'parse-time)
-(require 'password-cache)
 (require 'shell)
-(require 'timer)
-(require 'ucs-normalize)
+
+(declare-function tramp-handle-temporary-file-directory "tramp")
 
 ;; For not existing functions, obsolete functions, or functions with a
 ;; changed argument list, there are compiler warnings.  We want to
@@ -74,7 +70,7 @@ Add the extension of F, if existing."
 (defalias 'tramp-compat-temporary-file-directory-function
   (if (fboundp 'temporary-file-directory)
       #'temporary-file-directory
-    'tramp-handle-temporary-file-directory))
+    #'tramp-handle-temporary-file-directory))
 
 (defun tramp-compat-process-running-p (process-name)
   "Returns t if system process PROCESS-NAME is running for `user-login-name'."
@@ -106,79 +102,85 @@ Add the extension of F, if existing."
 
 ;; `file-attribute-*' are introduced in Emacs 25.1.
 
-(if (fboundp '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'.
+(defalias 'tramp-compat-file-attribute-type
+  (if (fboundp 'file-attribute-type)
+      #'file-attribute-type
+    (lambda (attributes)
+      "The type field in ATTRIBUTES returned by `file-attributes'.
 The value is either t for directory, string (name linked to) for
 symbolic link, or nil."
-    (nth 0 attributes)))
-
-(if (fboundp 'file-attribute-link-number)
-    (defalias 'tramp-compat-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)
-  (defsubst tramp-compat-file-attribute-user-id (attributes)
-    "The UID field in ATTRIBUTES returned by `file-attributes'.
+      (nth 0 attributes))))
+
+(defalias 'tramp-compat-file-attribute-link-number
+  (if (fboundp 'file-attribute-link-number)
+      #'file-attribute-link-number
+    (lambda (attributes)
+      "Return the number of links in ATTRIBUTES returned by `file-attributes'."
+      (nth 1 attributes))))
+
+(defalias 'tramp-compat-file-attribute-user-id
+  (if (fboundp 'file-attribute-user-id)
+      #'file-attribute-user-id
+    (lambda (attributes)
+      "The UID field in ATTRIBUTES returned by `file-attributes'.
 This is either a string or a number.  If a string value cannot be
 looked up, a numeric value, either an integer or a float, is
 returned."
-    (nth 2 attributes)))
+      (nth 2 attributes))))
 
-(if (fboundp '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'.
+(defalias 'tramp-compat-file-attribute-group-id
+  (if (fboundp 'file-attribute-group-id)
+      #'file-attribute-group-id
+    (lambda (attributes)
+      "The GID field in ATTRIBUTES returned by `file-attributes'.
 This is either a string or a number.  If a string value cannot be
 looked up, a numeric value, either an integer or a float, is
 returned."
-    (nth 3 attributes)))
+      (nth 3 attributes))))
 
-(if (fboundp 'file-attribute-modification-time)
-    (defalias 'tramp-compat-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'.
+(defalias 'tramp-compat-file-attribute-modification-time
+  (if (fboundp 'file-attribute-modification-time)
+      #'file-attribute-modification-time
+    (lambda (attributes)
+      "The modification time in ATTRIBUTES returned by `file-attributes'.
 This is the time of the last change to the file's contents, and
 is a Lisp timestamp in the style of `current-time'."
-    (nth 5 attributes)))
+      (nth 5 attributes))))
 
-(if (fboundp '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'.
+(defalias 'tramp-compat-file-attribute-size
+  (if (fboundp 'file-attribute-size)
+      #'file-attribute-size
+    (lambda (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
 and later, and is a float in Emacs 26 and earlier."
-    (nth 7 attributes)))
+      (nth 7 attributes))))
 
-(if (fboundp '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'.
+(defalias 'tramp-compat-file-attribute-modes
+  (if (fboundp 'file-attribute-modes)
+      #'file-attribute-modes
+    (lambda (attributes)
+      "The file modes in ATTRIBUTES returned by `file-attributes'.
 This is a string of ten letters or dashes as in ls -l."
-    (nth 8 attributes)))
+      (nth 8 attributes))))
 
 ;; `format-message' is new in Emacs 25.1.
 (unless (fboundp 'format-message)
   (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)
-  (defsubst tramp-compat-directory-name-p (name)
-    "Return non-nil if NAME ends with a directory separator character."
-    (let ((len (length name))
-          (lastc ?.))
-      (if (> len 0)
-          (setq lastc (aref name (1- len))))
-      (or (= lastc ?/)
-          (and (memq system-type '(windows-nt ms-dos))
-               (= lastc ?\\))))))
+(defalias 'tramp-compat-directory-name-p
+  (if (fboundp 'directory-name-p)
+      #'directory-name-p
+    (lambda (name)
+      "Return non-nil if NAME ends with a directory separator character."
+      (let ((len (length name))
+            (lastc ?.))
+       (if (> len 0)
+            (setq lastc (aref name (1- len))))
+       (or (= lastc ?/)
+            (and (memq system-type '(windows-nt ms-dos))
+                (= lastc ?\\)))))))
 
 ;; `file-missing' is introduced in Emacs 26.1.
 (defconst tramp-file-missing
@@ -187,36 +189,42 @@ This is a string of ten letters or dashes as in ls -l."
 
 ;; `file-local-name', `file-name-quoted-p', `file-name-quote' and
 ;; `file-name-unquote' are introduced in Emacs 26.
-(eval-and-compile
+(defalias 'tramp-compat-file-local-name
   (if (fboundp 'file-local-name)
-      (defalias 'tramp-compat-file-local-name #'file-local-name)
-    (defsubst tramp-compat-file-local-name (name)
+      #'file-local-name
+    (lambda (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)
-    (defsubst tramp-compat-file-name-quoted-p (name &optional top)
+      (or (file-remote-p name 'localname) name))))
+
+;; `file-name-quoted-p' got a second argument in Emacs 27.1.
+(defalias 'tramp-compat-file-name-quoted-p
+  (if (and
+       (fboundp 'file-name-quoted-p)
+       (equal (tramp-compat-funcall 'func-arity #'file-name-quoted-p) '(1 . 
2)))
+      #'file-name-quoted-p
+    (lambda (name &optional top)
       "Whether NAME is quoted with prefix \"/:\".
 If NAME is a remote file name and TOP is nil, check the local part of NAME."
       (let ((file-name-handler-alist (unless top file-name-handler-alist)))
-       (string-prefix-p "/:" (tramp-compat-file-local-name name)))))
+       (string-prefix-p "/:" (tramp-compat-file-local-name name))))))
 
+(defalias 'tramp-compat-file-name-quote
   (if (fboundp 'file-name-quote)
-      (defalias 'tramp-compat-file-name-quote #'file-name-quote)
-    (defsubst tramp-compat-file-name-quote (name)
+      #'file-name-quote
+    (lambda (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) "/:" (tramp-compat-file-local-name name)))))
+        (file-remote-p name) "/:" (tramp-compat-file-local-name name))))))
 
+(defalias 'tramp-compat-file-name-unquote
   (if (fboundp 'file-name-unquote)
-      (defalias 'tramp-compat-file-name-unquote #'file-name-unquote)
-    (defsubst tramp-compat-file-name-unquote (name)
+      #'file-name-unquote
+    (lambda (name)
       "Remove quotation prefix \"/:\" from file NAME.
 If NAME is a remote file name, the local part of NAME is unquoted."
       (let ((localname (tramp-compat-file-local-name name)))
@@ -241,16 +249,16 @@ If NAME is a remote file name, the local part of NAME is 
unquoted."
     '(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
+;; Therefore, we cannot use `url-tramp-convert-url-to-tramp' prior
 ;; Emacs 26.1.  We use `temporary-file-directory' as indicator.
 (defconst tramp-compat-use-url-tramp-p (fboundp 'temporary-file-directory)
   "Whether to use url-tramp.el.")
 
 ;; `exec-path' is new in Emacs 27.1.
-(eval-and-compile
+(defalias 'tramp-compat-exec-path
   (if (fboundp 'exec-path)
-      (defalias 'tramp-compat-exec-path #'exec-path)
-    (defun tramp-compat-exec-path ()
+      #'exec-path
+    (lambda ()
       "List of directories to search programs to run in remote subprocesses."
       (let ((handler (find-file-name-handler default-directory 'exec-path)))
        (if handler
@@ -258,27 +266,29 @@ If NAME is a remote file name, the local part of NAME is 
unquoted."
          exec-path)))))
 
 ;; `time-equal-p' has appeared in Emacs 27.1.
-(if (fboundp '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.
+(defalias 'tramp-compat-time-equal-p
+  (if (fboundp 'time-equal-p)
+      #'time-equal-p
+    (lambda (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)))))
+      (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))))
+(defalias 'tramp-compat-flatten-tree
+  (if (fboundp 'flatten-tree)
+      #'flatten-tree
+    (lambda (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 ()
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 8fea82d..3810231 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -99,20 +99,26 @@
 
 (eval-when-compile (require 'cl-lib))
 (require 'tramp)
-
 (require 'dbus)
 (require 'url-parse)
 (require 'url-util)
-(require 'zeroconf)
 
 ;; Pacify byte-compiler.
 (eval-when-compile
   (require 'custom))
 
+(declare-function zeroconf-init "zeroconf")
+(declare-function zeroconf-list-service-types "zeroconf")
+(declare-function zeroconf-list-services "zeroconf")
+(declare-function zeroconf-service-host "zeroconf")
+(declare-function zeroconf-service-port "zeroconf")
+(declare-function zeroconf-service-txt "zeroconf")
+
 ;; We don't call `dbus-ping', because this would load dbus.el.
 (defconst tramp-gvfs-enabled
   (ignore-errors
     (and (featurep 'dbusbind)
+        (autoload 'zeroconf-init "zeroconf")
         (tramp-compat-funcall 'dbus-get-unique-name :system)
         (tramp-compat-funcall 'dbus-get-unique-name :session)
         (or (tramp-compat-process-running-p "gvfs-fuse-daemon")
@@ -1187,6 +1193,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
        (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-sentinel p #'tramp-file-notify-process-sentinel)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
        (while (tramp-accept-process-output p 0))
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index da168ad..35d2eb3 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -31,10 +31,10 @@
 
 ;; Pacify byte-compiler.
 (require 'cl-lib)
+(declare-function recentf-cleanup "recentf")
 (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)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index dc64726..11b1af8 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -30,10 +30,6 @@
 (eval-when-compile (require 'cl-lib))
 (require 'tramp)
 
-;; Pacify byte-compiler.
-(eval-when-compile
-  (require 'dired))
-
 (declare-function dired-remove-file "dired-aux")
 (defvar dired-compress-file-suffixes)
 (defvar vc-handled-backends)
@@ -2417,9 +2413,7 @@ The method used must be an out-of-band method."
              ;; The default directory must be remote.
              (let ((default-directory
                      (file-name-directory (if t1 filename newname)))
-                   (process-environment (copy-sequence process-environment))
-                   ;; We do not want to run timers.
-                   timer-list timer-idle-list)
+                   (process-environment (copy-sequence process-environment)))
                ;; Set the transfer process properties.
                (tramp-set-connection-property
                 v "process-name" (buffer-name (current-buffer)))
@@ -2878,8 +2872,6 @@ the result will be a local, non-Tramp, file name."
               ;; 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)
@@ -3444,88 +3436,89 @@ the result will be a local, non-Tramp, file name."
 ;; any other remote command.
 (defun tramp-sh-handle-vc-registered (file)
   "Like `vc-registered' for Tramp files."
-  (with-temp-message ""
-    (with-parsed-tramp-file-name file nil
-      (with-tramp-progress-reporter
-         v 3 (format-message "Checking `vc-registered' for %s" file)
-
-       ;; There could be new files, created by the vc backend.  We
-       ;; cannot reuse the old cache entries, therefore.  In
-       ;; `tramp-get-file-property', `remote-file-name-inhibit-cache'
-       ;; could also be a timestamp as `current-time' returns.  This
-       ;; means invalidate all cache entries with an older timestamp.
-       (let (tramp-vc-registered-file-names
-             (remote-file-name-inhibit-cache (current-time))
-             (file-name-handler-alist
-              `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
-
-         ;; 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-message v 10 "\n%s" tramp-vc-registered-file-names)
-
-         ;; Send just one command, in order to fill the cache.
-         (when tramp-vc-registered-file-names
-           (tramp-maybe-send-script
-            v
-            (format tramp-vc-registered-read-file-names
-                    (tramp-get-file-exists-command v)
-                    (format "%s -r" (tramp-get-test-command v)))
-            "tramp_vc_registered_read_file_names")
-
-           (dolist
-               (elt
-                (ignore-errors
-                  ;; We cannot use `tramp-send-command-and-read',
-                  ;; because this does not cooperate well with
-                  ;; heredoc documents.
-                  (tramp-send-command
-                   v
-                   (format
-                    "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n"
-                    tramp-end-of-heredoc
-                    (mapconcat #'tramp-shell-quote-argument
-                               tramp-vc-registered-file-names
-                               "\n")
-                    tramp-end-of-heredoc))
-                  (with-current-buffer (tramp-get-connection-buffer v)
-                    ;; Read the expression.
-                    (goto-char (point-min))
-                    (read (current-buffer)))))
-
-             (tramp-set-file-property
-              v (car elt) (cadr elt) (cadr (cdr elt))))))
-
-       ;; Second run.  Now all `file-exists-p' or `file-readable-p'
-       ;; calls shall be answered from the file cache.  We unset
-       ;; `process-file-side-effects' and `remote-file-name-inhibit-cache'
-       ;; in order to keep the cache.
-       (let ((vc-handled-backends vc-handled-backends)
-             remote-file-name-inhibit-cache process-file-side-effects)
-         ;; Reduce `vc-handled-backends' in order to minimize process calls.
-         (when (and (memq 'Bzr vc-handled-backends)
-                    (boundp 'vc-bzr-program)
-                    (not (with-tramp-connection-property v vc-bzr-program
-                           (tramp-find-executable
-                            v vc-bzr-program (tramp-get-remote-path v)))))
-           (setq vc-handled-backends (remq 'Bzr vc-handled-backends)))
-         (when (and (memq 'Git vc-handled-backends)
-                    (boundp 'vc-git-program)
-                    (not (with-tramp-connection-property v vc-git-program
-                           (tramp-find-executable
-                            v vc-git-program (tramp-get-remote-path v)))))
-           (setq vc-handled-backends (remq 'Git vc-handled-backends)))
-         (when (and (memq 'Hg vc-handled-backends)
-                    (boundp 'vc-hg-program)
-                    (not (with-tramp-connection-property v vc-hg-program
-                           (tramp-find-executable
-                            v vc-hg-program (tramp-get-remote-path v)))))
-           (setq vc-handled-backends (remq 'Hg vc-handled-backends)))
-         ;; Run.
-         (tramp-with-demoted-errors
-             v "Error in 2nd pass of `vc-registered': %s"
-           (tramp-run-real-handler #'vc-registered (list file))))))))
+  (when vc-handled-backends
+    (with-temp-message ""
+      (with-parsed-tramp-file-name file nil
+        (with-tramp-progress-reporter
+           v 3 (format-message "Checking `vc-registered' for %s" file)
+
+         ;; There could be new files, created by the vc backend.  We
+         ;; cannot reuse the old cache entries, therefore.  In
+         ;; `tramp-get-file-property', `remote-file-name-inhibit-cache'
+         ;; could also be a timestamp as `current-time' returns.  This
+         ;; means invalidate all cache entries with an older timestamp.
+         (let (tramp-vc-registered-file-names
+               (remote-file-name-inhibit-cache (current-time))
+               (file-name-handler-alist
+                `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
+
+           ;; 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-message v 10 "\n%s" tramp-vc-registered-file-names)
+
+           ;; Send just one command, in order to fill the cache.
+           (when tramp-vc-registered-file-names
+             (tramp-maybe-send-script
+              v
+              (format tramp-vc-registered-read-file-names
+                      (tramp-get-file-exists-command v)
+                      (format "%s -r" (tramp-get-test-command v)))
+              "tramp_vc_registered_read_file_names")
+
+             (dolist
+                 (elt
+                  (ignore-errors
+                    ;; We cannot use `tramp-send-command-and-read',
+                    ;; because this does not cooperate well with
+                    ;; heredoc documents.
+                    (tramp-send-command
+                     v
+                     (format
+                      "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n"
+                      tramp-end-of-heredoc
+                      (mapconcat #'tramp-shell-quote-argument
+                                 tramp-vc-registered-file-names
+                                 "\n")
+                      tramp-end-of-heredoc))
+                    (with-current-buffer (tramp-get-connection-buffer v)
+                      ;; Read the expression.
+                      (goto-char (point-min))
+                      (read (current-buffer)))))
+
+               (tramp-set-file-property
+                v (car elt) (cadr elt) (cadr (cdr elt))))))
+
+         ;; Second run.  Now all `file-exists-p' or `file-readable-p'
+         ;; calls shall be answered from the file cache.  We unset
+         ;; `process-file-side-effects' and `remote-file-name-inhibit-cache'
+         ;; in order to keep the cache.
+         (let ((vc-handled-backends vc-handled-backends)
+               remote-file-name-inhibit-cache process-file-side-effects)
+           ;; Reduce `vc-handled-backends' in order to minimize process calls.
+           (when (and (memq 'Bzr vc-handled-backends)
+                      (boundp 'vc-bzr-program)
+                      (not (with-tramp-connection-property v vc-bzr-program
+                             (tramp-find-executable
+                              v vc-bzr-program (tramp-get-remote-path v)))))
+             (setq vc-handled-backends (remq 'Bzr vc-handled-backends)))
+           (when (and (memq 'Git vc-handled-backends)
+                      (boundp 'vc-git-program)
+                      (not (with-tramp-connection-property v vc-git-program
+                             (tramp-find-executable
+                              v vc-git-program (tramp-get-remote-path v)))))
+             (setq vc-handled-backends (remq 'Git vc-handled-backends)))
+           (when (and (memq 'Hg vc-handled-backends)
+                      (boundp 'vc-hg-program)
+                      (not (with-tramp-connection-property v vc-hg-program
+                             (tramp-find-executable
+                              v vc-hg-program (tramp-get-remote-path v)))))
+             (setq vc-handled-backends (remq 'Hg vc-handled-backends)))
+           ;; Run.
+           (tramp-with-demoted-errors
+               v "Error in 2nd pass of `vc-registered': %s"
+             (tramp-run-real-handler #'vc-registered (list file)))))))))
 
 ;;;###tramp-autoload
 (defun tramp-sh-file-name-handler (operation &rest args)
@@ -3549,24 +3542,29 @@ Fall back to normal file name handler if no Tramp 
handler exists."
           (tramp-replace-environment-variables
            (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
-        ;; That's what we want: file names, for which checks are
-        ;; applied.  We assume that VC uses only `file-exists-p' and
-        ;; `file-readable-p' checks; otherwise we must extend the
-        ;; list.  We do not perform any action, but return nil, in
-        ;; order to keep `vc-registered' running.
-        ((and fn (memq operation '(file-exists-p file-readable-p)))
-         (add-to-list 'tramp-vc-registered-file-names localname 'append)
-         nil)
-        ;; `process-file' and `start-file-process' shall be ignored.
-        ((and fn (eq operation 'process-file) 0))
-        ((and fn (eq operation 'start-file-process) nil))
-        ;; Tramp file name handlers like `expand-file-name'.  They
-        ;; must still work.
-        (fn (save-match-data (apply (cdr fn) args)))
-        ;; Default file name handlers, we don't care.
-        (t (tramp-run-real-handler operation args)))))))
+      (if (tramp-tramp-file-p filename)
+         (with-parsed-tramp-file-name filename nil
+           (cond
+            ;; That's what we want: file names, for which checks are
+            ;; applied.  We assume that VC uses only `file-exists-p'
+            ;; and `file-readable-p' checks; otherwise we must extend
+            ;; the list.  We do not perform any action, but return
+            ;; nil, in order to keep `vc-registered' running.
+            ((and fn (memq operation '(file-exists-p file-readable-p)))
+             (add-to-list 'tramp-vc-registered-file-names localname 'append)
+             nil)
+            ;; `process-file' and `start-file-process' shall be ignored.
+            ((and fn (eq operation 'process-file) 0))
+            ((and fn (eq operation 'start-file-process) nil))
+            ;; Tramp file name handlers like `expand-file-name'.  They
+            ;; must still work.
+            (fn (save-match-data (apply (cdr fn) args)))
+            ;; Default file name handlers, we don't care.
+            (t (tramp-run-real-handler operation args))))
+
+       ;; When `tramp-mode' is not enabled, or the file name is
+       ;; quoted, we don't do anything.
+       (tramp-run-real-handler operation args)))))
 
 (defun tramp-sh-handle-file-notify-add-watch (file-name flags _callback)
   "Like `file-notify-add-watch' for Tramp files."
@@ -3644,6 +3642,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
        (process-put p 'watch-name localname)
        (set-process-query-on-exit-flag p nil)
        (set-process-filter p filter)
+       (set-process-sentinel p #'tramp-file-notify-process-sentinel)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
        (while (tramp-accept-process-output p 0))
@@ -4619,21 +4618,19 @@ Goes through the list `tramp-inline-compress-commands'."
 
     ;; Ad-hoc proxy definitions.
     (dolist (proxy (reverse (split-string hops tramp-postfix-hop-regexp 
'omit)))
-      (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-port) (regexp-quote host-port))
-        (and (stringp user-domain) (regexp-quote user-domain))
-        proxy)
+      (let* ((host-port (tramp-file-name-host-port item))
+            (user-domain (tramp-file-name-user-domain item))
+            (proxy (concat
+                    tramp-prefix-format proxy tramp-postfix-host-format))
+            (entry
+             (list (and (stringp host-port)
+                        (concat "^" (regexp-quote host-port) "$"))
+                   (and (stringp user-domain)
+                        (concat "^" (regexp-quote user-domain) "$"))
+                   (propertize proxy 'tramp-ad-hoc t))))
+       (tramp-message vec 5 "Add %S to `tramp-default-proxies-alist'" entry)
        ;; Add the hop.
-       (add-to-list
-        'tramp-default-proxies-alist
-        (list (and (stringp host-port) (regexp-quote host-port))
-              (and (stringp user-domain) (regexp-quote user-domain))
-              (propertize proxy 'tramp-ad-hoc t)))
+       (add-to-list 'tramp-default-proxies-alist entry)
        (setq item (tramp-dissect-file-name proxy))))
     ;; Save the new value.
     (when (and hops tramp-save-ad-hoc-proxies)
@@ -4772,8 +4769,8 @@ 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 ((p (tramp-get-connection-process vec))
        (process-name (tramp-get-connection-property vec "process-name" nil))
-       (process-environment (copy-sequence process-environment))
-       (pos (with-current-buffer (tramp-get-connection-buffer vec) (point))))
+       (pos (with-current-buffer (tramp-get-connection-buffer vec) (point)))
+       tmp-process-environment)
 
     ;; If Tramp opens the same connection within a short time frame,
     ;; there is a problem.  We shall signal this.
@@ -4838,17 +4835,22 @@ connection if a previous connection has died for some 
reason."
              ;; Start new process.
              (when (and p (processp p))
                (delete-process p))
-             (setenv "TERM" tramp-terminal-type)
-             (setenv "LC_ALL" (tramp-get-local-locale vec))
-             (if (stringp tramp-histfile-override)
-                 (setenv "HISTFILE" tramp-histfile-override)
-               (if tramp-histfile-override
-                   (progn
-                     (setenv "HISTFILE")
-                     (setenv "HISTFILESIZE" "0")
-                     (setenv "HISTSIZE" "0"))))
-             (setenv "PROMPT_COMMAND")
-             (setenv "PS1" tramp-initial-end-of-output)
+             ;; Use a temporary `process-environment', in order not
+             ;; to penetrate local processes.
+             (let ((process-environment (copy-sequence process-environment)))
+               (setenv "TERM" tramp-terminal-type)
+               (setenv "LC_ALL" (tramp-get-local-locale vec))
+               (if (stringp tramp-histfile-override)
+                   (setenv "HISTFILE" tramp-histfile-override)
+                 (if tramp-histfile-override
+                     (progn
+                       (setenv "HISTFILE")
+                       (setenv "HISTFILESIZE" "0")
+                       (setenv "HISTSIZE" "0"))))
+               (setenv "PROMPT_COMMAND")
+               (setenv "PS1" tramp-initial-end-of-output)
+               (setq tmp-process-environment
+                     (copy-sequence process-environment)))
               (unless (stringp tramp-encoding-shell)
                 (tramp-error vec 'file-error "`tramp-encoding-shell' not set"))
              (let* ((current-host (system-name))
@@ -4865,7 +4867,8 @@ connection if a previous connection has died for some 
reason."
                     ;; This must be done in order to avoid our file
                     ;; name handler.
                     (p (let ((default-directory
-                               (tramp-compat-temporary-file-directory)))
+                               (tramp-compat-temporary-file-directory))
+                             (process-environment tmp-process-environment))
                          (apply
                           #'start-process
                           (tramp-get-connection-name vec)
@@ -5956,5 +5959,7 @@ function cell is returned to be applied on a buffer."
 ;; * 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.
+;;
+;; * Implement `:stderr' of `make-process' as pipe process.
 
 ;;; tramp-sh.el ends here
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 6647630..9d15c05 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -452,9 +452,7 @@ pass to the OPERATION."
                               (expand-file-name
                                tramp-temp-name-prefix
                                (tramp-compat-temporary-file-directory))))
-                  (args      (list (concat "//" host "/" share) "-E"))
-                  ;; We do not want to run timers.
-                  timer-list timer-idle-list)
+                  (args      (list (concat "//" host "/" share) "-E")))
 
              (if (not (zerop (length user)))
                  (setq args (append args (list "-U" user)))
@@ -742,9 +740,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (let* ((share     (tramp-smb-get-share v))
                 (localname (replace-regexp-in-string
                             "\\\\" "/" (tramp-smb-get-localname v)))
-                (args      (list (concat "//" host "/" share) "-E"))
-                ;; We do not want to run timers.
-                timer-list timer-idle-list)
+                (args      (list (concat "//" host "/" share) "-E")))
 
            (if (not (zerop (length user)))
                (setq args (append args (list "-U" user)))
@@ -1218,8 +1214,6 @@ component is used as the target of the symlink."
     (let* ((name (file-name-nondirectory program))
           (name1 name)
           (i 0)
-          ;; We do not want to run timers.
-          timer-list timer-idle-list
           input tmpinput outbuf command ret)
 
       ;; Determine input.
@@ -1395,9 +1389,7 @@ component is used as the target of the symlink."
                           "\\\\" "/" (tramp-smb-get-localname v)))
               (args      (list (concat "//" host "/" share) "-E" "-S"
                                (replace-regexp-in-string
-                                "\n" "," acl-string)))
-              ;; We do not want to run timers.
-              timer-list timer-idle-list)
+                                "\n" "," acl-string))))
 
          (if (not (zerop (length user)))
              (setq args (append args (list "-U" user)))
@@ -1477,9 +1469,7 @@ component is used as the target of the symlink."
           (command (mapconcat #'identity (cons program args) " "))
           (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)
+          (i 0))
       (unwind-protect
          (save-excursion
            (save-restriction
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 2e1a096..4815244 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -9,6 +9,7 @@
 ;; Package: tramp
 ;; Version: 2.4.2-pre
 ;; Package-Requires: ((emacs "24.1"))
+;; URL: https://savannah.gnu.org/projects/tramp
 
 ;; This file is part of GNU Emacs.
 
@@ -605,7 +606,10 @@ The regexp should match at end of buffer."
 
 (defcustom tramp-yesno-prompt-regexp
   (concat
-   (regexp-opt '("Are you sure you want to continue connecting (yes/no)?") t)
+   (regexp-opt
+    '("Are you sure you want to continue connecting (yes/no)?"
+      "Are you sure you want to continue connecting (yes/no/[fingerprint])?")
+    t)
    "\\s-*")
   "Regular expression matching all yes/no queries which need to be confirmed.
 The confirmation should be done with yes or no.
@@ -1637,8 +1641,6 @@ The outline level is equal to the verbosity of the Tramp 
message."
       (get-buffer-create (tramp-debug-buffer-name vec))
     (when (bobp)
       (setq buffer-undo-list t)
-      ;; So it does not get loaded while `outline-regexp' is let-bound.
-      (require 'outline)
       ;; Activate `outline-mode'.  This runs `text-mode-hook' and
       ;; `outline-mode-hook'.  We must prevent that local processes
       ;; die.  Yes: I've seen `flyspell-mode', which starts "ispell".
@@ -2138,7 +2140,11 @@ pass to the OPERATION."
 ;; function as well but regexp only.
 (defun tramp-file-name-for-operation (operation &rest args)
   "Return file name related to OPERATION file primitive.
-ARGS are the arguments OPERATION has been called with."
+ARGS are the arguments OPERATION has been called with.
+
+It does not always return a Tramp file name, for example if the
+first argument of `expand-file-name' is absolute and not remote.
+Must be handled by the callers."
   (cond
    ;; FILE resp DIRECTORY.
    ((member operation
@@ -2950,7 +2956,9 @@ Host is always \"localhost\"."
 (defun tramp-parse-netrc (filename)
   "Return a list of (user host) tuples allowed to access.
 User may be nil."
-  (require 'netrc)
+  ;; The declaration is not sufficient at runtime, because netrc.el is
+  ;; not autoloaded.
+  (autoload 'netrc-parse "netrc")
   (mapcar
    (lambda (item)
      (and (assoc "machine" item)
@@ -3383,6 +3391,7 @@ User is always nil."
     (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)
+      ;; We must load it in order to get the advice around `insert-directory'.
       (require 'ls-lisp)
       (let (ls-lisp-use-insert-directory-program start)
        (tramp-run-real-handler
@@ -3639,10 +3648,11 @@ support symbolic links."
 
     (if (and (not current-buffer-p) (integerp asynchronous))
        (let ((tramp-remote-process-environment
-              ;; `shell-command-width' has been introduced with Emacs 27.1.
-              (if (natnump (bound-and-true-p shell-command-width))
+              ;; `async-shell-command-width' has been introduced with
+              ;; Emacs 27.1.
+              (if (natnump (bound-and-true-p async-shell-command-width))
                   (cons (format "COLUMNS=%d"
-                                (bound-and-true-p shell-command-width))
+                                (bound-and-true-p async-shell-command-width))
                         tramp-remote-process-environment)
                 tramp-remote-process-environment)))
          (prog1
@@ -3854,6 +3864,12 @@ of."
          (concat (file-remote-p default-directory)
                  (process-get proc 'watch-name))))))
 
+(defun tramp-file-notify-process-sentinel (proc event)
+  "Call `file-notify-rm-watch'."
+  (unless (process-live-p proc)
+    (tramp-message proc 5 "Sentinel called: `%S' `%s'" proc event)
+    (tramp-compat-funcall 'file-notify-rm-watch proc)))
+
 ;;; Functions for establishing connection:
 
 ;; The following functions are actions to be taken when seeing certain
@@ -4080,15 +4096,7 @@ for process communication also."
   (with-current-buffer (process-buffer proc)
     (let ((inhibit-read-only t)
          last-coding-system-used
-         ;; We do not want to run timers.
-         (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 %s\n%s"
@@ -4096,8 +4104,6 @@ for process communication also."
        (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)
@@ -4178,20 +4184,12 @@ The STRING is expected to use Unix line-endings, but 
the lines sent to
 the remote host use line-endings as defined in the variable
 `tramp-rsh-end-of-line'.  The communication buffer is erased before sending."
   (let* ((p (tramp-get-connection-process vec))
-        (chunksize (tramp-get-connection-property p "chunksize" nil))
-        ;; We do not want to run timers.
-        (tl timer-list)
-         (stimers (with-timeout-suspend))
-        timer-list timer-idle-list)
+        (chunksize (tramp-get-connection-property p "chunksize" nil)))
     (unless p
       (tramp-error
        vec 'file-error "Can't send string to remote host -- not logged in"))
     (tramp-set-connection-property p "last-cmd-time" (current-time))
     (tramp-message vec 10 "%s" string)
-    ;; Enable our progress reporter.
-    (dolist (timer tl)
-      (if (eq (timer--function timer) #'tramp-progress-reporter-update)
-          (push timer timer-list)))
     (with-current-buffer (tramp-get-connection-buffer vec)
       ;; Clean up the buffer.  We cannot call `erase-buffer' because
       ;; narrowing might be in effect.
@@ -4215,9 +4213,7 @@ the remote host use line-endings as defined in the 
variable
                (process-send-string
                 p (substring string pos (min (+ pos chunksize) end)))
                (setq pos (+ pos chunksize))))
-         (process-send-string p string)))
-      ;; Reenable the timers.
-      (with-timeout-unsuspend stimers))))
+         (process-send-string p string))))))
 
 (defun tramp-process-sentinel (proc event)
   "Flush file caches and remove shell prompt."
@@ -4870,13 +4866,11 @@ Only works for Bourne-like shells."
        (tramp-compat-funcall
         'tramp-send-command
         (process-get proc 'vector)
-        (format "kill -2 %d" pid))
+        (format "kill -2 -%d" pid))
        ;; Wait, until the process has disappeared.  If it doesn't,
        ;; fall back to the default implementation.
-       (with-timeout (1 (ignore))
-         (while (tramp-accept-process-output proc))
-         ;; Report success.
-         proc)))))
+        (while (tramp-accept-process-output proc 0))
+       (not (process-live-p proc))))))
 
 ;; `interrupt-process-functions' exists since Emacs 26.1.
 (when (boundp 'interrupt-process-functions)
@@ -4890,7 +4884,6 @@ Only works for Bourne-like shells."
 ;; - Unload all `tramp-*' packages
 ;; - Reset `file-name-handler-alist'
 ;; - Cleanup hooks where Tramp functions are in
-;; - Cleanup advised functions
 ;; - Cleanup autoloads
 ;;;###autoload
 (defun tramp-unload-tramp ()
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 9d919cc..ac706b9 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: code extracted from Emacs-20's simple.el
-;; Maintainer: Stefan Monnier <address@hidden>
+;; Maintainer: Stefan Monnier <address@hidden>
 ;; Keywords: comment uncomment
 ;; Package: emacs
 
@@ -1001,7 +1001,15 @@ This function is the default value of 
`uncomment-region-function'."
                       (re-search-forward sre (line-end-position) t))
                (replace-match "" t t nil (if (match-end 2) 2 1)))))
          ;; Go to the end for the next comment.
-         (goto-char (point-max))))))
+         (goto-char (point-max)))
+        ;; Remove any obtrusive spaces left preceding a tab at `spt'.
+        (when (and (eq (char-after spt) ?\t) (eq (char-before spt) ? )
+                   (> tab-width 0))
+          (save-excursion
+            (goto-char spt)
+            (let* ((fcol (current-column))
+                   (slim (- (point) (mod fcol tab-width))))
+              (delete-char (- (skip-chars-backward " " slim)))))))))
   (set-marker end nil))
 
 (defun uncomment-region-default (beg end &optional arg)
diff --git a/lisp/novice.el b/lisp/novice.el
index 3da4e25..1da4b71 100644
--- a/lisp/novice.el
+++ b/lisp/novice.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal, help
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 6f80912..8da9f5c 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -2379,7 +2379,9 @@ With a prefix argument, inserts the character directly."
 (put 'nxml-char-ref 'evaporate t)
 
 (defun nxml-char-ref-display-extra (start end n)
-  (when nxml-char-ref-extra-display
+  (when (and ;; Displaying literal newline is unhelpful.
+         (not (eql n ?\n))
+         nxml-char-ref-extra-display)
     (let ((name (or (get-char-code-property n 'name)
                     (get-char-code-property n 'old-name)))
          (glyph-string (and nxml-char-ref-display-glyph-flag
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index 2bd758b..21dbade 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -35,35 +35,25 @@
 ;;
 ;; Our strategy is to keep track of just the problematic things.
 ;; Specifically, we keep track of all comments, CDATA sections and
-;; processing instructions in the instance.  We do this by marking all
-;; except the first character of these with a non-nil nxml-inside text
-;; property. The value of the nxml-inside property is comment,
-;; cdata-section or processing-instruction.  The first character does
-;; not have the nxml-inside property so we can find the beginning of
-;; the construct by looking for a change in a text property value
-;; (Emacs provides primitives for this).  We use text properties
-;; rather than overlays, since the implementation of overlays doesn't
-;; look like it scales to large numbers of overlays in a buffer.
-;;
-;; We don't in fact track all these constructs, but only track them in
-;; some initial part of the instance.
+;; processing instructions in the instance.  We do this by marking
+;; the first character of these with the generic string syntax by setting
+;; a 'syntax-table' text property in `sgml-syntax-propertize'.
 ;;
 ;; Thus to parse some random point in the file we first ensure that we
-;; have scanned up to that point.  Then we search backwards for a
-;; <. Then we check whether the < has an nxml-inside property. If it
-;; does we go backwards to first character that does not have an
-;; nxml-inside property (this character must be a <).  Then we start
-;; parsing forward from the < we have found.
+;; have scanned up to that point.  Then we search backwards for a <.
+;; Then we check whether the < has the generic string syntax.  If it
+;; does we go backwards to first character of the generic string (this
+;; character must be a <).  Then we start parsing forward from the <
+;; we have found.
 ;;
 ;; The prolog has to be parsed specially, so we also keep track of the
 ;; end of the prolog in `nxml-prolog-end'. The prolog is reparsed on
 ;; every change to the prolog.  This won't work well if people try to
 ;; edit huge internal subsets. Hopefully that will be rare.
 ;;
-;; We keep track of the changes by adding to the buffer's
-;; after-change-functions hook.  Scanning is also done as a
-;; prerequisite to fontification by adding to fontification-functions
-;; (in the same way as jit-lock).  This means that scanning for these
+;; We rely on the `syntax-propertize-function' machinery to keep track
+;; of the changes in the buffer.  Fontification also relies on correct
+;; `syntax-table' properties.  This means that scanning for these
 ;; constructs had better be quick.  Fortunately it is. Firstly, the
 ;; typical proportion of comments, CDATA sections and processing
 ;; instructions is small relative to other things.  Secondly, to scan
@@ -79,7 +69,15 @@
   "Integer giving position following end of the prolog.")
 
 (defsubst nxml-get-inside (pos)
-  (save-excursion (nth 8 (syntax-ppss pos))))
+  "Return non-nil if inside comment, CDATA, or PI."
+  (let ((ppss (save-excursion (syntax-ppss pos))))
+    (or
+     ;; Inside comment.
+     (nth 4 ppss)
+     ;; Inside "generic" string which is used for CDATA, and PI.
+     ;; "Normal" double and single quoted strings are used for
+     ;; attribute values.
+     (eq t (nth 3 ppss)))))
 
 (defun nxml-inside-end (pos)
   "Return the end of the inside region containing POS.
diff --git a/lisp/obarray.el b/lisp/obarray.el
index c83d5d4..fbab506 100644
--- a/lisp/obarray.el
+++ b/lisp/obarray.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: obarray functions
 ;; Package: emacs
 
diff --git a/lisp/obsolete/abbrevlist.el b/lisp/obsolete/abbrevlist.el
index e2bf14f..dfd7b2b 100644
--- a/lisp/obsolete/abbrevlist.el
+++ b/lisp/obsolete/abbrevlist.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1986, 1992, 2001-2019 Free Software Foundation, Inc.
 ;; Suggested by a previous version by Gildea.
 
-;; Maintainer: address@hidden
 ;; Keywords: abbrev
 ;; Package: emacs
 ;; Obsolete-since: 24.1
diff --git a/lisp/obsolete/bruce.el b/lisp/obsolete/bruce.el
index fba54c1..8044a0e 100644
--- a/lisp/obsolete/bruce.el
+++ b/lisp/obsolete/bruce.el
@@ -4,7 +4,6 @@
 ;; Copyright (C) 1988, 1993, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: games
 ;; Created: Jan 1997
 ;; Obsolete-since: 24.3
diff --git a/lisp/obsolete/fast-lock.el b/lisp/obsolete/fast-lock.el
index 5180d45..10af6ab 100644
--- a/lisp/obsolete/fast-lock.el
+++ b/lisp/obsolete/fast-lock.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: faces files
 ;; Version: 3.14
 ;; Obsolete-since: 22.1
diff --git a/lisp/obsolete/gs.el b/lisp/obsolete/gs.el
index cfdc9dc..24c9b67 100644
--- a/lisp/obsolete/gs.el
+++ b/lisp/obsolete/gs.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Obsolete-since: 26.1
 
diff --git a/lisp/obsolete/gulp.el b/lisp/obsolete/gulp.el
index bdb3406..373ee35 100644
--- a/lisp/obsolete/gulp.el
+++ b/lisp/obsolete/gulp.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Sam Shteingold <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: maint
 ;; Obsolete-since: 25.1
 
diff --git a/lisp/obsolete/info-edit.el b/lisp/obsolete/info-edit.el
new file mode 100644
index 0000000..e520faf
--- /dev/null
+++ b/lisp/obsolete/info-edit.el
@@ -0,0 +1,82 @@
+;; info-edit.el --- Editing info files  -*- lexical-binding:t -*-
+
+;; Copyright (C) 1985-1986, 1992-2019 Free Software Foundation, Inc.
+
+;; Keywords: help
+;; Obsolete-since: 24.4
+
+;; 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:
+
+(require 'info)
+
+(defvar Info-edit-mode-hook nil
+  "Hook run when `Info-edit-mode' is activated.")
+
+(make-obsolete-variable 'Info-edit-mode-hook
+                       "editing Info nodes by hand is not recommended." "24.4")
+
+(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1")
+(defvar Info-edit-mode-map (let ((map (make-sparse-keymap)))
+                             (set-keymap-parent map text-mode-map)
+                             (define-key map "\C-c\C-c" 'Info-cease-edit)
+                             map)
+  "Local keymap used within `e' command of Info.")
+
+(make-obsolete-variable 'Info-edit-mode-map
+                       "editing Info nodes by hand is not recommended."
+                       "24.4")
+
+;; Info-edit mode is suitable only for specially formatted data.
+(put 'Info-edit-mode 'mode-class 'special)
+
+(define-derived-mode Info-edit-mode text-mode "Info Edit"
+  "Major mode for editing the contents of an Info node.
+Like text mode with the addition of `Info-cease-edit'
+which returns to Info mode for browsing."
+  (setq buffer-read-only nil)
+  (force-mode-line-update)
+  (buffer-enable-undo (current-buffer)))
+
+(defun Info-edit ()
+  "Edit the contents of this Info node."
+  (interactive)
+  (Info-edit-mode)
+  (message "%s" (substitute-command-keys
+                "Editing: Type \\<Info-edit-mode-map>\\[Info-cease-edit] to 
return to info")))
+
+(put 'Info-edit 'disabled "Editing Info nodes by hand is not recommended.
+This feature will be removed in future.")
+
+(defun Info-cease-edit ()
+  "Finish editing Info node; switch back to Info proper."
+  (interactive)
+  ;; Do this first, so nothing has changed if user C-g's at query.
+  (and (buffer-modified-p)
+       (y-or-n-p "Save the file? ")
+       (save-buffer))
+  (Info-mode)
+  (force-mode-line-update)
+  (and (marker-position Info-tag-table-marker)
+       (buffer-modified-p)
+       (message "Tags may have changed.  Use Info-tagify if necessary")))
+
+(provide 'info-edit)
+
+;;; info-edit.el ends here
diff --git a/lisp/obsolete/lazy-lock.el b/lisp/obsolete/lazy-lock.el
index 44f8528..5167928 100644
--- a/lisp/obsolete/lazy-lock.el
+++ b/lisp/obsolete/lazy-lock.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: faces files
 ;; Version: 2.11
 ;; Obsolete-since: 22.1
diff --git a/lisp/obsolete/ledit.el b/lisp/obsolete/ledit.el
index 6383a42..91efa29 100644
--- a/lisp/obsolete/ledit.el
+++ b/lisp/obsolete/ledit.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: languages
 ;; Obsolete-since: 24.3
 
diff --git a/lisp/obsolete/levents.el b/lisp/obsolete/levents.el
index 714b3fb..f2b081d 100644
--- a/lisp/obsolete/levents.el
+++ b/lisp/obsolete/levents.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: emulations
 ;; Obsolete-since: 23.2
 
diff --git a/lisp/obsolete/lucid.el b/lisp/obsolete/lucid.el
index d1b702e..9d0c5da 100644
--- a/lisp/obsolete/lucid.el
+++ b/lisp/obsolete/lucid.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993, 1995, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: emulations
 ;; Obsolete-since: 23.2
 
diff --git a/lisp/obsolete/mailpost.el b/lisp/obsolete/mailpost.el
index 2f74faf..33cc43c 100644
--- a/lisp/obsolete/mailpost.el
+++ b/lisp/obsolete/mailpost.el
@@ -6,7 +6,6 @@
 ;; This file is part of GNU Emacs.
 
 ;; Author: Gary Delp <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 13 Jan 1986
 ;; Keywords: mail
 ;; Obsolete-since: 24.3
diff --git a/lisp/obsolete/meese.el b/lisp/obsolete/meese.el
index 81739df..190db94 100644
--- a/lisp/obsolete/meese.el
+++ b/lisp/obsolete/meese.el
@@ -5,7 +5,6 @@
 
 ;; This file is part of GNU Emacs.
 
-;; Maintainer: address@hidden
 ;; Keywords: games
 ;; Obsolete-since: 24.4
 
diff --git a/lisp/obsolete/pc-mode.el b/lisp/obsolete/pc-mode.el
index 6d1a456..4908b51 100644
--- a/lisp/obsolete/pc-mode.el
+++ b/lisp/obsolete/pc-mode.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: emulations
 ;; Obsolete-since: 24.1
 
diff --git a/lisp/obsolete/rcompile.el b/lisp/obsolete/rcompile.el
index dfa8009..53537a0 100644
--- a/lisp/obsolete/rcompile.el
+++ b/lisp/obsolete/rcompile.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Alon Albert <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 1993 Oct 6
 ;; Keywords: tools, processes
 ;; Obsolete-since: 24.4
diff --git a/lisp/obsolete/sregex.el b/lisp/obsolete/sregex.el
index 884cd3e..ba36f2d 100644
--- a/lisp/obsolete/sregex.el
+++ b/lisp/obsolete/sregex.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Bob Glickstein <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: extensions
 ;; Obsolete-since: 24.1
 
diff --git a/lisp/obsolete/sup-mouse.el b/lisp/obsolete/sup-mouse.el
index 6bd4278..752ebf5 100644
--- a/lisp/obsolete/sup-mouse.el
+++ b/lisp/obsolete/sup-mouse.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Rupprecht
-;; Maintainer: address@hidden
 ;; Created: 21 Nov 1986
 ;; Keywords: hardware
 ;; Obsolete-since: 24.4
diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el
index ce6f230..d0631b3 100644
--- a/lisp/obsolete/terminal.el
+++ b/lisp/obsolete/terminal.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
-;; Maintainer: address@hidden
 ;; Obsolete-since: 24.4
 ;; Keywords: comm, terminals
 
diff --git a/lisp/obsolete/ws-mode.el b/lisp/obsolete/ws-mode.el
index 3d2e968..1615610 100644
--- a/lisp/obsolete/ws-mode.el
+++ b/lisp/obsolete/ws-mode.el
@@ -289,66 +289,6 @@ with C-q w."
   (setq ws-last-errormessage string)
   (error string))
 
-(defun ws-set-marker-0 ()
-  "In WordStar mode: Set marker 0 to current cursor position."
-  (interactive)
-  (setq ws-marker-0 (point-marker))
-  (message "Marker 0 set"))
-
-(defun ws-set-marker-1 ()
-  "In WordStar mode: Set marker 1 to current cursor position."
-  (interactive)
-  (setq ws-marker-1 (point-marker))
-  (message "Marker 1 set"))
-
-(defun ws-set-marker-2 ()
-  "In WordStar mode: Set marker 2 to current cursor position."
-  (interactive)
-  (setq ws-marker-2 (point-marker))
-  (message "Marker 2 set"))
-
-(defun ws-set-marker-3 ()
-  "In WordStar mode: Set marker 3 to current cursor position."
-  (interactive)
-  (setq ws-marker-3 (point-marker))
-  (message "Marker 3 set"))
-
-(defun ws-set-marker-4 ()
-  "In WordStar mode: Set marker 4 to current cursor position."
-  (interactive)
-  (setq ws-marker-4 (point-marker))
-  (message "Marker 4 set"))
-
-(defun ws-set-marker-5 ()
-  "In WordStar mode: Set marker 5 to current cursor position."
-  (interactive)
-  (setq ws-marker-5 (point-marker))
-  (message "Marker 5 set"))
-
-(defun ws-set-marker-6 ()
-  "In WordStar mode: Set marker 6 to current cursor position."
-  (interactive)
-  (setq ws-marker-6 (point-marker))
-  (message "Marker 6 set"))
-
-(defun ws-set-marker-7 ()
-  "In WordStar mode: Set marker 7 to current cursor position."
-  (interactive)
-  (setq ws-marker-7 (point-marker))
-  (message "Marker 7 set"))
-
-(defun ws-set-marker-8 ()
-  "In WordStar mode: Set marker 8 to current cursor position."
-  (interactive)
-  (setq ws-marker-8 (point-marker))
-  (message "Marker 8 set"))
-
-(defun ws-set-marker-9 ()
-  "In WordStar mode: Set marker 9 to current cursor position."
-  (interactive)
-  (setq ws-marker-9 (point-marker))
-  (message "Marker 9 set"))
-
 (defun ws-begin-block ()
   "In WordStar mode: Set block begin marker to current cursor position."
   (interactive)
@@ -447,96 +387,6 @@ with C-q w."
                    (ws-block-end-marker "Block begin marker not set")
                    (t "Block markers not set")))))
 
-(defun ws-find-marker-0 ()
-  "In WordStar mode: Go to marker 0."
-  (interactive)
-  (if ws-marker-0
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-0))
-    (ws-error "Marker 0 not set")))
-
-(defun ws-find-marker-1 ()
-  "In WordStar mode: Go to marker 1."
-  (interactive)
-  (if ws-marker-1
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-1))
-    (ws-error "Marker 1 not set")))
-
-(defun ws-find-marker-2 ()
-  "In WordStar mode: Go to marker 2."
-  (interactive)
-  (if ws-marker-2
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-2))
-    (ws-error "Marker 2 not set")))
-
-(defun ws-find-marker-3 ()
-  "In WordStar mode: Go to marker 3."
-  (interactive)
-  (if ws-marker-3
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-3))
-    (ws-error "Marker 3 not set")))
-
-(defun ws-find-marker-4 ()
-  "In WordStar mode: Go to marker 4."
-  (interactive)
-  (if ws-marker-4
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-4))
-    (ws-error "Marker 4 not set")))
-
-(defun ws-find-marker-5 ()
-  "In WordStar mode: Go to marker 5."
-  (interactive)
-  (if ws-marker-5
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-5))
-    (ws-error "Marker 5 not set")))
-
-(defun ws-find-marker-6 ()
-  "In WordStar mode: Go to marker 6."
-  (interactive)
-  (if ws-marker-6
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-6))
-    (ws-error "Marker 6 not set")))
-
-(defun ws-find-marker-7 ()
-  "In WordStar mode: Go to marker 7."
-  (interactive)
-  (if ws-marker-7
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-7))
-    (ws-error "Marker 7 not set")))
-
-(defun ws-find-marker-8 ()
-  "In WordStar mode: Go to marker 8."
-  (interactive)
-  (if ws-marker-8
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-8))
-    (ws-error "Marker 8 not set")))
-
-(defun ws-find-marker-9 ()
-  "In WordStar mode: Go to marker 9."
-  (interactive)
-  (if ws-marker-9
-      (progn
-       (setq ws-last-cursorposition (point-marker))
-       (goto-char ws-marker-9))
-    (ws-error "Marker 9 not set")))
-
 (defun ws-goto-block-begin ()
   "In WordStar mode: Go to block begin marker."
   (interactive)
@@ -654,6 +504,36 @@ sWith: " )
                    (ws-block-end-marker "Block begin marker not set")
                    (t "Block markers not set")))))
 
+(defmacro ws-set-marker (&rest indices)
+  (let (n forms)
+    (while indices
+      (setq n (pop indices))
+      (push `(defun ,(intern (format "ws-set-marker-%d" n)) ()
+               ,(format "In WordStar mode: Set marker %d to current cursor 
position" n)
+               (interactive)
+               (setq ,(intern (format "ws-marker-%d" n)) (point-marker))
+               (message ,(format "Marker %d set" n)))
+            forms))
+    `(progn ,@(nreverse forms))))
+
+(ws-set-marker 0 1 2 3 4 5 6 7 8 9)
+
+(defmacro ws-find-marker (&rest indices)
+  (let (n forms)
+    (while indices
+      (setq n (pop indices))
+      (push `(defun ,(intern (format "ws-find-marker-%d" n)) ()
+               ,(format "In WordStar mode: Go to marker %d." n)
+               (interactive)
+               (if ,(intern (format "ws-marker-%d" n))
+                   (progn (setq ws-last-cursorposition (point-marker))
+                          (goto-char ,(intern (format "ws-marker-%d" n))))
+                 (ws-error ,(format "Marker %d not set" n))))
+            forms))
+    `(progn ,@(nreverse forms))))
+
+(ws-find-marker 0 1 2 3 4 5 6 7 8 9)
+
 (provide 'ws-mode)
 
 ;;; ws-mode.el ends here
diff --git a/lisp/obsolete/yow.el b/lisp/obsolete/yow.el
index 5cbb2ef..eddb3f9 100644
--- a/lisp/obsolete/yow.el
+++ b/lisp/obsolete/yow.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Author: Richard Mlynarik
 ;; Keywords: games
 ;; Obsolete-since: 24.4
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index 74312bc..9126647 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -2,7 +2,7 @@
 ;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: David O'Toole <address@hidden>
-;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
+;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: hypermedia, outlines, wp
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/outline.el b/lisp/outline.el
index 74df77b..7783d37 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1986, 1993-1995, 1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: outlines
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/paren.el b/lisp/paren.el
index 13908d4..d00e7d9 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993, 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: address@hidden
-;; Maintainer: address@hidden
 ;; Keywords: languages, faces
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el
index e461b37..fb310fa 100644
--- a/lisp/play/cookie1.el
+++ b/lisp/play/cookie1.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: games, extensions
 ;; Created: Mon Mar 22 17:06:26 1993
 
diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el
index a5880c0..fc76f2b 100644
--- a/lisp/play/dissociate.el
+++ b/lisp/play/dissociate.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: games
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el
index b1ab670..e9c78f5 100644
--- a/lisp/play/doctor.el
+++ b/lisp/play/doctor.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: games
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index 4a9dac7..54eeafd 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -663,6 +663,7 @@ FILE is created there."
              (revert-buffer nil t nil)
              (display-buffer buf))
          (find-file-read-only target))
+        (view-mode)
         (goto-char (point-min))
         (search-forward (concat (int-to-string score)
                                " " (user-login-name) " "
@@ -691,7 +692,8 @@ FILE is created there."
     (forward-line gamegrid-score-file-length)
     (delete-region (point) (point-max))
     (setq buffer-read-only t)
-    (save-buffer)))
+    (save-buffer)
+    (view-mode)))
 
 
 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index 6d5553b..562e5c0 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Philippe Schnoebelen <address@hidden>
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR, Daniel Pfeiffer <address@hidden>
 ;; Keywords: games
 
diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el
index d762290..1f2e2c0 100644
--- a/lisp/play/hanoi.el
+++ b/lisp/play/hanoi.el
@@ -1,7 +1,6 @@
 ;;; hanoi.el --- towers of hanoi in Emacs
 
 ;; Author: Damon Anton Permezel
-;; Maintainer: address@hidden
 ;; Keywords: games
 
 ; Author (a) 1985, Damon Anton Permezel
diff --git a/lisp/play/life.el b/lisp/play/life.el
index 6cce1e5..7d9f147 100644
--- a/lisp/play/life.el
+++ b/lisp/play/life.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kyle Jones <kyleuunet.uu.net>
-;; Maintainer: address@hidden
 ;; Keywords: games
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/play/spook.el b/lisp/play/spook.el
index d884c0a..c1394a3 100644
--- a/lisp/play/spook.el
+++ b/lisp/play/spook.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1988, 1993, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: games
 ;; Created: May 1987
 
diff --git a/lisp/play/studly.el b/lisp/play/studly.el
index ff1bf03..6d54f6d 100644
--- a/lisp/play/studly.el
+++ b/lisp/play/studly.el
@@ -5,7 +5,6 @@
 
 ;; This file is part of GNU Emacs.
 
-;; Maintainer: address@hidden
 ;; Keywords: games
 
 ;;; Commentary:
diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el
index 1e0681d..a797a26 100644
--- a/lisp/play/tetris.el
+++ b/lisp/play/tetris.el
@@ -277,6 +277,7 @@ each one of its four blocks.")
 (defvar tetris-null-map
   (let ((map (make-sparse-keymap 'tetris-null-map)))
     (define-key map "n"                'tetris-start-game)
+    (define-key map "q"         'quit-window)
     map))
 
 ;; ;;;;;;;;;;;;;;;; game functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index e01f1e8..50f7b4c 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -5,7 +5,7 @@
 ;; Author: Rolf Ebert      <address@hidden>
 ;;      Markus Heritsch <address@hidden>
 ;;      Emmanuel Briot  <address@hidden>
-;; Maintainer: Stephen Leake <address@hidden>
+;; Maintainer: Stephen Leake <address@hidden>
 ;; Keywords: languages ada
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index c56d16e..491b780 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1991, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: tools, languages
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index 009f58e..74548f6 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -90,26 +90,26 @@ Works with: topmost-intro-cont."
 
 (defun c-lineup-gnu-DEFUN-intro-cont (langelem)
   "Line up the continuation lines of a DEFUN macro in the Emacs C source.
-These lines are indented as though they were `knr-argdecl-intro' lines.
+These lines are indented `c-basic-offset' columns, usually from column 0.
 Return nil when we're not in such a construct.
 
-This function is for historical compatibility with how previous CC Modes (5.28
-and earlier) indented such lines.
+This function was formally for use in DEFUNs, which used to have knr
+argument lists.  Now (2019-05) it just indents the argument list of the
+DEFUN's function, which would otherwise go to column 0.
 
 Here is an example:
 
 DEFUN (\"forward-char\", Fforward_char, Sforward_char, 0, 1, \"p\",
        doc: /* Move point right N characters (left if N is negative).
 On reaching end of buffer, stop and signal error.  */)
-     (n)                      <- c-lineup-gnu-DEFUN-into-cont
-     Lisp_Object n;           <- c-lineup-gnu-DEFUN-into-cont
+  (Lisp_Object n)             <- c-lineup-gnu-DEFUN-into-cont
 
 Works with: topmost-intro-cont."
   (save-excursion
     (let (case-fold-search)
       (goto-char (c-langelem-pos langelem))
       (if (looking-at "\\<DEFUN\\>")
-         (c-calc-offset '(knr-argdecl-intro))))))
+         c-basic-offset))))
 
 (defun c-block-in-arglist-dwim (arglist-start)
   ;; This function implements the DWIM to avoid far indentation of
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index 1a67a95..ff4ea1a 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Alan Mackenzie <address@hidden> (originally based on awk-mode.el)
-;; Maintainer: address@hidden
 ;; Keywords: AWK, cc-mode, unix, languages
 ;; Package: cc-mode
 
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index cd4ed6b..d20e3ef 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -81,7 +81,7 @@
   (progn
     (require 'font-lock)
     (let (font-lock-keywords)
-      (font-lock-compile-keywords '("a\\`")) ; doesn't match anything.
+      (font-lock-compile-keywords (list regexp-unmatchable))
       font-lock-keywords))))
 
 
@@ -1890,8 +1890,8 @@ when it's needed.  The default is the current language 
taken from
 
     ;; Produce a regexp that doesn't match anything.
     (if adorn
-       "\\(a\\`\\)"
-      "a\\`")))
+       (concat "\\(" regexp-unmatchable "\\)")
+      regexp-unmatchable)))
 
 (put 'c-make-keywords-re 'lisp-indent-function 1)
 
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 242954d..c043367 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -287,7 +287,8 @@ otherwise return nil and leave point unchanged.
 
 Note that this function might do hidden buffer changes.  See the
 comment at the start of cc-engine.el for more info."
-  (let ((here (point)))
+  (let ((here (point))
+       (pause (c-point 'eol)))
     (when c-opt-cpp-prefix
       (if (and (car c-macro-cache)
               (>= (point) (car c-macro-cache))
@@ -307,8 +308,23 @@ comment at the start of cc-engine.el for more info."
        (save-restriction
          (if lim (narrow-to-region lim (point-max)))
          (beginning-of-line)
-         (while (eq (char-before (1- (point))) ?\\)
-           (forward-line -1))
+         (when (or (null lim)
+                   (>= here lim))
+           (while
+               (progn
+                 (while (eq (char-before (1- (point))) ?\\)
+                   (forward-line -1))
+                 (when (and c-last-c-comment-end-on-line-re
+                            (re-search-forward
+                             c-last-c-comment-end-on-line-re pause t))
+                   (goto-char (match-end 1))
+                   (if (c-backward-single-comment)
+                       (progn
+                         (beginning-of-line)
+                         (setq pause (point)))
+                     (goto-char pause)
+                     nil)))))
+
          (back-to-indentation)
          (if (and (<= (point) here)
                   (save-match-data (looking-at c-opt-cpp-start))
@@ -345,12 +361,23 @@ comment at the start of cc-engine.el for more info."
              c-macro-cache-start-pos nil
              c-macro-cache-syntactic nil
              c-macro-cache-no-comment nil))
-      (while (progn
-              (end-of-line)
-              (when (and (eq (char-before) ?\\)
-                         (not (eobp)))
-                (forward-char)
-                t)))
+      (while
+         (progn
+           (while (progn
+                    (end-of-line)
+                    (when (and (eq (char-before) ?\\)
+                               (not (eobp)))
+                      (forward-char)
+                      t)))
+           (if (and c-last-open-c-comment-start-on-line-re
+                    (re-search-backward
+                     c-last-open-c-comment-start-on-line-re
+                     (c-point 'bol) t))
+               (progn
+                 (goto-char (match-beginning 1))
+                 (c-forward-single-comment))
+             nil)))
+
       (when (and (car c-macro-cache)
                 (bolp)
                 (not (eq (char-before (1- (point))) ?\\)))
@@ -880,7 +907,7 @@ comment at the start of cc-engine.el for more info."
        stack
        ;; Regexp which matches "for", "if", etc.
        (cond-key (or c-opt-block-stmt-key
-                     "a\\`"))  ; Doesn't match anything.
+                     regexp-unmatchable))
        ;; Return value.
        (ret 'same)
        ;; Positions of the last three sexps or bounds we've stopped at.
@@ -1116,6 +1143,9 @@ comment at the start of cc-engine.el for more info."
                         ;; Have we moved into a macro?
                         ((and (not macro-start)
                               (c-beginning-of-macro))
+                         (save-excursion
+                           (c-backward-syntactic-ws)
+                           (setq before-sws-pos (point)))
                          ;; Have we crossed a statement boundary?  If not,
                          ;; keep going back until we find one or a "real" sexp.
                          (and
@@ -1223,12 +1253,20 @@ comment at the start of cc-engine.el for more info."
                  ;; (including a case label) or something like C++'s "public:"?
                  ;; A case label might use an expression rather than a token.
                  (setq after-case:-pos (or tok start))
-                 (if (or (looking-at c-nonlabel-token-key) ; e.g. "while" or 
"'a'"
+                 (if (or (looking-at c-nonlabel-nonparen-token-key)
+                                       ; e.g. "while" or "'a'"
                          ;; Catch C++'s inheritance construct "class foo : 
bar".
                          (save-excursion
                            (and
                             (c-safe (c-backward-sexp) t)
-                            (looking-at c-nonlabel-token-2-key))))
+                            (looking-at c-nonlabel-token-2-key)))
+                         ;; Catch C++'s "case a(1):"
+                         (and (c-major-mode-is 'c++-mode)
+                              (eq (char-after) ?\()
+                              (save-excursion
+                                (not (and
+                                      (zerop (c-backward-token-2 2))
+                                      (looking-at c-case-kwds-regexp))))))
                      (setq c-maybe-labelp nil)
                    (if after-labels-pos ; Have we already encountered a label?
                        (if (not last-label-pos)
@@ -1812,7 +1850,7 @@ comment at the start of cc-engine.el for more info."
          (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)
+(defun c-invalidate-sws-region-after-del (beg end _old-len)
   ;; Text has been deleted, OLD-LEN characters of it starting from position
   ;; BEG.  END is typically eq to BEG.  Should there have been a comment or
   ;; CPP construct open at END before the deletion, check whether this
@@ -2007,6 +2045,10 @@ comment at the start of cc-engine.el for more info."
            ;; Take elaborate precautions to detect an open block comment at
            ;; the end of a macro.  If we find one, we set `safe-start' to nil
            ;; and break off any further scanning of comments.
+           ;;
+           ;; (2019-05-02): `c-end-of-macro' now moves completely over block
+           ;; comments, even multiline ones lacking \s at their EOLs.  So a
+           ;; lot of the following is probably redundant now.
            (let ((com-begin (point)) com-end in-macro)
              (when (and (c-forward-single-comment)
                         (setq com-end (point))
@@ -2492,6 +2534,25 @@ comment at the start of cc-engine.el for more info."
 ;; reduced by buffer changes, and increased by invocations of
 ;; `c-state-literal-at'.
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; We also maintain a less simple cache of positions which aren't in a
+;; literal, disregarding macros.
+;;
+;; This cache is in two parts: the "near" cache, which is an association list
+;; of a small number (currently six) of positions and the parser states there;
+;; the "far" cache (also known as "the cache"), a list of compressed parser
+;; states going back to the beginning of the buffer, one entry every 3000
+;; characters.
+;;
+;; When searching this cache, `c-state-semi-pp-to-literal' first seeks an
+;; exact match, then a "close" match from the near cache.  If neither of these
+;; succeed, the nearest entry in the far cache is used.
+;;
+;; Because either sub-cache can raise `c-state-semi-nonlit-pos-cache-limit',
+;; both of them are "trimmed" together after a buffer change to ensure
+;; consistency.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (defvar c-state-semi-nonlit-pos-cache nil)
 (make-variable-buffer-local 'c-state-semi-nonlit-pos-cache)
 ;; A list of elements which are either buffer positions (when such positions
@@ -2505,12 +2566,62 @@ comment at the start of cc-engine.el for more info."
 ;; is reduced by buffer changes, and increased by invocations of
 ;; `c-parse-ps-state-below'.
 
+(defvar c-state-semi-nonlit-near-cache nil)
+(make-variable-buffer-local 'c-state-semi-nonlit-near-cache)
+;; A list of up to six recent results from `c-state-semi-pp-to-literal'.  Each
+;; element is a cons of the buffer position and the `parse-partial-sexp' state
+;; at that position.
+
 (defsubst c-truncate-semi-nonlit-pos-cache (pos)
   ;; Truncate the upper bound of the cache `c-state-semi-nonlit-pos-cache' to
   ;; POS, if it is higher than that position.
   (setq c-state-semi-nonlit-pos-cache-limit
        (min c-state-semi-nonlit-pos-cache-limit pos)))
 
+(defun c-state-semi-trim-near-cache ()
+  ;; Remove stale entries in `c-state-semi-nonlit-near-cache', i.e. those
+  ;; whose positions are above `c-state-semi-nonlit-pos-cache-limit'.
+  (let ((nc-list c-state-semi-nonlit-near-cache))
+    (while nc-list
+      (if (> (caar nc-list) c-state-semi-nonlit-pos-cache-limit)
+         (setq c-state-semi-nonlit-near-cache
+               (delq (car nc-list) c-state-semi-nonlit-near-cache)
+               nc-list c-state-semi-nonlit-near-cache) ; start again in case
+                                       ; of list breakage.
+       (setq nc-list (cdr nc-list))))))
+
+(defun c-state-semi-get-near-cache-entry (here)
+  ;; Return the near cache entry at the highest postion before HERE, if any,
+  ;; or nil.  The near cache entry is of the form (POSITION . STATE), where
+  ;; STATE has the form of a result of `parse-partial-sexp'.
+  (let ((nc-pos-state
+        (or (assq here c-state-semi-nonlit-near-cache)
+            (let ((nc-list c-state-semi-nonlit-near-cache)
+                  pos (nc-pos 0) cand-pos-state)
+              (while nc-list
+                (setq pos (caar nc-list))
+                (when (and (<= pos here)
+                           (> pos nc-pos))
+                  (setq nc-pos pos
+                        cand-pos-state (car nc-list)))
+                (setq nc-list (cdr nc-list)))
+              cand-pos-state))))
+    (when (and nc-pos-state
+              (not (eq nc-pos-state (car c-state-semi-nonlit-near-cache))))
+      ;; Move the found cache entry to the front of the list.
+      (setq c-state-semi-nonlit-near-cache
+           (delq nc-pos-state c-state-semi-nonlit-near-cache))
+      (push nc-pos-state c-state-semi-nonlit-near-cache))
+    nc-pos-state))
+
+(defun c-state-semi-put-near-cache-entry (here state)
+  ;; Put a new near cache entry into the near cache.
+  (while (>= (length c-state-semi-nonlit-near-cache) 6)
+    (setq c-state-semi-nonlit-near-cache
+         (delq (car (last c-state-semi-nonlit-near-cache))
+               c-state-semi-nonlit-near-cache)))
+  (push (cons here state) c-state-semi-nonlit-near-cache))
+
 (defun c-state-semi-pp-to-literal (here &optional not-in-delimiter)
   ;; Do a parse-partial-sexp from a position in the buffer before HERE which
   ;; isn't in a literal, and return information about HERE, either:
@@ -2530,12 +2641,28 @@ comment at the start of cc-engine.el for more info."
   (save-excursion
     (save-restriction
       (widen)
+      (c-state-semi-trim-cache)
+      (c-state-semi-trim-near-cache)
+      (setq c-state-semi-nonlit-pos-cache-limit here)
       (save-match-data
-       (let* ((base-and-state (c-parse-ps-state-below here))
+       (let* ((base-and-state (c-state-semi-get-near-cache-entry here))
               (base (car base-and-state))
+              (near-base base)
               (s (cdr base-and-state))
-              (s (parse-partial-sexp base here nil nil s))
-              ty)
+              far-base-and-state far-base far-s ty)
+         (if (or (not base)
+                 (< base (- here 100)))
+             (progn
+               (setq far-base-and-state (c-parse-ps-state-below here)
+                     far-base (car far-base-and-state)
+                     far-s (cdr far-base-and-state))
+               (when (or (not base) (> far-base base))
+                 (setq base far-base
+                       s far-s))))
+         (when (> here base)
+           (setq s (parse-partial-sexp base here nil nil s)))
+         (when (not (eq near-base here))
+           (c-state-semi-put-near-cache-entry here s))
          (cond
           ((or (nth 3 s)
                (and (nth 4 s)
@@ -2578,12 +2705,28 @@ comment at the start of cc-engine.el for more info."
   (save-excursion
     (save-restriction
       (widen)
+      (c-state-semi-trim-cache)
+      (c-state-semi-trim-near-cache)
+      (setq c-state-semi-nonlit-pos-cache-limit here)
       (save-match-data
-       (let* ((base-and-state (c-parse-ps-state-below here))
+       (let* ((base-and-state (c-state-semi-get-near-cache-entry here))
               (base (car base-and-state))
+              (near-base base)
               (s (cdr base-and-state))
-              (s (parse-partial-sexp base here nil nil s))
-              ty start)
+              far-base-and-state far-base far-s ty start)
+         (if (or (not base)
+                 (< base (- here 100)))
+             (progn
+               (setq far-base-and-state (c-parse-ps-state-below here)
+                     far-base (car far-base-and-state)
+                     far-s (cdr far-base-and-state))
+               (when (or (not base) (> far-base base))
+                 (setq base far-base
+                       s far-s))))
+         (when (> here base)
+           (setq s (parse-partial-sexp base here nil nil s)))
+         (when (not (eq near-base here))
+           (c-state-semi-put-near-cache-entry here s))
          (cond
           ((or (nth 3 s)
                (and (nth 4 s)
@@ -2778,6 +2921,14 @@ comment at the start of cc-engine.el for more info."
       elt
     (car elt)))
 
+(defun c-state-semi-trim-cache ()
+  ;; Trim the `c-state-semi-nonlit-pos-cache' to take account of buffer
+  ;; changes, indicated by `c-state-semi-nonlit-pos-cache-limit'.
+  (while (and c-state-semi-nonlit-pos-cache
+             (> (c-ps-state-cache-pos (car c-state-semi-nonlit-pos-cache))
+                c-state-semi-nonlit-pos-cache-limit))
+    (setq c-state-semi-nonlit-pos-cache (cdr c-state-semi-nonlit-pos-cache))))
+
 (defun c-parse-ps-state-below (here)
   ;; Given a buffer position HERE, Return a cons (CACHE-POS . STATE), where
   ;; CACHE-POS is a position not very far before HERE for which the
@@ -2788,14 +2939,9 @@ comment at the start of cc-engine.el for more info."
   (save-excursion
     (save-restriction
       (widen)
+      (c-state-semi-trim-cache)
       (let ((c c-state-semi-nonlit-pos-cache)
            elt state npos high-elt)
-       ;; Trim the cache to take account of buffer changes.
-       (while (and c (> (c-ps-state-cache-pos (car c))
-                        c-state-semi-nonlit-pos-cache-limit))
-         (setq c (cdr c)))
-       (setq c-state-semi-nonlit-pos-cache c)
-
        (while (and c (> (c-ps-state-cache-pos (car c)) here))
          (setq high-elt (car c))
          (setq c (cdr c)))
@@ -4345,6 +4491,30 @@ comment at the start of cc-engine.el for more info."
                       (goto-char pos))))))
       (< (point) start)))
 
+(defun c-end-of-token (&optional back-limit)
+  ;; Move to the end of the token we're just before or in the middle of.
+  ;; BACK-LIMIT may be used to bound the backward search; if given it's
+  ;; assumed to be at the boundary between two tokens.  Return non-nil if the
+  ;; point is moved, nil otherwise.
+  ;;
+  ;; This function might do hidden buffer changes.
+  (let ((start (point)))
+    (cond ;; ((< (skip-syntax-backward "w_" (1- start)) 0)
+     ;;  (skip-syntax-forward "w_"))
+     ((> (skip-syntax-forward "w_") 0))
+     ((< (skip-syntax-backward ".()" back-limit) 0)
+      (while (< (point) start)
+       (if (looking-at c-nonsymbol-token-regexp)
+           (goto-char (match-end 0))
+         ;; `c-nonsymbol-token-regexp' should always match since
+         ;; we've skipped backward over punctuation or paren
+         ;; syntax, but move forward in case it doesn't so that
+         ;; we don't leave point earlier than we started with.
+         (forward-char))))
+     (t (if (looking-at c-nonsymbol-token-regexp)
+           (goto-char (match-end 0)))))
+    (> (point) start)))
+
 (defun c-end-of-current-token (&optional back-limit)
   ;; Move to the end of the current token.  Do not move if not in the
   ;; middle of one.  BACK-LIMIT may be used to bound the backward
@@ -5475,6 +5645,9 @@ comment at the start of cc-engine.el for more info."
   (setq c-bs-cache-limit
        (min c-bs-cache-limit pos)))
 
+(defvar c-restricted-<>-arglists)      ;FIXME: Move definition here?
+(defvar c-parse-and-markup-<>-arglists)        ;FIXME: Move definition here?
+
 (defun c-update-brace-stack (stack from to)
   ;; Given a brace-stack which has the value STACK at position FROM, update it
   ;; to its value at position TO, where TO is after (or equal to) FROM.
@@ -5529,7 +5702,9 @@ comment at the start of cc-engine.el for more info."
                      (prog1 (looking-at "\\s(")
                        (forward-char))))
          (backward-char)
-         (if (c-forward-<>-arglist nil) ; Should always work.
+         (if (let ((c-parse-and-markup-<>-arglists t)
+                   (c-restricted-<>-arglists t))
+               (c-forward-<>-arglist nil)) ; Should always work.
              (when (> (point) to)
                (setq bound-<> (point)))
            (forward-char)))
@@ -5578,7 +5753,7 @@ comment at the start of cc-engine.el for more info."
        (when (not high-elt)
          (setq stack (cdr elt))
          (while
-             ;; Add an element to `c-state-semi-nonlit-pos-cache' each 
iteration.
+             ;; Add an element to `c-bs-cache' each iteration.
              (<= (setq npos (+ pos c-bs-interval)) here)
            (setq elt (c-update-brace-stack stack pos npos))
            (setq npos (car elt))
@@ -5656,7 +5831,10 @@ comment at the start of cc-engine.el for more info."
               (setq cfd-re-match cfd-limit)
               nil)
              ((c-got-face-at
-               (if (setq cfd-re-match (match-end 1))
+               (if (setq cfd-re-match
+                         (or (match-end 1)
+                             (and c-dposr-cpp-macro-depth
+                                  (match-end (1+ c-dposr-cpp-macro-depth)))))
                    ;; Matched the end of a token preceding a decl spot.
                    (progn
                      (goto-char cfd-re-match)
@@ -5667,15 +5845,19 @@ comment at the start of cc-engine.el for more info."
                c-literal-faces)
               ;; Pseudo match inside a comment or string literal.  Skip out
               ;; of comments and string literals.
-              (while (progn
-                       (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))))
+              (while
+                  (progn
+                    (unless
+                        (and
+                         (or (match-end 1)
+                             (and c-dposr-cpp-macro-depth
+                                  (match-end (1+ c-dposr-cpp-macro-depth))))
+                         (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.
              ((and c-opt-identifier-concat-key
                    (match-string 1)
@@ -5720,9 +5902,14 @@ comment at the start of cc-engine.el for more info."
             ;; comment style has removed face properties from a construct,
             ;; and is relying on `c-font-lock-declarations' to add them
             ;; again.
-            (and (< (point) cfd-limit)
-                 (looking-at c-doc-line-join-re)
-                 (goto-char (match-end 0)))))
+            (cond
+             ((looking-at c-noise-macro-name-re)
+              (c-forward-noise-clause-not-macro-decl nil)) ; Returns t.
+             ((looking-at c-noise-macro-with-parens-name-re)
+              (c-forward-noise-clause-not-macro-decl t)) ; Always returns t.
+             ((and (< (point) cfd-limit)
+                   (looking-at c-doc-line-join-re))
+              (goto-char (match-end 0))))))
        ;; Set the position to continue at.  We can avoid going over
        ;; the comments skipped above a second time, but it's possible
        ;; that the comment skipping has taken us past `cfd-prop-match'
@@ -5751,6 +5938,8 @@ comment at the start of cc-engine.el for more info."
   ;; o The first token after the end of submatch 1 in
   ;;   `c-decl-prefix-or-start-re' when that submatch matches.  This
   ;;   submatch is typically a (L or R) brace or paren, a ;, or a ,.
+  ;;    As a special case, noise macros are skipped over and the next
+  ;;    token regarded as the spot.
   ;; o The start of each `c-decl-prefix-or-start-re' match when
   ;;   submatch 1 doesn't match.  This is, for example, the keyword
   ;;   "class" in Pike.
@@ -5827,7 +6016,7 @@ comment at the start of cc-engine.el for more info."
     ;; before the point, and do the first `c-decl-prefix-or-start-re'
     ;; search unless we're at bob.
 
-    (let (start-in-literal start-in-macro syntactic-pos)
+    (let (start-in-literal start-in-macro syntactic-pos hash-define-pos)
       ;; Must back up a bit since we look for the end of the previous
       ;; statement or declaration, which is earlier than the first
       ;; returned match.
@@ -5982,7 +6171,21 @@ comment at the start of cc-engine.el for more info."
          ;; The only syntactic ws in macros are comments.
          (c-backward-comments)
          (or (bobp) (backward-char))
-         (c-beginning-of-current-token))
+         (c-beginning-of-current-token)
+         ;; If we're in a macro without argument parentheses, we could have
+         ;; now ended up at the macro's identifier.  We need to be at #define
+         ;; for `c-find-decl-prefix-search' to find the first token of the
+         ;; macro's expansion.
+         (when (and (c-on-identifier)
+                    (setq hash-define-pos
+                          (save-excursion
+                            (and
+                             (zerop (c-backward-token-2 2)) ; over define, #
+                             (save-excursion
+                               (beginning-of-line)
+                               (looking-at c-opt-cpp-macro-define-id))
+                             (point)))))
+           (goto-char hash-define-pos)))
 
         (start-in-literal
          ;; If we're in a comment it can only be the closest
@@ -6409,44 +6612,52 @@ comment at the start of cc-engine.el for more info."
   ;;
   ;; FIXME!!!  This routine ignores the possibility of macros entirely.
   ;; 2010-01-29.
-  (save-excursion
-    (c-save-buffer-state
-       ((beg-lit-start (progn (goto-char beg) (c-literal-start)))
-        (end-lit-limits (progn (goto-char end) (c-literal-limits)))
-        new-beg new-end beg-limit end-limit)
-      ;; Locate the earliest < after the barrier before the changed region,
-      ;; which isn't already marked as a paren.
-      (goto-char (or beg-lit-start beg))
-      (setq beg-limit (c-determine-limit 512))
-
-      ;; Remove the syntax-table/category properties from each pertinent <...>
-      ;; pair.  Firstly, the ones with the < before beg and > after beg....
-      (while (progn (c-syntactic-skip-backward "^;{}<" beg-limit)
-                   (eq (char-before) ?<))
-       (c-backward-token-2)
-       (when (eq (char-after) ?<)
-         (c-clear-<-pair-props-if-match-after beg)
-         (setq new-beg (point))))
-      (c-forward-syntactic-ws)
+  (when (and (> end beg)
+            (or
+             (progn
+               (goto-char beg)
+               (search-backward "<" (max (- (point) 1024) (point-min)) t))
+             (progn
+               (goto-char end)
+               (search-forward ">" (min (+ (point) 1024) (point-max)) t))))
+    (save-excursion
+      (c-save-buffer-state
+         ((beg-lit-start (progn (goto-char beg) (c-literal-start)))
+          (end-lit-limits (progn (goto-char end) (c-literal-limits)))
+          new-beg new-end beg-limit end-limit)
+       ;; Locate the earliest < after the barrier before the changed region,
+       ;; which isn't already marked as a paren.
+       (goto-char (or beg-lit-start beg))
+       (setq beg-limit (c-determine-limit 512))
+
+       ;; Remove the syntax-table/category properties from each pertinent <...>
+       ;; pair.  Firstly, the ones with the < before beg and > after beg....
+       (while (progn (c-syntactic-skip-backward "^;{}<" beg-limit)
+                     (eq (char-before) ?<))
+         (c-backward-token-2)
+         (when (eq (char-after) ?<)
+           (c-clear-<-pair-props-if-match-after beg)
+           (setq new-beg (point))))
+       (c-forward-syntactic-ws)
 
-      ;; ...Then the ones with < before end and > after end.
-      (goto-char (if end-lit-limits (cdr end-lit-limits) end))
-      (setq end-limit (c-determine-+ve-limit 512))
-      (while (and (c-syntactic-re-search-forward "[;{}>]" end-limit 'end)
-                 (eq (char-before) ?>))
-       (c-end-of-current-token)
-       (when (eq (char-before) ?>)
-         (c-clear->-pair-props-if-match-before end (1- (point)))
-         (setq new-end (point))))
-      (c-backward-syntactic-ws)
-
-      ;; Extend the fontification region, if needed.
-      (and new-beg
-          (< new-beg c-new-BEG)
-          (setq c-new-BEG new-beg))
-      (and new-end
-          (> new-end c-new-END)
-          (setq c-new-END new-end)))))
+       ;; ...Then the ones with < before end and > after end.
+       (goto-char (if end-lit-limits (cdr end-lit-limits) end))
+       (setq end-limit (c-determine-+ve-limit 512))
+       (while (and (c-syntactic-re-search-forward "[;{}>]" end-limit 'end)
+                   (eq (char-before) ?>))
+         (c-end-of-current-token)
+         (when (eq (char-before) ?>)
+           (c-clear->-pair-props-if-match-before end (1- (point)))
+           (setq new-end (point))))
+       (c-backward-syntactic-ws)
+
+       ;; Extend the fontification region, if needed.
+       (and new-beg
+            (< new-beg c-new-BEG)
+            (setq c-new-BEG new-beg))
+       (and new-end
+            (> new-end c-new-END)
+            (setq c-new-END new-end))))))
 
 (defun c-after-change-check-<>-operators (beg end)
   ;; This is called from `after-change-functions' when
@@ -6486,9 +6697,6 @@ comment at the start of cc-engine.el for more info."
            (c-clear-<>-pair-props)
            (forward-char)))))))
 
-(defvar c-restricted-<>-arglists)      ;FIXME: Move definition here?
-(defvar c-parse-and-markup-<>-arglists)        ;FIXME: Move definition here?
-
 (defun c-restore-<>-properties (_beg _end _old-len)
   ;; This function is called as an after-change function.  It restores the
   ;; category/syntax-table properties on template/generic <..> pairs between
@@ -6925,7 +7133,7 @@ comment at the start of cc-engine.el for more info."
   ;; This functions is called as an after-change function by virtue of its
   ;; membership of the C++ value of `c-before-font-lock-functions'.
   ;; (when (< beg end)
-    (c-save-buffer-state (found eoll state id found-beg found-end)
+    (c-save-buffer-state (found eoll state id found-beg)
       ;; Has an inserted " swallowed up a R"(, turning it into "...R"(?
       (goto-char end)
       (setq eoll (c-point 'eoll))
@@ -7037,77 +7245,33 @@ comment at the start of cc-engine.el for more info."
          (c-depropertize-raw-strings-in-region found-beg (point))))))
 
 (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).
+  ;; When this function is called, point is immediately after a " which opens
+  ;; a string.  If this " is the characteristic " of of a raw string
+  ;; opener, apply the pertinent `syntax-table' text properties to the
+  ;; entire raw string (when properly terminated) or just the delimiter
+  ;; (otherwise).  In either of these cases, return t, otherwise return nil.
   ;;
-  ;; 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\\}\\)("))
+    (when
+       (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
+      (when
+         (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
-            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)))))
+       (goto-char (or macro-end (point-max))))
+      t)))
 
 
 ;; Handling of small scale constructs like types and names.
@@ -7261,6 +7425,21 @@ comment at the start of cc-engine.el for more info."
       (c-forward-syntactic-ws))
   t)
 
+(defun c-forward-noise-clause-not-macro-decl (maybe-parens)
+  ;; Point is at a noise macro identifier, which, when MAYBE-PARENS is
+  ;; non-nil, optionally takes paren arguments.  Go forward over this name,
+  ;; and when there may be optional parens, any parenthesis expression which
+  ;; follows it, but DO NOT go over any macro declaration which may come
+  ;; between them.  Always return t.
+  (c-end-of-token)
+  (when maybe-parens
+    (let ((here (point)))
+      (c-forward-comments)
+      (if (not (and (eq (char-after) ?\()
+                   (c-go-list-forward)))
+         (goto-char here))))
+  t)
+
 (defun c-forward-keyword-clause (match)
   ;; Submatch MATCH in the current match data is assumed to surround a
   ;; token.  If it's a keyword, move over it and any immediately
@@ -7468,7 +7647,9 @@ comment at the start of cc-engine.el for more info."
                (progn
                  (c-forward-syntactic-ws)
                  (when (or (and c-record-type-identifiers all-types)
-                           (not (equal c-inside-<>-type-key "\\(a\\`\\)")))
+                           (not (equal c-inside-<>-type-key
+                                       (concat
+                                        "\\(" regexp-unmatchable "\\)"))))
                    (c-forward-syntactic-ws)
                    (cond
                     ((eq (char-after) ??)
@@ -8873,7 +9054,10 @@ This function might do hidden buffer changes."
           ((and c-opt-cpp-prefix
                 (looking-at c-noise-macro-with-parens-name-re))
            (setq noise-start (point))
-           (c-forward-noise-clause)
+           (while
+               (and
+                 (c-forward-noise-clause)
+                 (looking-at c-noise-macro-with-parens-name-re)))
            (setq kwd-clause-end (point))))
 
          (when (setq found-type (c-forward-type t)) ; brace-block-too
@@ -9075,7 +9259,7 @@ This function might do hidden buffer changes."
       ;; Skip over type decl prefix operators.  (Note similar code in
       ;; `c-forward-declarator'.)
       (if (and c-recognize-typeless-decls
-              (equal c-type-decl-prefix-key "a\\`")) ; Regexp which doesn't 
match
+              (equal c-type-decl-prefix-key regexp-unmatchable))
          (when (eq (char-after) ?\()
            (progn
              (setq paren-depth (1+ paren-depth))
@@ -10708,7 +10892,7 @@ comment at the start of cc-engine.el for more info."
              ;; legal because it's part of a "compound keyword" like
              ;; "enum class".  Of course, if c-after-brace-list-key
              ;; is nil, we can skip the test.
-             (or (equal c-after-brace-list-key "a\\`") ; Regexp which doesn't 
match
+             (or (equal c-after-brace-list-key regexp-unmatchable)
                  (save-match-data
                    (save-excursion
                      (not
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 831fa30..b3a9dd4 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1042,7 +1042,7 @@ casts and declarations are fontified.  Used on level 2 
and higher."
     (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)
+     (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))
@@ -1549,7 +1549,8 @@ casts and declarations are fontified.  Used on level 2 
and higher."
   ;; font-lock-keyword-face.  It always returns NIL to inhibit this and
   ;; prevent a repeat invocation.  See elisp/lispref page "Search-based
   ;; Fontification".
-  (while (search-forward-regexp c-enum-clause-introduction-re limit t)
+  (while (and (< (point) limit)
+             (search-forward-regexp c-enum-clause-introduction-re limit t))
     (when (save-excursion
            (backward-char)
            (c-backward-over-enum-header))
@@ -2579,14 +2580,14 @@ need for `pike-font-lock-extra-types'.")
 
 ;;; Doc comments.
 
-(defvar c-doc-line-join-re "a\\`")
+(defvar c-doc-line-join-re regexp-unmatchable)
 ;; Matches a join of two lines in a doc comment.
 ;; This should not be changed directly, but instead set by
 ;; `c-setup-doc-comment-style'.  This variable is used in `c-find-decl-spots'
 ;; in (e.g.) autodoc style comments to bridge the gap between a "@\n" at an
 ;; EOL and the token following "//!" on the next line.
 
-(defvar c-doc-bright-comment-start-re "a\\`")
+(defvar c-doc-bright-comment-start-re regexp-unmatchable)
 ;; Matches the start of a "bright" comment, one whose contents may be
 ;; fontified by, e.g., `c-font-lock-declarations'.
 
@@ -2850,7 +2851,8 @@ need for `pike-font-lock-extra-types'.")
                         "\\)\\)\\s *\\)@[A-Za-z_-]+\\(\\s \\|$\\)"))
        (markup-faces (list c-doc-markup-face-name c-doc-face-name)))
 
-    (while (re-search-forward line-re limit t)
+    (while (and (< (point) limit)
+               (re-search-forward line-re limit t))
       (goto-char (match-end 1))
 
       (if (looking-at autodoc-decl-keywords)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 50f8b84..9d2f689 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -945,7 +945,7 @@ file name in angle brackets or quotes."
         (c-make-keywords-re 'appendable
           (c-lang-const c-cpp-include-directives))
         "[ \t]*")
-      "a\\`"))                         ; Doesn't match anything
+      regexp-unmatchable))
 (c-lang-defvar c-cpp-include-key (c-lang-const c-cpp-include-key))
 
 (c-lang-defconst c-opt-cpp-macro-define
@@ -979,6 +979,14 @@ definition, or nil if the language doesn't have any."
 (c-lang-defvar c-opt-cpp-macro-define-id
   (c-lang-const c-opt-cpp-macro-define-id))
 
+(c-lang-defconst c-anchored-hash-define-no-parens
+  ;; Regexp matching everything up to the end of a cpp define which has no
+  ;; argument parentheses.  Or nil in languages which don't have them.
+  t (if (c-lang-const c-opt-cpp-macro-define)
+       (concat (c-lang-const c-anchored-cpp-prefix)
+               (c-lang-const c-opt-cpp-macro-define)
+               "[ \t]+\\(\\sw\\|_\\)+\\([^(a-zA-Z0-9_]\\|$\\)")))
+
 (c-lang-defconst c-cpp-expr-directives
   "List of cpp directives (without the prefix) that are followed by an
 expression."
@@ -1323,7 +1331,7 @@ operators."
           (c--set-difference (c-lang-const c-assignment-operators)
                              '("=")
                              :test 'string-equal)))
-      "a\\`"))                         ; Doesn't match anything.
+      regexp-unmatchable))
 (c-lang-defvar c-assignment-op-regexp
   (c-lang-const c-assignment-op-regexp))
 
@@ -1546,7 +1554,7 @@ properly."
   ;; language)
   t (if (c-lang-const c-block-comment-ender)
        (regexp-quote (c-lang-const c-block-comment-ender))
-      "a\\`"))                         ; Doesn't match anything.
+      regexp-unmatchable))
 (c-lang-defvar c-block-comment-ender-regexp
               (c-lang-const c-block-comment-ender-regexp))
 
@@ -1557,7 +1565,7 @@ properly."
   ;; `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.
+      regexp-unmatchable))
 (c-lang-setvar font-lock-comment-end-skip
               (c-lang-const c-font-lock-comment-end-skip))
 
@@ -1576,7 +1584,7 @@ properly."
   ;; language)
   t (if (c-lang-const c-block-comment-starter)
        (regexp-quote (c-lang-const c-block-comment-starter))
-      "a\\`"))                         ; Doesn't match anything.
+      regexp-unmatchable))
 (c-lang-defvar c-block-comment-start-regexp
   (c-lang-const c-block-comment-start-regexp))
 
@@ -1585,22 +1593,42 @@ properly."
   ;; language; it does in all 7 CC Mode languages).
   t (if (c-lang-const c-line-comment-starter)
        (regexp-quote (c-lang-const c-line-comment-starter))
-      "a\\`"))                         ; Doesn't match anything.
+      regexp-unmatchable))
 (c-lang-defvar c-line-comment-start-regexp
               (c-lang-const c-line-comment-start-regexp))
 
+(c-lang-defconst c-last-c-comment-end-on-line-re
+  "Regexp which matches the last block comment ender on the
+current line, if any, or nil in those languages without block
+comments.  When a match is found, submatch 1 contains the comment
+ender."
+  t "\\(\\*/\\)\\([^*]\\|\\*[^/]\\)*$"
+  awk nil)
+(c-lang-defvar c-last-c-comment-end-on-line-re
+              (c-lang-const c-last-c-comment-end-on-line-re))
+
+(c-lang-defconst c-last-open-c-comment-start-on-line-re
+  "Regexp which matches the last block comment start on the
+current ine, if any, or nil in those languages without block
+comments.  When a match is found, submatch 1 contains the comment
+starter."
+  t "\\(/\\*\\)\\([^*]\\|\\*[^/]\\)*$"
+  awk nil)
+(c-lang-defvar c-last-open-c-comment-start-on-line-re
+              (c-lang-const c-last-open-c-comment-start-on-line-re))
+
 (c-lang-defconst c-literal-start-regexp
   ;; Regexp to match the start of comments and string literals.
   t (concat (c-lang-const c-comment-start-regexp)
            "\\|"
            (if (memq 'gen-string-delim c-emacs-features)
-               "\"|"
+               "\"\\|\\s|"
              "\"")))
 (c-lang-defvar c-literal-start-regexp (c-lang-const c-literal-start-regexp))
 
 (c-lang-defconst c-doc-comment-start-regexp
   "Regexp to match the start of documentation comments."
-  t    "a\\`"  ; Doesn't match anything.
+  t    regexp-unmatchable
   ;; From font-lock.el: `doxygen' uses /*! while others use /**.
   (c c++ objc) "/\\*[*!]"
   java "/\\*\\*"
@@ -3084,7 +3112,7 @@ Note that Java specific rules are currently applied to 
tell this from
   "Regexp matching a keyword that is followed by a colon, where
   the whole construct can precede a declaration.
   E.g. \"public:\" in C++."
-  t "a\\`"                             ; Doesn't match anything.
+  t regexp-unmatchable
   c++ (c-make-keywords-re t (c-lang-const c-protection-kwds)))
 (c-lang-defvar c-decl-start-colon-kwd-re
   (c-lang-const c-decl-start-colon-kwd-re))
@@ -3163,24 +3191,40 @@ constructs."
   ;; token that might precede such a construct, e.g. ';', '}' or '{'.
   ;; It's built from `c-decl-prefix-re'.
   ;;
-  ;; If the first submatch did not match, the match of the whole
-  ;; regexp is taken to be at the first token in the declaration.
-  ;; `c-decl-start-re' is not checked in this case.
+  ;; If the first submatch did not match, we have either a #define construct
+  ;; without parentheses or the match of the whole regexp is taken to be at
+  ;; the first token in the declaration.  `c-decl-start-re' is not checked in
+  ;; these cases.
   ;;
   ;; Design note: The reason the same regexp is used to match both
   ;; tokens that precede declarations and start them is to avoid an
   ;; extra regexp search from the previous declaration spot in
   ;; `c-find-decl-spots'.  Users of `c-find-decl-spots' also count on
-  ;; that it finds all declaration/cast/label starts in approximately
+  ;; it finding all declaration/cast/label starts in approximately
   ;; linear order, so we can't do the searches in two separate passes.
-  t (if (c-lang-const c-decl-start-kwds)
-       (concat (c-lang-const c-decl-prefix-re)
-               "\\|"
-               (c-make-keywords-re t (c-lang-const c-decl-start-kwds)))
-      (c-lang-const c-decl-prefix-re)))
+  t (cond
+     ((and (c-lang-const c-decl-start-kwds)
+          (c-lang-const c-anchored-hash-define-no-parens))
+      (concat (c-lang-const c-decl-prefix-re)
+             "\\|" (c-lang-const c-anchored-hash-define-no-parens)
+             "\\|" (c-make-keywords-re t (c-lang-const c-decl-start-kwds))))
+     ((c-lang-const c-decl-start-kwds)
+      (concat (c-lang-const c-decl-prefix-re)
+             "\\|" (c-make-keywords-re t (c-lang-const c-decl-start-kwds))))
+     ((c-lang-const c-anchored-hash-define-no-parens)
+      (concat (c-lang-const c-decl-prefix-re)
+             "\\|" (c-lang-const c-anchored-hash-define-no-parens)))
+     (t (c-lang-const c-decl-prefix-re))))
 (c-lang-defvar c-decl-prefix-or-start-re
   (c-lang-const c-decl-prefix-or-start-re))
 
+(c-lang-defconst c-dposr-cpp-macro-depth
+  ;; The match number of `c-anchored-hash-define-no-parens''s first match
+  ;; within `c-decl-prefix-or-start-re', or nil if there is no such component.
+  t (if (c-lang-const c-anchored-hash-define-no-parens)
+       (1+ (regexp-opt-depth (c-lang-const c-decl-prefix-re)))))
+(c-lang-defvar c-dposr-cpp-macro-depth (c-lang-const c-dposr-cpp-macro-depth))
+
 (c-lang-defconst c-cast-parens
   ;; List containing the paren characters that can open a cast, or nil in
   ;; languages without casts.
@@ -3265,7 +3309,7 @@ Identifier syntax is in effect when this is matched \(see
   t (if (c-lang-const c-type-modifier-kwds)
        (concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>")
       ;; Default to a regexp that never matches.
-      "a\\`")
+      regexp-unmatchable)
   ;; Check that there's no "=" afterwards to avoid matching tokens
   ;; like "*=".
   (c objc) (concat "\\("
@@ -3303,7 +3347,7 @@ that might precede the identifier in a declaration, e.g. 
the
 as the end of the operator.  Identifier syntax is in effect when
 this is matched \(see `c-identifier-syntax-table')."
   t ;; Default to a regexp that never matches.
-    "a\\`"
+    regexp-unmatchable
   ;; Check that there's no "=" afterwards to avoid matching tokens
   ;; like "*=".
   (c objc) (concat "\\(\\*\\)"
@@ -3462,7 +3506,7 @@ list."
 (c-lang-defconst c-pre-id-bracelist-key
   "A regexp matching tokens which, preceding an identifier, signify a 
bracelist.
 "
-  t "a\\`"                             ; Doesn't match anything.
+  t regexp-unmatchable
   c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)")
 (c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key))
 
@@ -3518,7 +3562,7 @@ the invalidity of the putative template construct."
         ;; before the '{' of the enum list, to avoid searching too far.
         "[^][{};/#=]*"
         "{")
-      "a\\`"))                         ; Doesn't match anything.
+      regexp-unmatchable))
 (c-lang-defvar c-enum-clause-introduction-re
               (c-lang-const c-enum-clause-introduction-re))
 
@@ -3630,11 +3674,36 @@ i.e. before \":\".  Only used if 
`c-recognize-colon-labels' is set."
   c++ (concat "\\s(\\|\"\\|" (c-lang-const c-nonlabel-token-key)))
 (c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key))
 
+(c-lang-defconst c-nonlabel-nonparen-token-key
+  "Regexp matching things that can't occur in generic colon labels,
+neither in a statement nor in a declaration context, with the
+exception of an open parenthesis.  The regexp is tested at the
+beginning of every sexp in a suspected label, i.e. before \":\".
+Only used if `c-recognize-colon-labels' is set."
+  ;; This lang const is the same as `c-nonlabel-token-key', except for a
+  ;; slight difference in the c++-mode value.
+  t (concat
+     ;; All keywords except `c-label-kwds' and `c-protection-kwds'.
+     (c-make-keywords-re t
+       (c--set-difference (c-lang-const c-keywords)
+                         (append (c-lang-const c-label-kwds)
+                                 (c-lang-const c-protection-kwds))
+                         :test 'string-equal)))
+  ;; Don't allow string literals, except in AWK and Java.  Character constants 
are OK.
+  (c objc pike idl) (concat "\"\\|"
+                           (c-lang-const c-nonlabel-nonparen-token-key))
+  ;; Also check for open parens in C++, to catch member init lists in
+  ;; constructors.  We normally allow it so that macros with arguments
+  ;; work in labels.
+  c++ (concat "[{[]\\|\"\\|" (c-lang-const c-nonlabel-nonparen-token-key)))
+(c-lang-defvar c-nonlabel-nonparen-token-key
+  (c-lang-const c-nonlabel-nonparen-token-key))
+
 (c-lang-defconst c-nonlabel-token-2-key
   "Regexp matching things that can't occur two symbols before a colon in
 a label construct.  This catches C++'s inheritance construct \"class foo
 : bar\".  Only used if `c-recognize-colon-labels' is set."
-  t "a\\`"                             ; Doesn't match anything.
+  t regexp-unmatchable
   c++ (c-make-keywords-re t '("class")))
 (c-lang-defvar c-nonlabel-token-2-key (c-lang-const c-nonlabel-token-2-key))
 
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index ea865e0..e4ff9f0 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1825,28 +1825,30 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;; by `c-doc-line-join-re'), return the position of the first line of the
   ;; sequence.  Otherwise, return nil.  Point has no significance at entry to
   ;; and exit from this function.
-  (goto-char pos)
-  (back-to-indentation)
-  (and (or (looking-at c-comment-start-regexp)
-          (memq (c-literal-type (c-literal-limits)) '(c c++)))
-       (progn
-        (end-of-line)
-        (let ((here (point)))
-          (while (re-search-backward c-doc-line-join-re (c-point 'bopl) t))
-          (and (not (eq (point) here))
-               (c-point 'bol))))))
+  (when (not (equal c-doc-line-join-re regexp-unmatchable))
+    (goto-char pos)
+    (back-to-indentation)
+    (and (or (looking-at c-comment-start-regexp)
+            (memq (c-literal-type (c-literal-limits)) '(c c++)))
+        (progn
+          (end-of-line)
+          (let ((here (point)))
+            (while (re-search-backward c-doc-line-join-re (c-point 'bopl) t))
+            (and (not (eq (point) here))
+                 (c-point 'bol)))))))
 
 (defun c-doc-fl-decl-end (pos)
   ;; If the line containing POS is continued by a doc comment continuation
   ;; marker (as defined by `c-doc-line-join-re), return the position of
   ;; the BOL at the end of the sequence.  Otherwise, return nil.  Point has no
   ;; significance at entry to and exit from this function.
-  (goto-char pos)
-  (back-to-indentation)
-  (let ((here (point)))
-    (while (re-search-forward c-doc-line-join-re (c-point 'eonl) t))
-    (and (not (eq (point) here))
-        (c-point 'bonl))))
+  (when (not (equal c-doc-line-join-re regexp-unmatchable))
+    (goto-char pos)
+    (back-to-indentation)
+    (let ((here (point)))
+      (while (re-search-forward c-doc-line-join-re (c-point 'eonl) t))
+      (and (not (eq (point) here))
+          (c-point 'bonl)))))
 
 (defun c-fl-decl-start (pos)
   ;; If the beginning of the line containing POS is in the middle of a "local"
@@ -1874,13 +1876,10 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
       ;; In C++ Mode, first check if we are within a (possibly nested) lambda
       ;; form capture list.
       (when (c-major-mode-is 'c++-mode)
-       (let ((paren-state (c-parse-state))
-             opener)
-         (save-excursion
-           (while (setq opener (c-pull-open-brace paren-state))
-             (goto-char opener)
-             (if (c-looking-at-c++-lambda-capture-list)
-                 (setq capture-opener (point)))))))
+       (save-excursion
+         (while (and (c-go-up-list-backward nil bod-lim)
+                     (c-looking-at-c++-lambda-capture-list))
+           (setq capture-opener (point)))))
 
       (while
          ;; Go to a less nested declaration each time round this loop.
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 6e8acd4..b818bce 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1648,9 +1648,9 @@ white space either before or after the operator, but not 
both."
   :group 'c)
 
 ;; Initialize the next two to a regexp which never matches.
-(defvar c-noise-macro-with-parens-name-re "a\\`")
+(defvar c-noise-macro-with-parens-name-re regexp-unmatchable)
 (make-variable-buffer-local 'c-noise-macro-with-parens-name-re)
-(defvar c-noise-macro-name-re "a\\`")
+(defvar c-noise-macro-name-re regexp-unmatchable)
 (make-variable-buffer-local 'c-noise-macro-name-re)
 
 (defcustom c-noise-macro-names nil
@@ -1682,7 +1682,7 @@ These are recognized by CC Mode only in declarations."
   ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into
   ;; `c-noise-macro-name-re' and `c-noise-macro-with-parens-name-re'.
   (setq c-noise-macro-with-parens-name-re
-       (cond ((null c-noise-macro-with-parens-names) "a\\`") ; Never matches.
+       (cond ((null c-noise-macro-with-parens-names) regexp-unmatchable)
              ((consp c-noise-macro-with-parens-names)
               (concat (regexp-opt c-noise-macro-with-parens-names t)
                       "\\([^[:alnum:]_$]\\|$\\)"))
@@ -1691,7 +1691,7 @@ These are recognized by CC Mode only in declarations."
              (t (error "c-make-noise-macro-regexps: \
 c-noise-macro-with-parens-names is invalid: %s" 
c-noise-macro-with-parens-names))))
   (setq c-noise-macro-name-re
-       (cond ((null c-noise-macro-names) "a\\`") ; Never matches anything.
+       (cond ((null c-noise-macro-names) regexp-unmatchable)
              ((consp c-noise-macro-names)
               (concat (regexp-opt c-noise-macro-names t)
                       "\\([^[:alnum:]_$]\\|$\\)"))
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 1a0d9bd..3930f09 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -5,7 +5,6 @@
 
 ;; Authors: Roland McGrath <address@hidden>,
 ;;         Daniel Pfeiffer <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: tools, processes
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index ba007d6..fd3eec7 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -5,7 +5,6 @@
 ;; Author: Ilya Zakharevich
 ;;     Bob Olson
 ;;     Jonathan Rockway <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: languages, Perl
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index d5803c7..757f0f2 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Odd Gripenstam <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: DCL editing major-mode languages
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 3faec49..0f44487 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: C++ tags tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cb1b17b..d62c131 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985-1986, 1999-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: lisp, languages
 ;; Package: emacs
 
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 910c320..54ca135 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -4,7 +4,6 @@
 ;; Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index d6cd370..4bb657e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -4,7 +4,7 @@
 
 ;; Author:  Pavel Kobyakov <address@hidden>
 ;; Maintainer: João Távora <address@hidden>
-;; Version: 1.0.5
+;; Version: 1.0.6
 ;; Package-Requires: ((emacs "26.1"))
 ;; Keywords: c languages tools
 
@@ -38,10 +38,9 @@
 ;; The main interactive entry point is the `flymake-mode' minor mode,
 ;; which periodically and automatically initiates checks as the user
 ;; is editing the buffer.  The variables `flymake-no-changes-timeout',
-;; `flymake-start-syntax-check-on-newline' and
 ;; `flymake-start-on-flymake-mode' give finer control over the events
-;; triggering a check, as does the interactive command
-;; `flymake-start', which immediately starts a check.
+;; triggering a check, as does the interactive command  `flymake-start',
+;; which immediately starts a check.
 ;;
 ;; Shortly after each check, a summary of collected diagnostics should
 ;; appear in the mode-line.  If it doesn't, there might not be a
@@ -178,14 +177,15 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
                 (const right-fringe)
                 (const :tag "No fringe indicators" nil)))
 
-(defcustom flymake-start-syntax-check-on-newline t
-  "Start syntax check if newline char was added/removed from the buffer."
-  :type 'boolean)
+(make-obsolete-variable 'flymake-start-syntax-check-on-newline
+                       "can check on newline in post-self-insert-hook"
+                        "27.1")
 
 (defcustom flymake-no-changes-timeout 0.5
   "Time to wait after last change before automatically checking buffer.
 If nil, never start checking buffer automatically like this."
-  :type 'number)
+  :type '(choice (number :tag "Timeout in seconds")
+                 (const :tag "No check on timeout" nil)))
 
 (defcustom flymake-gui-warnings-enabled t
   "Enables/disables GUI warnings."
@@ -203,7 +203,7 @@ Specifically, start it when the buffer is actually 
displayed."
   :type 'boolean)
 
 (defcustom flymake-start-on-save-buffer t
-  "If non-nil start syntax check when a buffer is saved.
+  "If non-nil, start syntax check when a buffer is saved.
 Specifically, start it when the saved buffer is actually displayed."
   :version "27.1"
   :type 'boolean)
@@ -856,6 +856,7 @@ with a report function."
 
 (defvar-local flymake--recent-changes nil
   "Recent changes collected by `flymake-after-change-function'.")
+(defvar flymake-mode)
 
 (defun flymake-start (&optional deferred force)
   "Start a syntax check for the current buffer.
@@ -900,7 +901,7 @@ Interactively, with a prefix arg, FORCE is t."
              (add-hook 'window-configuration-change-hook
                        #'start-on-display
                        'append 'local))
-            (t
+            (flymake-mode
              (setq flymake-check-start-time (float-time))
              (let ((backend-args
                     (and
@@ -940,12 +941,10 @@ Flymake collects diagnostic information from multiple 
sources,
 called backends, and visually annotates the buffer with the
 results.
 
-Flymake performs these checks while the user is editing.  The
-customization variables `flymake-start-on-flymake-mode',
-`flymake-no-changes-timeout' and
-`flymake-start-syntax-check-on-newline' determine the exact
-circumstances whereupon Flymake decides to initiate a check of
-the buffer.
+Flymake performs these checks while the user is editing.
+The customization variables `flymake-start-on-flymake-mode',
+`flymake-no-changes-timeout' determine the exact circumstances
+whereupon Flymake decides to initiate a check of the buffer.
 
 The commands `flymake-goto-next-error' and
 `flymake-goto-prev-error' can be used to navigate among Flymake
@@ -1039,9 +1038,6 @@ Do it only if `flymake-no-changes-timeout' is non-nil."
 START and STOP and LEN are as in `after-change-functions'."
   (let((new-text (buffer-substring start stop)))
     (push (list start stop new-text) flymake--recent-changes)
-    (when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
-      (flymake-log :debug "starting syntax check as new-line has been seen")
-      (flymake-start t))
     (flymake--schedule-timer-maybe)))
 
 (defun flymake-after-save-hook ()
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 716f40c..e09aaa3 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Nick Roberts <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: unix, tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 85f9078..d094c95 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: tools, processes
 
 ;; This file is part of GNU Emacs.
@@ -837,7 +836,8 @@ This function is called from `compilation-filter-hook'."
        grep-mode-line-matches)
   ;; compilation-directory-matcher can't be nil, so we set it to a regexp that
   ;; can never match.
-  (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`"))
+  (set (make-local-variable 'compilation-directory-matcher)
+       (list regexp-unmatchable))
   (set (make-local-variable 'compilation-process-setup-function)
        'grep-process-setup)
   (set (make-local-variable 'compilation-disable-input) t)
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 4306f5d..f5680f2 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: unix, tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index dcce2a6..1d62bb5 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -1,4 +1,4 @@
-;;; hideshow.el --- minor mode cmds to selectively display code/comment blocks
+;;; hideshow.el --- minor mode cmds to selectively display code/comment blocks 
 -*- lexical-binding:t -*-
 
 ;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
@@ -37,7 +37,7 @@
 ;;   hs-show-all                        C-c @ C-M-s
 ;;   hs-hide-level                      C-c @ C-l
 ;;   hs-toggle-hiding                   C-c @ C-c
-;;   hs-mouse-toggle-hiding             [(shift mouse-2)]
+;;   hs-toggle-hiding                   [(shift mouse-2)]
 ;;   hs-hide-initial-comment-block
 ;;
 ;; Blocks are defined per mode.  In c-mode, c++-mode and java-mode, they
@@ -55,8 +55,7 @@
 ;; Then, add the following to your init file:
 ;;
 ;; (load-library "hideshow")
-;; (add-hook 'X-mode-hook               ; other modes similarly
-;;           (lambda () (hs-minor-mode 1)))
+;; (add-hook 'X-mode-hook #'hs-minor-mode)           ; other modes similarly
 ;;
 ;; where X = {emacs-lisp,c,c++,perl,...}.  You can also manually toggle
 ;; hideshow minor mode by typing `M-x hs-minor-mode'.  After hideshow is
@@ -181,8 +180,8 @@
 ;; (5) Hideshow interacts badly with Ediff and `vc-diff'.  At the moment, the
 ;;     suggested workaround is to turn off hideshow entirely, for example:
 ;;
-;;     (add-hook 'ediff-prepare-buffer-hook 'turn-off-hideshow)
-;;     (add-hook 'vc-before-checkin-hook 'turn-off-hideshow)
+;;     (add-hook 'ediff-prepare-buffer-hook #'turn-off-hideshow)
+;;     (add-hook 'vc-before-checkin-hook #'turn-off-hideshow)
 ;;
 ;;     In the case of `vc-diff', here is a less invasive workaround:
 ;;
@@ -317,7 +316,7 @@ a block), `hs-hide-all', `hs-hide-block' and 
`hs-hide-level'.")
 These commands include the toggling commands (when the result is to show
 a block), `hs-show-all' and `hs-show-block'.")
 
-(defvar hs-set-up-overlay nil
+(defvar hs-set-up-overlay #'ignore
   "Function called with one arg, OV, a newly initialized overlay.
 Hideshow puts a unique overlay on each range of text to be hidden
 in the buffer.  Here is a simple example of how to use this variable:
@@ -329,7 +328,7 @@ in the buffer.  Here is a simple example of how to use this 
variable:
                            (count-lines (overlay-start ov)
                                         (overlay-end ov))))))
 
-  (setq hs-set-up-overlay \\='display-code-line-counts)
+  (setq hs-set-up-overlay #\\='display-code-line-counts)
 
 This example shows how to get information from the overlay as well
 as how to set its `display' property.  See `hs-make-overlay' and
@@ -355,7 +354,7 @@ Use the command `hs-minor-mode' to toggle or set this 
variable.")
     (define-key map "address@hidden"       'hs-hide-all)
     (define-key map "address@hidden"       'hs-hide-block)
     (define-key map "address@hidden"       'hs-toggle-hiding)
-    (define-key map [(shift mouse-2)] 'hs-mouse-toggle-hiding)
+    (define-key map [(shift mouse-2)] 'hs-toggle-hiding)
     map)
   "Keymap for hideshow minor mode.")
 
@@ -410,7 +409,7 @@ element (using `match-beginning') before calling 
`hs-forward-sexp-func'.")
 (defvar-local hs-block-end-regexp nil
   "Regexp for end of block.")
 
-(defvar-local hs-forward-sexp-func 'forward-sexp
+(defvar-local hs-forward-sexp-func #'forward-sexp
   "Function used to do a `forward-sexp'.
 Should change for Algol-ish modes.  For single-character block
 delimiters -- ie, the syntax table regexp for the character is
@@ -418,7 +417,7 @@ either `(' or `)' -- `hs-forward-sexp-func' would just be
 `forward-sexp'.  For other modes such as simula, a more specialized
 function is necessary.")
 
-(defvar-local hs-adjust-block-beginning nil
+(defvar-local hs-adjust-block-beginning #'identity
   "Function used to tweak the block beginning.
 The block is hidden from the position returned by this function,
 as opposed to hiding it from the position returned when searching
@@ -575,10 +574,8 @@ and then further adjusted to be at the end of the line."
        ;; `p' is the point at the end of the block beginning, which
        ;; may need to be adjusted
        (save-excursion
-         (if hs-adjust-block-beginning
-             (goto-char (funcall hs-adjust-block-beginning
-                                 header-end))
-           (goto-char header-end))
+         (goto-char (funcall (or hs-adjust-block-beginning #'identity)
+                             header-end))
          (setq p (line-end-position)))
        ;; `q' is the point at the end of the block
        (hs-forward-sexp mdata 1)
@@ -657,9 +654,8 @@ If `hs-special-modes-alist' has information associated with 
the
 current buffer's major mode, use that.
 Otherwise, guess start, end and `comment-start' regexps; `forward-sexp'
 function; and adjust-block-beginning function."
-  (if (and (boundp 'comment-start)
-           (boundp 'comment-end)
-           comment-start comment-end)
+  (if (and (bound-and-true-p comment-start)
+           (bound-and-true-p comment-end))
       (let* ((lookup (assoc major-mode hs-special-modes-alist))
              (start-elem (or (nth 1 lookup) "\\s(")))
         (if (listp start-elem)
@@ -677,8 +673,8 @@ function; and adjust-block-beginning function."
                                           (substring c-start-regexp
                                                      0 (1- (match-end 0)))
                                         c-start-regexp)))
-              hs-forward-sexp-func (or (nth 4 lookup) 'forward-sexp)
-              hs-adjust-block-beginning (nth 5 lookup)))
+              hs-forward-sexp-func (or (nth 4 lookup) #'forward-sexp)
+              hs-adjust-block-beginning (or (nth 5 lookup) #'identity)))
     (setq hs-minor-mode nil)
     (error "%s Mode doesn't support Hideshow Minor Mode"
            (format-mode-line mode-name))))
@@ -729,13 +725,12 @@ Return point, or nil if original point was not in a 
block."
   "Evaluate BODY forms if variable `hs-minor-mode' is non-nil.
 In the dynamic context of this macro, `inhibit-point-motion-hooks'
 and `case-fold-search' are both t."
+  (declare (debug t))
   `(when hs-minor-mode
      (let ((inhibit-point-motion-hooks t)
            (case-fold-search t))
        ,@body)))
 
-(put 'hs-life-goes-on 'edebug-form-spec '(&rest form))
-
 (defun hs-overlay-at (position)
   "Return hideshow overlay at POSITION, or nil if none to be found."
   (let ((overlays (overlays-at position))
@@ -895,24 +890,18 @@ The hook `hs-hide-hook' is run; see `run-hooks'."
      (message "Hiding blocks ... done"))
    (run-hooks 'hs-hide-hook)))
 
-(defun hs-toggle-hiding ()
+(defun hs-toggle-hiding (&optional e)
   "Toggle hiding/showing of a block.
-See `hs-hide-block' and `hs-show-block'."
+See `hs-hide-block' and `hs-show-block'.
+Argument E should be the event that triggered this action."
   (interactive)
   (hs-life-goes-on
+   (posn-set-point (event-end e))
    (if (hs-already-hidden-p)
        (hs-show-block)
      (hs-hide-block))))
 
-(defun hs-mouse-toggle-hiding (e)
-  "Toggle hiding/showing of a block.
-This command should be bound to a mouse key.
-Argument E is a mouse event used by `mouse-set-point'.
-See `hs-hide-block' and `hs-show-block'."
-  (interactive "@e")
-  (hs-life-goes-on
-   (mouse-set-point e)
-   (hs-toggle-hiding)))
+(define-obsolete-function-alias 'hs-mouse-toggle-hiding #'hs-toggle-hiding 
"27.1")
 
 (defun hs-hide-initial-comment-block ()
   "Hide the first block of comments in a file.
@@ -939,7 +928,7 @@ The value (hs . t) is added to `buffer-invisibility-spec'.
 
 The main commands are: `hs-hide-all', `hs-show-all', `hs-hide-block',
 `hs-show-block', `hs-hide-level' and `hs-toggle-hiding'.  There is also
-`hs-hide-initial-comment-block' and `hs-mouse-toggle-hiding'.
+`hs-hide-initial-comment-block'.
 
 Turning hideshow minor mode off reverts the menu bar and the
 variables to default values and disables the hideshow commands.
@@ -957,7 +946,7 @@ Key bindings:
         (hs-grok-mode-type)
         ;; Turn off this mode if we change major modes.
         (add-hook 'change-major-mode-hook
-                  'turn-off-hideshow
+                  #'turn-off-hideshow
                   nil t)
         (easy-menu-add hs-minor-mode-menu)
         (set (make-local-variable 'line-move-ignore-invisible) t)
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index cffb749..c3ff235 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -4,7 +4,6 @@
 
 ;; Author: Thomas Neumann <address@hidden>
 ;;     Eric S. Raymond <address@hidden>
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR
 ;; Keywords: unix, tools
 
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el
index a759709..1dd5d51 100644
--- a/lisp/progmodes/mixal-mode.el
+++ b/lisp/progmodes/mixal-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Pieter E.J. Pareit <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 09 Nov 2002
 ;; Version: 0.1
 ;; Keywords: languages, Knuth, mix, mixal, asm, mixvm, The Art Of Computer 
Programming
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index aa41230..087d1f6 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -2,7 +2,6 @@
 
 ;; Author: Michael Schmidt <address@hidden>
 ;;     Tom Perrine <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: languages
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 52e5fd4..4d4e2e1 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -4,7 +4,6 @@
 
 ;; Author: Kurt Hornik <address@hidden>
 ;;        John Eaton <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: languages
 
 ;; This file is part of GNU Emacs.
@@ -1691,7 +1690,7 @@ code line."
   (eval-and-compile (require 'help-mode))
   ;; Don't highlight `EXAMPLE' as elisp symbols by using a regexp that
   ;; can never match.
-  (setq-local help-xref-symbol-regexp "x\\`"))
+  (setq-local help-xref-symbol-regexp regexp-unmatchable))
 
 (defun octave-help (fn)
   "Display the documentation of FN."
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 7cbd30a..f01d6b6 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1990, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: William F. Mann
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR
 ;; Keywords: languages
 
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 2b05735..bd56d1a 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 11a2ef4..ec7df78 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -157,19 +157,13 @@ end it with `/'.  DIR must be one of `project-roots' or
     vc-directory-exclusion-list)
    grep-find-ignored-files))
 
-(cl-defgeneric project-file-completion-table (project dirs)
-  "Return a completion table for 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.
-
-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))))
-       (t
-        (complete-with-action action all-files string pred))))))
+(defun project--file-completion-table (all-files)
+  (lambda (string pred action)
+    (cond
+     ((eq action 'metadata)
+      '(metadata . ((category . project-file))))
+     (t
+      (complete-with-action action all-files string pred)))))
 
 (cl-defmethod project-roots ((project (head transient)))
   (list (cdr project)))
@@ -355,7 +349,7 @@ requires quoting, e.g. `\\[quoted-insert]<space>'."
             (let ((dir (read-directory-name "Base directory: "
                                             nil default-directory t)))
               (project--files-in-directory dir
-                                           (project--dir-ignores pr dir)
+                                           nil
                                            (grep-read-files regexp))))))
     (project--find-regexp-in-files regexp files)))
 
@@ -470,55 +464,77 @@ recognized."
                 (project-external-roots pr))))
     (project-find-file-in (thing-at-point 'filename) dirs pr)))
 
+(defcustom project-read-file-name-function #'project--read-file-cpd-relative
+  "Function to call to read a file name from a list.
+For the arguments list, see `project--read-file-cpd-relative'."
+  :type '(choice (const :tag "Read with completion from relative names"
+                        project--read-file-cpd-relative)
+                 (const :tag "Read with completion from absolute names"
+                        project--read-file-absolute)
+                 (function :tag "Custom function" nil))
+  :version "27.1")
+
+(defun project--read-file-cpd-relative (prompt
+                                        all-files &optional predicate
+                                        hist default)
+  "Read a file name, prompting with PROMPT.
+ALL-FILES is a list of possible file name completions.
+PREDICATE, HIST, and DEFAULT have the same meaning as in
+`completing-read'."
+  (let* ((common-parent-directory
+          (let ((common-prefix (try-completion "" all-files)))
+            (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))))
+         (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files))
+         (new-collection (project--file-completion-table substrings))
+         (res (project--completing-read-strict prompt
+                                               new-collection
+                                               predicate
+                                               hist default)))
+    (concat common-parent-directory res)))
+
+(defun project--read-file-absolute (prompt
+                                    all-files &optional predicate
+                                    hist default)
+  (project--completing-read-strict prompt
+                                   (project--file-completion-table all-files)
+                                   predicate
+                                   hist default))
+
 (defun project-find-file-in (filename dirs project)
   "Complete FILENAME in DIRS in PROJECT and visit the result."
-  (let* ((table (project-file-completion-table project dirs))
-         (file (project--completing-read-strict
-                "Find file" table nil nil
-                filename)))
+  (let* ((all-files (project-files project dirs))
+         (file (funcall project-read-file-name-function
+                       "Find file" all-files nil nil
+                       filename)))
     (if (string= file "")
         (user-error "You didn't specify the file")
       (find-file file))))
 
 (defun project--completing-read-strict (prompt
                                         collection &optional predicate
-                                        hist default inherit-input-method)
+                                        hist default)
   ;; Tried both expanding the default before showing the prompt, and
   ;; removing it when it has no matches.  Neither seems natural
   ;; enough.  Removal is confusing; early expansion makes the prompt
   ;; too long.
-  (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
+  (let* ((new-prompt (if (and default (not (string-equal default "")))
                          (format "%s (default %s): " prompt default)
                        (format "%s: " prompt)))
          (res (completing-read new-prompt
-                               new-collection predicate t
+                               collection predicate t
                                nil ;; initial-input
-                               hist default inherit-input-method)))
+                               hist default)))
     (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)))
+                             collection predicate t res hist nil)))
+    res))
 
 (declare-function fileloop-continue "fileloop" ())
 
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index eb3e31c..74e865b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -6,7 +6,6 @@
 ;; URL: https://github.com/fgallina/python.el
 ;; Version: 0.26.1
 ;; Package-Requires: ((emacs "24.1") (cl-lib "1.0"))
-;; Maintainer: address@hidden
 ;; Created: Jul 2010
 ;; Keywords: languages
 
@@ -1070,12 +1069,18 @@ possibilities can be narrowed to specific indentation 
points."
         (`(,(or :after-line
                 :after-comment
                 :inside-string
-                :after-backslash
-                :inside-paren-at-closing-paren
-                :inside-paren-at-closing-nested-paren) . ,start)
+                :after-backslash) . ,start)
          ;; Copy previous indentation.
          (goto-char start)
          (current-indentation))
+        (`(,(or :inside-paren-at-closing-paren
+                :inside-paren-at-closing-nested-paren) . ,start)
+         (goto-char (+ 1 start))
+         (if (looking-at "[ \t]*\\(?:#\\|$\\)")
+             ;; Copy previous indentation.
+             (current-indentation)
+           ;; Align with opening paren.
+           (current-column)))
         (`(:inside-docstring . ,start)
          (let* ((line-indentation (current-indentation))
                 (base-indent (progn
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 853a350..8f52a36 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -5,7 +5,6 @@
 
 ;; Author: Daniel Pfeiffer <address@hidden>
 ;; Version: 2.0f
-;; Maintainer: address@hidden
 ;; Keywords: languages, unix
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index ffb3d41..31315e2 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1994, 1998-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Author: Tom Tromey <address@hidden>
 ;;    Chris Lindblad <address@hidden>
 ;; Keywords: languages tcl modes
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index e75e584..eeed4c0 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -121,7 +121,7 @@
 ;;
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "2019-04-02-5d62d3f-vpo-GNU"
+(defconst verilog-mode-version "2019-05-06-28bee25-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.")
@@ -2760,13 +2760,13 @@ find the errors."
 (defconst verilog-delay-re 
"#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)")
 (defconst verilog-declaration-re-2-no-macro
   (concat "\\s-*" verilog-declaration-re
-         "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)"
-         "\\)"))
+          "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)"
+          "\\)"))
 (defconst verilog-declaration-re-2-macro
   (concat "\\s-*" verilog-declaration-re
-         "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)"
-         "\\|\\(" verilog-macroexp-re "\\)"
-         "\\)"))
+          "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)"
+          "\\|\\(" verilog-macroexp-re "\\)"
+          "\\)"))
 (defconst verilog-declaration-re-1-macro
   (concat "^" verilog-declaration-re-2-macro))
 
@@ -8357,13 +8357,13 @@ Use optional HEADER and PREFIX."
   (when (looking-at ")")
     (verilog-backward-open-paren)
     (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_$]" nil nil))
-  (skip-chars-backward "a-zA-Z0-9'_$")
+  (skip-chars-backward "a-zA-Z0-9`_$")
   ;; #1 is legal syntax for gate primitives
   (when (save-excursion
-         (verilog-backward-syntactic-ws-quick)
-         (eq ?# (char-before)))
+          (verilog-backward-syntactic-ws-quick)
+          (eq ?# (char-before)))
     (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_$]" nil nil)
-    (skip-chars-backward "a-zA-Z0-9'_$"))
+    (skip-chars-backward "a-zA-Z0-9`_$"))
   (looking-at "[a-zA-Z0-9`_$]+")
   ;; Important: don't use match string, this must work with Emacs 19 font-lock 
on
   (buffer-substring-no-properties (match-beginning 0) (match-end 0))
@@ -11412,7 +11412,7 @@ If PAR-VALUES replace final strings with these 
parameter values."
     (when tpl-ass
       ;; Evaluate @"(lispcode)"
       (when (string-match "@\".*[^\\]\"" tpl-net)
-       (while (string-match "@\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"" tpl-net)
+        (while (string-match "@\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"" tpl-net)
          (setq tpl-net
                (concat
                 (substring tpl-net 0 (match-beginning 0))
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index e5e5972..bf999ae 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -731,7 +731,8 @@ references displayed in the current *xref* buffer."
   (interactive "e")
   (mouse-set-point event)
   (forward-line 0)
-  (xref--search-property 'xref-item)
+  (or (get-text-property (point) 'xref-item)
+      (xref--search-property 'xref-item))
   (xref-show-location-at-point))
 
 (defun xref--insert-xrefs (xref-alist)
@@ -828,20 +829,25 @@ Return an alist of the form ((FILENAME . (XREF ...)) 
...)."
 (defun xref--read-identifier (prompt)
   "Return the identifier at point or read it from the minibuffer."
   (let* ((backend (xref-find-backend))
-         (id (xref-backend-identifier-at-point backend)))
+         (def (xref-backend-identifier-at-point backend)))
     (cond ((or current-prefix-arg
-               (not id)
+               (not def)
                (xref--prompt-p this-command))
-           (completing-read (if id
-                                (format "%s (default %s): "
-                                        (substring prompt 0 (string-match
-                                                             "[ :]+\\'" 
prompt))
-                                        id)
-                              prompt)
-                            (xref-backend-identifier-completion-table backend)
-                            nil nil nil
-                            'xref--read-identifier-history id))
-          (t id))))
+           (let ((id
+                  (completing-read
+                   (if def
+                       (format "%s (default %s): "
+                               (substring prompt 0 (string-match
+                                                    "[ :]+\\'" prompt))
+                               def)
+                     prompt)
+                   (xref-backend-identifier-completion-table backend)
+                   nil nil nil
+                   'xref--read-identifier-history def)))
+             (if (equal id "")
+                 (or def (user-error "There is no defailt identifier"))
+               id)))
+          (t def))))
 
 
 ;;; Commands
@@ -1058,7 +1064,8 @@ IGNORES is a list of glob patterns."
 IGNORES is a list of glob patterns.  DIR is an absolute
 directory, used as the root of the ignore globs."
   (cl-assert (not (string-match-p "\\`~" dir)))
-  (when ignores
+  (if (not ignores)
+      ""
     (concat
      (shell-quote-argument "(")
      " -path "
diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el
index 62c42d3..7ae4712 100644
--- a/lisp/progmodes/xscheme.el
+++ b/lisp/progmodes/xscheme.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1986-1987, 1989-1990, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: languages, lisp
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el
index be80b4a..2e75e53 100644
--- a/lisp/ps-bdf.el
+++ b/lisp/ps-bdf.el
@@ -9,7 +9,7 @@
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
 
-;; Author: Kenichi Handa <address@hidden>
+;; Author: Kenichi Handa <address@hidden>
 ;; (according to ack.texi)
 ;; Keywords: wp, BDF, font, PostScript
 ;; Package: ps-print
diff --git a/lisp/ps-def.el b/lisp/ps-def.el
index 2063133..d248556 100644
--- a/lisp/ps-def.el
+++ b/lisp/ps-def.el
@@ -3,8 +3,8 @@
 ;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
-;;     Kenichi Handa <address@hidden> (multi-byte characters)
-;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
+;;     Kenichi Handa <address@hidden> (multi-byte characters)
+;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
 ;;     Vinicius Jose Latorre <address@hidden>
 ;; Keywords: wp, print, PostScript
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el
index c88d6d2..537ba96 100644
--- a/lisp/ps-mule.el
+++ b/lisp/ps-mule.el
@@ -3,8 +3,8 @@
 ;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
-;;     Kenichi Handa <address@hidden> (multi-byte characters)
-;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
+;;     Kenichi Handa <address@hidden> (multi-byte characters)
+;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
 ;;     Vinicius Jose Latorre <address@hidden>
 ;; Keywords: wp, print, PostScript, multibyte, mule
 ;; Package: ps-print
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 647597c..d0d9cbe 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -5,13 +5,15 @@
 ;; Author: Jim Thompson (was <address@hidden>)
 ;;     Jacques Duthen (was <address@hidden>)
 ;;     Vinicius Jose Latorre <address@hidden>
-;;     Kenichi Handa <address@hidden> (multi-byte characters)
-;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
+;;     Kenichi Handa <address@hidden> (multi-byte characters)
+;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
 ;;     Vinicius Jose Latorre <address@hidden>
 ;; Keywords: wp, print, PostScript
 ;; Version: 7.3.5
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
+(eval-when-compile (require 'cl-lib))
+
 (defconst ps-print-version "7.3.5"
   "ps-print.el, v 7.3.5 <2009/12/23 vinicius>
 
@@ -1403,7 +1405,7 @@ Please send all bug fixes and enhancements to
 ;; prologue code suggestion, for odd/even printing suggestion and for
 ;; `ps-prologue-file' enhancement.
 ;;
-;; Thanks to Ken'ichi Handa <address@hidden> for multi-byte buffer handling.
+;; Thanks to Ken'ichi Handa <address@hidden> for multi-byte buffer handling.
 ;;
 ;; Thanks to Matthew O Persico <address@hidden> for line number on
 ;; empty columns.
@@ -4612,7 +4614,9 @@ page-height == ((floor print-height ((th + ls) * zh)) * 
((th + ls) * zh)) - th
 (defsubst ps-output-string-prim (string)
   (insert "(")                         ;insert start-string delimiter
   (save-excursion                      ;insert string
-    (insert (string-as-unibyte string)))
+    (insert (if (multibyte-string-p string)
+                (encode-coding-string string 'utf-8)
+              string)))
   ;; Find and quote special characters as necessary for PS
   ;; This skips everything except control chars, non-ASCII chars, (, ) and \.
   (while (progn (skip-chars-forward " -'*-[]-~") (not (eobp)))
@@ -5770,9 +5774,9 @@ XSTART YSTART are the relative position for the first 
page in a sheet.")
        ps-footer-font-size-internal (ps-get-font-size 'ps-footer-font-size)
        ps-control-or-escape-regexp
        (cond ((eq ps-print-control-characters '8-bit)
-              (string-as-unibyte "[\000-\037\177-\377]"))
+              "[\000-\037\177-\377]")
              ((eq ps-print-control-characters 'control-8-bit)
-              (string-as-unibyte "[\000-\037\177-\237]"))
+              "[\000-\037\177-\237]")
              ((eq ps-print-control-characters 'control)
               "[\000-\037\177]")
              (t "[\t\n\f]"))
@@ -5827,6 +5831,7 @@ XSTART YSTART are the relative position for the first 
page in a sheet.")
        ;; They may be overridden by ps-mule-begin-job.
        ps-basic-plot-string-function    'ps-basic-plot-string
        ps-encode-header-string-function nil)
+  (cl-assert (not (multibyte-string-p ps-control-or-escape-regexp)))
   ;; initialize page dimensions
   (ps-get-page-dimensions)
   ;; final check
diff --git a/lisp/ps-samp.el b/lisp/ps-samp.el
index 784b435..99c17c7 100644
--- a/lisp/ps-samp.el
+++ b/lisp/ps-samp.el
@@ -5,8 +5,8 @@
 ;; Author: Jim Thompson (was <address@hidden>)
 ;;     Jacques Duthen (was <address@hidden>)
 ;;     Vinicius Jose Latorre <address@hidden>
-;;     Kenichi Handa <address@hidden> (multi-byte characters)
-;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
+;;     Kenichi Handa <address@hidden> (multi-byte characters)
+;; Maintainer: Kenichi Handa <address@hidden> (multi-byte characters)
 ;;     Vinicius Jose Latorre <address@hidden>
 ;; Keywords: wp, print, PostScript
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
diff --git a/lisp/register.el b/lisp/register.el
index 775e1a2..d3825fe 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1993-1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/replace.el b/lisp/replace.el
index 9d1b7bf..00b8be5 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2019 Free
 ;; Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/reposition.el b/lisp/reposition.el
index 22f9986..0416845 100644
--- a/lisp/reposition.el
+++ b/lisp/reposition.el
@@ -4,7 +4,6 @@
 
 ;; Author: Michael D. Ernst <address@hidden>
 ;; Created: Jan 1991
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/rot13.el b/lisp/rot13.el
index 8f4044d..bdb2e4b 100644
--- a/lisp/rot13.el
+++ b/lisp/rot13.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 1eab18e..84cba61 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -1,9 +1,8 @@
-;;; savehist.el --- Save minibuffer history
+;;; savehist.el --- Save minibuffer history  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 1997, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Niksic <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: minibuffer
 ;; Version: 24
 
@@ -62,8 +61,7 @@
   "If non-nil, save all recorded minibuffer histories.
 If you want to save only specific histories, use `savehist-save-hook'
 to modify the value of `savehist-minibuffer-history-variables'."
-  :type 'boolean
-  :group 'savehist)
+  :type 'boolean)
 
 (defcustom savehist-additional-variables ()
   "List of additional variables to save.
@@ -77,13 +75,11 @@ non-nil.
 User options should be saved with the Customize interface.  This
 list is useful for saving automatically updated variables that are not
 minibuffer histories, such as `compile-command' or `kill-ring'."
-  :type '(repeat variable)
-  :group 'savehist)
+  :type '(repeat variable))
 
 (defcustom savehist-ignored-variables nil ;; '(command-history)
   "List of additional variables not to save."
-  :type '(repeat variable)
-  :group 'savehist)
+  :type '(repeat variable))
 
 (defcustom savehist-file
   (locate-user-emacs-file "history" ".emacs-history")
@@ -95,8 +91,7 @@ for more details.
 If you want your minibuffer history shared between Emacs and XEmacs,
 customize this value and make sure that `savehist-coding-system' is
 set to a coding system that exists in both emacsen."
-  :type 'file
-  :group 'savehist)
+  :type 'file)
 
 (defcustom savehist-file-modes #o600
   "Default permissions of the history file.
@@ -104,27 +99,23 @@ This is decimal, not octal.  The default is 384 (0600 in 
octal).
 Set to nil to use the default permissions that Emacs uses, typically
 mandated by umask.  The default is a bit more restrictive to protect
 the user's privacy."
-  :type 'integer
-  :group 'savehist)
+  :type 'integer)
 
 (defcustom savehist-autosave-interval (* 5 60)
   "The interval between autosaves of minibuffer history.
 If set to nil, disables timer-based autosaving."
   :type '(choice (const :tag "Disabled" nil)
-                 (integer :tag "Seconds"))
-  :group 'savehist)
+                 (integer :tag "Seconds")))
 
 (defcustom savehist-mode-hook nil
   "Hook called when Savehist mode is turned on."
-  :type 'hook
-  :group 'savehist)
+  :type 'hook)
 
 (defcustom savehist-save-hook nil
   "Hook called by `savehist-save' before saving the variables.
 You can use this hook to influence choice and content of variables
 to save."
-  :type 'hook
-  :group 'savehist)
+  :type 'hook)
 
 ;; This should be capable of representing characters used by Emacs.
 ;; We prefer UTF-8 over ISO 2022 because it is well-known outside
@@ -150,12 +141,6 @@ The contents of this variable is built while Emacs is 
running, and saved
 along with minibuffer history.  You can change its value off
 `savehist-save-hook' to influence which variables are saved.")
 
-(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion)
-  "Coding system without any conversion.
-This is used for calculating an internal checksum.  Should be as fast
-as possible, ideally simply exposing the internal representation of
-buffer text.")
-
 (defvar savehist-loaded nil
   "Whether the history has already been loaded.
 This prevents toggling Savehist mode from destroying existing
@@ -223,8 +208,8 @@ histories, which is probably undesirable."
 Normally invoked by calling `savehist-mode' to set the minor mode.
 Installs `savehist-autosave' in `kill-emacs-hook' and on a timer.
 To undo this, call `savehist-uninstall'."
-  (add-hook 'minibuffer-setup-hook 'savehist-minibuffer-hook)
-  (add-hook 'kill-emacs-hook 'savehist-autosave)
+  (add-hook 'minibuffer-setup-hook #'savehist-minibuffer-hook)
+  (add-hook 'kill-emacs-hook #'savehist-autosave)
   ;; Install an invocation of savehist-autosave on a timer.  This
   ;; should not cause noticeable delays for users -- savehist-autosave
   ;; executes in under 5 ms on my system.
@@ -233,16 +218,16 @@ To undo this, call `savehist-uninstall'."
     (setq savehist-timer
          (if (featurep 'xemacs)
              (start-itimer
-              "savehist" 'savehist-autosave savehist-autosave-interval
+              "savehist" #'savehist-autosave savehist-autosave-interval
               savehist-autosave-interval)
            (run-with-timer savehist-autosave-interval
-                           savehist-autosave-interval 'savehist-autosave)))))
+                           savehist-autosave-interval #'savehist-autosave)))))
 
 (defun savehist-uninstall ()
   "Undo installing savehist.
 Normally invoked by calling `savehist-mode' to unset the minor mode."
-  (remove-hook 'minibuffer-setup-hook 'savehist-minibuffer-hook)
-  (remove-hook 'kill-emacs-hook 'savehist-autosave)
+  (remove-hook 'minibuffer-setup-hook #'savehist-minibuffer-hook)
+  (remove-hook 'kill-emacs-hook #'savehist-autosave)
   (when savehist-timer
     (if (featurep 'xemacs)
        (delete-itimer savehist-timer)
@@ -327,7 +312,7 @@ If AUTO-SAVE is non-nil, compare the saved contents to the 
one last saved,
              (insert ?\n))))))
     ;; If autosaving, avoid writing if nothing has changed since the
     ;; last write.
-    (let ((checksum (md5 (current-buffer) nil nil savehist-no-conversion)))
+    (let ((checksum (md5 (current-buffer) nil nil savehist-coding-system)))
       (unless (and auto-save (equal checksum savehist-last-checksum))
        ;; Set file-precious-flag when saving the buffer because we
        ;; don't want a half-finished write ruining the entire
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 730d31e..960cace 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: July, 1993
 ;; Keywords: bookmarks, placeholders
 
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index dc0df7a..4fc9df8 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993-1995, 1999-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: hardware
 ;; Package: emacs
 
diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el
index 8281edb..7212732 100644
--- a/lisp/scroll-lock.el
+++ b/lisp/scroll-lock.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 2005-06-18
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/select.el b/lisp/select.el
index c79e923..a8adc16 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
@@ -309,6 +308,10 @@ the formats available in the clipboard if TYPE is 
`CLIPBOARD'."
                           (_ (error "Unknown selection data type: %S"
                                     type))))))
         (setq data (if coding (decode-coding-string data coding)
+                     ;; This is for C_STRING case.
+                     ;; We want to convert each non-ASCII byte to the
+                     ;; corresponding eight-bit character, which has
+                     ;; a codepoint >= #x3FFF00.
                      (string-to-multibyte data))))
       (setq next-selection-coding-system nil)
       (put-text-property 0 (length data) 'foreign-selection data-type data))
@@ -472,6 +475,9 @@ two markers or an overlay.  Otherwise, it is nil."
            (setq str (encode-coding-string str coding)))
 
           ((eq type 'C_STRING)
+            ;; If STR is unibyte (the normal case), use it; otherwise
+            ;; we assume some of the characters are eight-bit, and
+            ;; take their lower 8 bits.
            (setq str (string-make-unibyte str)))
 
           (t
diff --git a/lisp/server.el b/lisp/server.el
index 1e5c57a..f692673 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: William Sommerfeld <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: processes
 
 ;; Changes by address@hidden and by rms.
@@ -96,7 +95,6 @@
              (unless load-in-progress
                (message "Local sockets unsupported, using TCP sockets")))
            (set-default sym val))
-  :group 'server
   :type 'boolean
   :version "22.1")
 
@@ -108,7 +106,6 @@ DO NOT give this a non-nil value unless you know what you 
are doing!
 On unsecured networks, accepting remote connections is very dangerous,
 because server-client communication (including session authentication)
 is not encrypted."
-  :group 'server
   :type '(choice
           (string :tag "Name or IP address")
           (const :tag "Local" nil))
@@ -121,7 +118,6 @@ is not encrypted."
 This variable only takes effect when the Emacs server is using
 TCP instead of local sockets.  A nil value means to use a random
 port number."
-  :group 'server
   :type '(choice
           (string :tag "Port number")
           (const :tag "Random" nil))
@@ -138,7 +134,6 @@ NOTE: On FAT32 filesystems, directories are not secure;
 files can be read and modified by any user or process.
 It is strongly suggested to set `server-auth-dir' to a
 directory residing in a NTFS partition instead."
-  :group 'server
   :type 'directory
   :version "22.1")
 ;;;###autoload
@@ -166,7 +161,6 @@ communications are unencrypted, still apply.
 The key must consist of 64 ASCII printable characters except for
 space (this means characters from ! to ~; or from code 33 to
 126).  You can use \\[server-generate-key] to get a random key."
-  :group 'server
   :type '(choice
          (const :tag "Random" nil)
          (string :tag "Password"))
@@ -174,30 +168,25 @@ space (this means characters from ! to ~; or from code 33 
to
 
 (defcustom server-raise-frame t
   "If non-nil, raise frame when switching to a buffer."
-  :group 'server
   :type 'boolean
   :version "22.1")
 
 (defcustom server-visit-hook nil
   "Hook run when visiting a file for the Emacs server."
-  :group 'server
   :type 'hook)
 
 (defcustom server-switch-hook nil
   "Hook run when switching to a buffer for the Emacs server."
-  :group 'server
   :type 'hook)
 
 (defcustom server-after-make-frame-hook nil
   "Hook run when the Emacs server creates a client frame.
 The created frame is selected when the hook is called."
-  :group 'server
   :type 'hook
   :version "27.1")
 
 (defcustom server-done-hook nil
   "Hook run when done editing a buffer for the Emacs server."
-  :group 'server
   :type 'hook)
 
 (defvar server-process nil
@@ -223,7 +212,6 @@ If it is a frame, use the frame's selected window.
 
 It is not meaningful to set this to a specific frame or window with Custom.
 Only programs can do so."
-  :group 'server
   :version "22.1"
   :type '(choice (const :tag "Use selected window"
                        :match (lambda (widget value)
@@ -233,11 +221,10 @@ Only programs can do so."
                 (function-item :tag "Use pop-to-buffer" pop-to-buffer)
                 (function :tag "Other function")))
 
-(defcustom server-temp-file-regexp "^/tmp/Re\\|/draft$"
+(defcustom server-temp-file-regexp "\\`/tmp/Re\\|/draft\\'"
   "Regexp matching names of temporary files.
 These are deleted and reused after each edit by the programs that
 invoke the Emacs server."
-  :group 'server
   :type 'regexp)
 
 (defcustom server-kill-new-buffers t
@@ -248,7 +235,6 @@ it with the Emacs server.  If nil, kill only buffers as 
specified by
 Please note that only buffers that still have a client are killed,
 i.e. buffers visited with \"emacsclient --no-wait\" are never killed
 in this way."
-  :group 'server
   :type 'boolean
   :version "21.1")
 
@@ -278,7 +264,6 @@ 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")
 
@@ -381,7 +366,7 @@ Updates `server-clients'."
 
       (server-log "Deleted" proc))))
 
-(defvar server-log-time-function 'current-time-string
+(defvar server-log-time-function #'current-time-string
   "Function to generate timestamps for `server-buffer'.")
 
 (defconst server-buffer " *server*"
@@ -549,6 +534,16 @@ Creates the directory if necessary and makes sure:
       (cl-letf (((default-file-modes) ?\700)) (make-directory dir t))
       (setq attrs (file-attributes dir 'integer)))
 
+    (let ((olddir (or (getenv "TMPDIR") "/tmp")))
+      (when (and (equal dir (format "%s/emacs" (getenv "XDG_RUNTIME_DIR")))
+                 (file-writable-p olddir))
+        (let ((link (format "%s/emacs%d" olddir (user-uid))))
+          (unless (file-directory-p link)
+            ;; We're using the new location, so try and setup a symlink from
+            ;; the old location, in case we want to use an old emacsclient.
+            ;; FIXME: Check that it's safe to use!
+            (make-symbolic-link dir link t)))))
+
     ;; Check that it's safe for use.
     (let* ((uid (file-attribute-user-id attrs))
           (w32 (eq system-type 'windows-nt))
@@ -684,16 +679,16 @@ server or call `\\[server-force-delete]' to forcibly 
disconnect it."))
        (when server-process
          (server-log (message "Restarting server")))
        (cl-letf (((default-file-modes) ?\700))
-         (add-hook 'suspend-tty-functions 'server-handle-suspend-tty)
-         (add-hook 'delete-frame-functions 'server-handle-delete-frame)
+         (add-hook 'suspend-tty-functions #'server-handle-suspend-tty)
+         (add-hook 'delete-frame-functions #'server-handle-delete-frame)
          (add-hook 'kill-emacs-query-functions
-                    'server-kill-emacs-query-function)
+                    #'server-kill-emacs-query-function)
           ;; We put server's kill-emacs-hook after the others, so that
           ;; frames are not deleted too early, because doing that
           ;; would severely degrade our abilities to communicate with
           ;; the user, while some hooks may wish to ask the user
           ;; questions (e.g., desktop-kill).
-         (add-hook 'kill-emacs-hook 'server-force-stop t) ;Cleanup upon exit.
+         (add-hook 'kill-emacs-hook #'server-force-stop t) ;Cleanup upon exit.
          (setq server-process
                (apply #'make-network-process
                       :name server-name
@@ -792,7 +787,6 @@ Server mode runs a process that accepts commands from the
 `emacsclient' program.  See Info node `Emacs server' and
 `server-start' for details."
   :global t
-  :group 'server
   :version "22.1"
   ;; Fixme: Should this check for an existing server socket and do
   ;; nothing if there is one (for multiple Emacs sessions)?
@@ -1118,7 +1112,7 @@ The following commands are accepted by the client:
            ;; Remove this line from STRING.
            (setq string (substring string (match-end 0)))
            (setq args-left
-                 (mapcar 'server-unquote-arg (split-string request " " t)))
+                 (mapcar #'server-unquote-arg (split-string request " " t)))
            (while args-left
               (pcase (pop args-left)
                 ;; -version CLIENT-VERSION: obsolete at birth.
@@ -1341,7 +1335,7 @@ The following commands are accepted by the client:
                           (when initial-buffer
                             (switch-to-buffer initial-buffer 'norecord))))))
 
-          (mapc 'funcall (nreverse commands))
+          (mapc #'funcall (nreverse commands))
 
           ;; Delete the client if necessary.
           (cond
@@ -1441,7 +1435,7 @@ so don't mark these buffers specially, just visit them 
normally."
          (run-hooks 'post-command-hook))
        (unless nowait
          ;; When the buffer is killed, inform the clients.
-         (add-hook 'kill-buffer-hook 'server-kill-buffer nil t)
+         (add-hook 'kill-buffer-hook #'server-kill-buffer nil t)
          (push proc server-buffer-clients))
        (push (current-buffer) client-record)))
     (unless nowait
@@ -1552,8 +1546,8 @@ specifically for the clients and did not exist before 
their request for it."
   "Ask before exiting Emacs if it has live clients."
   (or (not (let (live-client)
              (dolist (proc server-clients)
-               (when (memq t (mapcar 'buffer-live-p (process-get
-                                                     proc 'buffers)))
+               (when (memq t (mapcar #'buffer-live-p
+                                     (process-get proc 'buffers)))
                  (setq live-client t)))
              live-client))
       (yes-or-no-p "This Emacs session has clients; exit anyway? ")))
@@ -1589,7 +1583,7 @@ starts server process and that is all.  Invoked by 
\\[server-edit]."
        (not server-process)
        (memq (process-status server-process) '(signal exit)))
     (server-mode 1))
-   (server-clients (apply 'server-switch-buffer (server-done)))
+   (server-clients (apply #'server-switch-buffer (server-done)))
    (t (message "No server editing buffers exist"))))
 
 (defun server-switch-buffer (&optional next-buffer killed-one filepos)
@@ -1622,7 +1616,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
     (if (not (buffer-live-p next-buffer))
        ;; If NEXT-BUFFER is a dead buffer, remove the server records for it
        ;; and try the next surviving server buffer.
-       (apply 'server-switch-buffer (server-buffer-done next-buffer))
+       (apply #'server-switch-buffer (server-buffer-done next-buffer))
       ;; OK, we know next-buffer is live, let's display and select it.
       (if (functionp server-window)
          (funcall server-window next-buffer)
@@ -1655,7 +1649,14 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
                              (frame-terminal))))
                'nomini 'visible (selected-window))))
            (condition-case nil
-               (switch-to-buffer next-buffer)
+                ;; If the client specified a new buffer position,
+                ;; treat that as an explicit point-move command, and
+                ;; override switch-to-buffer-preserve-window-point.
+                (let ((switch-to-buffer-preserve-window-point
+                       (if filepos
+                           nil
+                         switch-to-buffer-preserve-window-point)))
+                  (switch-to-buffer next-buffer))
              ;; After all the above, we might still have ended up with
              ;; a minibuffer/dedicated-window (if there's no other).
              (error (pop-to-buffer next-buffer)))))))
@@ -1701,7 +1702,7 @@ only these files will be asked to be saved."
   (save-current-buffer
     (dolist (buffer (buffer-list))
       (set-buffer buffer)
-      (remove-hook 'kill-buffer-hook 'server-kill-buffer t)))
+      (remove-hook 'kill-buffer-hook #'server-kill-buffer t)))
   ;; continue standard unloading
   nil)
 
diff --git a/lisp/ses.el b/lisp/ses.el
index 73157d6..7fdacc7 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <address@hidden>
-;; Maintainer: Vincent Belaïche  <address@hidden>
+;; Maintainer: Vincent Belaïche <address@hidden>
 ;; Keywords: spreadsheet Dijkstra
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/shell.el b/lisp/shell.el
index 5357027..6e2ae85 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -5,7 +5,6 @@
 
 ;; Author: Olin Shivers <address@hidden>
 ;;     Simon Marshall <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: processes
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/simple.el b/lisp/simple.el
index 5660f65..c0e8d58 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985-1987, 1993-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
@@ -3353,7 +3352,7 @@ is output."
   :group 'shell
   :version "26.1")
 
-(defcustom shell-command-width nil
+(defcustom async-shell-command-width nil
   "Number of display columns available for asynchronous shell command output.
 If nil, use the shell default number (usually 80 columns).
 If a positive integer, tell the shell to use that number of columns for
@@ -3627,8 +3626,8 @@ impose the use of a shell (with its need to quote 
arguments)."
                   (shell-command--save-pos-or-erase)
                  (setq default-directory directory)
                  (let ((process-environment
-                        (if (natnump shell-command-width)
-                            (cons (format "COLUMNS=%d" shell-command-width)
+                        (if (natnump async-shell-command-width)
+                            (cons (format "COLUMNS=%d" 
async-shell-command-width)
                                   process-environment)
                           process-environment)))
                    (setq proc
@@ -5612,7 +5611,7 @@ see `region-noncontiguous-p' and 
`extract-rectangle-bounds'."
   "Return non-nil if the region contains several pieces.
 An example is a rectangular region handled as a list of
 separate contiguous regions for each line."
-  (> (length (region-bounds)) 1))
+  (cdr (region-bounds)))
 
 (defvar redisplay-unhighlight-region-function
   (lambda (rol) (when (overlayp rol) (delete-overlay rol))))
diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index bce73d6..1d06b64 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: extensions, abbrev, languages, tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/sort.el b/lisp/sort.el
index 6ea1c44..86cb180 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Howie Kaye
-;; Maintainer: address@hidden
 ;; Keywords: unix
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/soundex.el b/lisp/soundex.el
index 1f1f9ca..9e4c797 100644
--- a/lisp/soundex.el
+++ b/lisp/soundex.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Christian Plaunt <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: matching
 ;; Created: Sat May 15 14:48:18 1993
 
diff --git a/lisp/startup.el b/lisp/startup.el
index 421a6ea..a88118e 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1992, 1994-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/strokes.el b/lisp/strokes.el
index 9265b8a..29daaa5 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David Bakhash <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: lisp, mouse, extensions
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/subr.el b/lisp/subr.el
index f68f9dd..c97d9b9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
@@ -1238,12 +1237,14 @@ The normal global definition of the character C-x 
indirects to this keymap.")
                          c)))
            key)))
 
-(defun eventp (obj)
-  "True if the argument is an event object."
-  (when obj
-    (or (integerp obj)
-        (and (symbolp obj) obj (not (keywordp obj)))
-        (and (consp obj) (symbolp (car obj))))))
+(defun eventp (object)
+  "Return non-nil if OBJECT is an input event or event object."
+  (or (integerp object)
+      (and (if (consp object)
+               (setq object (car object))
+             object)
+           (symbolp object)
+           (not (keywordp object)))))
 
 (defun event-modifiers (event)
   "Return a list of symbols representing the modifier keys in event EVENT.
@@ -5542,4 +5543,8 @@ returned list are in the same order as in TREE.
 ;; for discoverability:
 (defalias 'flatten-list 'flatten-tree)
 
+;; The initial anchoring is for better performance in searching matches.
+(defconst regexp-unmatchable "\\`a\\`"
+  "Standard regexp guaranteed not to match any string at all.")
+
 ;;; subr.el ends here
diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el
index 14b292d..1f4be16 100644
--- a/lisp/t-mouse.el
+++ b/lisp/t-mouse.el
@@ -1,7 +1,6 @@
 ;;; t-mouse.el --- mouse support within the text terminal
 
 ;; Author: Nick Roberts <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: mouse gpm linux
 
 ;; Copyright (C) 1994-1995, 1998, 2006-2019 Free Software Foundation,
diff --git a/lisp/tabify.el b/lisp/tabify.el
index 37cd8fb..345771e 100644
--- a/lisp/tabify.el
+++ b/lisp/tabify.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/talk.el b/lisp/talk.el
index 0b7d5db..b5c77a9 100644
--- a/lisp/talk.el
+++ b/lisp/talk.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: comm, frames
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 599da9a..c75fe7c 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1990-1991, 1993-2019 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 04 Apr 1990
 ;; Keywords: unix
 
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 28afbec..e3b9c76 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -1,11 +1,11 @@
-;;; tempo.el --- Flexible template insertion
+;;; tempo.el --- Flexible template insertion -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Kågedal <address@hidden>
 ;; Created: 16 Feb 1994
 ;; Kågedal's last version number: 1.2.4
-;; Keywords: extensions, languages, tools
+;; Keywords: abbrev, extensions, languages, tools
 
 ;; This file is part of GNU Emacs.
 
@@ -152,7 +152,7 @@ setting it to (upcase), for example.")
 (defvar tempo-tags nil
   "An association list with tags and corresponding templates.")
 
-(defvar tempo-local-tags '((tempo-tags . nil))
+(defvar-local tempo-local-tags '((tempo-tags . nil))
   "A list of locally installed tag completion lists.
 It is an association list where the car of every element is a symbol
 whose variable value is a template list.  The cdr part, if non-nil,
@@ -161,16 +161,16 @@ documentation for the function `tempo-complete-tag' for 
more info.
 
 `tempo-tags' is always in the last position in this list.")
 
-(defvar tempo-collection nil
+(defvar-local tempo-collection nil
   "A collection of all the tags defined for the current buffer.")
 
-(defvar tempo-dirty-collection t
+(defvar-local tempo-dirty-collection t
   "Indicates if the tag collection needs to be rebuilt.")
 
-(defvar tempo-marks nil
+(defvar-local tempo-marks nil
   "A list of marks to jump to with `\\[tempo-forward-mark]' and 
`\\[tempo-backward-mark]'.")
 
-(defvar tempo-match-finder "\\b\\([[:word:]]+\\)\\="
+(defvar-local tempo-match-finder "\\b\\([[:word:]]+\\)\\="
   "The regexp or function used to find the string to match against tags.
 
 If `tempo-match-finder' is a string, it should contain a regular
@@ -195,23 +195,15 @@ A list of symbols which are bound to functions that take 
one argument.
 This function should return something to be sent to `tempo-insert' if
 it recognizes the argument, and nil otherwise.")
 
-(defvar tempo-named-insertions nil
+(defvar-local tempo-named-insertions nil
   "Temporary storage for named insertions.")
 
-(defvar tempo-region-start (make-marker)
+(defvar-local tempo-region-start (make-marker)
   "Region start when inserting around the region.")
 
-(defvar tempo-region-stop (make-marker)
+(defvar-local tempo-region-stop (make-marker)
   "Region stop when inserting around the region.")
 
-;; Make some variables local to every buffer
-
-(make-variable-buffer-local 'tempo-marks)
-(make-variable-buffer-local 'tempo-local-tags)
-(make-variable-buffer-local 'tempo-match-finder)
-(make-variable-buffer-local 'tempo-collection)
-(make-variable-buffer-local 'tempo-dirty-collection)
-
 ;;; Functions
 
 ;;
@@ -268,11 +260,14 @@ The elements in ELEMENTS can be of several types:
  - `n>': Inserts a newline and indents line.
  - `o': Like `%' but leaves the point before the newline.
  - nil: It is ignored.
- - Anything else: It is evaluated and the result is treated as an
-   element to be inserted.  One additional tag is useful for these
-   cases.  If an expression returns a list (l foo bar), the elements
-   after `l' will be inserted according to the usual rules.  This makes
-   it possible to return several elements from one expression."
+ - Anything else: Each function in `tempo-user-elements' is called
+   with it as argument until one of them returns non-nil, and the
+   result is inserted.  If all of them return nil, it is evaluated and
+   the result is treated as an element to be inserted.  One additional
+   tag is useful for these cases.  If an expression returns a list (l
+   foo bar), the elements after `l' will be inserted according to the
+   usual rules.  This makes it possible to return several elements
+   from one expression."
   (let* ((template-name (intern (concat "tempo-template-"
                                       name)))
         (command-name template-name))
diff --git a/lisp/term.el b/lisp/term.el
index 586a887..553c3a1 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -390,8 +390,16 @@ This emulates (more or less) the behavior of xterm.")
   "A queue of strings whose echo we want suppressed.")
 (defvar term-terminal-undecoded-bytes nil)
 (defvar term-current-face 'term)
-(defvar term-scroll-start 0 "Top-most line (inclusive) of scrolling region.")
-(defvar term-scroll-end) ; Number of line (zero-based) after scrolling region.
+(defvar-local term-scroll-start 0
+  "Top-most line (inclusive) of the scrolling region.
+`term-scroll-start' must be in the range [0,term-height).  In addition, its
+value has to be smaller than `term-scroll-end', i.e. one line scroll regions 
are
+not allowed.")
+(defvar-local term-scroll-end nil
+  "Bottom-most line (inclusive) of the scrolling region.
+`term-scroll-end' must be in the range [0,term-height).  In addition, its
+value has to be greater than `term-scroll-start', i.e. one line scroll regions 
are
+not allowed.")
 (defvar term-pager-count nil
   "Number of lines before we need to page; if nil, paging is disabled.")
 (defvar term-saved-cursor nil)
@@ -1075,9 +1083,6 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (make-local-variable 'term-current-column)
   (make-local-variable 'term-current-row)
   (make-local-variable 'term-log-buffer)
-  (make-local-variable 'term-scroll-start)
-  (set (make-local-variable 'term-scroll-end) term-height)
-  (make-local-variable 'term-scroll-with-delete)
   (make-local-variable 'term-pager-count)
   (make-local-variable 'term-pager-old-local-map)
   (make-local-variable 'term-old-mode-map)
@@ -1117,6 +1122,8 @@ Entry to this mode runs the hooks on `term-mode-hook'."
 
   (add-hook 'read-only-mode-hook #'term-line-mode-buffer-read-only-update nil 
t)
 
+  (term--reset-scroll-region)
+
   (easy-menu-add term-terminal-menu)
   (easy-menu-add term-signals-menu)
   (or term-input-ring
@@ -1133,6 +1140,9 @@ Entry to this mode runs the hooks on `term-mode-hook'."
       (let ((inhibit-read-only t))
         (delete-char 1)))))
 
+(defun term--last-line ()
+  (1- term-height))
+
 (defun term--filter-buffer-substring (content)
   (with-temp-buffer
     (insert content)
@@ -1174,7 +1184,7 @@ 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)
-      (term-set-scroll-region 0 height)
+      (term--reset-scroll-region)
       ;; `term-set-scroll-region' causes these to be set, we have to
       ;; clear them again since we're changing point (Bug#30544).
       (setq term-start-line-column nil)
@@ -2935,7 +2945,8 @@ 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)
+                      (add-text-properties (1- (point)) (point)
+                                           '(term-line-wrap t rear-nonsticky 
t))
                       (setq decoded-substring
                             (substring decoded-substring (- term-width 
old-column)))
                       (setq old-column 0)))
@@ -3204,7 +3215,7 @@ option is enabled.  See `term-set-goto-process-mark'."
        (goto-char term-home-marker)
        (term-vertical-motion (1+ count))
        (set-marker term-home-marker (point))
-       (setq term-current-row (1- term-height))))))
+       (setq term-current-row (term--last-line))))))
 
 (defun term-reset-terminal ()
   "Reset the terminal, delete all the content and set the face to the default 
one."
@@ -3212,8 +3223,7 @@ option is enabled.  See `term-set-goto-process-mark'."
   (term-ansi-reset)
   (setq term-current-row 0)
   (setq term-current-column 1)
-  (setq term-scroll-start 0)
-  (setq term-scroll-end term-height)
+  (term--reset-scroll-region)
   (setq term-insert-mode nil)
   ;; FIXME: No idea why this is here, it looks wrong.  --Stef
   (setq term-ansi-face-already-done nil))
@@ -3422,6 +3432,10 @@ option is enabled.  See `term-set-goto-process-mark'."
      (1- (or (nth 1 params) 0))))
    (t)))
 
+(defun term--reset-scroll-region ()
+  "Sets the scroll region to the full height of the terminal."
+  (term-set-scroll-region 0 (term--last-line)))
+
 (defun term-set-scroll-region (top bottom)
   "Set scrolling region.
 TOP is the top-most line (inclusive) of the new scrolling region,
@@ -3432,13 +3446,13 @@ The top-most line is line 0."
            0
          top))
   (setq term-scroll-end
-       (if (or (<= bottom term-scroll-start) (> bottom term-height))
-           term-height
+       (if (or (<= bottom term-scroll-start) (> bottom (term--last-line)))
+           (term--last-line)
          bottom))
   (setq term-scroll-with-delete
        (or (term-using-alternate-sub-buffer)
            (not (and (= term-scroll-start 0)
-                     (= term-scroll-end term-height)))))
+                      (= term-scroll-end (term--last-line))))))
   (term-move-columns (- (term-current-column)))
   (term-goto 0 0))
 
@@ -3567,7 +3581,7 @@ The top-most line is line 0."
     (when (> moved lines)
       (backward-char))
     (cond ((<= deficit 0) ;; OK, had enough in the buffer for request.
-          (recenter (1- term-height)))
+          (recenter (term--last-line)))
          ((term-pager-continue deficit)))))
 
 (defun term-pager-page (arg)
@@ -3581,7 +3595,7 @@ The top-most line is line 0."
   (goto-char (point-min))
   (when (= (vertical-motion term-height) term-height)
     (backward-char))
-  (recenter (1- term-height)))
+  (recenter (term--last-line)))
 
 ;; Pager mode command to go to end of buffer.
 (defun term-pager-eob ()
@@ -3599,7 +3613,7 @@ The top-most line is line 0."
     ;; Move cursor to end of window.
     (vertical-motion term-height)
     (backward-char))
-  (recenter (1- term-height)))
+  (recenter (term--last-line)))
 
 (defun term-pager-back-page (arg)
   (interactive "p")
@@ -3754,7 +3768,8 @@ all pending output has been dealt with."))
   (when (not (bolp))
     (let ((old-point (point)))
       (insert-before-markers ?\n)
-      (put-text-property old-point (point) 'term-line-wrap t))))
+      (add-text-properties old-point (point)
+                           '(term-line-wrap t rear-nonsticky t)))))
 
 (defun term-erase-in-line (kind)
   (when (= kind 1) ;; erase left of point
diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el
index b7a778f..d7fceb8 100644
--- a/lisp/term/common-win.el
+++ b/lisp/term/common-win.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: terminals
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index 0927599..c434ea6 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: Morten Welinder <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 307586f..2718aec 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
-;; Maintainer: address@hidden
 ;; Keywords: terminals, faces
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index 7a5d3ef..de82232 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -4,7 +4,6 @@
 
 ;; Author: Henry Kautz
 ;; (according to authors.el)
-;; Maintainer: address@hidden
 ;; Keywords: bib
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index c285491..46dbcfe 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2019 Free
 ;; Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: wp
 ;; Package: emacs
 
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index d18916d..a06f8ed 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Manuel Serrano <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6553a27..0c5e6a1 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -4016,7 +4016,7 @@ You can bind this to the key C-c i in GNUS or mail by 
adding to
 
 (defun ispell-non-empty-string (string)
   (if (or (not string) (string-equal string ""))
-      "\\'\\`" ; An unmatchable string if string is null.
+      regexp-unmatchable
     (regexp-quote string)))
 
 
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index ff3d242..f351b87 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1991, 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
-;; Maintainer: address@hidden
 ;; Keywords: docs convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index f33d4df..e5964d1 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1994-1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: wp
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 220ef2d..bc92121 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: wp convenience
 ;; Package: emacs
 
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 92a6b90..8a1af3a 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1987, 1991, 1994-1997, 1999-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: wp
 ;; Package: emacs
 
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index b520849..79039bc 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 ;; Keywords: convenience wp
 
 ;; This file is part of GNU Emacs.
@@ -625,7 +624,6 @@ Leaves the region surrounding the rectangle."
 (defvar picture-mode-map
   (let ((map (make-keymap)))
     (define-key map [remap self-insert-command] 'picture-self-insert)
-    (define-key map [remap self-insert-command] 'picture-self-insert)
     (define-key map [remap completion-separator-self-insert-command]
                          'picture-self-insert)
     (define-key map [remap completion-separator-self-insert-autofilling]
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index 3ba52e6..03b1b04 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Henry Kautz <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: bib, tex
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el
index f13e1d7..3d4d0d2 100644
--- a/lisp/textmodes/refer.el
+++ b/lisp/textmodes/refer.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992, 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ashwin Ram <address@hidden>
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR
 ;; Keywords: bib
 
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index 67ecd3c..efc1108 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1999-2001, 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
-;; Maintainer: address@hidden
 ;; Created: 29 Mar 1999
 ;; Version: 2.0
 ;; Keywords: data memory todo pim
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 9e3be99..d0586fd 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: James Clark <address@hidden>
-;; Maintainer: address@hidden
 ;; Adapted-By: ESR, Daniel Pfeiffer <address@hidden>,
 ;;             address@hidden
 ;; Keywords: wp, hypermedia, comm, languages
@@ -96,24 +95,20 @@ a DOCTYPE or an XML declaration."
 `text-mode-hook' is run first."
   :type 'hook)
 
-;; As long as Emacs's syntax can't be complemented with predicates to context
-;; sensitively confirm the syntax of characters, we have to live with this
-;; kludgy kind of tradeoff.
-(defvar sgml-specials '(?\")
+;; The official handling of "--" is complicated in SGML, and
+;; historically not well supported by browser HTML parsers.
+;; Recommendations for writing HTML comments is to use <!--...-->
+;; (where ... doesn't contain "--") to avoid the complications
+;; altogether (XML goes even further by requiring this in the spec).
+;; So there is probably no need to handle it "correctly".
+(defvar sgml-specials '(?\" ?\')
   "List of characters that have a special meaning for SGML mode.
 This list is used when first loading the `sgml-mode' library.
-The supported characters and potential disadvantages are:
+The supported characters are ?\\\", ?\\=', and ?-.
 
-  ?\\\"        Makes \" in text start a string.
-  ?\\='        Makes \\=' in text start a string.
-  ?-   Makes -- in text start a comment.
-
-When only one of ?\\\" or ?\\=' are included, \"\\='\" or \\='\"\\=', as can 
be found in
-DTDs, start a string.  To partially avoid this problem this also makes these
-self insert as named entities depending on `sgml-quick-keys'.
-
-Including ?- has the problem of affecting dashes that have nothing to do
-with comments, so we normally turn it off.")
+Including ?- makes double dashes into comment delimiters, but
+they are really only supposed to delimit comments within DTD
+definitions.  So we normally turn it off.")
 
 (defvar sgml-quick-keys nil
   "Use <, >, &, /, SPC and `sgml-specials' keys \"electrically\" when non-nil.
@@ -333,6 +328,24 @@ Any terminating `>' or `/' is not matched.")
 (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
   "Rules for highlighting SGML code.  See also `sgml-tag-face-alist'.")
 
+(defvar-local sgml--syntax-propertize-ppss nil)
+
+(defun sgml--syntax-propertize-ppss (pos)
+  "Return PPSS at POS, fixing the syntax of any lone `>' along the way."
+  (cl-assert (>= pos (car sgml--syntax-propertize-ppss)))
+  (let ((ppss (parse-partial-sexp (car sgml--syntax-propertize-ppss) pos -1
+                                  nil (cdr sgml--syntax-propertize-ppss))))
+    (while (eq -1 (car ppss))
+      (put-text-property (1- (point)) (point)
+                         'syntax-table (string-to-syntax "."))
+      ;; Hack attack: rather than recompute the ppss from
+      ;; (car sgml--syntax-propertize-ppss), we manually "fix it".
+      (setcar ppss 0)
+      (setq ppss (parse-partial-sexp (point) pos -1 nil ppss)))
+    (setcdr sgml--syntax-propertize-ppss ppss)
+    (setcar sgml--syntax-propertize-ppss pos)
+    ppss))
+
 (eval-and-compile
   (defconst sgml-syntax-propertize-rules
     (syntax-propertize-precompile-rules
@@ -343,29 +356,34 @@ 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 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
+     ;; Quotes outside of tags should not introduce strings which end up
+     ;; hiding tags.  We used to test every quote and mark it as "."
+     ;; if it's outside of tags, but there are too many 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))
+     ("\\(?:\\(?1:\"\\)[^\"<>]*\\|\\(?1:'\\)[^'\"<>]*\\)"
+      (1 (if (eq (char-after) (char-after (match-beginning 0)))
+             (forward-char 1)
            ;; 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))))
+           (if (zerop (save-excursion
+                        (car (sgml--syntax-propertize-ppss
+                              (match-beginning 0)))))
                (string-to-syntax ".")))))
      )))
 
 (defun sgml-syntax-propertize (start end)
   "Syntactic keywords for `sgml-mode'."
-  (goto-char start)
+  (setq sgml--syntax-propertize-ppss (cons start (syntax-ppss start)))
+  (cl-assert (>= (cadr sgml--syntax-propertize-ppss) 0))
   (sgml-syntax-propertize-inside end)
   (funcall
    (syntax-propertize-rules sgml-syntax-propertize-rules)
-   start end))
+   start end)
+  ;; Catch any '>' after the last quote.
+  (sgml--syntax-propertize-ppss end))
 
 (defun sgml-syntax-propertize-inside (end)
   (let ((ppss (syntax-ppss)))
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index bed8b2f..256fac6 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -590,7 +590,7 @@
 ;; attempt of implementing the table feature to Emacs.  This greatly
 ;; motivated me to follow through to its completion.
 ;;
-;; Kenichi Handa <address@hidden> kindly guided me through to
+;; Kenichi Handa <address@hidden> kindly guided me through to
 ;; overcome many technical issues while I was struggling with quail
 ;; related internationalization problems.
 ;;
@@ -930,16 +930,16 @@ This is always set to nil at the entry to 
`table-with-cache-buffer' before execu
 ;; refill the table cache.  If the command were not listed fast
 ;; typing can cause unwanted cache refill.
 (defconst table-cell-bindings
-  '(([(control i)]     . table-forward-cell)
-    ([(control I)]     . table-backward-cell)
+  '(([(control ?i)]    . table-forward-cell)
+    ([(control ?I)]    . table-backward-cell)
     ([tab]             . table-forward-cell)
     ([(shift backtab)] . table-backward-cell) ; for HPUX console keyboard
     ([(shift iso-lefttab)]    . table-backward-cell) ; shift-tab on a 
microsoft natural keyboard and redhat linux
     ([(shift tab)]     . table-backward-cell)
     ([backtab]          . table-backward-cell) ; for terminals (e.g., xterm)
     ([return]          . *table--cell-newline)
-    ([(control m)]     . *table--cell-newline)
-    ([(control j)]     . *table--cell-newline-and-indent)
+    ([(control ?m)]    . *table--cell-newline)
+    ([(control ?j)]    . *table--cell-newline-and-indent)
     ([mouse-3]         . *table--present-cell-popup-menu)
     ([(control ?>)]    . table-widen-cell)
     ([(control ?<)]    . table-narrow-cell)
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 9c91d27..8611b73 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2019 Free
 ;; Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: tex
 
 ;; Contributions over the years by William F. Schelter, Dick King,
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index 4bfecb4..5a54e0d 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: Robert J. Chassell <address@hidden>
 ;; Keywords: maint, tex, docs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 71cdcab..54306d2 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -5,7 +5,6 @@
 
 ;; Author: Robert J. Chassell
 ;; Date:   [See date below for texinfo-version]
-;; Maintainer: address@hidden
 ;; Keywords: maint, tex, docs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index e960e99..4f49c7f 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1989-1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
-;; Maintainer: address@hidden
 ;; Keywords: maint, tex, docs
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index e676a5d..ac292e4 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1992, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: wp
 ;; Package: emacs
 
diff --git a/lisp/textmodes/underline.el b/lisp/textmodes/underline.el
index e0bfd24..8c904f5 100644
--- a/lisp/textmodes/underline.el
+++ b/lisp/textmodes/underline.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: wp
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 26e0843..e0184a7 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1991-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Mike Williams <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: extensions, matching, mouse
 ;; Created: Thu Mar 28 13:48:23 1991
 
@@ -585,13 +584,13 @@ See RFC 4122 for the description of the format.")
 
 ;;  Aliases
 
-(defun word-at-point ()
+(defun word-at-point (&optional no-properties)
   "Return the word at point.  See `thing-at-point'."
-  (thing-at-point 'word))
+  (thing-at-point 'word no-properties))
 
-(defun sentence-at-point ()
+(defun sentence-at-point (&optional no-properties)
   "Return the sentence at point.  See `thing-at-point'."
-  (thing-at-point 'sentence))
+  (thing-at-point 'sentence no-properties))
 
 (defun thing-at-point--read-from-whole-string (str)
   "Read a Lisp expression from STR.
diff --git a/lisp/thread.el b/lisp/thread.el
index e8f3cc7..3242d1d 100644
--- a/lisp/thread.el
+++ b/lisp/thread.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: thread, tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 6a17a75..dd0491a 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Jean-Philippe Theberge <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: Multimedia
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/time.el b/lisp/time.el
index 35157c5..c2f60d3 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -3,8 +3,6 @@
 ;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 44f04ea..bb96b5a 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1994-1996, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Ilya Zakharevich <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 37ebb5c..e428182 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: help, internal
 ;; Package: emacs
 
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index 3dd9e34..29612b3 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Dick King <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: files
 ;; Created: 15 May 86
 ;; Package: emacs
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 0746cfd..beed7c6 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -86,7 +86,7 @@ instead of the filename inheritance method."
      ((and prompt (not byserv))
       (setq user (or
                  (url-do-auth-source-search server type :user)
-                 (read-string (url-auth-user-prompt url realm)
+                 (read-string (url-auth-user-prompt href realm)
                               (or user (user-real-login-name))))
            pass (or
                  (url-do-auth-source-search server type :secret)
@@ -115,7 +115,7 @@ instead of the filename inheritance method."
          (progn
            (setq user (or
                        (url-do-auth-source-search server type :user)
-                       (read-string (url-auth-user-prompt url realm)
+                       (read-string (url-auth-user-prompt href realm)
                                     (user-real-login-name)))
                  pass (or
                        (url-do-auth-source-search server type :secret)
@@ -478,6 +478,8 @@ PROMPT is boolean - specifies whether to ask the user for a 
username/password
        if one cannot be found in the cache"
   (if (not realm)
       (setq realm (cdr-safe (assoc "realm" args))))
+  (if (equal realm "")
+      (setq realm nil))
   (if (stringp url)
       (setq url (url-generic-parse-url url)))
   (if (or (null type) (eq type 'any))
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index a4cf0f0..dba3134 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: url, vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el
index 5436084..00d784a 100644
--- a/lisp/url/url-gw.el
+++ b/lisp/url/url-gw.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1997-1998, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, data, processes
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index e35d999..9d7837d 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -23,17 +23,17 @@
 
 ;;; Code:
 
-;; (require 'url)
 (require 'url-parse)
-;; (require 'url-util)
 (eval-when-compile (require 'mm-decode))
-;; (require 'mailcap)
 (eval-when-compile (require 'subr-x))
 ;; The following are autoloaded instead of `require'd to avoid eagerly
 ;; loading all of URL when turning on url-handler-mode in the .emacs.
-(autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified 
url, and canonicalize it.")
-(autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and 
return a list of MIME handles.")
-(autoload 'url-scheme-get-property "url-methods" "Get property of a URL 
SCHEME.")
+(autoload 'url-expand-file-name "url-expand"
+  "Convert URL to a fully specified URL, and canonicalize it.")
+(autoload 'mm-dissect-buffer "mm-decode"
+  "Dissect the current buffer and return a list of MIME handles.")
+(autoload 'url-scheme-get-property "url-methods"
+  "Get PROPERTY of a URL SCHEME.")
 
 ;; Always used after mm-dissect-buffer and defined in the same file.
 (declare-function mm-save-part-to-file "mm-decode" (handle file))
@@ -112,15 +112,16 @@
       (push (cons url-handler-regexp 'url-file-handler)
            file-name-handler-alist)))
 
-(defcustom url-handler-regexp 
"\\`\\(https?\\|ftp\\|file\\|nfs\\|ssh\\|scp\\|rsync\\|telnet\\)://"
+(defcustom url-handler-regexp
+  "\\`\\(?:https?\\|ftp\\|file\\|nfs\\|ssh\\|scp\\|rsync\\|telnet\\)://"
   "Regular expression for URLs handled by `url-handler-mode'.
 When URL Handler mode is enabled, this regular expression is
 added to `file-name-handler-alist'.
 
 Some valid URL protocols just do not make sense to visit
-interactively \(about, data, info, irc, mailto, etc.).  This
+interactively (about, data, info, irc, mailto, etc.).  This
 regular expression avoids conflicts with local files that look
-like URLs \(Gnus is particularly bad at this)."
+like URLs (Gnus is particularly bad at this)."
   :group 'url
   :type 'regexp
   :version "25.1"
@@ -144,8 +145,8 @@ like URLs \(Gnus is particularly bad at this)."
 ;;;###autoload
 (defun url-file-handler (operation &rest args)
   "Function called from the `file-name-handler-alist' routines.
-OPERATION is what needs to be done (`file-exists-p', etc).  ARGS are
-the arguments that would have been passed to OPERATION."
+OPERATION is what needs to be done (`file-exists-p', etc.).
+ARGS are the arguments that would have been passed to OPERATION."
   ;; Avoid recursive load.
   (if (and load-in-progress url-file-handler-load-in-progress)
       (url-run-real-handler operation args)
@@ -153,48 +154,46 @@ the arguments that would have been passed to OPERATION."
       ;; Check, whether there are arguments we want pass to Tramp.
       (if (catch :do
             (dolist (url (cons default-directory args))
-              (and (member
-                    (url-type (url-generic-parse-url (and (stringp url) url)))
-                    url-tramp-protocols)
+              (and (stringp url)
+                   (member (url-type (url-generic-parse-url url))
+                           url-tramp-protocols)
                    (throw :do t))))
-          (apply 'url-tramp-file-handler operation args)
+          (apply #'url-tramp-file-handler operation args)
         ;; Otherwise, let's do the job.
         (let ((fn (get operation 'url-file-handlers))
-              (val nil)
-              (hooked nil))
-          (if (and (not fn) (intern-soft (format "url-%s" operation))
+              val)
+          (if (and (not fn)
                    (fboundp (intern-soft (format "url-%s" operation))))
               (error "Missing URL handler mapping for %s" operation))
-          (if fn
-              (setq hooked t
-                    val (save-match-data (apply fn args)))
-            (setq hooked nil
-                  val (url-run-real-handler operation args)))
-          (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real")
+          (setq val (if fn (save-match-data (apply fn args))
+                      (url-run-real-handler operation args)))
+          (url-debug 'handlers "%s %S%S => %S" (if fn "Hooked" "Real")
                      operation args val)
           val)))))
 
-(defun url-file-handler-identity (&rest args)
-  ;; Identity function
-  (car args))
-
-;; These are operations that we can fully support
-(put 'file-readable-p 'url-file-handlers 'url-file-exists-p)
-(put 'substitute-in-file-name 'url-file-handlers 'url-file-handler-identity)
-(put 'file-name-absolute-p 'url-file-handlers (lambda (&rest ignored) t))
-(put 'expand-file-name 'url-file-handlers 'url-handler-expand-file-name)
-(put 'directory-file-name 'url-file-handlers 'url-handler-directory-file-name)
-(put 'file-name-directory 'url-file-handlers 'url-handler-file-name-directory)
-(put 'unhandled-file-name-directory 'url-file-handlers 
'url-handler-unhandled-file-name-directory)
-(put 'file-remote-p 'url-file-handlers 'url-handler-file-remote-p)
-;; (put 'file-name-as-directory 'url-file-handlers 
'url-handler-file-name-as-directory)
+(defun url-file-handler-identity (arg &rest _ignored)
+  ;; Identity function.
+  arg)
+
+;; These are operations that we can fully support.
+(put 'file-readable-p 'url-file-handlers #'url-file-exists-p)
+(put 'substitute-in-file-name 'url-file-handlers #'url-file-handler-identity)
+(put 'file-name-absolute-p 'url-file-handlers (lambda (&rest _ignored) t))
+(put 'expand-file-name 'url-file-handlers #'url-handler-expand-file-name)
+(put 'directory-file-name 'url-file-handlers #'url-handler-directory-file-name)
+(put 'file-name-directory 'url-file-handlers #'url-handler-file-name-directory)
+(put 'unhandled-file-name-directory 'url-file-handlers
+     #'url-handler-unhandled-file-name-directory)
+(put 'file-remote-p 'url-file-handlers #'url-handler-file-remote-p)
+;; (put 'file-name-as-directory 'url-file-handlers
+;;      #'url-handler-file-name-as-directory)
 
 ;; These are operations that we do not support yet (DAV!!!)
-(put 'file-writable-p 'url-file-handlers 'ignore)
-(put 'file-symlink-p 'url-file-handlers 'ignore)
+(put 'file-writable-p 'url-file-handlers #'ignore)
+(put 'file-symlink-p 'url-file-handlers #'ignore)
 ;; Just like for ange-ftp: let's not waste time trying to look for RCS/foo,v
 ;; files and such since we can't do anything clever with them anyway.
-(put 'vc-registered 'url-file-handlers 'ignore)
+(put 'vc-registered 'url-file-handlers #'ignore)
 
 (defun url-handler-expand-file-name (file &optional base)
   ;; When we see "/foo/bar" in a file whose working dir is "http://bla/bla";,
@@ -215,7 +214,7 @@ the arguments that would have been passed to OPERATION."
 ;; reversible:  (f-n-a-d (d-f-n (f-n-a-d X))) == (f-n-a-d X)
 (defun url-handler-directory-file-name (dir)
   ;; When there's more than a single /, just don't touch the slashes at all.
-  (if (string-match "//\\'" dir) dir
+  (if (string-suffix-p "//" dir) dir
     (url-run-real-handler 'directory-file-name (list dir))))
 
 (defun url-handler-unhandled-file-name-directory (filename)
@@ -257,49 +256,48 @@ the arguments that would have been passed to OPERATION."
       ;; `url-handler-unhandled-file-name-directory'.
       nil)))
 
-;; The actual implementation
+;; The actual implementation.
 ;;;###autoload
-(defun url-copy-file (url newname &optional ok-if-already-exists
-                          _keep-time _preserve-uid-gid _preserve-permissions)
-  "Copy URL to NEWNAME.  Both args must be strings.
-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.)
-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))
-      (signal 'file-already-exists (list "File exists" newname)))
-  (let ((buffer (url-retrieve-synchronously url))
-       (handle nil))
-    (if (not buffer)
-        (signal 'file-missing (list "Opening URL" "No such file or directory"
-                                    url)))
-    (with-current-buffer buffer
-      (setq handle (mm-dissect-buffer t)))
+(defun url-copy-file (url newname &optional ok-if-already-exists &rest 
_ignored)
+  "Copy URL to NEWNAME.  Both arguments must be strings.
+Signal a `file-already-exists' error if file NEWNAME already
+exists, unless a third argument OK-IF-ALREADY-EXISTS is supplied
+and non-nil.  An integer as third argument means request
+confirmation if NEWNAME already exists."
+  (and (file-exists-p newname)
+       (or (not ok-if-already-exists)
+           (and (integerp ok-if-already-exists)
+                (not (yes-or-no-p
+                      (format "File %s already exists; copy to it anyway? "
+                              newname)))))
+       (signal 'file-already-exists (list "File already exists" newname)))
+  (let* ((buffer (or (url-retrieve-synchronously url)
+                     (signal 'file-missing
+                             (list "Opening URL"
+                                   "No such file or directory" url))))
+         (handle (with-current-buffer buffer
+                   (mm-dissect-buffer t))))
     (let ((mm-attachment-file-modes (default-file-modes)))
       (mm-save-part-to-file handle newname))
     (kill-buffer buffer)
     (mm-destroy-parts handle)))
-(put 'copy-file 'url-file-handlers 'url-copy-file)
+(put 'copy-file 'url-file-handlers #'url-copy-file)
 
 ;;;###autoload
-(defun url-file-local-copy (url &rest ignored)
+(defun url-file-local-copy (url &rest _ignored)
   "Copy URL into a temporary file on this machine.
 Returns the name of the local copy, or nil, if FILE is directly
 accessible."
   (let ((filename (make-temp-file "url")))
     (url-copy-file url filename 'ok-if-already-exists)
     filename))
-(put 'file-local-copy 'url-file-handlers 'url-file-local-copy)
+(put 'file-local-copy 'url-file-handlers #'url-file-local-copy)
 
 (defun url-insert (buffer &optional beg end)
   "Insert the body of a URL object.
 BUFFER should be a complete URL buffer as returned by `url-retrieve'.
-If the headers specify a coding-system, it is applied to the body before it is 
inserted.
+If the headers specify a coding-system (and current buffer is multibyte),
+it is applied to the body before it is inserted.
 Returns a list of the form (SIZE CHARSET), where SIZE is the size in bytes
 of the inserted text and CHARSET is the charset that was specified in the 
header,
 or nil if none was found.
@@ -311,12 +309,13 @@ They count bytes from the beginning of the body."
                      (buffer-substring (+ (point-min) beg)
                                        (if end (+ (point-min) end) 
(point-max)))
                   (buffer-string))))
-         (charset (mail-content-type-get (mm-handle-type handle)
-                                          'charset)))
+         (charset (if enable-multibyte-characters
+                      (mail-content-type-get (mm-handle-type handle)
+                                             'charset))))
     (mm-destroy-parts handle)
-    (if charset
-        (insert (mm-decode-string data (mm-charset-to-coding-system charset)))
-      (insert data))
+    (insert (if charset
+                (mm-decode-string data (mm-charset-to-coding-system charset))
+              data))
     (list (length data) charset)))
 
 (defvar url-http-codes)
@@ -328,8 +327,8 @@ This is like `url-insert', but also decodes the current 
buffer as
 if it had been inserted from a file named URL."
   (if visit (setq buffer-file-name url))
   (save-excursion
-    (let* ((start (point))
-           (size-and-charset (url-insert buffer beg end)))
+    (let ((start (point))
+          (size-and-charset (url-insert buffer beg end)))
       (kill-buffer buffer)
       (when replace
         (delete-region (point-min) start)
@@ -340,42 +339,27 @@ if it had been inserted from a file named URL."
         (decode-coding-inserted-region (point-min) (point) url
                                        visit beg end replace))
       (let ((inserted (car size-and-charset)))
-        (when (fboundp 'after-insert-file-set-coding)
-          (let ((insval (after-insert-file-set-coding inserted visit)))
-            (if insval (setq inserted insval))))
-        (list url inserted)))))
+        (list url (or (and (fboundp 'after-insert-file-set-coding)
+                           (after-insert-file-set-coding inserted visit))
+                      inserted))))))
 
 ;;;###autoload
 (defun url-insert-file-contents (url &optional visit beg end replace)
   (let ((buffer (url-retrieve-synchronously url)))
     (unless buffer (signal 'file-error (list url "No Data")))
-    (with-current-buffer buffer
+    (when (fboundp 'url-http--insert-file-helper)
       ;; XXX: This is HTTP/S specific and should be moved to url-http
       ;; 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
-        ;; support, e.g., 'browse-url-emacs', which is a fancy way of
-        ;; visiting the HTML source of a URL: in that case, we want to
-        ;; display a file buffer even if the URL does not exist and
-        ;; 'url-retrieve-synchronously' returns 404 or whatever.
-        (unless (or visit
-                    (and (>= url-http-response-status 200)
-                         (< url-http-response-status 300)))
-          (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
-            (kill-buffer buffer)
-            ;; Signal file-error per bug#16733.
-            (signal 'file-error (list url desc))))))
+      (url-http--insert-file-helper buffer url visit))
     (url-insert-buffer-contents buffer url visit beg end replace)))
-
-(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)
+(put 'insert-file-contents 'url-file-handlers #'url-insert-file-contents)
 
 (defun url-file-name-completion (url _directory &optional _predicate)
   ;; Even if it's not implemented, it's not an error to ask for completion,
   ;; in case it's available (bug#14806).
   ;; (error "Unimplemented")
   url)
-(put 'file-name-completion 'url-file-handlers 'url-file-name-completion)
+(put 'file-name-completion 'url-file-handlers #'url-file-name-completion)
 
 (defun url-file-name-all-completions (_file _directory)
   ;; Even if it's not implemented, it's not an error to ask for completion,
@@ -383,7 +367,7 @@ if it had been inserted from a file named URL."
   ;; (error "Unimplemented")
   nil)
 (put 'file-name-all-completions
-     'url-file-handlers 'url-file-name-all-completions)
+     'url-file-handlers #'url-file-name-all-completions)
 
 ;; All other handlers map onto their respective backends.
 (defmacro url-handlers-create-wrapper (method args)
@@ -393,10 +377,10 @@ if it had been inserted from a file named URL."
                 (or (documentation method t) "No original documentation."))
        (setq url (url-generic-parse-url url))
        (when (url-type url)
-         (funcall (url-scheme-get-property (url-type url) (quote ,method))
-                  ,@(remove '&rest (remove '&optional args)))))
+         (funcall (url-scheme-get-property (url-type url) ',method)
+                  ,@(remq '&rest (remq '&optional args)))))
      (unless (get ',method 'url-file-handlers)
-       (put ',method 'url-file-handlers ',(intern (format "url-%s" method))))))
+       (put ',method 'url-file-handlers #',(intern (format "url-%s" 
method))))))
 
 (url-handlers-create-wrapper file-exists-p (url))
 (url-handlers-create-wrapper file-attributes (url &optional id-format))
@@ -407,12 +391,12 @@ if it had been inserted from a file named URL."
 (url-handlers-create-wrapper directory-files (url &optional full match nosort))
 (url-handlers-create-wrapper file-truename (url &optional counter prev-dirs))
 
-(add-hook 'find-file-hook 'url-handlers-set-buffer-mode)
+(add-hook 'find-file-hook #'url-handlers-set-buffer-mode)
 
 (defun url-handlers-set-buffer-mode ()
   "Set correct modes for the current buffer if visiting a remote file."
-  (and (stringp buffer-file-name)
-       (string-match url-handler-regexp buffer-file-name)
+  (and buffer-file-name
+       (string-match-p url-handler-regexp buffer-file-name)
        (auto-save-mode 0)))
 
 (provide 'url-handlers)
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 662b666..a11f514 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1999, 2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, data, processes
 
 ;; This file is part of GNU Emacs.
@@ -530,6 +529,23 @@ work correctly."
 (declare-function gnutls-peer-status "gnutls.c" (proc))
 (declare-function gnutls-negotiate "gnutls.el" t t)
 
+(defun url-http--insert-file-helper (buffer url &optional visit)
+  (with-current-buffer buffer
+    (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
+      ;; support, e.g., 'browse-url-emacs', which is a fancy way of
+      ;; visiting the HTML source of a URL: in that case, we want to
+      ;; display a file buffer even if the URL does not exist and
+      ;; 'url-retrieve-synchronously' returns 404 or whatever.
+      (unless (or visit
+                  (and (>= url-http-response-status 200)
+                       (< url-http-response-status 300)))
+        (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
+          (kill-buffer buffer)
+          ;; Signal file-error per bug#16733.
+          (signal 'file-error (list url desc)))))))
+
 (defun url-http-parse-headers ()
  "Parse and handle HTTP specific headers.
 Return t if and only if the current buffer is still active and
@@ -1080,10 +1096,16 @@ the end of the document."
          (if no-initial-crlf (skip-chars-forward "\r\n"))
          (if (not (looking-at regexp))
              (progn
-          ;; Must not have received the entirety of the chunk header,
+               ;; Must not have received the entirety of the chunk header,
                ;; need to spin some more.
                (url-http-debug "Did not see start of chunk @ %d!" (point))
                (setq read-next-chunk nil))
+            ;; The data we got may have started in the middle of the
+            ;; initial chunk header, so move back to the start of the
+            ;; line and re-compute.
+            (when (= url-http-chunked-counter 0)
+              (beginning-of-line)
+              (looking-at regexp))
            (add-text-properties (match-beginning 0) (match-end 0)
                                 (list 'start-open t
                                       'end-open t
@@ -1099,8 +1121,7 @@ the end of the document."
                                          (or url-http-chunked-start
                                              (make-marker))
                                          (match-end 0)))
-;          (if (not url-http-debug)
-               (delete-region (match-beginning 0) (match-end 0));)
+           (delete-region (match-beginning 0) (match-end 0))
            (url-http-debug "Saw start of chunk %d (length=%d, start=%d"
                            url-http-chunked-counter url-http-chunked-length
                            (marker-position url-http-chunked-start))
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 5b83506..dbcc9a6 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Bill Perry <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, data, processes
 
 ;; This file is part of GNU Emacs.
@@ -543,6 +542,7 @@ This uses `url-current-object', set locally to the buffer."
 (defun url-get-url-at-point (&optional pt)
   "Get the URL closest to point, but don't change position.
 Has a preference for looking backward when not directly on a symbol."
+  (declare (obsolete thing-at-point-url-at-point "27.1"))
   ;; Not at all perfect - point must be right in the name.
   (save-excursion
     (if pt (goto-char pt))
diff --git a/lisp/url/url.el b/lisp/url/url.el
index ed09477..eafac8a 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author: Bill Perry <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: comm, data, processes, hypermedia
 
 ;; This file is part of GNU Emacs.
@@ -136,9 +135,11 @@ STATUS is a plist representing what happened during the 
request,
 with most recent events first, or an empty list if no events have
 occurred.  Each pair is one of:
 
-\(:redirect REDIRECTED-TO) - the request was redirected to this URL
-\(:error (ERROR-SYMBOL . DATA)) - an error occurred.  The error can be
-signaled with (signal ERROR-SYMBOL DATA).
+\(:redirect REDIRECTED-TO) - the request was redirected to this URL.
+
+\(:error (error type . DATA)) - an error occurred.  TYPE is a
+symbol that says something about where the error occurred, and
+DATA is a list (possibly nil) that describes the error further.
 
 Return the buffer URL will load into, or nil if the process has
 already completed (i.e. URL was a mailto URL or similar; in this case
diff --git a/lisp/userlock.el b/lisp/userlock.el
index f077bc9..c4178ac 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -4,7 +4,6 @@
 
 ;; Author: Richard King
 ;; (according to authors.el)
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index f9efd44..5cd4f46 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985-1986, 1988, 1993-1994, 1997-1998, 2000-2019 Free
 ;; Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: vc tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index 02c08af..2811d46 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: convenience files vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index a26e9ee..0d5dc0e 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -283,6 +283,14 @@ well."
 ;;;; font-lock support
 ;;;;
 
+;; Note: The colors used in a color-rich environments (a GUI or in a
+;; terminal supporting 24 bit colors) doesn't render well in terminal
+;; supporting only 256 colors.  Concretely, both #ffeeee
+;; (diff-removed) and #eeffee (diff-added) are mapped to the same
+;; greyish color.  "min-colors 257" ensures that those colors are not
+;; used terminals supporting only 256 colors.  However, any number
+;; between 257 and 2^24 (16777216) would do.
+
 (defface diff-header
   '((((class color) (min-colors 88) (background light))
      :background "grey85")
@@ -314,8 +322,10 @@ well."
 (defface diff-removed
   '((default
      :inherit diff-changed)
-    (((class color) (min-colors 88) (background light))
+    (((class color) (min-colors 257) (background light))
      :background "#ffeeee")
+    (((class color) (min-colors 88) (background light))
+     :background "#ffdddd")
     (((class color) (min-colors 88) (background dark))
      :background "#553333")
     (((class color))
@@ -325,8 +335,10 @@ well."
 (defface diff-added
   '((default
      :inherit diff-changed)
-    (((class color) (min-colors 88) (background light))
+    (((class color) (min-colors 257) (background light))
      :background "#eeffee")
+    (((class color) (min-colors 88) (background light))
+     :background "#ddffdd")
     (((class color) (min-colors 88) (background dark))
      :background "#335533")
     (((class color))
@@ -2040,8 +2052,10 @@ For use in `add-log-current-defun-function'."
 (defface diff-refine-removed
   '((default
      :inherit diff-refine-changed)
-    (((class color) (min-colors 88) (background light))
+    (((class color) (min-colors 257) (background light))
      :background "#ffcccc")
+    (((class color) (min-colors 88) (background light))
+     :background "#ffbbbb")
     (((class color) (min-colors 88) (background dark))
      :background "#aa2222"))
   "Face used for removed characters shown by `diff-refine-hunk'."
@@ -2050,8 +2064,10 @@ For use in `add-log-current-defun-function'."
 (defface diff-refine-added
   '((default
      :inherit diff-refine-changed)
-    (((class color) (min-colors 88) (background light))
+    (((class color) (min-colors 257) (background light))
      :background "#bbffbb")
+    (((class color) (min-colors 88) (background light))
+     :background "#aaffaa")
     (((class color) (min-colors 88) (background dark))
      :background "#22aa22"))
   "Face used for added characters shown by `diff-refine-hunk'."
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 523be87..bee3659 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -5,7 +5,6 @@
 
 ;; Author: Frank Bresz
 ;; (according to authors.el)
-;; Maintainer: address@hidden
 ;; Keywords: unix, vc, tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 4178b5a..70c03b5 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -297,11 +297,24 @@ program."
              ;; file names. This is a heuristic intended to improve guessing
              (let ((default-directory (file-name-directory filename)))
                (unless (or (file-name-absolute-p base-dir1)
-                           (file-name-absolute-p base-dir2)
-                           (not (file-exists-p base-dir1))
-                           (not (file-exists-p base-dir2)))
-                 (setq base-dir1 ""
-                       base-dir2 "")))
+                           (file-name-absolute-p base-dir2))
+                 (if (and (file-exists-p base-dir1)
+                          (file-exists-p base-dir2))
+                     (setq base-dir1 ""
+                           base-dir2 "")
+                   ;; Strip possible source/destination prefixes
+                   ;; such as a/ and b/ from dir names.
+                   (save-match-data
+                     (let ((m1 (when (string-match "^[^/]+/" base-dir1)
+                                  (cons (substring base-dir1 0 (match-end 0))
+                                        (substring base-dir1 (match-end 0)))))
+                           (m2 (when (string-match "^[^/]+/" base-dir2)
+                                 (cons (substring base-dir2 0 (match-end 0))
+                                        (substring base-dir2 (match-end 0))))))
+                       (when (and (file-exists-p (cdr m1))
+                                  (file-exists-p (cdr m2)))
+                         (setq base-dir1 (car m1)
+                               base-dir2 (car m2))))))))
              (or (string= (car proposed-file-names) "/dev/null")
                  (setcar proposed-file-names
                          (ediff-file-name-sans-prefix
@@ -325,8 +338,8 @@ program."
     (mapc (lambda (session-info)
            (let ((proposed-file-names
                   (ediff-get-session-objA-name session-info)))
-             (if (and (string-match "^/null/" (car proposed-file-names))
-                      (string-match "^/null/" (cdr proposed-file-names)))
+             (if (and (string-match-p "^/null/" (car proposed-file-names))
+                      (string-match-p "^/null/" (cdr proposed-file-names)))
                  ;; couldn't intuit the file name to patch, so
                  ;; something is amiss
                  (progn
@@ -574,7 +587,7 @@ optional argument, then use it."
        (ediff-patch-file-internal
         patch-buf
         (if (and ediff-patch-map
-                 (not (string-match
+                 (not (string-match-p
                        "^/dev/null"
                        ;; this is the file to patch
                        (ediff-get-session-objA-name (car ediff-patch-map))))
@@ -677,7 +690,7 @@ optional argument, then use it."
         target-buf buf-to-patch file-name-magic-p
         patch-return-code ctl-buf backup-style aux-wind)
 
-    (if (string-match "V" ediff-patch-options)
+    (if (string-match-p "V" ediff-patch-options)
        (error
         "Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))
 
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index e47fad8..0b57e1d 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -585,6 +585,13 @@ point, get the diff between the revision at point and its
 previous revision.  Otherwise, get the diff between the revisions
 where the region starts and ends.
 
+When the beginning of the region is on the top line that has no revision,
+use the current working revision as the first revision to compare.
+
+When the end of the region is on the bottom non-revision line after
+the last revision line, use the previous revision of the last
+displayed revision as the second revision to compare.
+
 Unlike `log-view-diff-changeset', this function only shows the
 part of the changeset which affected the currently considered
 file(s)."
@@ -600,6 +607,13 @@ point, get the diff between the revision at point and its
 previous revision.  Otherwise, get the diff between the revisions
 where the region starts and ends.
 
+When the beginning of the region is on the top line that has no revision,
+use the current working revision as the first revision to compare.
+
+When the end of the region is on the bottom non-revision line after
+the last revision line, use the previous revision of the last
+displayed revision as the second revision to compare.
+
 Unlike `log-view-diff' this function shows the whole changeset,
 including changes affecting other files than the currently
 considered file(s)."
@@ -618,10 +632,11 @@ considered file(s)."
     ;; When TO and FR are the same, or when point is on a line after
     ;; the last entry, look at the previous revision.
     (when (or (string-equal fr to)
-              (>= (point)
+              (>= end
                   (save-excursion
-                    (goto-char (car fr-entry))
-                    (forward-line))))
+                    (goto-char end)
+                    (log-view-end-of-defun)
+                    (point))))
       (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil 
fr)))
     (vc-diff-internal
      t (list log-view-vc-backend
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index 8483813..15f234f 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:     Martin Lorentzson  <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: vc tools
 ;; Package: vc
 
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index ab5a449..3ab8c49 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -4,7 +4,6 @@
 
 ;; Author: Dave Love <address@hidden>
 ;;        Riccardo Murri <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: vc tools
 ;; Created: Sept 2006
 ;; Package: vc
@@ -702,7 +701,7 @@ or a superior directory.")
   (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
   (require 'add-log)
   (set (make-local-variable 'log-view-per-file-logs) nil)
-  (set (make-local-variable 'log-view-file-re) "\\`a\\`")
+  (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
   (set (make-local-variable 'log-view-message-re)
        (if (eq vc-log-view-type 'short)
           "^ *\\([0-9.]+\\): \\(.*?\\)[ 
\t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
@@ -1319,7 +1318,8 @@ stream.  Standard error output is discarded."
      ((string-match "\\`annotate:" string)
       (completion-table-with-context
        (substring string 0 (match-end 0))
-       (apply-partially #'completion-table-with-terminator '(":" . "\\`a\\`")
+       (apply-partially #'completion-table-with-terminator
+                        (cons ":" regexp-unmatchable)
                         #'completion-file-name-table)
        (substring string (match-end 0)) pred action))
 
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 626e190..cc1845a 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1995, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
-;; Maintainer:  address@hidden
 ;; Package: vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index edbb83f..579448b 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
-;; Maintainer: address@hidden
 ;; Keywords: vc tools
 ;; Package: vc
 
@@ -324,7 +323,8 @@ case, and the process object in the asynchronous case."
                       (apply 'start-file-process command (current-buffer)
                               command squeezed))))
                (when vc-command-messages
-                 (message "Running in background: %s" full-command))
+                 (let ((inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+                   (message "Running in background: %s" full-command)))
                 ;; Get rid of the default message insertion, in case we don't
                 ;; set a sentinel explicitly.
                (set-process-sentinel proc #'ignore)
@@ -332,11 +332,13 @@ case, and the process object in the asynchronous case."
                (setq status proc)
                (when vc-command-messages
                  (vc-run-delayed
-                   (let ((message-truncate-lines t))
+                   (let ((message-truncate-lines t)
+                         (inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
                      (message "Done in background: %s" full-command)))))
            ;; Run synchronously
            (when vc-command-messages
-             (message "Running in foreground: %s" full-command))
+             (let ((inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+               (message "Running in foreground: %s" full-command)))
            (let ((buffer-undo-list t))
              (setq status (apply 'process-file command nil t nil squeezed)))
            (when (and (not (eq t okstatus))
@@ -350,7 +352,8 @@ case, and the process object in the asynchronous case."
                     (if (integerp status) (format "status %d" status) status)
                     full-command))
            (when vc-command-messages
-             (message "Done (status=%d): %s" status full-command))))
+             (let ((inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+               (message "Done (status=%d): %s" status full-command)))))
        (vc-run-delayed
          (run-hook-with-args 'vc-post-command-functions
                              command file-or-list flags))
diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el
index f05e8ef..37c71f9 100644
--- a/lisp/vc/vc-filewise.el
+++ b/lisp/vc/vc-filewise.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
-;; Maintainer: address@hidden
 ;; Package: vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 192e6cf..b6feb3b 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1017,8 +1017,8 @@ If LIMIT is a revision string, use it as an end-revision."
     ;; If the buffer exists from a previous invocation it might be
     ;; read-only.
     (let ((inhibit-read-only t))
-      (with-current-buffer
-          buffer
+      (with-current-buffer buffer
+       (insert "\n")
        (apply 'vc-git-command buffer
               'async files
               (append
@@ -1087,7 +1087,7 @@ If LIMIT is a revision string, use it as an end-revision."
 (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
   (require 'add-log) ;; We need the faces add-log.
   ;; Don't have file markers, so use impossible regexp.
-  (set (make-local-variable 'log-view-file-re) "\\`a\\`")
+  (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
   (set (make-local-variable 'log-view-per-file-logs) nil)
   (set (make-local-variable 'log-view-message-re)
        (if (not (eq vc-log-view-type 'long))
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index d3f132d..f1b603b 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Ivan Kanis
-;; Maintainer: address@hidden
 ;; Keywords: vc tools
 ;; Package: vc
 
@@ -444,7 +443,7 @@ If LIMIT is non-nil, show no more than this many entries."
 
 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
   (require 'add-log) ;; we need the add-log faces
-  (set (make-local-variable 'log-view-file-re) "\\`a\\`")
+  (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
   (set (make-local-variable 'log-view-per-file-logs) nil)
   (set (make-local-variable 'log-view-message-re)
        (if (eq vc-log-view-type 'short)
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 07b3d86..1871e1e 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
-;; Maintainer: address@hidden
 ;; Package: vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el
index f0b1248..91cc280 100644
--- a/lisp/vc/vc-mtn.el
+++ b/lisp/vc/vc-mtn.el
@@ -240,7 +240,7 @@ If LIMIT is non-nil, show no more than this many entries."
 
 (define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View"
   ;; Don't match anything.
-  (set (make-local-variable 'log-view-file-re) "\\`a\\`")
+  (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
   (set (make-local-variable 'log-view-per-file-logs) nil)
   ;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives
   ;; in the ChangeLog text.
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 598e982..ee227b1 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
-;; Maintainer: address@hidden
 ;; Package: vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 4e9f5a0..0d27528 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
-;; Maintainer: address@hidden
 ;; Package: vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index f847592..b708cd4 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
-;; Maintainer: address@hidden
 ;; Package: vc
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index b992a8e..d9fb829 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1992-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
-;; Maintainer: address@hidden
 ;; Keywords: vc tools
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vcursor.el b/lisp/vcursor.el
index 3e8b6ee..7673d9b 100644
--- a/lisp/vcursor.el
+++ b/lisp/vcursor.el
@@ -4,7 +4,6 @@
 ;; Inc.
 
 ;; Author:   Peter Stephenson <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: virtual cursor, convenience
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/version.el b/lisp/version.el
index d13d8c3..d5bc3eb 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1992, 1994-1995, 1999-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
diff --git a/lisp/view.el b/lisp/view.el
index e74ce1e..c8d5f0d 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -4,7 +4,6 @@
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: address@hidden
 ;; Keywords: files
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/vt100-led.el b/lisp/vt100-led.el
index d7b5f0a..6678f49 100644
--- a/lisp/vt100-led.el
+++ b/lisp/vt100-led.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
-;; Maintainer: address@hidden
 ;; Keywords: hardware
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index 8762fe7..443a995 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -305,6 +305,9 @@ names."
 
 ;;;; System name and version for emacsbug.el
 
+(declare-function w32-version "w32-win" ())
+(declare-function w32-read-registry "w32fns" (root key name))
+
 (defun w32--os-description ()
   "Return a string describing the underlying OS and its version."
   (let* ((w32ver (car (w32-version)))
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index b9f98cd..713c857 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1996-1997, 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: extensions
 ;; Package: emacs
 
diff --git a/lisp/window.el b/lisp/window.el
index b4f5ac5..7e6a484 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 1985, 1989, 1992-1994, 2000-2019 Free Software
 ;; Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Keywords: internal
 ;; Package: emacs
 
@@ -7534,6 +7533,152 @@ be added to ALIST."
       (unless (cdr (assq 'inhibit-switch-frame alist))
        (window--maybe-raise-frame frame)))))
 
+(defun windows-sharing-edge (&optional window edge within)
+  "Return list of live windows sharing the same edge with WINDOW.
+WINDOW must be a valid window and defaults to the selected one.
+EDGE stands for the edge to share and must be either 'left',
+'above', 'right' or 'below'.  Omitted or nil, EDGE defaults to
+'left'.
+
+WITHIN nil means to find a live window that shares the opposite
+EDGE with WINDOW.  For example, if EDGE equals 'left', WINDOW has
+to share (part of) the right edge of any window returned.  WITHIN
+non-nil means to find all live windows that share the same EDGE
+with WINDOW (Window must be internal in this case).  So if EDGE
+equals 'left', WINDOW's left edge has to fully encompass the left
+edge of any window returned."
+  (setq window (window-normalize-window window))
+  (setq edge (or edge 'left))
+  (when (and within (window-live-p window))
+    (error "Cannot share edge from within live window %s" window))
+  (let ((window-edges (window-edges window nil nil t))
+       (horizontal (memq edge '(left right)))
+       (n (pcase edge
+            ('left 0) ('above 1) ('right 2) ('below 3))))
+    (unless (numberp n)
+      (error "Invalid EDGE %s" edge))
+    (let ((o (mod (+ 2 n) 4))
+         (p (if horizontal 1 0))
+         (q (if horizontal 3 2))
+         windows)
+      (walk-window-tree
+       (lambda (other)
+        (let ((other-edges (window-edges other nil nil t)))
+          (when (and (not (eq window other))
+                     (= (nth n window-edges)
+                        (nth (if within n o) other-edges))
+                     (cond
+                      ((= (nth p window-edges) (nth p other-edges)))
+                      ((< (nth p window-edges) (nth p other-edges))
+                       (< (nth p other-edges) (nth q window-edges)))
+                      (t
+                       (< (nth p window-edges) (nth q other-edges)))))
+            (setq windows (cons other windows)))))
+       (window-frame window) nil 'nomini)
+      (reverse windows))))
+
+(defun window--try-to-split-window-in-direction (window direction alist)
+  "Try to split WINDOW in DIRECTION.
+DIRECTION is passed as SIDE argument to `split-window-no-error'.
+ALIST is a buffer display alist."
+  (and (not (frame-parameter (window-frame window) 'unsplittable))
+       (let* ((window-combination-limit
+              ;; When `window-combination-limit' equals
+              ;; `display-buffer' or equals `resize-window' and a
+              ;; `window-height' or `window-width' alist entry are
+              ;; present, bind it to t so resizing steals space
+              ;; preferably from the window that was split.
+              (if (or (eq window-combination-limit 'display-buffer)
+                      (and (eq window-combination-limit 'window-size)
+                           (or (cdr (assq 'window-height alist))
+                               (cdr (assq 'window-width alist)))))
+                  t
+                window-combination-limit))
+             (new-window (split-window-no-error window nil direction)))
+        (and (window-live-p new-window) new-window))))
+
+(defun display-buffer-in-direction (buffer alist)
+  "Try to display BUFFER in a direction specified by ALIST.
+ALIST has to contain a 'direction' entry whose value should be
+one of 'left', 'above' (or 'up'), 'right', and 'below' (or
+'down').  Other values are usually interpreted as 'below'.
+
+If ALIST also contains a 'window' entry, its value specifies a
+reference window.  That value can be a special symbol like
+'main' (which stands for the selected frame's main window) or
+'root' (standings for the selected frame's root window) or an
+arbitrary valid window.  Any other value (or omitting the
+'window' entry) means to use the selected window as reference
+window.
+
+This function tries to reuse or split a window such that the
+window produced this way is on the side of the reference window
+specified by the 'direction' entry.
+
+Four special values for 'direction' entries allow to implicitly
+specify the selected frame's main window as reference window:
+'leftmost', 'top', 'rightmost' and 'bottom'.  Hence, instead of
+'(direction . left) (window . main)' one can simply write
+'(direction . leftmost)'."
+  (let ((direction (cdr (assq 'direction alist))))
+    (when direction
+      (let ((window (cdr (assq 'window alist)))
+           within windows other-window-shows-buffer other-window)
+       ;; Sanitize WINDOW.
+       (cond
+        ((or (eq window 'main)
+              (memq direction '(top bottom leftmost rightmost)))
+         (setq window (window-main-window)))
+        ((eq window 'root)
+         (setq window (frame-root-window)))
+        ((window-valid-p window))
+        (t
+         (setq window (selected-window))))
+       (setq within (not (window-live-p window)))
+       ;; Sanitize DIRECTION
+       (cond
+        ((memq direction '(left above right below)))
+        ((eq direction 'leftmost)
+         (setq direction 'left))
+        ((memq direction '(top up))
+         (setq direction 'above))
+        ((eq direction 'rightmost)
+         (setq direction 'right))
+        ((memq direction '(bottom down))
+         (setq direction 'below))
+        (t
+         (setq direction 'below)))
+
+       (setq alist
+             (append alist
+                     `(,(if temp-buffer-resize-mode
+                            '(window-height . resize-temp-buffer-window)
+                          '(window-height . fit-window-to-buffer))
+                       ,(when temp-buffer-resize-mode
+                          '(preserve-size . (nil . t))))))
+
+       (setq windows (windows-sharing-edge window direction within))
+       (dolist (other windows)
+         (cond
+          ((and (not other-window-shows-buffer)
+                (eq buffer (window-buffer other)))
+           (setq other-window-shows-buffer t)
+           (setq other-window other))
+          ((not other-window)
+           (setq other-window other))))
+       (or (and other-window-shows-buffer
+                (window--display-buffer buffer other-window 'reuse alist))
+           (and (setq other-window
+                      (window--try-to-split-window-in-direction
+                       window direction alist))
+                (window--display-buffer buffer other-window 'window alist))
+           (and (setq window other-window)
+                (not (window-dedicated-p other-window))
+                (not (window-minibuffer-p other-window))
+                (window--display-buffer buffer other-window 'reuse alist)))))))
+
+;; This should be rewritten as
+;; (display-buffer-in-direction buffer (cons '(direction . below) alist))
 (defun display-buffer-below-selected (buffer alist)
   "Try displaying BUFFER in a window below the selected window.
 If there is a window below the selected one and that window
@@ -7589,6 +7734,8 @@ must also contain a 'window-height' entry with the same 
value."
         (display-buffer--maybe-pop-up-frame buffer alist)
         (display-buffer-at-bottom buffer alist))))
 
+;; This should be rewritten as
+;; (display-buffer-in-direction buffer (cons '(direction . bottom) alist))
 (defun display-buffer-at-bottom (buffer alist)
   "Try displaying BUFFER in a window at the bottom of the selected frame.
 This either reuses such a window provided it shows BUFFER
diff --git a/lisp/woman.el b/lisp/woman.el
index 39d9b80..5735447 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Francis J. Wright <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: help, unix
 ;; Adapted-By: Eli Zaretskii <address@hidden>
 ;; Version: 0.551
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index e4e2dec..31d409c 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: window, drag, drop
 ;; Package: emacs
 
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index e0488a5..6bb9f8f 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 17
+# manywarnings.m4 serial 18
 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,
@@ -112,16 +112,19 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
   gl_manywarn_set=
   for gl_manywarn_item in -fno-common \
     -W \
+    -Wabsolute-value \
     -Waddress \
+    -Waddress-of-packed-member \
     -Waggressive-loop-optimizations \
     -Wall \
-    -Wattribute-alias \
+    -Wattribute-warning \
     -Wattributes \
     -Wbad-function-cast \
     -Wbool-compare \
     -Wbool-operation \
     -Wbuiltin-declaration-mismatch \
     -Wbuiltin-macro-redefined \
+    -Wcannot-profile \
     -Wcast-align \
     -Wcast-align=strict \
     -Wcast-function-type \
@@ -186,6 +189,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
     -Wmissing-field-initializers \
     -Wmissing-include-dirs \
     -Wmissing-parameter-type \
+    -Wmissing-profile \
     -Wmissing-prototypes \
     -Wmultichar \
     -Wmultistatement-macros \
@@ -292,6 +296,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
   AC_MSG_RESULT([$gl_alloc_max])
   gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max"
   gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
+  gl_manywarn_set="$gl_manywarn_set -Wattribute-alias=2"
   gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2"
   gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2"
   gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5"
diff --git a/make-dist b/make-dist
index 7466003..e4e6d40 100755
--- a/make-dist
+++ b/make-dist
@@ -52,7 +52,7 @@ make_tar=no
 default_gzip=gzip
 newer=""
 with_info=yes
-with_tests=no
+with_tests=yes
 changelog=yes
 verbose=no
 
@@ -110,11 +110,16 @@ while [ $# -gt 0 ]; do
      ;;
 
     ## Include the test/ directory.
-    ## This option is mainly for the hydra build server.
+    ## This is for backward compability to when --no-tests was the default.
     "--tests")
       with_tests=yes
      ;;
 
+    ## Exclude the test/ directory.
+    "--no-tests")
+      with_tests=no
+     ;;
+
     "--verbose")
       verbose=yes
      ;;
@@ -131,9 +136,9 @@ while [ $# -gt 0 ]; do
       echo "  --no-update      don't recompile or do analogous things"
       echo "  --no-changelog   don't generate the top-level ChangeLog"
       echo "  --no-info                don't include info files"
+      echo "  --no-tests       don't include the test/ directory"
       echo "  --snapshot       same as --clean-up --no-update --tar --no-check"
       echo "  --tar            make a tar file"
-      echo "  --tests  include the test/ directory"
       echo "  --verbose                noisier output"
       echo ""
       exit 0
diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64
index 994c567..4583aed 100644
--- a/nt/INSTALL.W64
+++ b/nt/INSTALL.W64
@@ -139,10 +139,10 @@ which 'make install' will use - in this example we set it 
to C:\emacs\emacs-26.
 If a prefix is not specified the files will be put in the standard Unix
 directories located in your C:\msys64 directory, but this is not recommended.
 
-Note also that we need to disable Imagemagick and D-Bus because Emacs
-does not yet support them on Windows.
+Note also that we need to disable D-Bus because Emacs does not yet
+support them on Windows.
 
-  ./configure --prefix=/c/emacs/emacs-26 --without-imagemagick --without-dbus
+  ./configure --prefix=/c/emacs/emacs-26 --without-dbus
 
 ** Run make
 
diff --git a/src/.gdbinit b/src/.gdbinit
index b8b3031..8c9a227 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1059,8 +1059,10 @@ end
 define xprintsym
   xsymname $arg0
   xgetptr $symname
-  set $sym_name = (struct Lisp_String *) $ptr
-  xprintstr $sym_name
+  if $ptr != 0
+    set $sym_name = (struct Lisp_String *) $ptr
+    xprintstr $sym_name
+  end
 end
 document xprintsym
   Print argument as a symbol.
diff --git a/src/alloc.c b/src/alloc.c
index 948a0e8..af4adb3 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1447,9 +1447,7 @@ mark_interval_tree (INTERVAL i)
 
 #define LARGE_STRING_BYTES 1024
 
-/* The SDATA typedef is a struct or union describing string memory
-   sub-allocated from an sblock.  This is where the contents of Lisp
-   strings are stored.  */
+/* The layout of a nonnull string.  */
 
 struct sdata
 {
@@ -1468,13 +1466,8 @@ struct sdata
   unsigned char data[FLEXIBLE_ARRAY_MEMBER];
 };
 
-#ifdef GC_CHECK_STRING_BYTES
-
-typedef struct sdata sdata;
-#define SDATA_NBYTES(S)        (S)->nbytes
-#define SDATA_DATA(S)  (S)->data
-
-#else
+/* A union describing string memory sub-allocated from an sblock.
+   This is where the contents of Lisp strings are stored.  */
 
 typedef union
 {
@@ -1502,8 +1495,6 @@ typedef union
 #define SDATA_NBYTES(S)        (S)->n.nbytes
 #define SDATA_DATA(S)  ((struct sdata *) (S))->data
 
-#endif /* not GC_CHECK_STRING_BYTES */
-
 enum { SDATA_DATA_OFFSET = offsetof (struct sdata, data) };
 
 /* Structure describing a block of memory which is sub-allocated to
@@ -1586,31 +1577,20 @@ static char const 
string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 # define GC_STRING_OVERRUN_COOKIE_SIZE 0
 #endif
 
-/* Value is the size of an sdata structure large enough to hold NBYTES
-   bytes of string data.  The value returned includes a terminating
-   NUL byte, the size of the sdata structure, and padding.  */
-
-#ifdef GC_CHECK_STRING_BYTES
-
-#define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, (NBYTES) + 1)
+/* Return the size of an sdata structure large enough to hold N bytes
+   of string data.  This counts the sdata structure, the N bytes, a
+   terminating NUL byte, and alignment padding.  */
 
-#else /* not GC_CHECK_STRING_BYTES */
-
-/* The 'max' reserves space for the nbytes union member even when NBYTES + 1 is
-   less than the size of that member.  The 'max' is not needed when
-   SDATA_DATA_OFFSET is a multiple of FLEXALIGNOF (struct sdata),
-   because then the alignment code reserves enough space.  */
-
-#define SDATA_SIZE(NBYTES)                                   \
-     ((SDATA_DATA_OFFSET                                     \
-       + (SDATA_DATA_OFFSET % FLEXALIGNOF (struct sdata) == 0 \
-         ? NBYTES                                            \
-         : max (NBYTES, FLEXALIGNOF (struct sdata) - 1))     \
-       + 1                                                   \
-       + FLEXALIGNOF (struct sdata) - 1)                     \
-      & ~(FLEXALIGNOF (struct sdata) - 1))
-
-#endif /* not GC_CHECK_STRING_BYTES */
+static ptrdiff_t
+sdata_size (ptrdiff_t n)
+{
+  /* Reserve space for the nbytes union member even when N + 1 is less
+     than the size of that member.  */
+  ptrdiff_t unaligned_size = max (SDATA_DATA_OFFSET + n + 1,
+                                 sizeof (sdata));
+  int sdata_align = max (FLEXALIGNOF (struct sdata), alignof (sdata));
+  return (unaligned_size + sdata_align - 1) & ~(sdata_align - 1);
+}
 
 /* Extra bytes to allocate for each string.  */
 #define GC_STRING_EXTRA GC_STRING_OVERRUN_COOKIE_SIZE
@@ -1664,21 +1644,14 @@ string_bytes (struct Lisp_String *s)
 static void
 check_sblock (struct sblock *b)
 {
-  sdata *from, *end, *from_end;
-
-  end = b->next_free;
+  sdata *end = b->next_free;
 
-  for (from = b->data; from < end; from = from_end)
+  for (sdata *from = b->data; from < end; )
     {
-      /* Compute the next FROM here because copying below may
-        overwrite data we need to compute it.  */
-      ptrdiff_t nbytes;
-
-      /* Check that the string size recorded in the string is the
-        same as the one recorded in the sdata structure.  */
-      nbytes = SDATA_SIZE (from->string ? string_bytes (from->string)
-                          : SDATA_NBYTES (from));
-      from_end = (sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
+      ptrdiff_t nbytes = sdata_size (from->string
+                                    ? string_bytes (from->string)
+                                    : SDATA_NBYTES (from));
+      from = (sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
     }
 }
 
@@ -1810,14 +1783,14 @@ allocate_string_data (struct Lisp_String *s,
 {
   sdata *data, *old_data;
   struct sblock *b;
-  ptrdiff_t needed, old_nbytes;
+  ptrdiff_t old_nbytes;
 
   if (STRING_BYTES_MAX < nbytes)
     string_overflow ();
 
   /* Determine the number of bytes needed to store NBYTES bytes
      of string data.  */
-  needed = SDATA_SIZE (nbytes);
+  ptrdiff_t needed = sdata_size (nbytes);
   if (s->u.s.data)
     {
       old_data = SDATA_OF_STRING (s);
@@ -2068,7 +2041,7 @@ compact_small_strings (void)
              nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from);
              eassert (nbytes <= LARGE_STRING_BYTES);
 
-             ptrdiff_t size = SDATA_SIZE (nbytes);
+             ptrdiff_t size = sdata_size (nbytes);
              sdata *from_end = (sdata *) ((char *) from
                                           + size + GC_STRING_EXTRA);
 
diff --git a/src/bignum.h b/src/bignum.h
index 4c670bd..743a18f 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -94,6 +94,18 @@ bignum_integer (mpz_t *tmp, Lisp_Object i)
   return &XBIGNUM (i)->value;
 }
 
+/* Set RESULT to the value stored in the Lisp integer I.  If I is a
+   big integer, copy it to RESULT.  RESULT must already be
+   initialized.  */
+INLINE void
+mpz_set_integer (mpz_t result, Lisp_Object i)
+{
+  if (FIXNUMP (i))
+    mpz_set_intmax (result, XFIXNUM (i));
+  else
+    mpz_set (result, XBIGNUM (i)->value);
+}
+
 INLINE_HEADER_END
 
 #endif /* BIGNUM_H */
diff --git a/src/buffer.c b/src/buffer.c
index ab47748..209e29f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2264,7 +2264,7 @@ validate_region (register Lisp_Object *b, register 
Lisp_Object *e)
 /* Advance BYTE_POS up to a character boundary
    and return the adjusted position.  */
 
-static ptrdiff_t
+ptrdiff_t
 advance_to_char_boundary (ptrdiff_t byte_pos)
 {
   int c;
@@ -2702,6 +2702,9 @@ current buffer is cleared.  */)
 
       /* Do this last, so it can calculate the new correspondences
         between chars and bytes.  */
+      /* FIXME: Is it worth the trouble, really?  Couldn't we just throw
+         away all the text-properties instead of trying to guess how
+         to adjust them?  AFAICT the result is not reliable anyway.  */
       set_intervals_multibyte (1);
     }
 
@@ -5600,17 +5603,17 @@ Use the command `abbrev-mode' to change this variable.  
*/);
                     doc: /* Non-nil if searches and matches should ignore 
case.  */);
 
   DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Column beyond which automatic line-wrapping should 
happen.
 Interactively, you can set the buffer local value using \\[set-fill-column].  
*/);
 
   DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Column for the default `indent-line-function' to 
indent to.
 Linefeed indents to this column in Fundamental mode.  */);
 
   DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Distance between tab stops (for display of tab 
characters), in columns.
 NOTE: This controls the display width of a TAB character, and not
 the size of an indentation step.
@@ -5781,7 +5784,7 @@ If it is nil, that means don't auto-save this buffer.  
*/);
 Backing up is done before the first time the file is saved.  */);
 
   DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Length of current buffer when last read in, saved 
or auto-saved.
 0 initially.
 -1 means auto-saving turned off until next real save.
@@ -5855,7 +5858,7 @@ In addition, a char-table has six extra slots to control 
the display of:
 See also the functions `display-table-slot' and `set-display-table-slot'.  */);
 
   DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, 
left_margin_cols),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Width in columns of left marginal area for display 
of a buffer.
 A value of nil means no marginal area.
 
@@ -5863,7 +5866,7 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, 
right_margin_cols),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Width in columns of right marginal area for 
display of a buffer.
 A value of nil means no marginal area.
 
@@ -5871,7 +5874,7 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, 
left_fringe_width),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Width of this buffer's left fringe (in pixels).
 A value of 0 means no left fringe is shown in this buffer's window.
 A value of nil means to use the left fringe width from the window's frame.
@@ -5880,7 +5883,7 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, 
right_fringe_width),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Width of this buffer's right fringe (in pixels).
 A value of 0 means no right fringe is shown in this buffer's window.
 A value of nil means to use the right fringe width from the window's frame.
@@ -5897,12 +5900,12 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, 
scroll_bar_width),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Width of this buffer's vertical scroll bars in 
pixels.
 A value of nil means to use the scroll bar width from the window's frame.  */);
 
   DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, 
scroll_bar_height),
-                    Qfixnump,
+                    Qintegerp,
                     doc: /* Height of this buffer's horizontal scroll bars in 
pixels.
 A value of nil means to use the scroll bar height from the window's frame.  
*/);
 
@@ -6172,7 +6175,7 @@ Setting this variable is very fast, much faster than 
scanning all the text in
 the buffer looking for properties to change.  */);
 
   DEFVAR_PER_BUFFER ("buffer-display-count",
-                    &BVAR (current_buffer, display_count), Qfixnump,
+                    &BVAR (current_buffer, display_count), Qintegerp,
                     doc: /* A number incremented each time this buffer is 
displayed in a window.
 The function `set-window-buffer' increments it.  */);
 
diff --git a/src/buffer.h b/src/buffer.h
index f42c3e9..2080a6f 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -327,6 +327,10 @@ extern void enlarge_buffer_text (struct buffer *, 
ptrdiff_t);
 #define BYTE_TO_CHAR(bytepos)                  \
   (buf_bytepos_to_charpos (current_buffer, bytepos))
 
+/* For those very rare cases where you may have a "random" pointer into
+   the middle of a multibyte char, this moves to the next boundary.  */
+extern ptrdiff_t advance_to_char_boundary (ptrdiff_t byte_pos);
+
 /* Convert PTR, the address of a byte in the buffer, into a byte position.  */
 
 #define PTR_BYTE_POS(ptr) \
diff --git a/src/bytecode.c b/src/bytecode.c
index 4097779..6f601cf 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -562,7 +562,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
            /* Inline the most common case.  */
            if (SYMBOLP (sym)
                && !EQ (val, Qunbound)
-               && !XSYMBOL (sym)->u.s.redirect
+               && XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL
                && !SYMBOL_TRAPPED_WRITE_P (sym))
              SET_SYMBOL_VAL (XSYMBOL (sym), val);
            else
diff --git a/src/character.h b/src/character.h
index 5dff85a..cc57a2a 100644
--- a/src/character.h
+++ b/src/character.h
@@ -558,12 +558,13 @@ enum
 
 /* Return a non-outlandish value for the tab width.  */
 
-#define SANE_TAB_WIDTH(buf) \
-  sanitize_tab_width (XFIXNAT (BVAR (buf, tab_width)))
+#define SANE_TAB_WIDTH(buf) sanitize_tab_width (BVAR (buf, tab_width))
+
 INLINE int
-sanitize_tab_width (EMACS_INT width)
+sanitize_tab_width (Lisp_Object width)
 {
-  return 0 < width && width <= 1000 ? width : 8;
+  return (FIXNUMP (width) && 0 < XFIXNUM (width) && XFIXNUM (width) <= 1000
+         ? XFIXNUM (width) : 8);
 }
 
 /* Return the width of ASCII character C.  The width is measured by
diff --git a/src/coding.c b/src/coding.c
index 2c6b2c4..9cba649 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6353,6 +6353,29 @@ utf8_string_p (Lisp_Object string)
   return check_utf_8 (&coding) != -1;
 }
 
+/* Like make_string, but always returns a multibyte Lisp string, and
+   avoids decoding if TEXT encoded in UTF-8.  */
+
+Lisp_Object
+make_string_from_utf8 (const char *text, ptrdiff_t nbytes)
+{
+  ptrdiff_t chars, bytes;
+  parse_str_as_multibyte ((const unsigned char *) text, nbytes,
+                         &chars, &bytes);
+  /* If TEXT is a valid UTF-8 string, we can convert it to a Lisp
+     string directly.  Otherwise, we need to decode it.  */
+  if (chars == nbytes || bytes == nbytes)
+    return make_specified_string (text, chars, nbytes, true);
+  else
+    {
+      struct coding_system coding;
+      setup_coding_system (Qutf_8_unix, &coding);
+      coding.mode |= CODING_MODE_LAST_BLOCK;
+      coding.source = (const unsigned char *) text;
+      decode_coding_object (&coding, Qnil, 0, 0, nbytes, nbytes, Qt);
+      return coding.dst_object;
+    }
+}
 
 /* Detect how end-of-line of a text of length SRC_BYTES pointed by
    SOURCE is encoded.  If CATEGORY is one of
diff --git a/src/coding.h b/src/coding.h
index 0c03d1a..619ca29 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -695,6 +695,7 @@ extern Lisp_Object raw_text_coding_system (Lisp_Object);
 extern bool raw_text_coding_system_p (struct coding_system *);
 extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
 extern Lisp_Object complement_process_encoding_system (Lisp_Object);
+extern Lisp_Object make_string_from_utf8 (const char *, ptrdiff_t);
 
 extern void decode_coding_gap (struct coding_system *,
                               ptrdiff_t, ptrdiff_t);
@@ -762,6 +763,16 @@ surrogates_to_codepoint (int low, int high)
   return 0x10000 + (low - 0xDC00) + ((high - 0xD800) * 0x400);
 }
 
+/* Like build_string, but always returns a multibyte string, and is
+   optimized for speed when STR is a UTF-8 encoded text string.  */
+
+INLINE Lisp_Object
+build_string_from_utf8 (const char *str)
+{
+  return make_string_from_utf8 (str, strlen (str));
+}
+
+
 extern Lisp_Object preferred_coding_system (void);
 
 /* Coding system to be used to encode text for terminal display when
diff --git a/src/conf_post.h b/src/conf_post.h
index 7699d2c..4af1ba9 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -59,7 +59,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    into the same 1-, 2-, or 4-byte allocation unit in the MinGW
    builds.  It was also needed to port to pre-C99 compilers, although
    we don't care about that any more.  */
-#if NS_IMPL_GNUSTEP || defined(__MINGW32__)
+#if NS_IMPL_GNUSTEP || defined __MINGW32__
 typedef unsigned int bool_bf;
 #else
 typedef bool bool_bf;
@@ -225,7 +225,9 @@ extern void _DebPrint (const char *fmt, ...);
 extern char *emacs_getenv_TZ (void);
 extern int emacs_setenv_TZ (char const *);
 
-#if __has_attribute (cold)
+/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
+   <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. */
+#if __has_attribute (cold) && !defined __MINGW32__
 # define ATTRIBUTE_COLD __attribute__ ((cold))
 #else
 # define ATTRIBUTE_COLD
diff --git a/src/data.c b/src/data.c
index 7928a1d..c1699ae 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1122,20 +1122,21 @@ store_symval_forwarding (lispfwd valcontents, 
Lisp_Object newval,
        int offset = XBUFFER_OBJFWD (valcontents)->offset;
        Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate;
 
-       if (!NILP (newval))
+       if (!NILP (newval) && !NILP (predicate))
          {
-           if (SYMBOLP (predicate))
+           eassert (SYMBOLP (predicate));
+           Lisp_Object choiceprop = Fget (predicate, Qchoice);
+           if (!NILP (choiceprop))
              {
-               Lisp_Object prop;
-
-               if ((prop = Fget (predicate, Qchoice), !NILP (prop)))
-                 {
-                   if (NILP (Fmemq (newval, prop)))
-                     wrong_choice (prop, newval);
-                 }
-               else if ((prop = Fget (predicate, Qrange), !NILP (prop)))
+               if (NILP (Fmemq (newval, choiceprop)))
+                 wrong_choice (choiceprop, newval);
+             }
+           else
+             {
+               Lisp_Object rangeprop = Fget (predicate, Qrange);
+               if (CONSP (rangeprop))
                  {
-                   Lisp_Object min = XCAR (prop), max = XCDR (prop);
+                   Lisp_Object min = XCAR (rangeprop), max = XCDR (rangeprop);
                    if (! NUMBERP (newval)
                        || NILP (CALLN (Fleq, min, newval, max)))
                      wrong_range (min, max, newval);
@@ -1301,15 +1302,13 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, 
Lisp_Object where,
               enum Set_Internal_Bind bindflag)
 {
   bool voide = EQ (newval, Qunbound);
-  struct Lisp_Symbol *sym;
-  Lisp_Object tem1;
 
   /* If restoring in a dead buffer, do nothing.  */
   /* if (BUFFERP (where) && NILP (XBUFFER (where)->name))
       return; */
 
   CHECK_SYMBOL (symbol);
-  sym = XSYMBOL (symbol);
+  struct Lisp_Symbol *sym = XSYMBOL (symbol);
   switch (sym->u.s.trapped_write)
     {
     case SYMBOL_NOWRITE:
@@ -1328,9 +1327,10 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, 
Lisp_Object where,
                                    bindflag == SET_INTERNAL_UNBIND? Qunlet :
                                    voide? Qmakunbound : Qset),
                                   where);
-      /* FALLTHROUGH!  */
+      break;
+
     case SYMBOL_UNTRAPPED_WRITE:
-        break;
+      break;
 
     default: emacs_abort ();
     }
@@ -1363,8 +1363,9 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, 
Lisp_Object where,
 
            /* Find the new binding.  */
            XSETSYMBOL (symbol, sym); /* May have changed via aliasing.  */
-           tem1 = assq_no_quit (symbol,
-                                BVAR (XBUFFER (where), local_var_alist));
+           Lisp_Object tem1
+             = assq_no_quit (symbol,
+                             BVAR (XBUFFER (where), local_var_alist));
            set_blv_where (blv, where);
            blv->found = true;
 
@@ -1649,10 +1650,8 @@ void
 set_default_internal (Lisp_Object symbol, Lisp_Object value,
                       enum Set_Internal_Bind bindflag)
 {
-  struct Lisp_Symbol *sym;
-
   CHECK_SYMBOL (symbol);
-  sym = XSYMBOL (symbol);
+  struct Lisp_Symbol *sym = XSYMBOL (symbol);
   switch (sym->u.s.trapped_write)
     {
     case SYMBOL_NOWRITE:
@@ -1669,9 +1668,10 @@ set_default_internal (Lisp_Object symbol, Lisp_Object 
value,
           /* Setting due to thread switching doesn't count.  */
           && bindflag != SET_INTERNAL_THREAD_SWITCH)
         notify_variable_watchers (symbol, value, Qset_default, Qnil);
-      /* FALLTHROUGH!  */
+      break;
+
     case SYMBOL_UNTRAPPED_WRITE:
-        break;
+      break;
 
     default: emacs_abort ();
     }
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 0afae6b..850d176 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -346,7 +346,6 @@ xd_signature (char *signature, int dtype, int parent_type, 
Lisp_Object object)
   int subtype;
   Lisp_Object elt;
   char const *subsig;
-  int subsiglen;
   char x[DBUS_MAXIMUM_SIGNATURE_LENGTH];
 
   elt = object;
@@ -430,10 +429,9 @@ xd_signature (char *signature, int dtype, int parent_type, 
Lisp_Object object)
          elt = CDR_SAFE (XD_NEXT_VALUE (elt));
        }
 
-      subsiglen = snprintf (signature, DBUS_MAXIMUM_SIGNATURE_LENGTH,
-                           "%c%s", dtype, subsig);
-      if (! (0 <= subsiglen && subsiglen < DBUS_MAXIMUM_SIGNATURE_LENGTH))
-       string_overflow ();
+      signature[0] = dtype;
+      signature[1] = '\0';
+      xd_signature_cat (signature, subsig);
       break;
 
     case DBUS_TYPE_VARIANT:
diff --git a/src/dispextern.h b/src/dispextern.h
index 4d6d037..ec1c962 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -34,16 +34,45 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #ifdef HAVE_XRENDER
 # include <X11/extensions/Xrender.h>
 #endif
+
+typedef XColor Emacs_Color;
+typedef Cursor Emacs_Cursor;
+#define No_Cursor (None)
+typedef Pixmap Emacs_Pixmap;
+typedef XRectangle Emacs_Rectangle;
+typedef XGCValues Emacs_GC;
 #else /* !HAVE_X_WINDOWS */
 
-/* X-related stuff used by non-X gui code.  */
+/* XColor-like struct used by non-X code.  */
 
-typedef struct {
+typedef struct
+{
   unsigned long pixel;
   unsigned short red, green, blue;
-  char flags;
-  char pad;
-} XColor;
+} Emacs_Color;
+
+/* Accommodate X's usage of None as a null resource ID.  */
+#define No_Cursor (NULL)
+
+/* XRectangle-like struct used by non-X GUI code.  */
+typedef struct
+{
+  int x, y;
+  unsigned width, height;
+} Emacs_Rectangle;
+
+/* XGCValues-like struct used by non-X GUI code.  */
+typedef struct
+{
+  unsigned long foreground;
+  unsigned long background;
+} Emacs_GC;
+
+/* Mask values to select foreground/background.  */
+/* FIXME: The GC handling in w32 really should be redesigned as to not
+   need these.  */
+#define GCForeground 0x01
+#define GCBackground 0x02
 
 #endif /* HAVE_X_WINDOWS */
 
@@ -63,16 +92,16 @@ xstrcasecmp (char const *a, char const *b)
 #ifdef HAVE_X_WINDOWS
 #include <X11/Xresource.h> /* for XrmDatabase */
 typedef struct x_display_info Display_Info;
-typedef XImage * XImagePtr;
-typedef XImagePtr XImagePtr_or_DC;
+typedef XImage *Emacs_Pix_Container;
+typedef XImage *Emacs_Pix_Context;
 #define NativeRectangle XRectangle
 #endif
 
 #ifdef HAVE_NTGUI
 #include "w32gui.h"
 typedef struct w32_display_info Display_Info;
-typedef XImage *XImagePtr;
-typedef HDC XImagePtr_or_DC;
+typedef XImage *Emacs_Pix_Container;
+typedef HDC Emacs_Pix_Context;
 #endif
 
 #ifdef HAVE_NS
@@ -80,8 +109,8 @@ typedef HDC XImagePtr_or_DC;
 #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;
+typedef Emacs_Pixmap Emacs_Pix_Container;
+typedef Emacs_Pixmap Emacs_Pix_Context;
 #else
 #define FACE_COLOR_TO_PIXEL(face_color, frame) face_color
 #endif
@@ -92,8 +121,7 @@ typedef XImagePtr XImagePtr_or_DC;
 #endif
 
 #ifndef HAVE_WINDOW_SYSTEM
-typedef int Cursor;
-#define No_Cursor (0)
+typedef void *Emacs_Cursor;
 #endif
 
 #ifndef NativeRectangle
@@ -1040,7 +1068,7 @@ struct glyph_row
 #ifdef HAVE_WINDOW_SYSTEM
   /* Non-NULL means the current clipping area.  This is temporarily
      set while exposing a region.  Coordinates are frame-relative.  */
-  XRectangle *clip;
+  const Emacs_Rectangle *clip;
 #endif
 };
 
@@ -1281,9 +1309,6 @@ struct glyph_string
   /* The window on which the glyph string is drawn.  */
   struct window *w;
 
-  /* X display and window for convenience.  */
-  Display *display;
-
   /* The glyph row for which this string was built.  It determines the
      y-origin and height of the string.  */
   struct glyph_row *row;
@@ -1292,7 +1317,7 @@ struct glyph_string
   enum glyph_row_area area;
 
   /* Characters to be drawn, and number of characters.  */
-  XChar2b *char2b;
+  unsigned *char2b;
   int nchars;
 
   /* A face-override for drawing cursors, mouse face and similar.  */
@@ -1353,7 +1378,7 @@ struct glyph_string
   GC gc;
 #endif
 #if defined (HAVE_NTGUI)
-  XGCValues *gc;
+  Emacs_GC *gc;
   HDC hdc;
 #endif
 
@@ -1595,8 +1620,11 @@ struct face
 
   /* If non-zero, this is a GC that we can use without modification for
      drawing the characters in this face.  */
+# ifdef HAVE_X_WINDOWS
   GC gc;
-
+# else
+  Emacs_GC *gc;
+# endif
   /* Background stipple or bitmap used for this face.  This is
      an id as returned from load_pixmap.  */
   ptrdiff_t stipple;
@@ -2891,7 +2919,7 @@ struct redisplay_interface
   void (*draw_glyph_string) (struct glyph_string *s);
 
   /* Define cursor CURSOR on frame F.  */
-  void (*define_frame_cursor) (struct frame *f, Cursor cursor);
+  void (*define_frame_cursor) (struct frame *f, Emacs_Cursor cursor);
 
   /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F.  */
   void (*clear_frame_area) (struct frame *f, int x, int y,
@@ -2958,7 +2986,7 @@ struct image
   struct timespec timestamp;
 
   /* Pixmaps of the image.  */
-  Pixmap pixmap, mask;
+  Emacs_Pixmap pixmap, mask;
 
 #ifdef USE_CAIRO
   void *cr_data;
@@ -2968,7 +2996,7 @@ struct image
      Non-NULL means it and its Pixmap counterpart may be out of sync
      and the latter is outdated.  NULL means the X image has been
      synchronized to Pixmap.  */
-  XImagePtr ximg, mask_img;
+  XImage *ximg, *mask_img;
 
 # ifdef HAVE_NATIVE_SCALING
   /* Picture versions of pixmap and mask for compositing.  */
@@ -3039,7 +3067,7 @@ struct image
   int hmargin, vmargin;
 
   /* Reference to the type of the image.  */
-  struct image_type *type;
+  struct image_type const *type;
 
   /* True means that loading the image failed.  Don't try again.  */
   bool load_failed_p;
@@ -3314,7 +3342,9 @@ extern void handle_tool_bar_click (struct frame *,
                                    int, int, bool, int);
 
 extern void expose_frame (struct frame *, int, int, int, int);
-extern bool gui_intersect_rectangles (XRectangle *, XRectangle *, XRectangle 
*);
+extern bool gui_intersect_rectangles (const Emacs_Rectangle *,
+                                      const Emacs_Rectangle *,
+                                      Emacs_Rectangle *);
 #endif /* HAVE_WINDOW_SYSTEM */
 
 extern void note_mouse_highlight (struct frame *, int, int);
@@ -3369,7 +3399,7 @@ extern void x_create_bitmap_mask (struct frame *, 
ptrdiff_t);
 #endif
 extern Lisp_Object image_find_image_file (Lisp_Object);
 
-void x_kill_gs_process (Pixmap, struct frame *);
+void x_kill_gs_process (Emacs_Pixmap, struct frame *);
 struct image_cache *make_image_cache (void);
 void free_image_cache (struct frame *);
 void clear_image_caches (Lisp_Object);
@@ -3387,9 +3417,9 @@ ptrdiff_t lookup_image (struct frame *, Lisp_Object);
 #endif
 
 RGB_PIXEL_COLOR image_background (struct image *, struct frame *,
-                                XImagePtr_or_DC ximg);
+                                  Emacs_Pix_Context img);
 int image_background_transparent (struct image *, struct frame *,
-                                  XImagePtr_or_DC mask);
+                                  Emacs_Pix_Context mask);
 
 int image_ascent (struct image *, struct face *, struct glyph_slice *);
 
@@ -3413,8 +3443,8 @@ void x_free_colors (struct frame *, unsigned long *, int);
 
 void update_face_from_frame_parameter (struct frame *, Lisp_Object,
                                        Lisp_Object);
-extern bool tty_defined_color (struct frame *f, const char *, XColor *, bool,
-                               bool);
+extern bool tty_defined_color (struct frame *, const char *, Emacs_Color *,
+                               bool, bool);
 
 Lisp_Object tty_color_name (struct frame *, int);
 void clear_face_cache (bool);
@@ -3521,6 +3551,10 @@ void clear_glyph_matrix_rows (struct glyph_matrix *, 
int, int);
 void clear_glyph_row (struct glyph_row *);
 void prepare_desired_row (struct window *, struct glyph_row *, bool);
 void update_single_window (struct window *);
+#ifdef HAVE_WINDOW_SYSTEM
+extern void gui_update_window_begin (struct window *);
+extern void gui_update_window_end (struct window *, bool, bool);
+#endif
 void do_pending_window_change (bool);
 void change_frame_size (struct frame *, int, int, bool, bool, bool, bool);
 void init_display (void);
diff --git a/src/dispnew.c b/src/dispnew.c
index 25a2d1c..52a7b6d 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3390,7 +3390,9 @@ update_window (struct window *w, bool force_p)
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   bool paused_p;
   int preempt_count = clip_to_bounds (1, baud_rate / 2400 + 1, INT_MAX);
+#ifdef HAVE_WINDOW_SYSTEM
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
+#endif
 #ifdef GLYPH_DEBUG
   /* Check that W's frame doesn't have glyph matrices.  */
   eassert (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w))));
@@ -3411,7 +3413,9 @@ update_window (struct window *w, bool force_p)
       bool changed_p = 0, mouse_face_overwritten_p = 0;
       int n_updated = 0;
 
-      rif->update_window_begin_hook (w);
+#ifdef HAVE_WINDOW_SYSTEM
+      gui_update_window_begin (w);
+#endif
       yb = window_text_bottom_y (w);
       row = MATRIX_ROW (desired_matrix, 0);
       end = MATRIX_MODE_LINE_ROW (desired_matrix);
@@ -3533,13 +3537,13 @@ update_window (struct window *w, bool force_p)
 
 #ifdef HAVE_WINDOW_SYSTEM
       update_window_fringes (w, 0);
-#endif
 
       /* End the update of window W.  Don't set the cursor if we
          paused updating the display because in this case,
          set_window_cursor_after_update hasn't been called, and
          W->output_cursor doesn't contain the cursor location.  */
-      rif->update_window_end_hook (w, !paused_p, mouse_face_overwritten_p);
+      gui_update_window_end (w, !paused_p, mouse_face_overwritten_p);
+#endif
     }
   else
     paused_p = 1;
@@ -3555,6 +3559,90 @@ update_window (struct window *w, bool force_p)
   return paused_p;
 }
 
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Start update of window W.  */
+
+void
+gui_update_window_begin (struct window *w)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+  block_input ();
+
+  if (FRAME_RIF (f)->update_window_begin_hook)
+    FRAME_RIF (f)->update_window_begin_hook (w);
+
+  w->output_cursor = w->cursor;
+
+  if (f == hlinfo->mouse_face_mouse_frame)
+    {
+      /* Don't do highlighting for mouse motion during the update.  */
+      hlinfo->mouse_face_defer = true;
+
+      /* If the frame needs to be redrawn, simply forget about any
+        prior mouse highlighting.  */
+      if (FRAME_GARBAGED_P (f))
+       hlinfo->mouse_face_window = Qnil;
+    }
+
+  unblock_input ();
+}
+
+/* End update of window W.
+
+   Draw vertical borders between horizontally adjacent windows, and
+   display W's cursor if CURSOR_ON_P is non-zero.
+
+   MOUSE_FACE_OVERWRITTEN_P non-zero means that some row containing
+   glyphs in mouse-face were overwritten.  In that case we have to
+   make sure that the mouse-highlight is properly redrawn.  */
+void
+gui_update_window_end (struct window *w, bool cursor_on_p,
+                       bool mouse_face_overwritten_p)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+
+  block_input ();
+
+  /* Pseudo windows don't have cursors, so don't display them here.  */
+  if (!w->pseudo_window_p)
+    {
+
+      if (cursor_on_p)
+       display_and_set_cursor (w, true,
+                               w->output_cursor.hpos, w->output_cursor.vpos,
+                               w->output_cursor.x, w->output_cursor.y);
+
+      if (draw_window_fringes (w, true))
+       {
+         if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
+           gui_draw_right_divider (w);
+         else
+           gui_draw_vertical_border (w);
+       }
+    }
+
+  /* If a row with mouse-face was overwritten, arrange for
+     frame_up_to_date_hook to redisplay the mouse highlight.  */
+  if (mouse_face_overwritten_p)
+    {
+      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+      hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+      hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+      hlinfo->mouse_face_window = Qnil;
+    }
+
+  if (FRAME_RIF (f)->update_window_end_hook)
+    FRAME_RIF (f)->update_window_end_hook (w,
+                                           cursor_on_p,
+                                           mouse_face_overwritten_p);
+  unblock_input ();
+}
+
+#endif /* HAVE_WINDOW_SYSTEM  */
 
 /* Update the display of area AREA in window W, row number VPOS.
    AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA.  */
diff --git a/src/dynlib.h b/src/dynlib.h
index 2688712..43a0e04 100644
--- a/src/dynlib.h
+++ b/src/dynlib.h
@@ -29,7 +29,7 @@ const char *dynlib_error (void);
 
 ATTRIBUTE_MAY_ALIAS void *dynlib_sym (dynlib_handle_ptr h, const char *sym);
 
-typedef struct dynlib_function_ptr_nonce *(ATTRIBUTE_MAY_ALIAS 
*dynlib_function_ptr) (void);
+typedef void (ATTRIBUTE_MAY_ALIAS *dynlib_function_ptr) (void);
 dynlib_function_ptr dynlib_func (dynlib_handle_ptr h, const char *sym);
 
 /* Sets *FILE to the file name from which PTR was loaded, and *SYM to
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 80a04ba..907a5d8 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -101,11 +101,6 @@ To add a new module function, proceed as follows:
 # pragma GCC diagnostic ignored "-Wclobbered"
 #endif
 
-/* This module is lackadaisical about function casts.  */
-#if GNUC_PREREQ (8, 0, 0)
-# pragma GCC diagnostic ignored "-Wcast-function-type"
-#endif
-
 /* We use different strategies for allocating the user-visible objects
    (struct emacs_runtime, emacs_env, emacs_value), depending on
    whether the user supplied the -module-assertions flag.  If
@@ -223,8 +218,6 @@ static void module_reset_handlerlist (struct handler **);
 static bool value_storage_contains_p (const struct emacs_value_storage *,
                                       emacs_value, ptrdiff_t *);
 static Lisp_Object module_encode (Lisp_Object);
-static Lisp_Object module_decode (Lisp_Object);
-static Lisp_Object module_decode_copy (Lisp_Object);
 
 static bool module_assertions = false;
 
@@ -532,10 +525,7 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, 
ptrdiff_t max_arity,
   function->data = data;
 
   if (documentation)
-    {
-      AUTO_STRING (unibyte_doc, documentation);
-      function->documentation = module_decode_copy (unibyte_doc);
-    }
+    function->documentation = build_string_from_utf8 (documentation);
 
   Lisp_Object result;
   XSET_MODULE_FUNCTION (result, function);
@@ -668,8 +658,8 @@ module_make_string (emacs_env *env, const char *str, 
ptrdiff_t length)
   MODULE_FUNCTION_BEGIN (NULL);
   if (! (0 <= length && length <= STRING_BYTES_BOUND))
     overflow_error ();
-  Lisp_Object lstr = make_unibyte_string (str, length);
-  return lisp_to_value (env, module_decode (lstr));
+  Lisp_Object lstr = make_string_from_utf8 (str, length);
+  return lisp_to_value (env, lstr);
 }
 
 static emacs_value
@@ -790,10 +780,7 @@ module_extract_big_integer (emacs_env *env, emacs_value 
value,
   MODULE_FUNCTION_BEGIN ();
   Lisp_Object o = value_to_lisp (value);
   CHECK_INTEGER (o);
-  if (FIXNUMP (o))
-    mpz_set_intmax (result->value, XFIXNUM (o));
-  else
-    mpz_set (result->value, XBIGNUM (o)->value);
+  mpz_set_integer (result->value, o);
 }
 
 static emacs_value
@@ -907,6 +894,11 @@ funcall_module (Lisp_Object function, ptrdiff_t nargs, 
Lisp_Object *arglist)
        memory_full (sizeof *args[i]);
     }
 
+  /* The only possibility of getting an error until here is failure to
+     allocate memory for the arguments, but then we already should
+     have signaled an error before.  */
+  eassert (priv.pending_non_local_exit == emacs_funcall_exit_return);
+
   emacs_value ret = func->subr (env, nargs, args, func->data);
 
   eassert (&priv == env->private_members);
@@ -1030,18 +1022,6 @@ module_encode (Lisp_Object string)
   return code_convert_string (string, Qutf_8_unix, Qt, true, true, true);
 }
 
-static Lisp_Object
-module_decode (Lisp_Object string)
-{
-  return code_convert_string (string, Qutf_8_unix, Qt, false, true, true);
-}
-
-static Lisp_Object
-module_decode_copy (Lisp_Object string)
-{
-  return code_convert_string (string, Qutf_8_unix, Qt, false, false, true);
-}
-
 
 /* Value conversion.  */
 
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index fbc62a6..9955e30 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -32,6 +32,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <gmp.h>
 #endif
 
+#define EMACS_MAJOR_VERSION @emacs_major_version@
+
 #if defined __cplusplus && __cplusplus >= 201103L
 # define EMACS_NOEXCEPT noexcept
 #else
diff --git a/src/emacs.c b/src/emacs.c
index 86d2bc6..fd46540 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2494,9 +2494,6 @@ You must run Emacs in batch mode in order to dump it.  */)
 # ifdef WINDOWSNT
   Vlibrary_cache = Qnil;
 # endif
-# ifdef HAVE_WINDOW_SYSTEM
-  reset_image_types ();
-# endif
 
   Vpurify_flag = tem;
 
diff --git a/src/eval.c b/src/eval.c
index 3fd9a40..567c32e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -715,6 +715,25 @@ DEFUN ("set-default-toplevel-value", 
Fset_default_toplevel_value,
   return Qnil;
 }
 
+DEFUN ("internal--define-uninitialized-variable",
+       Finternal__define_uninitialized_variable,
+       Sinternal__define_uninitialized_variable, 1, 2, 0,
+       doc: /* Define SYMBOL as a variable, with DOC as its docstring.
+This is like `defvar' and `defconst' but without affecting the variable's
+value.  */)
+  (Lisp_Object symbol, Lisp_Object doc)
+{
+  XSYMBOL (symbol)->u.s.declared_special = true;
+  if (!NILP (doc))
+    {
+      if (!NILP (Vpurify_flag))
+       doc = Fpurecopy (doc);
+      Fput (symbol, Qvariable_documentation, doc);
+    }
+  LOADHIST_ATTACH (symbol);
+  return Qnil;
+}
+
 DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
        doc: /* Define SYMBOL as a variable, and return SYMBOL.
 You are not required to define a variable in order to use it, but
@@ -754,32 +773,25 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
     {
       if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail))))
        error ("Too many arguments");
+      Lisp_Object exp = XCAR (tail);
 
       tem = Fdefault_boundp (sym);
+      tail = XCDR (tail);
 
       /* Do it before evaluating the initial value, for self-references.  */
-      XSYMBOL (sym)->u.s.declared_special = true;
+      Finternal__define_uninitialized_variable (sym, CAR (tail));
 
       if (NILP (tem))
-       Fset_default (sym, eval_sub (XCAR (tail)));
+       Fset_default (sym, eval_sub (exp));
       else
        { /* Check if there is really a global binding rather than just a let
             binding that shadows the global unboundness of the var.  */
          union specbinding *binding = default_toplevel_binding (sym);
          if (binding && EQ (specpdl_old_value (binding), Qunbound))
            {
-             set_specpdl_old_value (binding, eval_sub (XCAR (tail)));
+             set_specpdl_old_value (binding, eval_sub (exp));
            }
        }
-      tail = XCDR (tail);
-      tem = Fcar (tail);
-      if (!NILP (tem))
-       {
-         if (!NILP (Vpurify_flag))
-           tem = Fpurecopy (tem);
-         Fput (sym, Qvariable_documentation, tem);
-       }
-      LOADHIST_ATTACH (sym);
     }
   else if (!NILP (Vinternal_interpreter_environment)
           && (SYMBOLP (sym) && !XSYMBOL (sym)->u.s.declared_special))
@@ -827,19 +839,12 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
       docstring = XCAR (XCDR (XCDR (args)));
     }
 
+  Finternal__define_uninitialized_variable (sym, docstring);
   tem = eval_sub (XCAR (XCDR (args)));
   if (!NILP (Vpurify_flag))
     tem = Fpurecopy (tem);
-  Fset_default (sym, tem);
-  XSYMBOL (sym)->u.s.declared_special = true;
-  if (!NILP (docstring))
-    {
-      if (!NILP (Vpurify_flag))
-       docstring = Fpurecopy (docstring);
-      Fput (sym, Qvariable_documentation, docstring);
-    }
-  Fput (sym, Qrisky_local_variable, Qt);
-  LOADHIST_ATTACH (sym);
+  Fset_default (sym, tem);      /* FIXME: set-default-toplevel-value? */
+  Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why?  */
   return sym;
 }
 
@@ -4198,6 +4203,7 @@ alist of active lexical bindings.  */);
   defsubr (&Sdefvaralias);
   DEFSYM (Qdefvaralias, "defvaralias");
   defsubr (&Sdefconst);
+  defsubr (&Sinternal__define_uninitialized_variable);
   defsubr (&Smake_var_non_special);
   defsubr (&Slet);
   defsubr (&SletX);
diff --git a/src/fileio.c b/src/fileio.c
index 4ee125d..9e97799 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5802,6 +5802,7 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
            && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
            && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
            /* -1 means we've turned off autosaving for a while--see below.  */
+           && FIXNUMP (BVAR (b, save_length))
            && XFIXNUM (BVAR (b, save_length)) >= 0
            && (do_handled_files
                || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name),
@@ -5815,13 +5816,17 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
                && before_time.tv_sec - b->auto_save_failure_time < 1200)
              continue;
 
+           enum { growth_factor = 4 };
+           verify (BUF_BYTES_MAX <= EMACS_INT_MAX / growth_factor);
+
            set_buffer_internal (b);
            if (NILP (Vauto_save_include_big_deletions)
-               && (XFIXNAT (BVAR (b, save_length)) * 10
-                   > (BUF_Z (b) - BUF_BEG (b)) * 13)
+               && FIXNUMP (BVAR (b, save_length))
                /* A short file is likely to change a large fraction;
                   spare the user annoying messages.  */
                && XFIXNAT (BVAR (b, save_length)) > 5000
+               && (growth_factor * (BUF_Z (b) - BUF_BEG (b))
+                   < (growth_factor - 1) * XFIXNAT (BVAR (b, save_length)))
                /* These messages are frequent and annoying for `*mail*'.  */
                && !NILP (BVAR (b, filename))
                && NILP (no_message))
diff --git a/src/fns.c b/src/fns.c
index c320249..6b1f733 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1131,10 +1131,8 @@ string the same way whether it is unibyte or multibyte.) 
 */)
 DEFUN ("string-make-unibyte", Fstring_make_unibyte, Sstring_make_unibyte,
        1, 1, 0,
        doc: /* Return the unibyte equivalent of STRING.
-Multibyte character codes are converted to unibyte according to
-`nonascii-translation-table' or, if that is nil, `nonascii-insert-offset'.
-If the lookup in the translation table fails, this function takes just
-the low 8 bits of each character.  */)
+Multibyte character codes above 255 are converted to unibyte
+by taking just the low 8 bits of each character's code.  */)
   (Lisp_Object string)
 {
   CHECK_STRING (string);
diff --git a/src/font.h b/src/font.h
index 1f62a61..a590bda 100644
--- a/src/font.h
+++ b/src/font.h
@@ -651,7 +651,7 @@ struct font_driver
      the font FONT and the sequence of glyph codes CODE, and store the
      result in METRICS.  */
   void (*text_extents) (struct font *font,
-                       unsigned *code, int nglyphs,
+                       const unsigned *code, int nglyphs,
                        struct font_metrics *metrics);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -920,7 +920,7 @@ extern Lisp_Object ftfont_shape (Lisp_Object, Lisp_Object);
 extern unsigned ftfont_encode_char (struct font *, int);
 extern void ftfont_close (struct font *);
 extern void ftfont_filter_properties (Lisp_Object, Lisp_Object);
-extern void ftfont_text_extents (struct font *, unsigned *, int,
+extern void ftfont_text_extents (struct font *, const unsigned *, int,
                                 struct font_metrics *);
 #ifdef HAVE_HARFBUZZ
 extern Lisp_Object fthbfont_combining_capability (struct font *);
diff --git a/src/frame.h b/src/frame.h
index b8aed82..7810633 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1626,7 +1626,7 @@ flush_frame (struct frame *f)
 #ifdef HAVE_WINDOW_SYSTEM
 
 struct MonitorInfo {
-  XRectangle geom, work;
+  Emacs_Rectangle geom, work;
   int mm_width, mm_height;
   char *name;
 };
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index dc59c2b..79bf681 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -79,7 +79,6 @@ ftcrfont_glyph_extents (struct font *font,
       cairo_glyph_t cr_glyph = {.index = glyph};
       cairo_text_extents_t extents;
 
-      FT_Activate_Size (ftcrfont_info->ft_size_draw);
       cairo_scaled_font_glyph_extents (ftcrfont_info->cr_scaled_font,
                                       &cr_glyph, 1, &extents);
       cache->lbearing = floor (extents.x_bearing);
@@ -110,99 +109,168 @@ ftcrfont_match (struct frame *f, Lisp_Object spec)
 static Lisp_Object
 ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 {
-  Lisp_Object font_object;
-
-  FT_UInt size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
+  FcResult result;
+  Lisp_Object val, filename, font_object;
+  FcPattern *pat, *match;
+  struct font_info *ftcrfont_info;
+  struct font *font;
+  double size = 0;
+  cairo_font_face_t *font_face;
+  cairo_font_extents_t extents;
+  FT_Face ft_face;
+  FcMatrix *matrix;
+
+  val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX));
+  if (! CONSP (val))
+    return Qnil;
+  val = XCDR (val);
+  filename = XCAR (val);
+  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
-  font_object = font_build_object (VECSIZE (struct font_info),
-                                  AREF (entity, FONT_TYPE_INDEX),
-                                  entity, size);
+
   block_input ();
-  font_object = ftfont_open2 (f, entity, pixel_size, font_object);
-  if (FONT_OBJECT_P (font_object))
+
+  pat = ftfont_entity_pattern (entity, pixel_size);
+  FcConfigSubstitute (NULL, pat, FcMatchPattern);
+  FcDefaultSubstitute (pat);
+  match = FcFontMatch (NULL, pat, &result);
+  ftfont_fix_match (pat, match);
+
+  FcPatternDestroy (pat);
+  font_face = cairo_ft_font_face_create_for_pattern (match);
+  if (!font_face)
     {
-      struct font *font = XFONT_OBJECT (font_object);
-      struct font_info *ftcrfont_info = (struct font_info *) font;
-      FT_Face ft_face = ftcrfont_info->ft_size->face;
+      unblock_input ();
+      FcPatternDestroy (match);
+      return Qnil;
+    }
+  cairo_matrix_t font_matrix, ctm;
+  cairo_matrix_init_scale (&font_matrix, pixel_size, pixel_size);
+  cairo_matrix_init_identity (&ctm);
+  cairo_font_options_t *options = cairo_font_options_create ();
+  cairo_scaled_font_t *scaled_font
+    = cairo_scaled_font_create (font_face, &font_matrix, &ctm, options);
+  cairo_font_face_destroy (font_face);
+  cairo_font_options_destroy (options);
+  unblock_input ();
 
+  font_object = font_build_object (VECSIZE (struct font_info),
+                                  AREF (entity, FONT_TYPE_INDEX),
+                                  entity, size);
+  ASET (font_object, FONT_FILE_INDEX, filename);
+  font = XFONT_OBJECT (font_object);
+  font->pixel_size = size;
 #ifdef HAVE_HARFBUZZ
-      if (EQ (AREF (font_object, FONT_TYPE_INDEX), Qftcrhb))
-       font->driver = &ftcrhbfont_driver;
-      else
+  if (EQ (AREF (font_object, FONT_TYPE_INDEX), Qftcrhb))
+    font->driver = &ftcrhbfont_driver;
+  else
 #endif /* HAVE_HARFBUZZ */
-      font->driver = &ftcrfont_driver;
-      FT_New_Size (ft_face, &ftcrfont_info->ft_size_draw);
-      FT_Activate_Size (ftcrfont_info->ft_size_draw);
-      if (ftcrfont_info->bitmap_strike_index < 0)
-       FT_Set_Pixel_Sizes (ft_face, 0, font->pixel_size);
-      else
-       FT_Select_Size (ft_face, ftcrfont_info->bitmap_strike_index);
-      cairo_font_face_t *font_face =
-       cairo_ft_font_face_create_for_ft_face (ft_face, 0);
-      cairo_matrix_t font_matrix, ctm;
-      cairo_matrix_init_scale (&font_matrix, pixel_size, pixel_size);
-      cairo_matrix_init_identity (&ctm);
-      cairo_font_options_t *options = cairo_font_options_create ();
-      ftcrfont_info->cr_scaled_font =
-       cairo_scaled_font_create (font_face, &font_matrix, &ctm, options);
-      cairo_font_face_destroy (font_face);
-      cairo_font_options_destroy (options);
-      ftcrfont_info->metrics = NULL;
-      ftcrfont_info->metrics_nrows = 0;
-      if (ftcrfont_info->bitmap_strike_index >= 0)
+  font->driver = &ftcrfont_driver;
+  font->encoding_charset = font->repertory_charset = -1;
+
+  ftcrfont_info = (struct font_info *) font;
+  ftcrfont_info->cr_scaled_font = scaled_font;
+
+  /* This means that there's no need of transformation.  */
+  ftcrfont_info->matrix.xx = 0;
+  if (FcPatternGetMatrix (match, FC_MATRIX, 0, &matrix) == FcResultMatch)
+    {
+      ftcrfont_info->matrix.xx = 0x10000L * matrix->xx;
+      ftcrfont_info->matrix.yy = 0x10000L * matrix->yy;
+      ftcrfont_info->matrix.xy = 0x10000L * matrix->xy;
+      ftcrfont_info->matrix.yx = 0x10000L * matrix->yx;
+    }
+
+  ftcrfont_info->metrics = NULL;
+  ftcrfont_info->metrics_nrows = 0;
+
+  block_input ();
+  cairo_glyph_t stack_glyph;
+  int n = 0;
+  font->min_width = font->average_width = font->space_width = 0;
+  for (char c = 32; c < 127; c++)
+    {
+      cairo_glyph_t *glyphs = &stack_glyph;
+      int num_glyphs = 1;
+      cairo_status_t status =
+       cairo_scaled_font_text_to_glyphs (ftcrfont_info->cr_scaled_font,
+                                         0, 0, &c, 1, &glyphs, &num_glyphs,
+                                         NULL, NULL, NULL);
+
+      if (status == CAIRO_STATUS_SUCCESS)
        {
-         /* Several members of struct font/font_info set by
-            ftfont_open2 are bogus.  Recalculate them with cairo
-            scaled font functions.  */
-         cairo_font_extents_t extents;
-         cairo_scaled_font_extents (ftcrfont_info->cr_scaled_font, &extents);
-         font->ascent = lround (extents.ascent);
-         font->descent = lround (extents.descent);
-         font->height = lround (extents.height);
-
-         cairo_glyph_t stack_glyph;
-         int n = 0;
-         font->min_width = font->average_width = font->space_width = 0;
-         for (char c = 32; c < 127; c++)
+         if (glyphs != &stack_glyph)
+           cairo_glyph_free (glyphs);
+         else if (stack_glyph.index)
            {
-             cairo_glyph_t *glyphs = &stack_glyph;
-             int num_glyphs = 1;
-             cairo_status_t status =
-               cairo_scaled_font_text_to_glyphs (ftcrfont_info->cr_scaled_font,
-                                                 0, 0, &c, 1,
-                                                 &glyphs, &num_glyphs,
-                                                 NULL, NULL, NULL);
-
-             if (status == CAIRO_STATUS_SUCCESS)
-               {
-                 if (glyphs != &stack_glyph)
-                   cairo_glyph_free (glyphs);
-                 else
-                   {
-                     int this_width =
-                       ftcrfont_glyph_extents (font, stack_glyph.index, NULL);
-
-                     if (this_width > 0
-                         && (! font->min_width
-                             || font->min_width > this_width))
-                       font->min_width = this_width;
-                     if (c == 32)
-                       font->space_width = this_width;
-                     font->average_width += this_width;
-                     n++;
-                   }
-               }
+             int this_width = ftcrfont_glyph_extents (font, stack_glyph.index,
+                                                      NULL);
+
+             if (this_width > 0
+                 && (! font->min_width
+                     || font->min_width > this_width))
+               font->min_width = this_width;
+             if (c == 32)
+               font->space_width = this_width;
+             font->average_width += this_width;
+             n++;
            }
-         if (n > 0)
-           font->average_width /= n;
-
-         font->underline_position = -1;
-         font->underline_thickness = 0;
        }
     }
+  if (n > 0)
+    font->average_width /= n;
+
+  cairo_scaled_font_extents (ftcrfont_info->cr_scaled_font, &extents);
+  font->ascent = lround (extents.ascent);
+  val = assq_no_quit (QCminspace, AREF (entity, FONT_EXTRA_INDEX));
+  if (!(CONSP (val) && NILP (XCDR (val))))
+    {
+      font->descent = lround (extents.descent);
+      font->height = font->ascent + font->descent;
+    }
+  else
+    {
+      font->height = lround (extents.height);
+      font->descent = font->height - font->ascent;
+    }
+
+  ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+  if (XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) == 0)
+    {
+      int upEM = ft_face->units_per_EM;
+
+      font->underline_position = -ft_face->underline_position * size / upEM;
+      font->underline_thickness = ft_face->underline_thickness * size / upEM;
+      if (font->underline_thickness > 2)
+       font->underline_position -= font->underline_thickness / 2;
+    }
+  else
+    {
+      font->underline_position = -1;
+      font->underline_thickness = 0;
+    }
+#ifdef HAVE_LIBOTF
+  ftcrfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
+  ftcrfont_info->otf = NULL;
+#endif /* HAVE_LIBOTF */
+#ifdef HAVE_HARFBUZZ
+  ftcrfont_info->hb_font = NULL;
+#endif /* HAVE_HARFBUZZ */
+  if (ft_face->units_per_EM)
+    ftcrfont_info->bitmap_position_unit = 0;
+  else
+    ftcrfont_info->bitmap_position_unit = (extents.height
+                                          / ft_face->size->metrics.height);
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
   unblock_input ();
 
+  font->baseline_offset = 0;
+  font->relative_compose = 0;
+  font->default_ascent = 0;
+  font->vertical_centering = false;
+
   return font_object;
 }
 
@@ -213,24 +281,70 @@ ftcrfont_close (struct font *font)
     return;
 
   struct font_info *ftcrfont_info = (struct font_info *) font;
-  int i;
 
   block_input ();
-  for (i = 0; i < ftcrfont_info->metrics_nrows; i++)
+#ifdef HAVE_LIBOTF
+  if (ftcrfont_info->otf)
+    {
+      OTF_close (ftcrfont_info->otf);
+      ftcrfont_info->otf = NULL;
+    }
+#endif
+#ifdef HAVE_HARFBUZZ
+  if (ftcrfont_info->hb_font)
+    {
+      hb_font_destroy (ftcrfont_info->hb_font);
+      ftcrfont_info->hb_font = NULL;
+    }
+#endif
+  for (int i = 0; i < ftcrfont_info->metrics_nrows; i++)
     if (ftcrfont_info->metrics[i])
       xfree (ftcrfont_info->metrics[i]);
   if (ftcrfont_info->metrics)
     xfree (ftcrfont_info->metrics);
-  FT_Done_Size (ftcrfont_info->ft_size_draw);
   cairo_scaled_font_destroy (ftcrfont_info->cr_scaled_font);
   unblock_input ();
+}
+
+static int
+ftcrfont_has_char (Lisp_Object font, int c)
+{
+  if (FONT_ENTITY_P (font))
+    return ftfont_has_char (font, c);
+
+  return -1;
+}
+
+static unsigned
+ftcrfont_encode_char (struct font *font, int c)
+{
+  struct font_info *ftcrfont_info = (struct font_info *) font;
+  unsigned code = FONT_INVALID_CODE;
+  unsigned char utf8[MAX_MULTIBYTE_LENGTH];
+  unsigned char *p = utf8;
+  cairo_glyph_t stack_glyph;
+  cairo_glyph_t *glyphs = &stack_glyph;
+  int num_glyphs = 1;
+
+  CHAR_STRING_ADVANCE (c, p);
+  if (cairo_scaled_font_text_to_glyphs (ftcrfont_info->cr_scaled_font, 0, 0,
+                                       (char *) utf8, p - utf8,
+                                       &glyphs, &num_glyphs,
+                                       NULL, NULL, NULL)
+      == CAIRO_STATUS_SUCCESS)
+    {
+      if (glyphs != &stack_glyph)
+       cairo_glyph_free (glyphs);
+      else if (stack_glyph.index)
+       code = stack_glyph.index;
+    }
 
-  ftfont_close (font);
+  return code;
 }
 
 static void
 ftcrfont_text_extents (struct font *font,
-                       unsigned *code,
+                       const unsigned *code,
                        int nglyphs,
                        struct font_metrics *metrics)
 {
@@ -268,10 +382,18 @@ ftcrfont_get_bitmap (struct font *font, unsigned int code,
 {
   struct font_info *ftcrfont_info = (struct font_info *) font;
 
-  if (ftcrfont_info->bitmap_strike_index < 0)
-    return ftfont_get_bitmap (font, code, bitmap, bits_per_pixel);
+  if (ftcrfont_info->bitmap_position_unit)
+    return -1;
 
-  return -1;
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+  FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+
+  ftcrfont_info->ft_size = ft_face->size;
+  int result = ftfont_get_bitmap (font, code, bitmap, bits_per_pixel);
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
+
+  return result;
 }
 
 static int
@@ -280,25 +402,75 @@ ftcrfont_anchor_point (struct font *font, unsigned int 
code, int idx,
 {
   struct font_info *ftcrfont_info = (struct font_info *) font;
 
-  if (ftcrfont_info->bitmap_strike_index < 0)
-    return ftfont_anchor_point (font, code, idx, x, y);
+  if (ftcrfont_info->bitmap_position_unit)
+    return -1;
 
-  return -1;
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+  FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+
+  ftcrfont_info->ft_size = ft_face->size;
+  int result = ftfont_anchor_point (font, code, idx, x, y);
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
+
+  return result;
 }
 
+#ifdef HAVE_LIBOTF
 static Lisp_Object
-ftcrfont_shape (Lisp_Object lgstring, Lisp_Object direction)
+ftcrfont_otf_capability (struct font *font)
 {
+  struct font_info *ftcrfont_info = (struct font_info *) font;
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+  FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+
+  ftcrfont_info->ft_size = ft_face->size;
+  Lisp_Object result = ftfont_otf_capability (font);
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
+
+  return result;
+}
+#endif
+
 #if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
+static Lisp_Object
+ftcrfont_shape (Lisp_Object lgstring, Lisp_Object direction)
+{
   struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring));
   struct font_info *ftcrfont_info = (struct font_info *) font;
 
-  if (ftcrfont_info->bitmap_strike_index < 0)
-    return ftfont_shape (lgstring, direction);
+  if (ftcrfont_info->bitmap_position_unit)
+    return make_fixnum (0);
+
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+  FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+
+  ftcrfont_info->ft_size = ft_face->size;
+  Lisp_Object result = ftfont_shape (lgstring, direction);
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
+
+  return result;
+}
 #endif
 
-  return make_fixnum (0);
+#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+static int
+ftcrfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
+{
+  struct font_info *ftcrfont_info = (struct font_info *) font;
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+  FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
+
+  ftcrfont_info->ft_size = ft_face->size;
+  int result = ftfont_variation_glyphs (font, c, variations);
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
+
+  return result;
 }
+#endif /* HAVE_OTF_GET_VARIATION_GLYPHS */
 
 static int
 ftcrfont_draw (struct glyph_string *s,
@@ -309,8 +481,6 @@ ftcrfont_draw (struct glyph_string *s,
   struct font_info *ftcrfont_info = (struct font_info *) s->font;
   cairo_t *cr;
   cairo_glyph_t *glyphs;
-  cairo_surface_t *surface;
-  cairo_surface_type_t surface_type;
   int len = to - from;
   int i;
 
@@ -329,28 +499,17 @@ ftcrfont_draw (struct glyph_string *s,
   glyphs = alloca (sizeof (cairo_glyph_t) * len);
   for (i = 0; i < len; i++)
     {
-      unsigned code = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
-                      | XCHAR2B_BYTE2 (s->char2b + from + i));
-
-      glyphs[i].index = code;
+      glyphs[i].index = s->char2b[from + i];
       glyphs[i].x = x;
       glyphs[i].y = y;
-      x += (s->padding_p ? 1 : ftcrfont_glyph_extents (s->font, code, NULL));
+      x += (s->padding_p ? 1 : ftcrfont_glyph_extents (s->font,
+                                                       glyphs[i].index,
+                                                       NULL));
     }
 
   x_set_cr_source_with_gc_foreground (f, s->gc);
   cairo_set_scaled_font (cr, ftcrfont_info->cr_scaled_font);
-
-  FT_Activate_Size (ftcrfont_info->ft_size_draw);
   cairo_show_glyphs (cr, glyphs, len);
-  surface = cairo_get_target (cr);
-  /* XXX: It used to be necessary to flush when exporting.  It might
-     be the case that this is no longer necessary.  */
-  surface_type = cairo_surface_get_type (surface);
-  if (surface_type != CAIRO_SURFACE_TYPE_XLIB
-      && (surface_type != CAIRO_SURFACE_TYPE_IMAGE
-         || cairo_image_surface_get_format (surface) != CAIRO_FORMAT_ARGB32))
-    cairo_surface_flush (surface);
 
   x_end_cr_clip (f);
 
@@ -377,20 +536,27 @@ static hb_font_t *
 ftcrhbfont_begin_hb_font (struct font *font, double *position_unit)
 {
   struct font_info *ftcrfont_info = (struct font_info *) font;
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+  FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
 
-  FT_Activate_Size (ftcrfont_info->ft_size_draw);
+  ftcrfont_info->ft_size = ft_face->size;
   hb_font_t *hb_font = fthbfont_begin_hb_font (font, position_unit);
-  int i = ftcrfont_info->bitmap_strike_index;
-  if (i >= 0)
-    {
-      FT_Face ft_face = ftcrfont_info->ft_size_draw->face;
-      *position_unit = ((double) font->height
-                       / ft_face->available_sizes[i].height) / (1 << 6);
-    }
+  if (ftcrfont_info->bitmap_position_unit)
+    *position_unit = ftcrfont_info->bitmap_position_unit;
 
   return hb_font;
 }
 
+static void
+ftcrhbfont_end_hb_font (struct font *font, hb_font_t *hb_font)
+{
+  struct font_info *ftcrfont_info = (struct font_info *) font;
+  cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font;
+
+  cairo_ft_scaled_font_unlock_face (scaled_font);
+  ftcrfont_info->ft_size = NULL;
+}
+
 #endif /* HAVE_HARFBUZZ */
 
 
@@ -405,18 +571,20 @@ struct font_driver const ftcrfont_driver =
   .list_family = ftfont_list_family,
   .open = ftcrfont_open,
   .close = ftcrfont_close,
-  .has_char = ftfont_has_char,
-  .encode_char = ftfont_encode_char,
+  .has_char = ftcrfont_has_char,
+  .encode_char = ftcrfont_encode_char,
   .text_extents = ftcrfont_text_extents,
   .draw = ftcrfont_draw,
   .get_bitmap = ftcrfont_get_bitmap,
   .anchor_point = ftcrfont_anchor_point,
 #ifdef HAVE_LIBOTF
-  .otf_capability = ftfont_otf_capability,
+  .otf_capability = ftcrfont_otf_capability,
 #endif
+#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
   .shape = ftcrfont_shape,
+#endif
 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS
-  .get_variation_glyphs = ftfont_variation_glyphs,
+  .get_variation_glyphs = ftcrfont_variation_glyphs,
 #endif
   .filter_properties = ftfont_filter_properties,
   .combining_capability = ftfont_combining_capability,
@@ -447,6 +615,7 @@ syms_of_ftcrfont_for_pdumper (void)
   ftcrhbfont_driver.shape = fthbfont_shape;
   ftcrhbfont_driver.combining_capability = fthbfont_combining_capability;
   ftcrhbfont_driver.begin_hb_font = ftcrhbfont_begin_hb_font;
+  ftcrhbfont_driver.end_hb_font = ftcrhbfont_end_hb_font;
   register_font_driver (&ftcrhbfont_driver, NULL);
 #endif /* HAVE_HARFBUZZ */
 }
diff --git a/src/ftfont.c b/src/ftfont.c
index 2373af8..5694c49 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1103,12 +1103,159 @@ ftfont_list_family (struct frame *f)
   return list;
 }
 
+void
+ftfont_fix_match (FcPattern *pat, FcPattern *match)
+{
+  /*  These values are not used for matching (except antialias), but for
+      rendering, so make sure they are carried over to the match.
+      We also put antialias here because most fonts are antialiased, so
+      the match will have antialias true.  */
+
+  FcBool b = FcTrue;
+  int i;
+  double dpi;
+
+  FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b);
+  if (! b)
+    {
+      FcPatternDel (match, FC_ANTIALIAS);
+      FcPatternAddBool (match, FC_ANTIALIAS, FcFalse);
+    }
+  FcPatternGetBool (pat, FC_HINTING, 0, &b);
+  if (! b)
+    {
+      FcPatternDel (match, FC_HINTING);
+      FcPatternAddBool (match, FC_HINTING, FcFalse);
+    }
+#ifndef FC_HINT_STYLE
+# define FC_HINT_STYLE "hintstyle"
+#endif
+  if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i))
+    {
+      FcPatternDel (match, FC_HINT_STYLE);
+      FcPatternAddInteger (match, FC_HINT_STYLE, i);
+    }
+#ifndef FC_LCD_FILTER
+  /* Older fontconfig versions don't have FC_LCD_FILTER. */
+#define FC_LCD_FILTER "lcdfilter"
+#endif
+  if (FcResultMatch == FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &i))
+    {
+      FcPatternDel (match, FC_LCD_FILTER);
+      FcPatternAddInteger (match, FC_LCD_FILTER, i);
+    }
+  if (FcResultMatch == FcPatternGetInteger (pat, FC_RGBA, 0, &i))
+    {
+      FcPatternDel (match, FC_RGBA);
+      FcPatternAddInteger (match, FC_RGBA, i);
+    }
+  if (FcResultMatch == FcPatternGetDouble (pat, FC_DPI, 0, &dpi))
+    {
+      FcPatternDel (match, FC_DPI);
+      FcPatternAddDouble (match, FC_DPI, dpi);
+    }
+}
+
+void
+ftfont_add_rendering_parameters (FcPattern *pat, Lisp_Object entity)
+{
+  Lisp_Object tail;
+  int ival;
+
+  for (tail = AREF (entity, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR 
(tail))
+    {
+      Lisp_Object key = XCAR (XCAR (tail));
+      Lisp_Object val = XCDR (XCAR (tail));
+
+      if (EQ (key, QCantialias))
+          FcPatternAddBool (pat, FC_ANTIALIAS, NILP (val) ? FcFalse : FcTrue);
+      else if (EQ (key, QChinting))
+       FcPatternAddBool (pat, FC_HINTING, NILP (val) ? FcFalse : FcTrue);
+      else if (EQ (key, QCautohint))
+       FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue);
+      else if (EQ (key, QChintstyle))
+       {
+         if (FIXNUMP (val))
+           FcPatternAddInteger (pat, FC_HINT_STYLE, XFIXNUM (val));
+          else if (SYMBOLP (val)
+                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
+           FcPatternAddInteger (pat, FC_HINT_STYLE, ival);
+       }
+      else if (EQ (key, QCrgba))
+       {
+         if (FIXNUMP (val))
+           FcPatternAddInteger (pat, FC_RGBA, XFIXNUM (val));
+          else if (SYMBOLP (val)
+                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
+           FcPatternAddInteger (pat, FC_RGBA, ival);
+       }
+      else if (EQ (key, QClcdfilter))
+       {
+         if (FIXNUMP (val))
+           FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XFIXNUM (val));
+          else if (SYMBOLP (val)
+                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
+           FcPatternAddInteger (pat, FC_LCD_FILTER, ival);
+       }
+#ifdef FC_EMBOLDEN
+      else if (EQ (key, QCembolden))
+       FcPatternAddBool (pat, FC_EMBOLDEN, NILP (val) ? FcFalse : FcTrue);
+#endif
+    }
+}
+
+FcPattern *
+ftfont_entity_pattern (Lisp_Object entity, int pixel_size)
+{
+  Lisp_Object val, filename, idx;
+  FcPattern *pat;
+  int i;
+
+  val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX));
+  eassert (CONSP (val));
+  val = XCDR (val);
+  filename = XCAR (val);
+  idx = XCDR (val);
+  pat = FcPatternCreate ();
+  FcPatternAddInteger (pat, FC_WEIGHT, FONT_WEIGHT_NUMERIC (entity));
+  i = FONT_SLANT_NUMERIC (entity) - 100;
+  if (i < 0) i = 0;
+  FcPatternAddInteger (pat, FC_SLANT, i);
+  FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity));
+  FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size);
+  val = AREF (entity, FONT_FAMILY_INDEX);
+  if (! NILP (val))
+    FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val)));
+  val = AREF (entity, FONT_FOUNDRY_INDEX);
+  if (! NILP (val))
+    FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) SDATA (SYMBOL_NAME 
(val)));
+  val = AREF (entity, FONT_SPACING_INDEX);
+  if (! NILP (val))
+    FcPatternAddInteger (pat, FC_SPACING, XFIXNUM (val));
+  val = AREF (entity, FONT_DPI_INDEX);
+  if (! NILP (val))
+    {
+      double dbl = XFIXNUM (val);
+
+      FcPatternAddDouble (pat, FC_DPI, dbl);
+    }
+  val = AREF (entity, FONT_AVGWIDTH_INDEX);
+  if (FIXNUMP (val) && XFIXNUM (val) == 0)
+    FcPatternAddBool (pat, FC_SCALABLE, FcTrue);
+  /* This is necessary to identify the exact font (e.g. 10x20.pcf.gz
+     over 10x20-ISO8859-1.pcf.gz).  */
+  FcPatternAddCharSet (pat, FC_CHARSET, ftfont_get_fc_charset (entity));
+
+  ftfont_add_rendering_parameters (pat, entity);
+
+  FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename));
+  FcPatternAddInteger (pat, FC_INDEX, XFIXNUM (idx));
+
+  return pat;
+}
 
 Lisp_Object
-ftfont_open2 (struct frame *f,
-              Lisp_Object entity,
-              int pixel_size,
-              Lisp_Object font_object)
+ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 {
   struct font_info *ftfont_info;
   struct font *font;
@@ -1116,12 +1263,11 @@ ftfont_open2 (struct frame *f,
   FT_Face ft_face;
   FT_Size ft_size;
   FT_UInt size;
-  Lisp_Object val, filename, idx, cache;
+  Lisp_Object val, filename, idx, cache, font_object;
   bool scalable;
   int spacing;
   int i;
   double upEM;
-  FT_Int strike_index = -1;
 
   val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX));
   if (! CONSP (val))
@@ -1132,7 +1278,6 @@ ftfont_open2 (struct frame *f,
     return Qnil;
   filename = XCAR (val);
   idx = XCDR (val);
-  val = XCDR (cache);
   cache_data = xmint_pointer (XCDR (cache));
   ft_face = cache_data->ft_face;
   if (cache_data->face_refcount > 0)
@@ -1151,35 +1296,17 @@ ftfont_open2 (struct frame *f,
     size = pixel_size;
   if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0)
     {
-      int min_distance = INT_MAX;
-      bool magnify = true;
-
-      for (FT_Int i = 0; i < ft_face->num_fixed_sizes; i++)
-       {
-         int distance = ft_face->available_sizes[i].height - (int) size;
-
-         /* Prefer down-scaling to upscaling.  */
-         if (magnify == (distance < 0) ? abs (distance) <= min_distance
-             : magnify)
-           {
-             magnify = distance < 0;
-             min_distance = abs (distance);
-             strike_index = i;
-           }
-       }
-
-      if (strike_index < 0 || FT_Select_Size (ft_face, strike_index) != 0)
+      if (cache_data->face_refcount == 0)
        {
-         if (cache_data->face_refcount == 0)
-           {
-             FT_Done_Face (ft_face);
-             cache_data->ft_face = NULL;
-           }
-         return Qnil;
+         FT_Done_Face (ft_face);
+         cache_data->ft_face = NULL;
        }
+      return Qnil;
     }
   cache_data->face_refcount++;
 
+  font_object = font_build_object (VECSIZE (struct font_info),
+                                  Qfreetype, entity, size);
   ASET (font_object, FONT_FILE_INDEX, filename);
   font = XFONT_OBJECT (font_object);
   ftfont_info = (struct font_info *) font;
@@ -1192,7 +1319,6 @@ ftfont_open2 (struct frame *f,
 #ifdef HAVE_HARFBUZZ
   ftfont_info->hb_font = NULL;
 #endif /* HAVE_HARFBUZZ */
-  ftfont_info->bitmap_strike_index = strike_index;
   /* This means that there's no need of transformation.  */
   ftfont_info->matrix.xx = 0;
   font->pixel_size = size;
@@ -1204,20 +1330,38 @@ ftfont_open2 (struct frame *f,
   font->driver = &ftfont_driver;
   font->encoding_charset = font->repertory_charset = -1;
 
+  val = assq_no_quit (QCminspace, AREF (entity, FONT_EXTRA_INDEX));
+  bool no_leading_p = !(CONSP (val) && NILP (XCDR (val)));
   upEM = ft_face->units_per_EM;
   scalable = (FIXNUMP (AREF (entity, FONT_AVGWIDTH_INDEX))
              && XFIXNUM (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0);
   if (scalable)
     {
       font->ascent = ft_face->ascender * size / upEM + 0.5;
-      font->descent = - ft_face->descender * size / upEM + 0.5;
-      font->height = ft_face->height * size / upEM + 0.5;
+      if (no_leading_p)
+       {
+         font->descent = - ft_face->descender * size / upEM + 0.5;
+         font->height = font->ascent + font->descent;
+       }
+      else
+       {
+         font->height = ft_face->height * size / upEM + 0.5;
+         font->descent = font->height - font->ascent;
+       }
     }
   else
     {
       font->ascent = ft_face->size->metrics.ascender >> 6;
-      font->descent = - ft_face->size->metrics.descender >> 6;
-      font->height = ft_face->size->metrics.height >> 6;
+      if (no_leading_p)
+       {
+         font->descent = - ft_face->size->metrics.descender >> 6;
+         font->height = font->ascent + font->descent;
+       }
+      else
+       {
+         font->height = ft_face->size->metrics.height >> 6;
+         font->descent = font->height - font->ascent;
+       }
     }
   if (FIXNUMP (AREF (entity, FONT_SPACING_INDEX)))
     spacing = XFIXNUM (AREF (entity, FONT_SPACING_INDEX));
@@ -1273,32 +1417,6 @@ ftfont_open2 (struct frame *f,
   return font_object;
 }
 
-Lisp_Object
-ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
-{
-  Lisp_Object font_object;
-  FT_UInt size;
-  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
-  if (size == 0)
-    size = pixel_size;
-  font_object = font_build_object (VECSIZE (struct font_info),
-                                  AREF (entity, FONT_TYPE_INDEX),
-                                  entity, size);
-  font_object = ftfont_open2 (f, entity, pixel_size, font_object);
-  if (FONT_OBJECT_P (font_object))
-    {
-      struct font *font = XFONT_OBJECT (font_object);
-      struct font_info *ftfont_info = (struct font_info *) font;
-
-      if (ftfont_info->bitmap_strike_index >= 0)
-       {
-         ftfont_close (font);
-         font_object = Qnil;
-       }
-    }
-  return font_object;
-}
-
 void
 ftfont_close (struct font *font)
 {
@@ -1391,7 +1509,7 @@ ftfont_glyph_metrics (FT_Face ft_face, int c, int 
*advance, int *lbearing,
 }
 
 void
-ftfont_text_extents (struct font *font, unsigned int *code,
+ftfont_text_extents (struct font *font, const unsigned int *code,
                     int nglyphs, struct font_metrics *metrics)
 {
   struct font_info *ftfont_info = (struct font_info *) font;
@@ -3131,6 +3249,17 @@ syms_of_ftfont (void)
   DEFSYM (Qsans, "sans");
   DEFSYM (Qsans__serif, "sans serif");
 
+  /* The boolean-valued font property key specifying the use of leading.  */
+  DEFSYM (QCminspace, ":minspace");
+
+  /* Fontconfig's rendering parameters.  */
+  DEFSYM (QChinting, ":hinting");
+  DEFSYM (QCautohint, ":autohint");
+  DEFSYM (QChintstyle, ":hintstyle");
+  DEFSYM (QCrgba, ":rgba");
+  DEFSYM (QCembolden, ":embolden");
+  DEFSYM (QClcdfilter, ":lcdfilter");
+
   staticpro (&freetype_font_cache);
   freetype_font_cache = list1 (Qt);
 
diff --git a/src/ftfont.h b/src/ftfont.h
index f877860..b2280e9 100644
--- a/src/ftfont.h
+++ b/src/ftfont.h
@@ -42,10 +42,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #endif /* HAVE_LIBOTF */
 
 extern FcCharSet *ftfont_get_fc_charset (Lisp_Object);
-extern Lisp_Object ftfont_open2 (struct frame *f,
-                                 Lisp_Object entity,
-                                 int pixel_size,
-                                 Lisp_Object font_object);
+extern void ftfont_fix_match (FcPattern *, FcPattern *);
+extern void ftfont_add_rendering_parameters (FcPattern *, Lisp_Object);
+extern FcPattern *ftfont_entity_pattern (Lisp_Object, int);
 
 /* This struct is shared by the XFT, Freetype, and Cairo font
    backends.  Members up to and including 'matrix' are common, the
@@ -59,10 +58,6 @@ struct font_info
 #endif /* HAVE_LIBOTF */
   FT_Size ft_size;
   int index;
-  /* Index of the bitmap strike used as a fallback for
-     FT_Set_Pixel_Sizes failure.  If the value is non-negative, then
-     ft_size is not of the requested size.  Otherwise it is -1.  */
-  FT_Int bitmap_strike_index;
   FT_Matrix matrix;
 #ifdef HAVE_HARFBUZZ
   hb_font_t *hb_font;
@@ -70,9 +65,10 @@ struct font_info
 
 #ifdef USE_CAIRO
   cairo_scaled_font_t *cr_scaled_font;
-  /* 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;
+  /* Scale factor from the bitmap strike metrics in 1/64 pixels, used
+     as the hb_position_t value in HarfBuzz, to those in (scaled)
+     pixels.  The value is 0 for scalable fonts.  */
+  double bitmap_position_unit;
   /* Font metrics cache.  */
   struct font_metrics **metrics;
   short metrics_nrows;
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 949ef4c..da3e3fb 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -244,7 +244,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int 
x, int y,
   struct font *font = s->font;
   XPoint p[0x700];
   int n[7];
-  unsigned *code;
+  unsigned *code = s->char2b + from;
   int len = to - from;
   int i;
   GC *gcs;
@@ -252,14 +252,9 @@ ftxfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
 
   n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0;
 
-  USE_SAFE_ALLOCA;
-  SAFE_NALLOCA (code, 1, len);
   block_input ();
   if (with_background)
     ftxfont_draw_background (f, font, s->gc, x, y, s->width);
-  for (i = 0; i < len; i++)
-    code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
-              | XCHAR2B_BYTE2 (s->char2b + from + i));
 
   if (face->gc == s->gc)
     {
@@ -304,7 +299,6 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int 
x, int y,
     }
 
   unblock_input ();
-  SAFE_FREE ();
 
   return len;
 }
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 4823357..43918dd 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -520,7 +520,7 @@ get_utf8_string (const char *str)
 bool
 xg_check_special_colors (struct frame *f,
                          const char *color_name,
-                         XColor *color)
+                         Emacs_Color *color)
 {
   bool success_p = 0;
   bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
diff --git a/src/gtkutil.h b/src/gtkutil.h
index ec89978..229aa08 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -166,7 +166,7 @@ extern void xg_free_frame_widgets (struct frame *f);
 extern void xg_set_background_color (struct frame *f, unsigned long bg);
 extern bool xg_check_special_colors (struct frame *f,
                                     const char *color_name,
-                                    XColor *color);
+                                    Emacs_Color *color);
 
 extern void xg_set_frame_icon (struct frame *f,
                                Pixmap icon_pixmap,
diff --git a/src/image.c b/src/image.c
index bf59498..57b405f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -132,17 +132,17 @@ static unsigned long *colors_in_color_table (int *n);
 #ifdef HAVE_NS
 /* Use with images created by ns_image_for_XPM.  */
 static unsigned long
-XGetPixel (XImagePtr ximage, int x, int y)
+XGetPixel (Emacs_Pix_Container image, int x, int y)
 {
-  return ns_get_pixel (ximage, x, y);
+  return ns_get_pixel (image, x, y);
 }
 
 /* Use with images created by ns_image_for_XPM; alpha set to 1;
    pixel is assumed to be in RGB form.  */
 static void
-XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
+XPutPixel (Emacs_Pix_Container image, int x, int y, unsigned long pixel)
 {
-  ns_put_pixel (ximage, x, y, pixel);
+  ns_put_pixel (image, x, y, pixel);
 }
 #endif /* HAVE_NS */
 
@@ -228,7 +228,7 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
 
 #ifdef HAVE_NTGUI
   Lisp_Object frame UNINIT;    /* The value is not used.  */
-  Pixmap bitmap;
+  Emacs_Pixmap bitmap;
   bitmap = CreateBitmap (width, height,
                         FRAME_DISPLAY_INFO (XFRAME (frame))->n_planes,
                         FRAME_DISPLAY_INFO (XFRAME (frame))->n_cbits,
@@ -412,17 +412,19 @@ typedef void Picture;
 #endif
 
 static bool image_create_x_image_and_pixmap_1 (struct frame *, int, int, int,
-                                               XImagePtr *, Pixmap *, Picture 
*);
-static void image_destroy_x_image (XImagePtr ximg);
+                                               Emacs_Pix_Container *,
+                                               Emacs_Pixmap *, Picture *);
+static void image_destroy_x_image (Emacs_Pix_Container);
 
 #ifdef HAVE_NTGUI
-static XImagePtr_or_DC image_get_x_image_or_dc (struct frame *, struct image *,
-                                               bool, HGDIOBJ *);
-static void image_unget_x_image_or_dc (struct image *, bool, XImagePtr_or_DC,
-                                      HGDIOBJ);
+static HDC image_get_x_image_or_dc (struct frame *, struct image *,
+                                    bool, HGDIOBJ *);
+static void image_unget_x_image_or_dc (struct image *, bool,
+                                       HDC, HGDIOBJ);
 #else
-static XImagePtr image_get_x_image (struct frame *, struct image *, bool);
-static void image_unget_x_image (struct image *, bool, XImagePtr);
+static Emacs_Pix_Container image_get_x_image (struct frame *, struct image *,
+                                              bool);
+static void image_unget_x_image (struct image *, bool, Emacs_Pix_Container);
 #define image_get_x_image_or_dc(f, img, mask_p, dummy) \
   image_get_x_image (f, img, mask_p)
 #define image_unget_x_image_or_dc(img, mask_p, ximg, dummy)    \
@@ -436,7 +438,7 @@ static void image_sync_to_pixmaps (struct frame *, struct 
image *);
 /* Useful functions defined in the section
    `Image type independent image structures' below. */
 
-static unsigned long four_corners_best (XImagePtr ximg,
+static unsigned long four_corners_best (XImage *ximg,
                                         int *corners,
                                         unsigned long width,
                                         unsigned long height);
@@ -449,7 +451,7 @@ void
 x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
 {
   Pixmap pixmap, mask;
-  XImagePtr ximg, mask_img;
+  XImage *ximg, *mask_img;
   unsigned long width, height;
   bool result;
   unsigned long bg;
@@ -548,82 +550,29 @@ struct image_type
   /* Free resources of image IMG which is used on frame F.  */
   void (*free) (struct frame *f, struct image *img);
 
+#ifdef WINDOWSNT
   /* 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;
+  /* An initializer for the init field.  */
+# define IMAGE_TYPE_INIT(f) f
+#else
+# define IMAGE_TYPE_INIT(f)
+#endif
 };
 
-/* 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.  */
-
-static struct image_type *image_types;
-
 /* Forward function prototypes.  */
 
-static struct image_type *lookup_image_type (Lisp_Object);
+static struct image_type const *lookup_image_type (Lisp_Object);
 static void image_laplace (struct frame *, struct image *);
 static void image_emboss (struct frame *, struct image *);
 static void image_build_heuristic_mask (struct frame *, struct image *,
                                     Lisp_Object);
-#ifdef WINDOWSNT
-#define CACHE_IMAGE_TYPE(type, status) \
-  do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while 
(0)
-#else
-#define CACHE_IMAGE_TYPE(type, status)
-#endif
-
-#define ADD_IMAGE_TYPE(type) \
-  do { Vimage_types = Fcons (type, Vimage_types); } while (0)
-
-/* Define a new image type from TYPE.  This adds a copy of TYPE to
-   image_types and caches the loading status of TYPE.  */
 
-static struct image_type *
-define_image_type (struct image_type *type)
+static void
+add_image_type (Lisp_Object type)
 {
-  struct image_type *p = NULL;
-  int new_type = type->type;
-  bool type_valid = true;
-
-  block_input ();
-
-  for (p = image_types; p; p = p->next)
-    if (p->type == new_type)
-      goto done;
-
-  if (type->init)
-    {
-#if defined HAVE_NTGUI && defined WINDOWSNT
-      /* If we failed to load the library before, don't try again.  */
-      Lisp_Object tested = Fassq (builtin_lisp_symbol (new_type),
-                                 Vlibrary_cache);
-      if (CONSP (tested) && NILP (XCDR (tested)))
-       type_valid = false;
-      else
-#endif
-       {
-         type_valid = type->init ();
-         CACHE_IMAGE_TYPE (builtin_lisp_symbol (new_type),
-                           type_valid ? Qt : Qnil);
-       }
-    }
-
-  if (type_valid)
-    {
-      /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
-         The initialized data segment is read-only.  */
-      p = xmalloc (sizeof *p);
-      *p = *type;
-      p->next = image_types;
-      image_types = p;
-    }
-
- done:
-  unblock_input ();
-  return p;
+  Vimage_types = Fcons (type, Vimage_types);
 }
 
 
@@ -637,29 +586,24 @@ define_image_type (struct image_type *type)
 bool
 valid_image_p (Lisp_Object object)
 {
-  bool valid_p = 0;
-
   if (IMAGEP (object))
     {
-      Lisp_Object tem;
-
-      for (tem = XCDR (object); CONSP (tem); tem = XCDR (tem))
-       if (EQ (XCAR (tem), QCtype))
+      Lisp_Object tail = XCDR (object);
+      FOR_EACH_TAIL_SAFE (tail)
+       if (EQ (XCAR (tail), QCtype))
          {
-           tem = XCDR (tem);
-           if (CONSP (tem) && SYMBOLP (XCAR (tem)))
+           tail = XCDR (tail);
+           if (CONSP (tail))
              {
-               struct image_type *type;
-               type = lookup_image_type (XCAR (tem));
+               struct image_type const *type = lookup_image_type (XCAR (tail));
                if (type)
-                 valid_p = type->valid_p (object);
+                 return type->valid_p (object);
              }
-
            break;
          }
     }
 
-  return valid_p;
+  return false;
 }
 
 
@@ -1134,10 +1078,10 @@ image_ascent (struct image *img, struct face *face, 
struct glyph_slice *slice)
 
 #ifdef USE_CAIRO
 static uint32_t
-xcolor_to_argb32 (XColor xc)
+emacs_color_to_argb32 (Emacs_Color *ec)
 {
-  return ((0xffu << 24) | ((xc.red / 256) << 16)
-         | ((xc.green / 256) << 8) | (xc.blue / 256));
+  return ((0xffu << 24) | ((ec->red / 256) << 16)
+         | ((ec->green / 256) << 8) | (ec->blue / 256));
 }
 
 static uint32_t
@@ -1145,11 +1089,11 @@ get_spec_bg_or_alpha_as_argb (struct image *img,
                               struct frame *f)
 {
   uint32_t bgcolor = 0;
-  XColor xbgcolor;
+  Emacs_Color xbgcolor;
   Lisp_Object bg = image_spec_value (img->spec, QCbackground, NULL);
 
   if (STRINGP (bg) && x_parse_color (f, SSDATA (bg), &xbgcolor))
-    bgcolor = xcolor_to_argb32 (xbgcolor);
+    bgcolor = emacs_color_to_argb32 (&xbgcolor);
 
   return bgcolor;
 }
@@ -1179,10 +1123,10 @@ set_cairo_image_surface (struct image *img, 
cairo_surface_t *surface)
 /* Image background colors.  */
 
 /* Find the "best" corner color of a bitmap.
-   On W32, XIMG is assumed to a device context with the bitmap selected.  */
+   On W32, PIMG is assumed to a device context with the bitmap selected.  */
 
 static RGB_PIXEL_COLOR
-four_corners_best (XImagePtr_or_DC ximg, int *corners,
+four_corners_best (Emacs_Pix_Context pimg, int *corners,
                   unsigned long width, unsigned long height)
 {
   RGB_PIXEL_COLOR corner_pixels[4];
@@ -1191,19 +1135,19 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners,
 
   if (corners && corners[BOT_CORNER] >= 0)
     {
-      /* Get the colors at the corner_pixels of ximg.  */
-      corner_pixels[0] = GET_PIXEL (ximg, corners[LEFT_CORNER], 
corners[TOP_CORNER]);
-      corner_pixels[1] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1, 
corners[TOP_CORNER]);
-      corner_pixels[2] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1, 
corners[BOT_CORNER] - 1);
-      corner_pixels[3] = GET_PIXEL (ximg, corners[LEFT_CORNER], 
corners[BOT_CORNER] - 1);
+      /* Get the colors at the corner_pixels of pimg.  */
+      corner_pixels[0] = GET_PIXEL (pimg, corners[LEFT_CORNER], 
corners[TOP_CORNER]);
+      corner_pixels[1] = GET_PIXEL (pimg, corners[RIGHT_CORNER] - 1, 
corners[TOP_CORNER]);
+      corner_pixels[2] = GET_PIXEL (pimg, corners[RIGHT_CORNER] - 1, 
corners[BOT_CORNER] - 1);
+      corner_pixels[3] = GET_PIXEL (pimg, corners[LEFT_CORNER], 
corners[BOT_CORNER] - 1);
     }
   else
     {
-      /* Get the colors at the corner_pixels of ximg.  */
-      corner_pixels[0] = GET_PIXEL (ximg, 0, 0);
-      corner_pixels[1] = GET_PIXEL (ximg, width - 1, 0);
-      corner_pixels[2] = GET_PIXEL (ximg, width - 1, height - 1);
-      corner_pixels[3] = GET_PIXEL (ximg, 0, height - 1);
+      /* Get the colors at the corner_pixels of pimg.  */
+      corner_pixels[0] = GET_PIXEL (pimg, 0, 0);
+      corner_pixels[1] = GET_PIXEL (pimg, width - 1, 0);
+      corner_pixels[2] = GET_PIXEL (pimg, width - 1, height - 1);
+      corner_pixels[3] = GET_PIXEL (pimg, 0, height - 1);
     }
   /* Choose the most frequently found color as background.  */
   for (i = best_count = 0; i < 4; ++i)
@@ -1221,49 +1165,29 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners,
   return best;
 }
 
-/* Portability macros */
-
-#ifdef HAVE_NTGUI
-
-#define Free_Pixmap(display, pixmap) \
-  DeleteObject (pixmap)
-
-#elif defined (HAVE_NS)
-
-#define Free_Pixmap(display, pixmap) \
-  ns_release_object (pixmap)
-
-#else
-
-#define Free_Pixmap(display, pixmap) \
-  XFreePixmap (display, pixmap)
-
-#endif /* !HAVE_NTGUI && !HAVE_NS */
-
-
 /* Return the `background' field of IMG.  If IMG doesn't have one yet,
    it is guessed heuristically.  If non-zero, XIMG is an existing
-   XImage object (or device context with the image selected on W32) to
-   use for the heuristic.  */
+   Emacs_Pix_Context object (device context with the image selected on
+   W32) to use for the heuristic.  */
 
 RGB_PIXEL_COLOR
-image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg)
+image_background (struct image *img, struct frame *f, Emacs_Pix_Context pimg)
 {
   if (! img->background_valid)
     /* IMG doesn't have a background yet, try to guess a reasonable value.  */
     {
-      bool free_ximg = !ximg;
+      bool free_pimg = !pimg;
 #ifdef HAVE_NTGUI
       HGDIOBJ prev;
 #endif /* HAVE_NTGUI */
 
-      if (free_ximg)
-       ximg = image_get_x_image_or_dc (f, img, 0, &prev);
+      if (free_pimg)
+       pimg = image_get_x_image_or_dc (f, img, 0, &prev);
 
-      img->background = four_corners_best (ximg, img->corners, img->width, 
img->height);
+      img->background = four_corners_best (pimg, img->corners, img->width, 
img->height);
 
-      if (free_ximg)
-       image_unget_x_image_or_dc (img, 0, ximg, prev);
+      if (free_pimg)
+       image_unget_x_image_or_dc (img, 0, pimg, prev);
 
       img->background_valid = 1;
     }
@@ -1273,10 +1197,12 @@ image_background (struct image *img, struct frame *f, 
XImagePtr_or_DC ximg)
 
 /* Return the `background_transparent' field of IMG.  If IMG doesn't
    have one yet, it is guessed heuristically.  If non-zero, MASK is an
-   existing XImage object to use for the heuristic.  */
+   existing Emacs_Pix_Context (XImage* on X) object to use for the
+   heuristic.  */
 
 int
-image_background_transparent (struct image *img, struct frame *f, 
XImagePtr_or_DC mask)
+image_background_transparent (struct image *img, struct frame *f,
+                              Emacs_Pix_Context mask)
 {
   if (! img->background_transparent_valid)
     /* IMG doesn't have a background yet, try to guess a reasonable value.  */
@@ -1328,7 +1254,7 @@ image_clear_image_1 (struct frame *f, struct image *img, 
int flags)
     {
       if (img->pixmap)
        {
-         Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap);
+         FRAME_TERMINAL (f)->free_pixmap (f, img->pixmap);
          img->pixmap = NO_PIXMAP;
          /* NOTE (HAVE_NS): background color is NOT an indexed color! */
          img->background_valid = 0;
@@ -1347,7 +1273,7 @@ image_clear_image_1 (struct frame *f, struct image *img, 
int flags)
     {
       if (img->mask)
        {
-         Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
+         FRAME_TERMINAL (f)->free_pixmap (f, img->mask);
          img->mask = NO_PIXMAP;
          img->background_transparent_valid = 0;
        }
@@ -1399,7 +1325,7 @@ static unsigned long
 image_alloc_image_color (struct frame *f, struct image *img,
                          Lisp_Object color_name, unsigned long dflt)
 {
-  XColor color;
+  Emacs_Color color;
   unsigned long result;
 
   eassert (STRINGP (color_name));
@@ -2079,7 +2005,7 @@ mark_image_cache (struct image_cache *c)
    WIDTH and HEIGHT must both be positive.
    If XIMG is null, assume it is a bitmap.  */
 static bool
-image_check_image_size (XImagePtr ximg, int width, int height)
+image_check_image_size (Emacs_Pix_Container ximg, int width, int height)
 {
 #ifdef HAVE_X_WINDOWS
   /* Respect Xlib's limits: it cannot deal with images that have more
@@ -2113,18 +2039,20 @@ image_check_image_size (XImagePtr ximg, int width, int 
height)
 #endif
 }
 
-/* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on
-   frame F.  Set *XIMG and *PIXMAP to the XImage and Pixmap created.
-   Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated
-   via xmalloc.  Print error messages via image_error if an error
-   occurs.  Value is true if successful.
+/* Create an Emacs_Pix_Container and a pixmap of size WIDTH x
+   HEIGHT for use on frame F.  Set *PIMG and *PIXMAP to the
+   Emacs_Pix_Container and Emacs_Pixmap created.  Set (*PIMG)->data
+   to a raster of WIDTH x HEIGHT pixels allocated via xmalloc.  Print
+   error messages via image_error if an error occurs.  Value is true
+   if successful.
 
    On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH
    should indicate the bit depth of the image.  */
 
 static bool
 image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int 
depth,
-                                   XImagePtr *ximg, Pixmap *pixmap, Picture 
*picture)
+                                   Emacs_Pix_Container *pimg,
+                                   Emacs_Pixmap *pixmap, Picture *picture)
 {
 #ifdef HAVE_X_WINDOWS
   Display *display = FRAME_X_DISPLAY (f);
@@ -2135,33 +2063,33 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
 
   if (depth <= 0)
     depth = DefaultDepthOfScreen (screen);
-  *ximg = XCreateImage (display, DefaultVisualOfScreen (screen),
+  *pimg = XCreateImage (display, DefaultVisualOfScreen (screen),
                        depth, ZPixmap, 0, NULL, width, height,
                        depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
-  if (*ximg == NULL)
+  if (*pimg == NULL)
     {
       image_error ("Unable to allocate X image");
       return 0;
     }
 
-  if (! image_check_image_size (*ximg, width, height))
+  if (! image_check_image_size (*pimg, width, height))
     {
-      image_destroy_x_image (*ximg);
-      *ximg = NULL;
+      image_destroy_x_image (*pimg);
+      *pimg = NULL;
       image_error ("Image too large (%dx%d)",
                   make_fixnum (width), make_fixnum (height));
       return 0;
     }
 
   /* Allocate image raster.  */
-  (*ximg)->data = xmalloc ((*ximg)->bytes_per_line * height);
+  (*pimg)->data = xmalloc ((*pimg)->bytes_per_line * height);
 
   /* Allocate a pixmap of the same size.  */
   *pixmap = XCreatePixmap (display, drawable, width, height, depth);
   if (*pixmap == NO_PIXMAP)
     {
-      image_destroy_x_image (*ximg);
-      *ximg = NULL;
+      image_destroy_x_image (*pimg);
+      *pimg = NULL;
       image_error ("Unable to create X pixmap");
       return 0;
     }
@@ -2228,10 +2156,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
   if (depth < 16)
     palette_colors = 1 << (depth - 1);
 
-  *ximg = xmalloc (sizeof (XImage) + palette_colors * sizeof (RGBQUAD));
+  *pimg = xmalloc (sizeof (XImage) + palette_colors * sizeof (RGBQUAD));
 
-  header = &(*ximg)->info.bmiHeader;
-  memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
+  header = &(*pimg)->info.bmiHeader;
+  memset (&(*pimg)->info, 0, sizeof (BITMAPINFO));
   header->biSize = sizeof (*header);
   header->biWidth = width;
   header->biHeight = -height;  /* negative indicates a top-down bitmap.  */
@@ -2243,10 +2171,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
   /* TODO: fill in palette.  */
   if (depth == 1)
     {
-      (*ximg)->info.bmiColors[0].rgbBlue = 0;
-      (*ximg)->info.bmiColors[0].rgbGreen = 0;
-      (*ximg)->info.bmiColors[0].rgbRed = 0;
-      (*ximg)->info.bmiColors[0].rgbReserved = 0;
+      (*pimg)->info.bmiColors[0].rgbBlue = 0;
+      (*pimg)->info.bmiColors[0].rgbGreen = 0;
+      (*pimg)->info.bmiColors[0].rgbRed = 0;
+      (*pimg)->info.bmiColors[0].rgbReserved = 0;
       /* bmiColors is a variable-length array declared by w32api
         headers as bmiColors[1], which triggers a warning under
         -Warray-bounds; shut that up.  */
@@ -2254,10 +2182,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
 #      pragma GCC push_options
 #      pragma GCC diagnostic ignored "-Warray-bounds"
 #     endif
-      (*ximg)->info.bmiColors[1].rgbBlue = 255;
-      (*ximg)->info.bmiColors[1].rgbGreen = 255;
-      (*ximg)->info.bmiColors[1].rgbRed = 255;
-      (*ximg)->info.bmiColors[1].rgbReserved = 0;
+      (*pimg)->info.bmiColors[1].rgbBlue = 255;
+      (*pimg)->info.bmiColors[1].rgbGreen = 255;
+      (*pimg)->info.bmiColors[1].rgbRed = 255;
+      (*pimg)->info.bmiColors[1].rgbReserved = 0;
 #     if GNUC_PREREQ (4, 4, 0)
 #      pragma GCC pop_options
 #     endif
@@ -2267,10 +2195,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
 
   /* Create a DIBSection and raster array for the bitmap,
      and store its handle in *pixmap.  */
-  *pixmap = CreateDIBSection (hdc, &((*ximg)->info),
+  *pixmap = CreateDIBSection (hdc, &((*pimg)->info),
                              (depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS,
                              /* casting avoids a GCC warning */
-                             (void **)&((*ximg)->data), NULL, 0);
+                             (void **)&((*pimg)->data), NULL, 0);
 
   /* Realize display palette and garbage all frames. */
   release_frame_dc (f, hdc);
@@ -2282,8 +2210,8 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
       /* All system errors are < 10000, so the following is safe.  */
       XSETINT (errcode, err);
       image_error ("Unable to create bitmap, error code %d", errcode);
-      image_destroy_x_image (*ximg);
-      *ximg = NULL;
+      image_destroy_x_image (*pimg);
+      *pimg = NULL;
       return 0;
     }
 
@@ -2295,69 +2223,70 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
   *pixmap = ns_image_for_XPM (width, height, depth);
   if (*pixmap == 0)
     {
-      *ximg = NULL;
+      *pimg = NULL;
       image_error ("Unable to allocate NSImage for XPM pixmap");
       return 0;
     }
-  *ximg = *pixmap;
+  *pimg = *pixmap;
   return 1;
 #endif
 }
 
 
-/* Destroy XImage XIMG.  Free XIMG->data.  */
+/* Destroy Emacs_Pix_Container PIMG.  Free data associated with PIMG.  */
 
 static void
-image_destroy_x_image (XImagePtr ximg)
+image_destroy_x_image (Emacs_Pix_Container pimg)
 {
   eassert (input_blocked_p ());
-  if (ximg)
+  if (pimg)
     {
 #ifdef HAVE_X_WINDOWS
-      xfree (ximg->data);
-      ximg->data = NULL;
-      XDestroyImage (ximg);
+      xfree (pimg->data);
+      pimg->data = NULL;
+      XDestroyImage (pimg);
 #endif /* HAVE_X_WINDOWS */
 #ifdef HAVE_NTGUI
       /* Data will be freed by DestroyObject.  */
-      ximg->data = NULL;
-      xfree (ximg);
+      pimg->data = NULL;
+      xfree (pimg);
 #endif /* HAVE_NTGUI */
 #ifdef HAVE_NS
-      ns_release_object (ximg);
+      ns_release_object (pimg);
 #endif /* HAVE_NS */
     }
 }
 
 
-/* Put XImage XIMG into pixmap PIXMAP on frame F.  WIDTH and HEIGHT
-   are width and height of both the image and pixmap.  */
+/* Put Emacs_Pix_Container PIMG into pixmap PIXMAP on frame F.
+   WIDTH and HEIGHT are width and height of both the image and
+   pixmap.  */
 
 static void
-gui_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap,
-                 int width, int height)
+gui_put_x_image (struct frame *f, Emacs_Pix_Container pimg,
+                 Emacs_Pixmap pixmap, int width, int height)
 {
 #ifdef HAVE_X_WINDOWS
   GC gc;
 
   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,
-             ximg->width, ximg->height);
+  XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, pimg, 0, 0, 0, 0,
+             pimg->width, pimg->height);
   XFreeGC (FRAME_X_DISPLAY (f), gc);
 #endif /* HAVE_X_WINDOWS */
 
 #ifdef HAVE_NTGUI
 #if 0  /* I don't think this is necessary looking at where it is used.  */
   HDC hdc = get_frame_dc (f);
-  SetDIBits (hdc, pixmap, 0, height, ximg->data, &(ximg->info), 
DIB_RGB_COLORS);
+  SetDIBits (hdc, pixmap, 0, height, pimg->data, &(pimg->info), 
DIB_RGB_COLORS);
   release_frame_dc (f, hdc);
 #endif
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  eassert (ximg == pixmap);
-  ns_retain_object (ximg);
+  eassert (pimg == pixmap);
+  ns_retain_object (pimg);
 #endif
 }
 
@@ -2367,7 +2296,7 @@ gui_put_x_image (struct frame *f, XImagePtr ximg, Pixmap 
pixmap,
 static bool
 image_create_x_image_and_pixmap (struct frame *f, struct image *img,
                                 int width, int height, int depth,
-                                XImagePtr *ximg, bool mask_p)
+                                Emacs_Pix_Container *ximg, bool mask_p)
 {
   eassert ((!mask_p ? img->pixmap : img->mask) == NO_PIXMAP);
 
@@ -2380,14 +2309,14 @@ image_create_x_image_and_pixmap (struct frame *f, 
struct image *img,
                                             picture);
 }
 
-/* Put X image XIMG into image IMG on frame F, as a mask if and only
-   if MASK_P.  On X, this simply records XIMG on a member of IMG, so
+/* Put pixel image PIMG into image IMG on frame F, as a mask if and only
+   if MASK_P.  On X, this simply records PIMG on a member of IMG, so
    it can be put into the pixmap afterwards via image_sync_to_pixmaps.
-   On the other platforms, it puts XIMG into the pixmap, then frees
-   the X image and its buffer.  */
+   On the other platforms, it puts PIMG into the pixmap, then frees
+   the pixel image and its buffer.  */
 
 static void
-image_put_x_image (struct frame *f, struct image *img, XImagePtr ximg,
+image_put_x_image (struct frame *f, struct image *img, Emacs_Pix_Container 
ximg,
                   bool mask_p)
 {
 #ifdef HAVE_X_WINDOWS
@@ -2435,12 +2364,12 @@ image_sync_to_pixmaps (struct frame *f, struct image 
*img)
    currently selected GDI object into *PREV for future restoration by
    image_unget_x_image_or_dc.  */
 
-static XImagePtr_or_DC
+static HDC
 image_get_x_image_or_dc (struct frame *f, struct image *img, bool mask_p,
                         HGDIOBJ *prev)
 {
   HDC frame_dc = get_frame_dc (f);
-  XImagePtr_or_DC ximg = CreateCompatibleDC (frame_dc);
+  HDC ximg = CreateCompatibleDC (frame_dc);
 
   release_frame_dc (f, frame_dc);
   *prev = SelectObject (ximg, !mask_p ? img->pixmap : img->mask);
@@ -2450,7 +2379,7 @@ image_get_x_image_or_dc (struct frame *f, struct image 
*img, bool mask_p,
 
 static void
 image_unget_x_image_or_dc (struct image *img, bool mask_p,
-                          XImagePtr_or_DC ximg, HGDIOBJ prev)
+                          HDC ximg, HGDIOBJ prev)
 {
   SelectObject (ximg, prev);
   DeleteDC (ximg);
@@ -2459,11 +2388,11 @@ image_unget_x_image_or_dc (struct image *img, bool 
mask_p,
 /* Get the X image for IMG on frame F.  The resulting X image data
    should be treated as read-only at least on X.  */
 
-static XImagePtr
+static Emacs_Pix_Container
 image_get_x_image (struct frame *f, struct image *img, bool mask_p)
 {
 #ifdef HAVE_X_WINDOWS
-  XImagePtr ximg_in_img = !mask_p ? img->ximg : img->mask_img;
+  XImage *ximg_in_img = !mask_p ? img->ximg : img->mask_img;
 
   if (ximg_in_img)
     return ximg_in_img;
@@ -2471,7 +2400,7 @@ image_get_x_image (struct frame *f, struct image *img, 
bool mask_p)
     return XGetImage (FRAME_X_DISPLAY (f), !mask_p ? img->pixmap : img->mask,
                      0, 0, img->width, img->height, ~0, ZPixmap);
 #elif defined (HAVE_NS)
-  XImagePtr pixmap = !mask_p ? img->pixmap : img->mask;
+  Emacs_Pix_Container pixmap = !mask_p ? img->pixmap : img->mask;
 
   ns_retain_object (pixmap);
   return pixmap;
@@ -2479,10 +2408,10 @@ image_get_x_image (struct frame *f, struct image *img, 
bool mask_p)
 }
 
 static void
-image_unget_x_image (struct image *img, bool mask_p, XImagePtr ximg)
+image_unget_x_image (struct image *img, bool mask_p, Emacs_Pix_Container ximg)
 {
 #ifdef HAVE_X_WINDOWS
-  XImagePtr ximg_in_img = !mask_p ? img->ximg : img->mask_img;
+  XImage *ximg_in_img = !mask_p ? img->ximg : img->mask_img;
 
   if (ximg_in_img)
     eassert (ximg == ximg_in_img);
@@ -2595,8 +2524,6 @@ slurp_file (int fd, ptrdiff_t *size)
                              XBM images
  ***********************************************************************/
 
-static bool xbm_load (struct frame *f, struct image *img);
-static bool xbm_image_p (Lisp_Object object);
 static bool xbm_file_p (Lisp_Object);
 
 
@@ -2640,18 +2567,6 @@ static const struct image_keyword xbm_format[XBM_LAST] =
   {":mask",            IMAGE_DONT_CHECK_VALUE_TYPE,            0}
 };
 
-/* Structure describing the image type XBM.  */
-
-static struct image_type xbm_type =
-{
-  SYMBOL_INDEX (Qxbm),
-  xbm_image_p,
-  xbm_load,
-  image_clear_image,
-  NULL,
-  NULL
-};
-
 /* Tokens returned from xbm_scan.  */
 
 enum xbm_token
@@ -3377,13 +3292,6 @@ xbm_load (struct frame *f, struct image *img)
                              XPM images
  ***********************************************************************/
 
-#if defined (HAVE_XPM) || defined (HAVE_NS)
-
-static bool xpm_image_p (Lisp_Object object);
-static bool xpm_load (struct frame *f, struct image *img);
-
-#endif /* HAVE_XPM || HAVE_NS */
-
 #ifdef HAVE_XPM
 #ifdef HAVE_NTGUI
 /* Indicate to xpm.h that we don't have Xlib.  */
@@ -3445,24 +3353,6 @@ static const struct image_keyword xpm_format[XPM_LAST] =
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-#if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_xpm_functions (void);
-#else
-#define init_xpm_functions NULL
-#endif
-
-/* Structure describing the image type XPM.  */
-
-static struct image_type xpm_type =
-{
-  SYMBOL_INDEX (Qxpm),
-  xpm_image_p,
-  xpm_load,
-  image_clear_image,
-  init_xpm_functions,
-  NULL
-};
-
 #ifdef HAVE_X_WINDOWS
 
 /* Define ALLOC_XPM_COLORS if we can use Emacs' own color allocation
@@ -4318,7 +4208,7 @@ xpm_load_image (struct frame *f,
 #ifndef HAVE_NS
   bool have_mask = false;
 #endif
-  XImagePtr ximg = NULL, mask_img = NULL;
+  Emacs_Pix_Container ximg = NULL, mask_img = NULL;
 
 #define match() \
      LA1 = xpm_scan (&s, end, &beg, &len)
@@ -4403,7 +4293,7 @@ xpm_load_image (struct frame *f,
       char *color, *max_color;
       int key, next_key, max_key = 0;
       Lisp_Object symbol_color = Qnil, color_val;
-      XColor cdef;
+      Emacs_Color cdef;
 
       expect (XPM_TK_STRING);
       if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel)
@@ -4889,18 +4779,18 @@ static int laplace_matrix[9] = {
 #define COLOR_INTENSITY(R, G, B) ((2 * (R) + 3 * (G) + (B)) / 6)
 
 
-/* On frame F, return an array of XColor structures describing image
-   IMG->pixmap.  Each XColor structure has its pixel color set.  RGB_P
-   means also fill the red/green/blue members of the XColor
-   structures.  Value is a pointer to the array of XColors structures,
+/* On frame F, return an array of Emacs_Color structures describing image
+   IMG->pixmap.  Each Emacs_Color structure has its pixel color set.  RGB_P
+   means also fill the red/green/blue members of the Emacs_Color
+   structures.  Value is a pointer to the array of Emacs_Color structures,
    allocated with xmalloc; it must be freed by the caller.  */
 
-static XColor *
-image_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
+static Emacs_Color *
+image_to_emacs_colors (struct frame *f, struct image *img, bool rgb_p)
 {
   int x, y;
-  XColor *colors, *p;
-  XImagePtr_or_DC ximg;
+  Emacs_Color *colors, *p;
+  Emacs_Pix_Context ximg;
   ptrdiff_t nbytes;
 #ifdef HAVE_NTGUI
   HGDIOBJ prev;
@@ -4915,13 +4805,13 @@ image_to_xcolors (struct frame *f, struct image *img, 
bool rgb_p)
   /* Get the X image or create a memory device context for IMG. */
   ximg = image_get_x_image_or_dc (f, img, 0, &prev);
 
-  /* Fill the `pixel' members of the XColor array.  I wished there
+  /* Fill the `pixel' members of the Emacs_Color array.  I wished there
      were an easy and portable way to circumvent XGetPixel.  */
   p = colors;
   for (y = 0; y < img->height; ++y)
     {
 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
-      XColor *row = p;
+      Emacs_Color *row = p;
       for (x = 0; x < img->width; ++x, ++p)
        p->pixel = GET_PIXEL (ximg, x, y);
       if (rgb_p)
@@ -4956,7 +4846,7 @@ image_to_xcolors (struct frame *f, struct image *img, 
bool rgb_p)
    stored in ximg->data.  */
 
 static void
-XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
+XPutPixel (XImage *ximg, int x, int y, COLORREF color)
 {
   int width = ximg->info.bmiHeader.biWidth;
   unsigned char * pixel;
@@ -4995,16 +4885,16 @@ XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
 
 #endif /* HAVE_NTGUI */
 
-/* Create IMG->pixmap from an array COLORS of XColor structures, whose
+/* Create IMG->pixmap from an array COLORS of Emacs_Color structures, whose
    RGB members are set.  F is the frame on which this all happens.
    COLORS will be freed; an existing IMG->pixmap will be freed, too.  */
 
 static void
-image_from_xcolors (struct frame *f, struct image *img, XColor *colors)
+image_from_emacs_colors (struct frame *f, struct image *img, Emacs_Color 
*colors)
 {
   int x, y;
-  XImagePtr oimg = NULL;
-  XColor *p;
+  Emacs_Pix_Container oimg = NULL;
+  Emacs_Color *p;
 
   init_color_table ();
 
@@ -5042,8 +4932,8 @@ static void
 image_detect_edges (struct frame *f, struct image *img,
                     int *matrix, int color_adjust)
 {
-  XColor *colors = image_to_xcolors (f, img, 1);
-  XColor *new, *p;
+  Emacs_Color *colors = image_to_emacs_colors (f, img, 1);
+  Emacs_Color *new, *p;
   int x, y, i, sum;
   ptrdiff_t nbytes;
 
@@ -5086,7 +4976,7 @@ image_detect_edges (struct frame *f, struct image *img,
            for (xx = x - 1; xx < x + 2; ++xx, ++i)
              if (matrix[i])
                {
-                 XColor *t = COLOR (colors, xx, yy);
+                 Emacs_Color *t = COLOR (colors, xx, yy);
                  r += matrix[i] * t->red;
                  g += matrix[i] * t->green;
                  b += matrix[i] * t->blue;
@@ -5100,7 +4990,7 @@ image_detect_edges (struct frame *f, struct image *img,
     }
 
   xfree (colors);
-  image_from_xcolors (f, img, new);
+  image_from_emacs_colors (f, img, new);
 
 #undef COLOR
 }
@@ -5183,8 +5073,8 @@ image_disable_image (struct frame *f, struct image *img)
       /* Color (or grayscale).  Convert to gray, and equalize.  Just
         drawing such images with a stipple can look very odd, so
         we're using this method instead.  */
-      XColor *colors = image_to_xcolors (f, img, 1);
-      XColor *p, *end;
+      Emacs_Color *colors = image_to_emacs_colors (f, img, 1);
+      Emacs_Color *p, *end;
       const int h = 15000;
       const int l = 30000;
 
@@ -5197,7 +5087,7 @@ image_disable_image (struct frame *f, struct image *img)
          p->red = p->green = p->blue = i2;
        }
 
-      image_from_xcolors (f, img, colors);
+      image_from_emacs_colors (f, img, colors);
     }
 
   /* Draw a cross over the disabled image, if we must or if we
@@ -5275,13 +5165,13 @@ static void
 image_build_heuristic_mask (struct frame *f, struct image *img,
                             Lisp_Object how)
 {
-  XImagePtr_or_DC ximg;
+  Emacs_Pix_Context ximg;
 #ifdef HAVE_NTGUI
   HGDIOBJ prev;
   char *mask_img;
   int row_width;
 #elif !defined HAVE_NS
-  XImagePtr mask_img;
+  Emacs_Pix_Container mask_img;
 #endif
   int x, y;
   bool use_img_background;
@@ -5384,9 +5274,6 @@ image_build_heuristic_mask (struct frame *f, struct image 
*img,
                       PBM (mono, gray, color)
  ***********************************************************************/
 
-static bool pbm_image_p (Lisp_Object object);
-static bool pbm_load (struct frame *f, struct image *img);
-
 /* Indices of image specification fields in gs_format, below.  */
 
 enum pbm_keyword_index
@@ -5423,19 +5310,6 @@ static const struct image_keyword pbm_format[PBM_LAST] =
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-/* Structure describing the image type `pbm'.  */
-
-static struct image_type pbm_type =
-{
-  SYMBOL_INDEX (Qpbm),
-  pbm_image_p,
-  pbm_load,
-  image_clear_image,
-  NULL,
-  NULL
-};
-
-
 /* Return true if OBJECT is a valid PBM image specification.  */
 
 static bool
@@ -5533,7 +5407,7 @@ pbm_load (struct frame *f, struct image *img)
   char *contents = NULL;
   char *end, *p;
 #ifndef USE_CAIRO
-  XImagePtr ximg;
+  Emacs_Pix_Container ximg;
 #endif
 
   specified_file = image_spec_value (img->spec, QCfile, NULL);
@@ -5655,7 +5529,7 @@ pbm_load (struct frame *f, struct image *img)
       unsigned long fg = FRAME_FOREGROUND_PIXEL (f);
       unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
 #ifdef USE_CAIRO
-      XColor xfg, xbg;
+      Emacs_Color xfg, xbg;
       int fga32, bga32;
 #endif
       /* Parse the image specification.  */
@@ -5675,7 +5549,7 @@ pbm_load (struct frame *f, struct image *img)
           xfg.pixel = fg;
           x_query_colors (f, &xfg, 1);
         }
-      fga32 = xcolor_to_argb32 (xfg);
+      fga32 = emacs_color_to_argb32 (&xfg);
 
       if (! fmt[PBM_BACKGROUND].count
           || ! STRINGP (fmt[PBM_BACKGROUND].value)
@@ -5688,7 +5562,7 @@ pbm_load (struct frame *f, struct image *img)
           xbg.pixel = bg;
           x_query_colors (f, &xbg, 1);
        }
-      bga32 = xcolor_to_argb32 (xbg);
+      bga32 = emacs_color_to_argb32 (&xbg);
 #else
       if (fmt[PBM_FOREGROUND].count
          && STRINGP (fmt[PBM_FOREGROUND].value))
@@ -5833,7 +5707,7 @@ pbm_load (struct frame *f, struct image *img)
 #else
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
     /* Casting avoids a GCC warning.  */
-    IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+    IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
 
   /* Put ximg into the image.  */
   image_put_x_image (f, img, ximg, 0);
@@ -5854,11 +5728,6 @@ pbm_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_PNG) || defined (HAVE_NS) || defined (USE_CAIRO)
 
-/* Function prototypes.  */
-
-static bool png_image_p (Lisp_Object object);
-static bool png_load (struct frame *f, struct image *img);
-
 /* Indices of image specification fields in png_format, below.  */
 
 enum png_keyword_index
@@ -5893,24 +5762,6 @@ static const struct image_keyword png_format[PNG_LAST] =
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-#if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_png_functions (void);
-#else
-#define init_png_functions NULL
-#endif
-
-/* Structure describing the image type `png'.  */
-
-static struct image_type png_type =
-{
-  SYMBOL_INDEX (Qpng),
-  png_image_p,
-  png_load,
-  image_clear_image,
-  init_png_functions,
-  NULL
-};
-
 /* Return true if OBJECT is a valid PNG image specification.  */
 
 static bool
@@ -5951,6 +5802,7 @@ DEF_DLL_FN (png_uint_32, png_get_valid, (png_structp, 
png_infop, png_uint_32));
 DEF_DLL_FN (void, png_set_strip_16, (png_structp));
 DEF_DLL_FN (void, png_set_expand, (png_structp));
 DEF_DLL_FN (void, png_set_gray_to_rgb, (png_structp));
+DEF_DLL_FN (int, png_set_interlace_handling, (png_structp));
 DEF_DLL_FN (void, png_set_background,
            (png_structp, png_color_16p, int, int, double));
 DEF_DLL_FN (png_uint_32, png_get_bKGD,
@@ -5989,6 +5841,7 @@ init_png_functions (void)
   LOAD_DLL_FN (library, png_set_strip_16);
   LOAD_DLL_FN (library, png_set_expand);
   LOAD_DLL_FN (library, png_set_gray_to_rgb);
+  LOAD_DLL_FN (library, png_set_interlace_handling);
   LOAD_DLL_FN (library, png_set_background);
   LOAD_DLL_FN (library, png_get_bKGD);
   LOAD_DLL_FN (library, png_read_update_info);
@@ -6024,6 +5877,7 @@ init_png_functions (void)
 #  undef png_set_background
 #  undef png_set_expand
 #  undef png_set_gray_to_rgb
+#  undef png_set_interlace_handling
 #  undef png_set_longjmp_fn
 #  undef png_set_read_fn
 #  undef png_set_sig_bytes
@@ -6048,6 +5902,7 @@ init_png_functions (void)
 #  define png_set_background fn_png_set_background
 #  define png_set_expand fn_png_set_expand
 #  define png_set_gray_to_rgb fn_png_set_gray_to_rgb
+#  define png_set_interlace_handling fn_png_set_interlace_handling
 #  define png_set_longjmp_fn fn_png_set_longjmp_fn
 #  define png_set_read_fn fn_png_set_read_fn
 #  define png_set_sig_bytes fn_png_set_sig_bytes
@@ -6178,7 +6033,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
   cairo_surface_t *surface;
   uint32_t *dataptr;
 #else
-  XImagePtr ximg, mask_img = NULL;
+  Emacs_Pix_Container ximg, mask_img = NULL;
 #endif
 
   /* Find out what file to load.  */
@@ -6336,7 +6191,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
       /* png_color_16 *image_bg; */
       Lisp_Object specified_bg
        = image_spec_value (img->spec, QCbackground, NULL);
-      XColor color;
+      Emacs_Color color;
 
       /* If the user specified a color, try to use it; if not, use the
         current frame background, ignoring any default background
@@ -6362,7 +6217,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
        }
     }
 
-  /* Update info structure.  */
+  png_set_interlace_handling (png_ptr);
   png_read_update_info (png_ptr, info_ptr);
 
   /* Get number of channels.  Valid values are 1 for grayscale images
@@ -6491,7 +6346,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
 #else
   /* Maybe fill in the background field while we have ximg handy.
      Casting avoids a GCC warning.  */
-  IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+  IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
 
   /* Put ximg into the image.  */
   image_put_x_image (f, img, ximg, 0);
@@ -6501,7 +6356,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
     {
       /* Fill in the background_transparent field while we have the
         mask handy.  Casting avoids a GCC warning.  */
-      image_background_transparent (img, f, (XImagePtr_or_DC)mask_img);
+      image_background_transparent (img, f, (Emacs_Pix_Context)mask_img);
 
       image_put_x_image (f, img, mask_img, 1);
     }
@@ -6538,9 +6393,6 @@ png_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_JPEG) || defined (HAVE_NS)
 
-static bool jpeg_image_p (Lisp_Object object);
-static bool jpeg_load (struct frame *f, struct image *img);
-
 /* Indices of image specification fields in gs_format, below.  */
 
 enum jpeg_keyword_index
@@ -6575,24 +6427,6 @@ static const struct image_keyword jpeg_format[JPEG_LAST] 
=
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-#if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_jpeg_functions (void);
-#else
-#define init_jpeg_functions NULL
-#endif
-
-/* Structure describing the image type `jpeg'.  */
-
-static struct image_type jpeg_type =
-{
-  SYMBOL_INDEX (Qjpeg),
-  jpeg_image_p,
-  jpeg_load,
-  image_clear_image,
-  init_jpeg_functions,
-  NULL
-};
-
 /* Return true if OBJECT is a valid JPEG image specification.  */
 
 static bool
@@ -6735,7 +6569,7 @@ my_error_exit (j_common_ptr cinfo)
 
 
 /* Init source method for JPEG data source manager.  Called by
-   jpeg_read_header() before any data is actually read.  See
+   jpeg_read_header before any data is actually read.  See
    libjpeg.doc from the JPEG lib distribution.  */
 
 static void
@@ -6745,7 +6579,7 @@ our_common_init_source (j_decompress_ptr cinfo)
 
 
 /* Method to terminate data source.  Called by
-   jpeg_finish_decompress() after all data has been processed.  */
+   jpeg_finish_decompress after all data has been processed.  */
 
 static void
 our_common_term_source (j_decompress_ptr cinfo)
@@ -6942,7 +6776,7 @@ jpeg_load_body (struct frame *f, struct image *img,
   int i, ir, ig, ib;
 #ifndef USE_CAIRO
   unsigned long *colors;
-  XImagePtr ximg = NULL;
+  Emacs_Pix_Container ximg = NULL;
 #endif
 
   /* Open the JPEG file.  */
@@ -7132,7 +6966,7 @@ jpeg_load_body (struct frame *f, struct image *img,
   /* Maybe fill in the background field while we have ximg handy. */
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
     /* Casting avoids a GCC warning.  */
-    IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+    IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
 
   /* Put ximg into the image.  */
   image_put_x_image (f, img, ximg, 0);
@@ -7170,9 +7004,6 @@ jpeg_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_TIFF) || defined (HAVE_NS)
 
-static bool tiff_image_p (Lisp_Object object);
-static bool tiff_load (struct frame *f, struct image *img);
-
 /* Indices of image specification fields in tiff_format, below.  */
 
 enum tiff_keyword_index
@@ -7209,24 +7040,6 @@ static const struct image_keyword tiff_format[TIFF_LAST] 
=
   {":index",           IMAGE_NON_NEGATIVE_INTEGER_VALUE,       0}
 };
 
-#if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_tiff_functions (void);
-#else
-#define init_tiff_functions NULL
-#endif
-
-/* Structure describing the image type `tiff'.  */
-
-static struct image_type tiff_type =
-{
-  SYMBOL_INDEX (Qtiff),
-  tiff_image_p,
-  tiff_load,
-  image_clear_image,
-  init_tiff_functions,
-  NULL
-};
-
 /* Return true if OBJECT is a valid TIFF image specification.  */
 
 static bool
@@ -7453,7 +7266,7 @@ tiff_load (struct frame *f, struct image *img)
   int width, height, x, y, count;
   uint32 *buf;
   int rc;
-  XImagePtr ximg;
+  Emacs_Pix_Container ximg;
   tiff_memory_source memsrc;
   Lisp_Object image;
 
@@ -7623,7 +7436,7 @@ tiff_load (struct frame *f, struct image *img)
   /* Maybe fill in the background field while we have ximg handy. */
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
     /* Casting avoids a GCC warning on W32.  */
-    IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+    IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
 
   /* Put ximg into the image.  */
   image_put_x_image (f, img, ximg, 0);
@@ -7654,10 +7467,6 @@ tiff_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_GIF) || defined (HAVE_NS)
 
-static bool gif_image_p (Lisp_Object object);
-static bool gif_load (struct frame *f, struct image *img);
-static void gif_clear_image (struct frame *f, struct image *img);
-
 /* Indices of image specification fields in gif_format, below.  */
 
 enum gif_keyword_index
@@ -7694,24 +7503,6 @@ static const struct image_keyword gif_format[GIF_LAST] =
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-#if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_gif_functions (void);
-#else
-#define init_gif_functions NULL
-#endif
-
-/* Structure describing the image type `gif'.  */
-
-static struct image_type gif_type =
-{
-  SYMBOL_INDEX (Qgif),
-  gif_image_p,
-  gif_load,
-  gif_clear_image,
-  init_gif_functions,
-  NULL
-};
-
 /* Free X resources of GIF image IMG which is used on frame F.  */
 
 static void
@@ -8033,7 +7824,7 @@ gif_load (struct frame *f, struct image *img)
   uint32_t *data32 = (uint32_t *) cairo_image_surface_get_data (surface);
   if (STRINGP (specified_bg))
     {
-      XColor color;
+      Emacs_Color color;
       if (FRAME_TERMINAL (f)->defined_color_hook
           (f, SSDATA (specified_bg), &color, false, false))
         {
@@ -8049,7 +7840,7 @@ gif_load (struct frame *f, struct image *img)
     }
 #else
   /* Create the X image and pixmap.  */
-  XImagePtr ximg;
+  Emacs_Pix_Container ximg;
   if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
     {
       gif_close (gif, NULL);
@@ -8279,7 +8070,7 @@ gif_load (struct frame *f, struct image *img)
   /* Maybe fill in the background field while we have ximg handy. */
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
     /* Casting avoids a GCC warning.  */
-    IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+    IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
 
   /* Put ximg into the image.  */
   image_put_x_image (f, img, ximg, 0);
@@ -8309,10 +8100,6 @@ gif_load (struct frame *f, struct image *img)
                                 ImageMagick
 ***********************************************************************/
 
-static bool imagemagick_image_p (Lisp_Object);
-static bool imagemagick_load (struct frame *, struct image *);
-static void imagemagick_clear_image (struct frame *, struct image *);
-
 /* Indices of image specification fields in imagemagick_format.  */
 
 enum imagemagick_keyword_index
@@ -8361,25 +8148,6 @@ static struct image_keyword 
imagemagick_format[IMAGEMAGICK_LAST] =
     {":crop",          IMAGE_DONT_CHECK_VALUE_TYPE,            0}
   };
 
-#if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_imagemagick_functions (void);
-#else
-#define init_imagemagick_functions NULL
-#endif
-
-/* Structure describing the image type for any image handled via
-   ImageMagick.  */
-
-static struct image_type imagemagick_type =
-  {
-    SYMBOL_INDEX (Qimagemagick),
-    imagemagick_image_p,
-    imagemagick_load,
-    imagemagick_clear_image,
-    init_imagemagick_functions,
-    NULL
-  };
-
 /* Free X resources of imagemagick image IMG which is used on frame F.  */
 
 static void
@@ -8686,7 +8454,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
   size_t image_width, image_height;
   MagickBooleanType status;
 #ifndef USE_CAIRO
-  XImagePtr ximg;
+  Emacs_Pix_Container ximg;
 #endif
   int x, y;
   MagickWand *image_wand;
@@ -8791,7 +8559,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
 
   /* Retrieve the frame's background color, for use later.  */
   {
-    XColor bgcolor;
+    Emacs_Color bgcolor;
     Lisp_Object specified_bg;
 
     specified_bg = image_spec_value (img->spec, QCbackground, NULL);
@@ -9157,9 +8925,6 @@ and `imagemagick-types-inhibit'.  */)
 
 /* Function prototypes.  */
 
-static bool svg_image_p (Lisp_Object object);
-static bool svg_load (struct frame *f, struct image *img);
-
 static bool svg_load_image (struct frame *, struct image *,
                            char *, ptrdiff_t, char *);
 
@@ -9197,27 +8962,6 @@ static const struct image_keyword svg_format[SVG_LAST] =
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-# if defined HAVE_NTGUI && defined WINDOWSNT
-static bool init_svg_functions (void);
-# else
-#define init_svg_functions NULL
-# endif
-
-/* Structure describing the image type `svg'.  Its the same type of
-   structure defined for all image formats, handled by emacs image
-   functions.  See struct image_type in dispextern.h.  */
-
-static struct image_type svg_type =
-{
-  SYMBOL_INDEX (Qsvg),
-  svg_image_p,
-  svg_load,
-  image_clear_image,
-  init_svg_functions,
-  NULL
-};
-
-
 /* Return true if OBJECT is a valid SVG image specification.  Do
    this by calling parse_image_spec and supplying the keywords that
    identify the SVG format.   */
@@ -9248,6 +8992,11 @@ svg_image_p (Lisp_Object object)
 
 # include <librsvg/rsvg.h>
 
+/* librsvg is too old for us if it doesn't define this macro.  */
+# ifndef LIBRSVG_CHECK_VERSION
+#  define LIBRSVG_CHECK_VERSION(v, w, x) false
+# endif
+
 # ifdef WINDOWSNT
 
 /* Restore the original definition of __MINGW_MAJOR_VERSION.  */
@@ -9456,7 +9205,18 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
      See rsvg bug 596114 - "image refs are relative to curdir, not .svg file"
      <https://gitlab.gnome.org/GNOME/librsvg/issues/33>. */
   if (filename)
-    rsvg_handle_set_base_uri(rsvg_handle, filename);
+    rsvg_handle_set_base_uri (rsvg_handle, filename);
+
+  /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
+     rsvg_handle_write and rsvg_handle_close.  FIXME: Use functions
+     like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
+     and remove this hack.  */
+  #if GNUC_PREREQ (4, 6, 0)
+   #pragma GCC diagnostic push
+  #endif
+  #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
+   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+  #endif
 
   /* Parse the contents argument and fill in the rsvg_handle.  */
   rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
@@ -9467,6 +9227,10 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
   rsvg_handle_close (rsvg_handle, &err);
   if (err) goto rsvg_error;
 
+  #if GNUC_PREREQ (4, 6, 0)
+   #pragma GCC diagnostic pop
+  #endif
+
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))
     {
@@ -9521,7 +9285,7 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
     g_object_unref (pixbuf);
 #else
     /* Try to create a x pixmap to hold the svg pixmap.  */
-    XImagePtr ximg;
+    Emacs_Pix_Container ximg;
     if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
       {
        g_object_unref (pixbuf);
@@ -9532,7 +9296,7 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
 
     /* Handle alpha channel by combining the image with a background
        color.  */
-    XColor background;
+    Emacs_Color background;
     Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, 
NULL);
     if (!STRINGP (specified_bg)
        || !FRAME_TERMINAL (f)->defined_color_hook (f,
@@ -9588,7 +9352,7 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
 
     /* Maybe fill in the background field while we have ximg handy.
        Casting avoids a GCC warning.  */
-    IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+    IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
 
     /* Put ximg into the image.  */
     image_put_x_image (f, img, ximg, 0);
@@ -9621,10 +9385,6 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
 
 #ifdef HAVE_GHOSTSCRIPT
 
-static bool gs_image_p (Lisp_Object object);
-static bool gs_load (struct frame *f, struct image *img);
-static void gs_clear_image (struct frame *f, struct image *img);
-
 /* Indices of image specification fields in gs_format, below.  */
 
 enum gs_keyword_index
@@ -9665,28 +9425,6 @@ static const struct image_keyword gs_format[GS_LAST] =
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-/* Structure describing the image type `ghostscript'.  */
-
-static struct image_type gs_type =
-{
-  SYMBOL_INDEX (Qpostscript),
-  gs_image_p,
-  gs_load,
-  gs_clear_image,
-  NULL,
-  NULL
-};
-
-
-/* Free X resources of Ghostscript image IMG which is used on frame F.  */
-
-static void
-gs_clear_image (struct frame *f, struct image *img)
-{
-  image_clear_image (f, img);
-}
-
-
 /* Return true if OBJECT is a valid Ghostscript image
    specification.  */
 
@@ -9812,7 +9550,7 @@ gs_load (struct frame *f, struct image *img)
    telling Emacs that Ghostscript has finished drawing.  */
 
 void
-x_kill_gs_process (Pixmap pixmap, struct frame *f)
+x_kill_gs_process (Emacs_Pixmap pixmap, struct frame *f)
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
   ptrdiff_t i;
@@ -9842,7 +9580,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
      img->pixmap.  */
   if (x_mutable_colormap (FRAME_X_VISUAL (f)))
     {
-      XImagePtr ximg;
+      XImage *ximg;
 
       block_input ();
 
@@ -9965,87 +9703,86 @@ the library file(s) specified by 
`dynamic-library-alist'.  */)
   return lookup_image_type (type) ? Qt : Qnil;
 }
 
-/* Look up image type TYPE, and return a pointer to its image_type
-   structure.  Return 0 if TYPE is not a known image type.  */
-
-static struct image_type *
-lookup_image_type (Lisp_Object type)
+static bool
+initialize_image_type (struct image_type const *type)
 {
-  /* Types pbm and xbm are built-in and always available.  */
-  if (EQ (type, Qpbm))
-    return define_image_type (&pbm_type);
-
-  if (EQ (type, Qxbm))
-    return define_image_type (&xbm_type);
+#ifdef WINDOWSNT
+  Lisp_Object typesym = builtin_lisp_symbol (type->type);
+  Lisp_Object tested = Fassq (typesym, Vlibrary_cache);
+  /* If we failed to load the library before, don't try again.  */
+  if (CONSP (tested))
+    return !NILP (XCDR (tested)) ? true : false;
 
-#if defined (HAVE_XPM) || defined (HAVE_NS)
-  if (EQ (type, Qxpm))
-    return define_image_type (&xpm_type);
+  bool (*init) (void) = type->init;
+  if (init)
+    {
+      bool type_valid = init ();
+      Vlibrary_cache = Fcons (Fcons (typesym, type_valid ? Qt : Qnil),
+                             Vlibrary_cache);
+      return type_valid;
+    }
 #endif
+  return true;
+}
 
-#if defined (HAVE_JPEG) || defined (HAVE_NS)
-  if (EQ (type, Qjpeg))
-    return define_image_type (&jpeg_type);
-#endif
+/* Array of supported image types.  */
 
-#if defined (HAVE_TIFF) || defined (HAVE_NS)
-  if (EQ (type, Qtiff))
-    return define_image_type (&tiff_type);
+static struct image_type const image_types[] =
+{
+#ifdef HAVE_GHOSTSCRIPT
+ { SYMBOL_INDEX (Qpostscript), gs_image_p, gs_load, image_clear_image },
 #endif
-
-#if defined (HAVE_GIF) || defined (HAVE_NS)
-  if (EQ (type, Qgif))
-    return define_image_type (&gif_type);
+#ifdef HAVE_IMAGEMAGICK
+ { SYMBOL_INDEX (Qimagemagick), imagemagick_image_p, imagemagick_load,
+   imagemagick_clear_image },
 #endif
-
-#if defined (HAVE_PNG) || defined (HAVE_NS) || defined (USE_CAIRO)
-  if (EQ (type, Qpng))
-    return define_image_type (&png_type);
+#ifdef HAVE_RSVG
+ { SYMBOL_INDEX (Qsvg), svg_image_p, svg_load, image_clear_image,
+   IMAGE_TYPE_INIT (init_svg_functions) },
 #endif
-
-#if defined (HAVE_RSVG)
-  if (EQ (type, Qsvg))
-    return define_image_type (&svg_type);
+#if defined HAVE_PNG || defined HAVE_NS || defined USE_CAIRO
+ { SYMBOL_INDEX (Qpng), png_image_p, png_load, image_clear_image,
+   IMAGE_TYPE_INIT (init_png_functions) },
 #endif
-
-#if defined (HAVE_IMAGEMAGICK)
-  if (EQ (type, Qimagemagick))
-    return define_image_type (&imagemagick_type);
+#if defined HAVE_GIF || defined HAVE_NS
+ { SYMBOL_INDEX (Qgif), gif_image_p, gif_load, gif_clear_image,
+   IMAGE_TYPE_INIT (init_gif_functions) },
 #endif
-
-#ifdef HAVE_GHOSTSCRIPT
-  if (EQ (type, Qpostscript))
-    return define_image_type (&gs_type);
+#if defined HAVE_TIFF || defined HAVE_NS
+ { SYMBOL_INDEX (Qtiff), tiff_image_p, tiff_load, image_clear_image,
+   IMAGE_TYPE_INIT (init_tiff_functions) },
 #endif
+#if defined HAVE_JPEG || defined HAVE_NS
+ { SYMBOL_INDEX (Qjpeg), jpeg_image_p, jpeg_load, image_clear_image,
+   IMAGE_TYPE_INIT (init_jpeg_functions) },
+#endif
+#if defined HAVE_XPM || defined HAVE_NS
+ { SYMBOL_INDEX (Qxpm), xpm_image_p, xpm_load, image_clear_image,
+   IMAGE_TYPE_INIT (init_xpm_functions) },
+#endif
+ { SYMBOL_INDEX (Qxbm), xbm_image_p, xbm_load, image_clear_image },
+ { SYMBOL_INDEX (Qpbm), pbm_image_p, pbm_load, image_clear_image },
+};
 
-  return NULL;
-}
-
-#if defined HAVE_UNEXEC && defined HAVE_WINDOW_SYSTEM
-
-/* Reset image_types before dumping.
-   Called from Fdump_emacs.  */
+/* Look up image type TYPE, and return a pointer to its image_type
+   structure.  Return 0 if TYPE is not a known image type.  */
 
-void
-reset_image_types (void)
+static struct image_type const *
+lookup_image_type (Lisp_Object type)
 {
-  while (image_types)
+  for (int i = 0; i < ARRAYELTS (image_types); i++)
     {
-      struct image_type *next = image_types->next;
-      xfree (image_types);
-      image_types = next;
+      struct image_type const *r = &image_types[i];
+      if (EQ (type, builtin_lisp_symbol (r->type)))
+       return initialize_image_type (r) ? r : NULL;
     }
+  return NULL;
 }
-#endif
+
 
 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.  */
   DEFVAR_LISP ("image-types", Vimage_types,
@@ -10096,7 +9833,7 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
   DEFSYM (QCmax_width, ":max-width");
   DEFSYM (QCmax_height, ":max-height");
 #ifdef HAVE_GHOSTSCRIPT
-  ADD_IMAGE_TYPE (Qpostscript);
+  add_image_type (Qpostscript);
   DEFSYM (QCloader, ":loader");
   DEFSYM (QCpt_width, ":pt-width");
   DEFSYM (QCpt_height, ":pt-height");
@@ -10136,44 +9873,44 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
 #endif
 
   DEFSYM (Qpbm, "pbm");
-  ADD_IMAGE_TYPE (Qpbm);
+  add_image_type (Qpbm);
 
   DEFSYM (Qxbm, "xbm");
-  ADD_IMAGE_TYPE (Qxbm);
+  add_image_type (Qxbm);
 
 #if defined (HAVE_XPM) || defined (HAVE_NS)
   DEFSYM (Qxpm, "xpm");
-  ADD_IMAGE_TYPE (Qxpm);
+  add_image_type (Qxpm);
 #endif
 
 #if defined (HAVE_JPEG) || defined (HAVE_NS)
   DEFSYM (Qjpeg, "jpeg");
-  ADD_IMAGE_TYPE (Qjpeg);
+  add_image_type (Qjpeg);
 #endif
 
 #if defined (HAVE_TIFF) || defined (HAVE_NS)
   DEFSYM (Qtiff, "tiff");
-  ADD_IMAGE_TYPE (Qtiff);
+  add_image_type (Qtiff);
 #endif
 
 #if defined (HAVE_GIF) || defined (HAVE_NS)
   DEFSYM (Qgif, "gif");
-  ADD_IMAGE_TYPE (Qgif);
+  add_image_type (Qgif);
 #endif
 
 #if defined (HAVE_PNG) || defined (HAVE_NS)
   DEFSYM (Qpng, "png");
-  ADD_IMAGE_TYPE (Qpng);
+  add_image_type (Qpng);
 #endif
 
 #if defined (HAVE_IMAGEMAGICK)
   DEFSYM (Qimagemagick, "imagemagick");
-  ADD_IMAGE_TYPE (Qimagemagick);
+  add_image_type (Qimagemagick);
 #endif
 
 #if defined (HAVE_RSVG)
   DEFSYM (Qsvg, "svg");
-  ADD_IMAGE_TYPE (Qsvg);
+  add_image_type (Qsvg);
 #ifdef HAVE_NTGUI
   /* Other libraries used directly by svg code.  */
   DEFSYM (Qgdk_pixbuf, "gdk-pixbuf");
diff --git a/src/indent.c b/src/indent.c
index a022ae9..f0d709e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -983,9 +983,10 @@ If specified column is within a character, point goes 
after that character.
 If it's past end of line, point goes to end of line.
 
 Optional second argument FORCE non-nil means if COLUMN is in the
-middle of a tab character, change it to spaces.
-In addition, if FORCE is t, and the line is too short to reach
-COLUMN, add spaces/tabs to get there.
+middle of a tab character, either change it to spaces (when
+`indent-tabs-mode' is nil), or insert enough spaces before it to reach
+COLUMN (otherwise).  In addition, if FORCE is t, and the line is too short
+to reach COLUMN, add spaces/tabs to get there.
 
 The return value is the current column.  */)
   (Lisp_Object column, Lisp_Object force)
diff --git a/src/insdel.c b/src/insdel.c
index 1231bb2..85fffd8 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2178,6 +2178,7 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, 
ptrdiff_t lenins)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
   struct rvoe_arg rvoe_arg;
+  Lisp_Object tmp;
 
   if (inhibit_modification_hooks)
     return;
@@ -2186,7 +2187,16 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t 
lendel, ptrdiff_t lenins)
      and there are no before-change functions,
      just record the args that we were going to use.  */
   if (! NILP (Vcombine_after_change_calls)
-      && NILP (Vbefore_change_functions)
+      /* It's OK to defer after-changes even if syntax-ppss-flush-cache
+       * is on before-change-functions, which is common enough to be worth
+       * adding a special case for it.  */
+      && (NILP (Vbefore_change_functions)
+          || (CONSP (Vbefore_change_functions)
+              && EQ (Qt, XCAR (Vbefore_change_functions))
+              && NILP (Fdefault_value (Qbefore_change_functions))
+              && CONSP (tmp = XCDR (Vbefore_change_functions))
+              && NILP (XCDR (tmp))
+              && EQ (XCAR (tmp), Qsyntax_ppss_flush_cache)))
       && !buffer_has_overlays ())
     {
       Lisp_Object elt;
@@ -2343,6 +2353,7 @@ syms_of_insdel (void)
   combine_after_change_buffer = Qnil;
 
   DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change");
+  DEFSYM (Qsyntax_ppss_flush_cache, "syntax-ppss-flush-cache");
 
   DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls,
               doc: /* Used internally by the function 
`combine-after-change-calls' macro.  */);
diff --git a/src/intervals.c b/src/intervals.c
index 8f39c45..3836746 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -2334,23 +2334,10 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag,
 
       if (multi_flag)
        {
-         ptrdiff_t temp;
-         left_end_byte = start_byte + LEFT_TOTAL_LENGTH (i);
+         left_end_byte
+            = advance_to_char_boundary (start_byte + LEFT_TOTAL_LENGTH (i));
          left_end = BYTE_TO_CHAR (left_end_byte);
-
-         temp = CHAR_TO_BYTE (left_end);
-
-         /* If LEFT_END_BYTE is in the middle of a character,
-            adjust it and LEFT_END to a char boundary.  */
-         if (left_end_byte > temp)
-           {
-             left_end_byte = temp;
-           }
-         if (left_end_byte < temp)
-           {
-             left_end--;
-             left_end_byte = CHAR_TO_BYTE (left_end);
-           }
+         eassert (CHAR_TO_BYTE (left_end) == left_end_byte);
        }
       else
        {
@@ -2367,24 +2354,10 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag,
 
       if (multi_flag)
        {
-         ptrdiff_t temp;
-
-         right_start_byte = end_byte - RIGHT_TOTAL_LENGTH (i);
+         right_start_byte
+            = advance_to_char_boundary (end_byte - RIGHT_TOTAL_LENGTH (i));
          right_start = BYTE_TO_CHAR (right_start_byte);
-
-         /* If RIGHT_START_BYTE is in the middle of a character,
-            adjust it and RIGHT_START to a char boundary.  */
-         temp = CHAR_TO_BYTE (right_start);
-
-         if (right_start_byte < temp)
-           {
-             right_start_byte = temp;
-           }
-         if (right_start_byte > temp)
-           {
-             right_start++;
-             right_start_byte = CHAR_TO_BYTE (right_start);
-           }
+         eassert (CHAR_TO_BYTE (right_start) == right_start_byte);
        }
       else
        {
diff --git a/src/json.c b/src/json.c
index 03468e9..e2a4424 100644
--- a/src/json.c
+++ b/src/json.c
@@ -215,47 +215,11 @@ json_has_suffix (const char *string, const char *suffix)
 
 #endif
 
-/* Create a multibyte Lisp string from the UTF-8 string in
-   [DATA, DATA + SIZE).  If the range [DATA, DATA + SIZE) does not
-   contain a valid UTF-8 string, the returned string will include raw
-   bytes.
-   Note that all callers below either pass only value UTF-8 strings or
-   use this function for formatting error messages; in the latter case
-   correctness isn't critical.  */
-
-static Lisp_Object
-json_make_string (const char *data, ptrdiff_t size)
-{
-  ptrdiff_t chars, bytes;
-  parse_str_as_multibyte ((const unsigned char *) data, size, &chars, &bytes);
-  /* If DATA is a valid UTF-8 string, we can convert it to a Lisp
-     string directly.  Otherwise, we need to decode it.  */
-  if (chars == size || bytes == size)
-    return make_specified_string (data, chars, size, true);
-  else
-    {
-      struct coding_system coding;
-      setup_coding_system (Qutf_8_unix, &coding);
-      coding.mode |= CODING_MODE_LAST_BLOCK;
-      coding.source = (const unsigned char *) data;
-      decode_coding_object (&coding, Qnil, 0, 0, size, size, Qt);
-      return coding.dst_object;
-    }
-}
-
-/* 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
+/* Note that all callers of make_string_from_utf8 and build_string_from_utf8
+   below either pass only value UTF-8 strings or use the functionf for
    formatting error messages; in the latter case correctness isn't
    critical.  */
 
-static Lisp_Object
-json_build_string (const char *data)
-{
-  return json_make_string (data, strlen (data));
-}
-
 /* Return a unibyte string containing the sequence of UTF-8 encoding
    units of the UTF-8 representation of STRING.  If STRING does not
    represent a sequence of Unicode scalar values, return a string with
@@ -303,9 +267,11 @@ json_parse_error (const json_error_t *error)
     symbol = Qjson_parse_error;
 #endif
   xsignal (symbol,
-           list5 (json_build_string (error->text),
-                  json_build_string (error->source), INT_TO_INTEGER 
(error->line),
-                  INT_TO_INTEGER (error->column), INT_TO_INTEGER 
(error->position)));
+           list5 (build_string_from_utf8 (error->text),
+                  build_string_from_utf8 (error->source),
+                 INT_TO_INTEGER (error->line),
+                  INT_TO_INTEGER (error->column),
+                 INT_TO_INTEGER (error->position)));
 }
 
 static void
@@ -648,7 +614,7 @@ usage: (json-serialize OBJECT &rest ARGS)  */)
     json_out_of_memory ();
   record_unwind_protect_ptr (json_free, string);
 
-  return unbind_to (count, json_build_string (string));
+  return unbind_to (count, build_string_from_utf8 (string));
 }
 
 struct json_buffer_and_size
@@ -855,8 +821,8 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
     case JSON_REAL:
       return make_float (json_real_value (json));
     case JSON_STRING:
-      return json_make_string (json_string_value (json),
-                               json_string_length (json));
+      return make_string_from_utf8 (json_string_value (json),
+                                   json_string_length (json));
     case JSON_ARRAY:
       {
         if (++lisp_eval_depth > max_lisp_eval_depth)
@@ -915,7 +881,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
               json_t *value;
               json_object_foreach (json, key_str, value)
                 {
-                  Lisp_Object key = json_build_string (key_str);
+                  Lisp_Object key = build_string_from_utf8 (key_str);
                   EMACS_UINT hash;
                   ptrdiff_t i = hash_lookup (h, key, &hash);
                   /* Keys in JSON objects are unique, so the key can't
@@ -932,7 +898,8 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
               json_t *value;
               json_object_foreach (json, key_str, value)
                 {
-                  Lisp_Object key = Fintern (json_build_string (key_str), 
Qnil);
+                  Lisp_Object key
+                   = Fintern (build_string_from_utf8 (key_str), Qnil);
                   result
                     = Fcons (Fcons (key, json_to_lisp (value, conf)),
                              result);
diff --git a/src/keyboard.c b/src/keyboard.c
index ea13c7f..bb4d185 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3909,7 +3909,7 @@ kbd_buffer_get_event (KBOARD **kbp,
       case END_SESSION_EVENT:
       case LANGUAGE_CHANGE_EVENT:
 #endif
-#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (HAVE_NS)
+#ifdef HAVE_WINDOW_SYSTEM
       case DELETE_WINDOW_EVENT:
       case ICONIFY_EVENT:
       case DEICONIFY_EVENT:
@@ -5283,7 +5283,7 @@ make_lispy_event (struct input_event *event)
 
   switch (event->kind)
     {
-#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (HAVE_NS)
+#ifdef HAVE_WINDOW_SYSTEM
     case DELETE_WINDOW_EVENT:
       /* Make an event (delete-frame (FRAME)).  */
       return list2 (Qdelete_frame, list1 (event->frame_or_window));
@@ -9968,7 +9968,7 @@ If CHECK-TIMERS is non-nil, timers that are ready to run 
will do so.  */)
 DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 1, 0,
        doc: /* Return vector of last few events, not counting those from 
keyboard macros.
 If INCLUDE-CMDS is non-nil, include the commands that were run,
-represented as events of the form (nil . COMMAND).  */)
+represented as pseudo-events of the form (nil . COMMAND).  */)
   (Lisp_Object include_cmds)
 {
   bool cmds = !NILP (include_cmds);
diff --git a/src/lisp.h b/src/lisp.h
index ca83347..6db9059 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -144,11 +144,13 @@ typedef intmax_t printmax_t;
 typedef uintmax_t uprintmax_t;
 # define pMd PRIdMAX
 # define pMu PRIuMAX
+# define pMx PRIxMAX
 #else
 typedef EMACS_INT printmax_t;
 typedef EMACS_UINT uprintmax_t;
 # define pMd pI"d"
 # define pMu pI"u"
+# define pMx pI"x"
 #endif
 
 /* Use pD to format ptrdiff_t values, which suffice for indexes into
@@ -2234,7 +2236,7 @@ INLINE int
 }
 
 /* Placeholder for make-docfile to process.  The actual symbol
-   definition is done by lread.c's defsym.  */
+   definition is done by lread.c's define_symbol.  */
 #define DEFSYM(sym, name) /* empty */
 
 
@@ -2677,7 +2679,7 @@ struct Lisp_Buffer_Objfwd
   {
     enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Buffer_Obj */
     int offset;
-    /* One of Qnil, Qfixnump, Qsymbolp, Qstringp, Qfloatp or Qnumberp.  */
+    /* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp.  */
     Lisp_Object predicate;
   };
 
@@ -3641,7 +3643,6 @@ extern void init_fringe_once (void);
 
 /* Defined in image.c.  */
 extern int x_bitmap_mask (struct frame *, ptrdiff_t);
-extern void reset_image_types (void);
 extern void syms_of_image (void);
 
 #ifdef HAVE_JSON
diff --git a/src/lread.c b/src/lread.c
index 1c97805..5fa90ca 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -44,6 +44,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "pdumper.h"
 #include <c-ctype.h>
+#include <vla.h>
 
 #ifdef MSDOS
 #include "msdos.h"
@@ -2640,90 +2641,83 @@ digit_to_number (int character, int base)
   return digit < base ? digit : -1;
 }
 
+static char const invalid_radix_integer_format[] = "integer, radix %"pI"d";
+
+/* Small, as read1 is recursive (Bug#31995).  But big enough to hold
+   the invalid_radix_integer string.  */
+enum { stackbufsize = max (64,
+                          (sizeof invalid_radix_integer_format
+                           - sizeof "%"pI"d"
+                           + INT_STRLEN_BOUND (EMACS_INT) + 1)) };
+
 static void
-free_contents (void *p)
+invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS 
(stackbufsize)])
 {
-  void **ptr = (void **) p;
-  xfree (*ptr);
+  sprintf (stackbuf, invalid_radix_integer_format, radix);
+  invalid_syntax (stackbuf);
 }
 
 /* Read an integer in radix RADIX using READCHARFUN to read
-   characters.  RADIX must be in the interval [2..36]; if it isn't, a
-   read error is signaled .  Value is the integer read.  Signals an
-   error if encountering invalid read syntax or if RADIX is out of
-   range.  */
+   characters.  RADIX must be in the interval [2..36].  Use STACKBUF
+   for temporary storage as needed.  Value is the integer read.
+   Signal an error if encountering invalid read syntax.  */
 
 static Lisp_Object
-read_integer (Lisp_Object readcharfun, EMACS_INT radix)
+read_integer (Lisp_Object readcharfun, int radix,
+             char stackbuf[VLA_ELEMS (stackbufsize)])
 {
-  /* 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));
-  char *buf = NULL;
-  char *p = buf;
+  char *read_buffer = stackbuf;
+  ptrdiff_t read_buffer_size = stackbufsize;
+  char *p = read_buffer;
+  char *heapbuf = NULL;
   int valid = -1; /* 1 if valid, 0 if not, -1 if incomplete.  */
-
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  if (radix < 2 || radix > 36)
-    valid = 0;
-  else
+  int c = READCHAR;
+  if (c == '-' || c == '+')
     {
-      int c, digit;
-
-      buf = xmalloc (len);
-      record_unwind_protect_ptr (free_contents, &buf);
-      p = buf;
-
+      *p++ = c;
       c = READCHAR;
-      if (c == '-' || c == '+')
-       {
-         *p++ = c;
-         c = READCHAR;
-       }
+    }
 
-      if (c == '0')
-       {
-         *p++ = c;
-         valid = 1;
+  if (c == '0')
+    {
+      *p++ = c;
+      valid = 1;
 
-         /* Ignore redundant leading zeros, so the buffer doesn't
-            fill up with them.  */
-         do
-           c = READCHAR;
-         while (c == '0');
-       }
+      /* Ignore redundant leading zeros, so the buffer doesn't
+        fill up with them.  */
+      do
+       c = READCHAR;
+      while (c == '0');
+    }
 
-      while ((digit = digit_to_number (c, radix)) >= -1)
+  for (int digit; (digit = digit_to_number (c, radix)) >= -1; )
+    {
+      if (digit == -1)
+       valid = 0;
+      if (valid < 0)
+       valid = 1;
+      /* Allow 1 extra byte for the \0.  */
+      if (p + 1 == read_buffer + read_buffer_size)
        {
-         if (digit == -1)
-           valid = 0;
-         if (valid < 0)
-           valid = 1;
-         /* Allow 1 extra byte for the \0.  */
-         if (p + 1 == buf + len)
-           {
-             ptrdiff_t where = p - buf;
-             len *= 2;
-             buf = xrealloc (buf, len);
-             p = buf + where;
-           }
-         *p++ = c;
-         c = READCHAR;
+         ptrdiff_t offset = p - read_buffer;
+         read_buffer = grow_read_buffer (read_buffer, offset,
+                                         &heapbuf, &read_buffer_size,
+                                         count);
+         p = read_buffer + offset;
        }
-
-      UNREAD (c);
+      *p++ = c;
+      c = READCHAR;
     }
 
+  UNREAD (c);
+
   if (valid != 1)
-    {
-      sprintf (buf, "integer, radix %"pI"d", radix);
-      invalid_syntax (buf);
-    }
+    invalid_radix_integer (radix, stackbuf);
 
   *p = '\0';
-  return unbind_to (count, string_to_number (buf, radix, 0));
+  return unbind_to (count, string_to_number (read_buffer, radix, NULL));
 }
 
 
@@ -2739,7 +2733,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
   int c;
   bool uninterned_symbol = false;
   bool multibyte;
-  char stackbuf[128];  /* Small, as read1 is recursive (Bug#31995).  */
+  char stackbuf[stackbufsize];
   current_thread->stack_top = stackbuf;
 
   *pch = 0;
@@ -3109,30 +3103,34 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
       /* ## is the empty symbol.  */
       if (c == '#')
        return Fintern (empty_unibyte_string, Qnil);
-      /* Reader forms that can reuse previously read objects.  */
+
       if (c >= '0' && c <= '9')
        {
-         EMACS_INT n = 0;
-         Lisp_Object tem;
+         EMACS_INT n = c - '0';
          bool overflow = false;
 
          /* Read a non-negative integer.  */
-         while (c >= '0' && c <= '9')
+         while ('0' <= (c = READCHAR) && c <= '9')
            {
              overflow |= INT_MULTIPLY_WRAPV (n, 10, &n);
              overflow |= INT_ADD_WRAPV (n, c - '0', &n);
-             c = READCHAR;
            }
 
-         if (!overflow && n <= MOST_POSITIVE_FIXNUM)
+         if (!overflow)
            {
              if (c == 'r' || c == 'R')
-               return read_integer (readcharfun, n);
+               {
+                 if (! (2 <= n && n <= 36))
+                   invalid_radix_integer (n, stackbuf);
+                 return read_integer (readcharfun, n, stackbuf);
+               }
 
-             if (! NILP (Vread_circle))
+             if (n <= MOST_POSITIVE_FIXNUM && ! NILP (Vread_circle))
                {
+                 /* Reader forms that can reuse previously read objects.  */
+
                  /* #n=object returns object, but associates it with
-                      n for #n#.  */
+                    n for #n#.  */
                  if (c == '=')
                    {
                      /* Make a placeholder for #n# to use temporarily.  */
@@ -3161,7 +3159,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                        hash_put (h, number, placeholder, hash);
 
                      /* Read the object itself.  */
-                     tem = read0 (readcharfun);
+                     Lisp_Object tem = read0 (readcharfun);
 
                      /* If it can be recursive, remember it for
                         future substitutions.  */
@@ -3211,11 +3209,11 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
          /* Fall through to error message.  */
        }
       else if (c == 'x' || c == 'X')
-       return read_integer (readcharfun, 16);
+       return read_integer (readcharfun, 16, stackbuf);
       else if (c == 'o' || c == 'O')
-       return read_integer (readcharfun, 8);
+       return read_integer (readcharfun, 8, stackbuf);
       else if (c == 'b' || c == 'B')
-       return read_integer (readcharfun, 2);
+       return read_integer (readcharfun, 2, stackbuf);
 
       UNREAD (c);
       invalid_syntax ("#");
diff --git a/src/macfont.m b/src/macfont.m
index 8fcbd50..abdf0ec 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1647,7 +1647,7 @@ static Lisp_Object macfont_open (struct frame *, 
Lisp_Object, int);
 static void macfont_close (struct font *);
 static int macfont_has_char (Lisp_Object, int);
 static unsigned macfont_encode_char (struct font *, int);
-static void macfont_text_extents (struct font *, unsigned int *, int,
+static void macfont_text_extents (struct font *, const unsigned int *, int,
                                   struct font_metrics *);
 static int macfont_draw (struct glyph_string *, int, int, int, int, bool);
 static Lisp_Object macfont_shape (Lisp_Object, Lisp_Object);
@@ -2743,7 +2743,7 @@ macfont_encode_char (struct font *font, int c)
 }
 
 static void
-macfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
+macfont_text_extents (struct font *font, const unsigned int *code, int nglyphs,
                       struct font_metrics *metrics)
 {
   int width, i;
@@ -2826,7 +2826,18 @@ macfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
       }
   }
 
-  context = [[NSGraphicsContext currentContext] graphicsPort];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
+  if ([[NSGraphicsContext currentContext] 
respondsToSelector:@selector(CGContext)])
+#endif
+    context = [[NSGraphicsContext currentContext] CGContext];
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
+  else
+#endif
+#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
+    context = [[NSGraphicsContext currentContext] graphicsPort];
+#endif
   CGContextSaveGState (context);
 
   if (!CGRectIsNull (background_rect))
@@ -3005,7 +3016,7 @@ macfont_shape (Lisp_Object lgstring, Lisp_Object 
direction)
 
       if (NILP (lglyph))
         {
-          lglyph = make_nil_vector (LGLYPH_SIZE);
+          lglyph = LGLYPH_NEW ();
           LGSTRING_SET_GLYPH (lgstring, i, lglyph);
         }
 
diff --git a/src/marker.c b/src/marker.c
index b58051a..0b2e1bf 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -332,6 +332,10 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t 
bytepos)
   if (best_above == best_above_byte)
     return bytepos;
 
+  /* Check bytepos is not in the middle of a character. */
+  eassert (bytepos >= BUF_Z_BYTE (b)
+           || CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));
+
   best_below = BEG;
   best_below_byte = BEG_BYTE;
 
diff --git a/src/mini-gmp.c b/src/mini-gmp.c
index 90beb6e..88b71c3 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-2019 Free Software Foundation, Inc.
+Copyright 1991-1997, 1999-2018 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -58,7 +58,7 @@ see https://www.gnu.org/licenses/.  */
 /* Macros */
 #define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
 
-#define GMP_LIMB_MAX (~ (mp_limb_t) 0)
+#define GMP_LIMB_MAX ((mp_limb_t) ~ (mp_limb_t) 0)
 #define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
 
 #define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
@@ -129,6 +129,20 @@ see https://www.gnu.org/licenses/.  */
 
 #define gmp_umul_ppmm(w1, w0, u, v)                                    \
   do {                                                                 \
+    int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;                           \
+    if (sizeof(unsigned int) * CHAR_BIT >= 2 * GMP_LIMB_BITS)          \
+      {                                                                        
\
+       unsigned int __ww = (unsigned int) (u) * (v);                   \
+       w0 = (mp_limb_t) __ww;                                          \
+       w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);                 \
+      }                                                                        
\
+    else if (GMP_ULONG_BITS >= 2 * GMP_LIMB_BITS)                      \
+      {                                                                        
\
+       unsigned long int __ww = (unsigned long int) (u) * (v);         \
+       w0 = (mp_limb_t) __ww;                                          \
+       w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);                 \
+      }                                                                        
\
+    else {                                                             \
     mp_limb_t __x0, __x1, __x2, __x3;                                  \
     unsigned __ul, __vl, __uh, __vh;                                   \
     mp_limb_t __u = (u), __v = (v);                                    \
@@ -150,6 +164,7 @@ see https://www.gnu.org/licenses/.  */
                                                                        \
     (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2));                       \
     (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK);    \
+    }                                                                  \
   } while (0)
 
 #define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di)                     \
@@ -753,6 +768,18 @@ mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n)
 mp_limb_t
 mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
 {
+  int GMP_LIMB_BITS_MUL_3 = GMP_LIMB_BITS * 3;
+  if (sizeof (unsigned) * CHAR_BIT > GMP_LIMB_BITS * 3)
+    {
+      return (((unsigned) 1 << GMP_LIMB_BITS_MUL_3) - 1) /
+       (((unsigned) u1 << GMP_LIMB_BITS_MUL_3 / 3) + u0);
+    }
+  else if (GMP_ULONG_BITS > GMP_LIMB_BITS * 3)
+    {
+      return (((unsigned long) 1 << GMP_LIMB_BITS_MUL_3) - 1) /
+       (((unsigned long) u1 << GMP_LIMB_BITS_MUL_3 / 3) + u0);
+    }
+  else {
   mp_limb_t r, p, m, ql;
   unsigned ul, uh, qh;
 
@@ -827,7 +854,7 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
       r -= u1;
     }
 
-  /* Now m is the 2/1 invers of u1. If u0 > 0, adjust it to become a
+  /* Now m is the 2/1 inverse of u1. If u0 > 0, adjust it to become a
      3/2 inverse. */
   if (u0 > 0)
     {
@@ -854,6 +881,7 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
     }
 
   return m;
+  }
 }
 
 struct gmp_div_inverse
@@ -964,36 +992,6 @@ mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
   return r >> inv->shift;
 }
 
-static mp_limb_t
-mpn_div_qr_1 (mp_ptr qp, mp_srcptr np, mp_size_t nn, mp_limb_t d)
-{
-  assert (d > 0);
-
-  /* Special case for powers of two. */
-  if ((d & (d-1)) == 0)
-    {
-      mp_limb_t r = np[0] & (d-1);
-      if (qp)
-       {
-         if (d <= 1)
-           mpn_copyi (qp, np, nn);
-         else
-           {
-             unsigned shift;
-             gmp_ctz (shift, d);
-             mpn_rshift (qp, np, nn, shift);
-           }
-       }
-      return r;
-    }
-  else
-    {
-      struct gmp_div_inverse inv;
-      mpn_div_qr_1_invert (&inv, d);
-      return mpn_div_qr_1_preinv (qp, np, nn, &inv);
-    }
-}
-
 static void
 mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
                     const struct gmp_div_inverse *inv)
@@ -1029,7 +1027,7 @@ mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
 
   if (shift > 0)
     {
-      assert ((r0 << (GMP_LIMB_BITS - shift)) == 0);
+      assert ((r0 & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift))) == 0);
       r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift));
       r1 >>= shift;
     }
@@ -1252,7 +1250,7 @@ mpn_limb_get_str (unsigned char *sp, mp_limb_t w,
       l = w << binv->shift;
 
       gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di);
-      assert ( (r << (GMP_LIMB_BITS - binv->shift)) == 0);
+      assert ((r & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - binv->shift))) == 0);
       r >>= binv->shift;
 
       sp[i] = r;
@@ -1420,7 +1418,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t 
sn, int base)
 void
 mpz_init (mpz_t r)
 {
-  static const mp_limb_t dummy_limb = 0xc1a0;
+  static const mp_limb_t dummy_limb = GMP_LIMB_MAX & 0xc1a0;
 
   r->_mp_alloc = 0;
   r->_mp_size = 0;
@@ -1478,6 +1476,12 @@ mpz_set_si (mpz_t r, signed long int x)
   if (x >= 0)
     mpz_set_ui (r, x);
   else /* (x < 0) */
+    if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+      {
+       mpz_set_ui (r, GMP_NEG_CAST (unsigned long int, x));
+       mpz_neg (r, r);
+      }
+  else
     {
       r->_mp_size = -1;
       MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x);
@@ -1491,6 +1495,15 @@ mpz_set_ui (mpz_t r, unsigned long int x)
     {
       r->_mp_size = 1;
       MPZ_REALLOC (r, 1)[0] = x;
+      if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+       {
+         int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+         while (x >>= LOCAL_GMP_LIMB_BITS)
+           {
+             ++ r->_mp_size;
+             MPZ_REALLOC (r, r->_mp_size)[r->_mp_size - 1] = x;
+           }
+       }
     }
   else
     r->_mp_size = 0;
@@ -1537,14 +1550,20 @@ mpz_init_set (mpz_t r, const mpz_t x)
 int
 mpz_fits_slong_p (const mpz_t u)
 {
-  mp_size_t us = u->_mp_size;
+  return (LONG_MAX + LONG_MIN == 0 || mpz_cmp_ui (u, LONG_MAX) <= 0) &&
+    mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, LONG_MIN)) <= 0;
+}
 
-  if (us == 1)
-    return u->_mp_d[0] < GMP_LIMB_HIGHBIT;
-  else if (us == -1)
-    return u->_mp_d[0] <= GMP_LIMB_HIGHBIT;
-  else
-    return (us == 0);
+static int
+mpn_absfits_ulong_p (mp_srcptr up, mp_size_t un)
+{
+  int ulongsize = GMP_ULONG_BITS / GMP_LIMB_BITS;
+  mp_limb_t ulongrem = 0;
+
+  if (GMP_ULONG_BITS % GMP_LIMB_BITS != 0)
+    ulongrem = (mp_limb_t) (ULONG_MAX >> GMP_LIMB_BITS * ulongsize) + 1;
+
+  return un <= ulongsize || (up[ulongsize] < ulongrem && un == ulongsize + 1);
 }
 
 int
@@ -1552,22 +1571,36 @@ mpz_fits_ulong_p (const mpz_t u)
 {
   mp_size_t us = u->_mp_size;
 
-  return (us == (us > 0));
+  return us >= 0 && mpn_absfits_ulong_p (u->_mp_d, us);
 }
 
 long int
 mpz_get_si (const mpz_t u)
 {
+  unsigned long r = mpz_get_ui (u);
+  unsigned long c = -LONG_MAX - LONG_MIN;
+
   if (u->_mp_size < 0)
-    /* This expression is necessary to properly handle 0x80000000 */
-    return -1 - (long) ((u->_mp_d[0] - 1) & ~GMP_LIMB_HIGHBIT);
+    /* This expression is necessary to properly handle -LONG_MIN */
+    return -(long) c - (long) ((r - c) & LONG_MAX);
   else
-    return (long) (mpz_get_ui (u) & ~GMP_LIMB_HIGHBIT);
+    return (long) (r & LONG_MAX);
 }
 
 unsigned long int
 mpz_get_ui (const mpz_t u)
 {
+  if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+    {
+      int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+      unsigned long r = 0;
+      mp_size_t n = GMP_ABS (u->_mp_size);
+      n = GMP_MIN (n, 1 + (GMP_ULONG_BITS - 1) / GMP_LIMB_BITS);
+      while (--n >= 0)
+       r = (r << LOCAL_GMP_LIMB_BITS) + u->_mp_d[n];
+      return r;
+    }
+
   return u->_mp_size == 0 ? 0 : u->_mp_d[0];
 }
 
@@ -1665,7 +1698,7 @@ mpz_set_d (mpz_t r, double x)
       r->_mp_size = 0;
       return;
     }
-  B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+  B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
   Bi = 1.0 / B;
   for (rn = 1; x >= B; rn++)
     x *= Bi;
@@ -1703,7 +1736,7 @@ mpz_get_d (const mpz_t u)
   mp_limb_t l;
   mp_size_t un;
   double x;
-  double B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+  double B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
 
   un = GMP_ABS (u->_mp_size);
 
@@ -1748,7 +1781,7 @@ mpz_cmpabs_d (const mpz_t x, double d)
     {
       xn = GMP_ABS (xn);
 
-      B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+      B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
       Bi = 1.0 / B;
 
       /* Scale d so it can be compared with the top limb. */
@@ -1807,14 +1840,12 @@ mpz_cmp_si (const mpz_t u, long v)
 {
   mp_size_t usize = u->_mp_size;
 
-  if (usize < -1)
-    return -1;
-  else if (v >= 0)
+  if (v >= 0)
     return mpz_cmp_ui (u, v);
   else if (usize >= 0)
     return 1;
-  else /* usize == -1 */
-    return GMP_CMP (GMP_NEG_CAST (mp_limb_t, v), u->_mp_d[0]);
+  else
+    return - mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, v));
 }
 
 int
@@ -1822,12 +1853,10 @@ mpz_cmp_ui (const mpz_t u, unsigned long v)
 {
   mp_size_t usize = u->_mp_size;
 
-  if (usize > 1)
-    return 1;
-  else if (usize < 0)
+  if (usize < 0)
     return -1;
   else
-    return GMP_CMP (mpz_get_ui (u), v);
+    return mpz_cmpabs_ui (u, v);
 }
 
 int
@@ -1847,10 +1876,15 @@ mpz_cmp (const mpz_t a, const mpz_t b)
 int
 mpz_cmpabs_ui (const mpz_t u, unsigned long v)
 {
-  if (GMP_ABS (u->_mp_size) > 1)
+  mp_size_t un = GMP_ABS (u->_mp_size);
+
+  if (! mpn_absfits_ulong_p (u->_mp_d, un))
     return 1;
   else
-    return GMP_CMP (mpz_get_ui (u), v);
+    {
+      unsigned long uu = mpz_get_ui (u);
+      return GMP_CMP(uu, v);
+    }
 }
 
 int
@@ -1885,81 +1919,28 @@ mpz_swap (mpz_t u, mpz_t v)
 
 /* MPZ addition and subtraction */
 
-/* Adds to the absolute value. Returns new size, but doesn't store it. */
-static mp_size_t
-mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
-  mp_size_t an;
-  mp_ptr rp;
-  mp_limb_t cy;
-
-  an = GMP_ABS (a->_mp_size);
-  if (an == 0)
-    {
-      MPZ_REALLOC (r, 1)[0] = b;
-      return b > 0;
-    }
-
-  rp = MPZ_REALLOC (r, an + 1);
-
-  cy = mpn_add_1 (rp, a->_mp_d, an, b);
-  rp[an] = cy;
-  an += cy;
-
-  return an;
-}
-
-/* Subtract from the absolute value. Returns new size, (or -1 on underflow),
-   but doesn't store it. */
-static mp_size_t
-mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
-  mp_size_t an = GMP_ABS (a->_mp_size);
-  mp_ptr rp;
-
-  if (an == 0)
-    {
-      MPZ_REALLOC (r, 1)[0] = b;
-      return -(b > 0);
-    }
-  rp = MPZ_REALLOC (r, an);
-  if (an == 1 && a->_mp_d[0] < b)
-    {
-      rp[0] = b - a->_mp_d[0];
-      return -1;
-    }
-  else
-    {
-      gmp_assert_nocarry (mpn_sub_1 (rp, a->_mp_d, an, b));
-      return mpn_normalized_size (rp, an);
-    }
-}
 
 void
 mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
 {
-  if (a->_mp_size >= 0)
-    r->_mp_size = mpz_abs_add_ui (r, a, b);
-  else
-    r->_mp_size = -mpz_abs_sub_ui (r, a, b);
+  mpz_t bb;
+  mpz_init_set_ui (bb, b);
+  mpz_add (r, a, bb);
+  mpz_clear (bb);
 }
 
 void
 mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
 {
-  if (a->_mp_size < 0)
-    r->_mp_size = -mpz_abs_add_ui (r, a, b);
-  else
-    r->_mp_size = mpz_abs_sub_ui (r, a, b);
+  mpz_ui_sub (r, b, a);
+  mpz_neg (r, r);
 }
 
 void
 mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
 {
-  if (b->_mp_size < 0)
-    r->_mp_size = mpz_abs_add_ui (r, b, a);
-  else
-    r->_mp_size = -mpz_abs_sub_ui (r, b, a);
+  mpz_neg (r, b);
+  mpz_add_ui (r, r, a);
 }
 
 static mp_size_t
@@ -2046,32 +2027,17 @@ mpz_mul_si (mpz_t r, const mpz_t u, long int v)
       mpz_neg (r, r);
     }
   else
-    mpz_mul_ui (r, u, (unsigned long int) v);
+    mpz_mul_ui (r, u, v);
 }
 
 void
 mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 {
-  mp_size_t un, us;
-  mp_ptr tp;
-  mp_limb_t cy;
-
-  us = u->_mp_size;
-
-  if (us == 0 || v == 0)
-    {
-      r->_mp_size = 0;
-      return;
-    }
-
-  un = GMP_ABS (us);
-
-  tp = MPZ_REALLOC (r, un + 1);
-  cy = mpn_mul_1 (tp, u->_mp_d, un, v);
-  tp[un] = cy;
-
-  un += (cy > 0);
-  r->_mp_size = (us < 0) ? - un : un;
+  mpz_t vv;
+  mpz_init_set_ui (vv, v);
+  mpz_mul (r, u, vv);
+  mpz_clear (vv);
+  return;
 }
 
 void
@@ -2150,8 +2116,8 @@ void
 mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 {
   mpz_t t;
-  mpz_init (t);
-  mpz_mul_ui (t, u, v);
+  mpz_init_set_ui (t, v);
+  mpz_mul (t, u, t);
   mpz_add (r, r, t);
   mpz_clear (t);
 }
@@ -2160,8 +2126,8 @@ void
 mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 {
   mpz_t t;
-  mpz_init (t);
-  mpz_mul_ui (t, u, v);
+  mpz_init_set_ui (t, v);
+  mpz_mul (t, u, t);
   mpz_sub (r, r, t);
   mpz_clear (t);
 }
@@ -2557,56 +2523,20 @@ static unsigned long
 mpz_div_qr_ui (mpz_t q, mpz_t r,
               const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
 {
-  mp_size_t ns, qn;
-  mp_ptr qp;
-  mp_limb_t rl;
-  mp_size_t rs;
-
-  ns = n->_mp_size;
-  if (ns == 0)
-    {
-      if (q)
-       q->_mp_size = 0;
-      if (r)
-       r->_mp_size = 0;
-      return 0;
-    }
-
-  qn = GMP_ABS (ns);
-  if (q)
-    qp = MPZ_REALLOC (q, qn);
-  else
-    qp = NULL;
+  unsigned long ret;
+  mpz_t rr, dd;
 
-  rl = mpn_div_qr_1 (qp, n->_mp_d, qn, d);
-  assert (rl < d);
-
-  rs = rl > 0;
-  rs = (ns < 0) ? -rs : rs;
-
-  if (rl > 0 && ( (mode == GMP_DIV_FLOOR && ns < 0)
-                 || (mode == GMP_DIV_CEIL && ns >= 0)))
-    {
-      if (q)
-       gmp_assert_nocarry (mpn_add_1 (qp, qp, qn, 1));
-      rl = d - rl;
-      rs = -rs;
-    }
+  mpz_init (rr);
+  mpz_init_set_ui (dd, d);
+  mpz_div_qr (q, rr, n, dd, mode);
+  mpz_clear (dd);
+  ret = mpz_get_ui (rr);
 
   if (r)
-    {
-      MPZ_REALLOC (r, 1)[0] = rl;
-      r->_mp_size = rs;
-    }
-  if (q)
-    {
-      qn -= (qp[qn-1] == 0);
-      assert (qn == 0 || qp[qn-1] > 0);
-
-      q->_mp_size = (ns < 0) ? - qn : qn;
-    }
+    mpz_swap (r, rr);
+  mpz_clear (rr);
 
-  return rl;
+  return ret;
 }
 
 unsigned long
@@ -2745,22 +2675,16 @@ mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
 unsigned long
 mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
 {
-  mp_size_t un;
+  mpz_t t;
+  mpz_init_set_ui(t, v);
+  mpz_gcd (t, u, t);
+  if (v > 0)
+    v = mpz_get_ui (t);
 
-  if (v == 0)
-    {
-      if (g)
-       mpz_abs (g, u);
-    }
-  else
-    {
-      un = GMP_ABS (u->_mp_size);
-      if (un != 0)
-       v = mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v);
+  if (g)
+    mpz_swap (t, g);
 
-      if (g)
-       mpz_set_ui (g, v);
-    }
+  mpz_clear (t);
 
   return v;
 }
@@ -2854,7 +2778,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, 
const mpz_t v)
       signed long sign = mpz_sgn (v);
       mpz_abs (g, v);
       if (s)
-       mpz_set_ui (s, 0);
+       s->_mp_size = 0;
       if (t)
        mpz_set_si (t, sign);
       return;
@@ -2868,7 +2792,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, 
const mpz_t v)
       if (s)
        mpz_set_si (s, sign);
       if (t)
-       mpz_set_ui (t, 0);
+       t->_mp_size = 0;
       return;
     }
 
@@ -2993,8 +2917,9 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, 
const mpz_t v)
          mpz_sub (s0, s0, s1);
          mpz_add (t0, t0, t1);
        }
-      mpz_divexact_ui (s0, s0, 2);
-      mpz_divexact_ui (t0, t0, 2);
+      assert (mpz_even_p (t0) && mpz_even_p (s0));
+      mpz_tdiv_q_2exp (s0, s0, 1);
+      mpz_tdiv_q_2exp (t0, t0, 1);
     }
 
   /* Arrange so that |s| < |u| / 2g */
@@ -3119,7 +3044,10 @@ void
 mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
 {
   mpz_t b;
-  mpz_pow_ui (r, mpz_roinit_normal_n (b, &blimb, blimb != 0), e);
+
+  mpz_init_set_ui (b, blimb);
+  mpz_pow_ui (r, b, e);
+  mpz_clear (b);
 }
 
 void
@@ -3231,7 +3159,10 @@ void
 mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
 {
   mpz_t e;
-  mpz_powm (r, b, mpz_roinit_normal_n (e, &elimb, elimb != 0), m);
+
+  mpz_init_set_ui (e, elimb);
+  mpz_powm (r, b, e, m);
+  mpz_clear (e);
 }
 
 /* x=trunc(y^(1/z)), r=y-x^z */
@@ -3409,6 +3340,177 @@ mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
 
 
 /* Primality testing */
+
+/* Computes Kronecker (a/b) with odd b, a!=0 and GCD(a,b) = 1 */
+/* Adapted from JACOBI_BASE_METHOD==4 in mpn/generic/jacbase.c */
+static int
+gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b)
+{
+  int c, bit = 0;
+
+  assert (b & 1);
+  assert (a != 0);
+  /* assert (mpn_gcd_11 (a, b) == 1); */
+
+  /* Below, we represent a and b shifted right so that the least
+     significant one bit is implicit. */
+  b >>= 1;
+
+  gmp_ctz(c, a);
+  a >>= 1;
+
+  do
+    {
+      a >>= c;
+      /* (2/b) = -1 if b = 3 or 5 mod 8 */
+      bit ^= c & (b ^ (b >> 1));
+      if (a < b)
+       {
+         bit ^= a & b;
+         a = b - a;
+         b -= a;
+       }
+      else
+       {
+         a -= b;
+         assert (a != 0);
+       }
+
+      gmp_ctz(c, a);
+      ++c;
+    }
+  while (b > 0);
+
+  return bit & 1 ? -1 : 1;
+}
+
+static void
+gmp_lucas_step_k_2k (mpz_t V, mpz_t Qk, const mpz_t n)
+{
+  mpz_mod (Qk, Qk, n);
+  /* V_{2k} <- V_k ^ 2 - 2Q^k */
+  mpz_mul (V, V, V);
+  mpz_submul_ui (V, Qk, 2);
+  mpz_tdiv_r (V, V, n);
+  /* Q^{2k} = (Q^k)^2 */
+  mpz_mul (Qk, Qk, Qk);
+}
+
+/* Computes V_k, Q^k (mod n) for the Lucas' sequence */
+/* with P=1, Q=Q; k = (n>>b0)|1. */
+/* Requires an odd n > 4; b0 > 0; -2*Q must not overflow a long */
+/* Returns (U_k == 0) and sets V=V_k and Qk=Q^k. */
+static int
+gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q,
+              mp_bitcnt_t b0, const mpz_t n)
+{
+  mp_bitcnt_t bs;
+  mpz_t U;
+  int res;
+
+  assert (b0 > 0);
+  assert (Q <= - (LONG_MIN / 2));
+  assert (Q >= - (LONG_MAX / 2));
+  assert (mpz_cmp_ui (n, 4) > 0);
+  assert (mpz_odd_p (n));
+
+  mpz_init_set_ui (U, 1); /* U1 = 1 */
+  mpz_set_ui (V, 1); /* V1 = 1 */
+  mpz_set_si (Qk, Q);
+
+  for (bs = mpz_sizeinbase (n, 2) - 1; --bs >= b0;)
+    {
+      /* U_{2k} <- U_k * V_k */
+      mpz_mul (U, U, V);
+      /* V_{2k} <- V_k ^ 2 - 2Q^k */
+      /* Q^{2k} = (Q^k)^2 */
+      gmp_lucas_step_k_2k (V, Qk, n);
+
+      /* A step k->k+1 is performed if the bit in $n$ is 1     */
+      /* mpz_tstbit(n,bs) or the the bit is 0 in $n$ but       */
+      /* should be 1 in $n+1$ (bs == b0)                       */
+      if (b0 == bs || mpz_tstbit (n, bs))
+       {
+         /* Q^{k+1} <- Q^k * Q */
+         mpz_mul_si (Qk, Qk, Q);
+         /* U_{k+1} <- (U_k + V_k) / 2 */
+         mpz_swap (U, V); /* Keep in V the old value of U_k */
+         mpz_add (U, U, V);
+         /* We have to compute U/2, so we need an even value, */
+         /* equivalent (mod n) */
+         if (mpz_odd_p (U))
+           mpz_add (U, U, n);
+         mpz_tdiv_q_2exp (U, U, 1);
+         /* V_{k+1} <-(D*U_k + V_k) / 2 =
+                       U_{k+1} + (D-1)/2*U_k = U_{k+1} - 2Q*U_k */
+         mpz_mul_si (V, V, -2*Q);
+         mpz_add (V, U, V);
+         mpz_tdiv_r (V, V, n);
+       }
+      mpz_tdiv_r (U, U, n);
+    }
+
+  res = U->_mp_size == 0;
+  mpz_clear (U);
+  return res;
+}
+
+/* Performs strong Lucas' test on x, with parameters suggested */
+/* for the BPSW test. Qk is only passed to recycle a variable. */
+/* Requires GCD (x,6) = 1.*/
+static int
+gmp_stronglucas (const mpz_t x, mpz_t Qk)
+{
+  mp_bitcnt_t b0;
+  mpz_t V, n;
+  mp_limb_t maxD, D; /* The absolute value is stored. */
+  long Q;
+  mp_limb_t tl;
+
+  /* Test on the absolute value. */
+  mpz_roinit_normal_n (n, x->_mp_d, GMP_ABS (x->_mp_size));
+
+  assert (mpz_odd_p (n));
+  /* assert (mpz_gcd_ui (NULL, n, 6) == 1); */
+  if (mpz_root (Qk, n, 2))
+    return 0; /* A square is composite. */
+
+  /* Check Ds up to square root (in case, n is prime)
+     or avoid overflows */
+  maxD = (Qk->_mp_size == 1) ? Qk->_mp_d [0] - 1 : GMP_LIMB_MAX;
+
+  D = 3;
+  /* Search a D such that (D/n) = -1 in the sequence 5,-7,9,-11,.. */
+  /* For those Ds we have (D/n) = (n/|D|) */
+  do
+    {
+      if (D >= maxD)
+       return 1 + (D != GMP_LIMB_MAX); /* (1 + ! ~ D) */
+      D += 2;
+      tl = mpz_tdiv_ui (n, D);
+      if (tl == 0)
+       return 0;
+    }
+  while (gmp_jacobi_coprime (tl, D) == 1);
+
+  mpz_init (V);
+
+  /* n-(D/n) = n+1 = d*2^{b0}, with d = (n>>b0) | 1 */
+  b0 = mpz_scan0 (n, 0);
+
+  /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */
+  Q = (D & 2) ? (D >> 2) + 1 : -(long) (D >> 2);
+
+  if (! gmp_lucas_mod (V, Qk, Q, b0, n))       /* If Ud != 0 */
+    while (V->_mp_size != 0 && --b0 != 0)      /* while Vk != 0 */
+      /* V <- V ^ 2 - 2Q^k */
+      /* Q^{2k} = (Q^k)^2 */
+      gmp_lucas_step_k_2k (V, Qk, n);
+
+  mpz_clear (V);
+  return (b0 != 0);
+}
+
 static int
 gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y,
                 const mpz_t q, mp_bitcnt_t k)
@@ -3470,21 +3572,26 @@ mpz_probab_prime_p (const mpz_t n, int reps)
   if (mpz_cmpabs_ui (n, 31*31) < 0)
     return 2;
 
-  /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
-     j^2 + j + 41 using Euler's polynomial. We potentially stop early,
-     if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
-     30 (a[30] == 971 > 31*31 == 961). */
-
   mpz_init (nm1);
   mpz_init (q);
-  mpz_init (y);
 
   /* Find q and k, where q is odd and n = 1 + 2**k * q.  */
-  nm1->_mp_size = mpz_abs_sub_ui (nm1, n, 1);
+  mpz_abs (nm1, n);
+  nm1->_mp_d[0] -= 1;
   k = mpz_scan1 (nm1, 0);
   mpz_tdiv_q_2exp (q, nm1, k);
 
-  for (j = 0, is_prime = 1; is_prime & (j < reps); j++)
+  /* BPSW test */
+  mpz_init_set_ui (y, 2);
+  is_prime = gmp_millerrabin (n, nm1, y, q, k) && gmp_stronglucas (n, y);
+  reps -= 24; /* skip the first 24 repetitions */
+
+  /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
+     j^2 + j + 41 using Euler's polynomial. We potentially stop early,
+     if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
+     30 (a[30] == 971 > 31*31 == 961). */
+
+  for (j = 0; is_prime & (j < reps); j++)
     {
       mpz_set_ui (y, (unsigned long) j*j+j+41);
       if (mpz_cmp (y, nm1) >= 0)
@@ -3552,7 +3659,7 @@ mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
     {
       /* d < 0. Check if any of the bits below is set: If so, our bit
         must be complemented. */
-      if (shift > 0 && (w << (GMP_LIMB_BITS - shift)) > 0)
+      if (shift > 0 && (mp_limb_t) (w << (GMP_LIMB_BITS - shift)) > 0)
        return bit ^ 1;
       while (--limb_index >= 0)
        if (d->_mp_d[limb_index] > 0)
@@ -3659,8 +3766,8 @@ mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
 void
 mpz_com (mpz_t r, const mpz_t u)
 {
-  mpz_neg (r, u);
-  mpz_sub_ui (r, r, 1);
+  mpz_add_ui (r, u, 1);
+  mpz_neg (r, r);
 }
 
 void
@@ -4000,7 +4107,7 @@ mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
        }
 
       /* Mask to 0 all bits before starting_bit, thus ignoring them. */
-      limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+      limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
     }
 
   return mpn_common_scan (limb, i, up, un, ux);
@@ -4030,7 +4137,7 @@ mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
     limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
 
   /* Mask all bits before starting_bit, thus ignoring them. */
-  limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+  limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
 
   return mpn_common_scan (limb, i, up, un, ux);
 }
diff --git a/src/mini-gmp.h b/src/mini-gmp.h
index 2586d32..27e0c06 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, 2019 Free Software Foundation, Inc.
+Copyright 2011-2015, 2017 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
diff --git a/src/minibuf.c b/src/minibuf.c
index 10fd5e5..2bf6bc2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1062,7 +1062,8 @@ Optional second arg DEF is value to return if user enters 
an empty line,
 Optional third arg REQUIRE-MATCH has the same meaning as the
  REQUIRE-MATCH argument of `completing-read'.
 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
+can be considered.  It will be called with each potential candidate, in
+the form of either a string or a cons cell whose `car' is a string, 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.
diff --git a/src/msdos.h b/src/msdos.h
index 0d15df7..3614c94 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -86,7 +86,6 @@ typedef int GC;
 typedef int Pixmap;
 typedef int Display;
 typedef int Window;
-typedef int XRectangle;
 #define PIX_TYPE unsigned long
 #define XDISPLAY
 
@@ -95,7 +94,6 @@ typedef struct tty_display_info Display_Info;
 extern struct tty_display_info the_only_display_info;
 extern struct tty_output the_only_tty_output;
 
-#define FRAME_X_DISPLAY(f) ((Display *) 0)
 #define FRAME_FONT(f) ((f)->output_data.tty->font)
 #define FRAME_DISPLAY_INFO(f) (&the_only_display_info)
 
diff --git a/src/nsfont.m b/src/nsfont.m
index 9721e48..eca97ab 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -945,7 +945,7 @@ nsfont_encode_char (struct font *font, int c)
    of METRICS.  The glyphs are specified by their glyph codes in
    CODE (length NGLYPHS).  */
 static void
-nsfont_text_extents (struct font *font, unsigned int *code,
+nsfont_text_extents (struct font *font, const unsigned int *code,
                     int nglyphs, struct font_metrics *metrics)
 {
   struct nsfont_info *font_info = (struct nsfont_info *)font;
diff --git a/src/nsgui.h b/src/nsgui.h
index c147f4d..c219535 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -58,72 +58,22 @@ typedef struct _XCharStruct
   int descent;
 } XCharStruct;
 
-/* Fake structure from Xlib.h to represent two-byte characters.  */
-#ifndef __OBJC__
-typedef unsigned short unichar;
-#endif
-typedef unichar XChar2b;
-
-#define STORE_XCHAR2B(chp, b1, b2) \
-  (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
-
-#define XCHAR2B_BYTE1(chp) \
-  ((*(chp) & 0xff00) >> 8)
-
-#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?  */
-typedef struct _XGCValues
-{
-  unsigned long foreground;
-  unsigned long background;
 #ifdef __OBJC__
-  struct ns_font *font;
+typedef id Emacs_Pixmap;
 #else
-  void *font;
+typedef void *Emacs_Pixmap;
 #endif
-} XGCValues;
-
-typedef XGCValues * GC;
-
-#define GCForeground 0x01
-#define GCBackground 0x02
-#define GCFont 0x03
 
 #ifdef __OBJC__
-typedef id Pixmap;
+typedef NSCursor *Emacs_Cursor;
 #else
-typedef void *Pixmap;
+typedef void *Emacs_Cursor;
 #endif
 
-#ifdef __OBJC__
-typedef NSCursor * Cursor;
-#else
-typedef void *Cursor;
-#endif
-
-#define No_Cursor (0)
-
-#ifdef __OBJC__
-typedef NSColor * Color;
-#else
-typedef void * Color;
-#endif
 typedef int Window;
-typedef int Display;
-
-
-/* Some sort of attempt to normalize rectangle handling.  Seems a bit
-   much for what is accomplished.  */
-typedef struct {
-      int x, y;
-      unsigned width, height;
-} XRectangle;
 
 #ifndef __OBJC__
 #if defined (__LP64__) && __LP64__
@@ -138,13 +88,13 @@ typedef struct _NSRect  { NSPoint origin; NSSize size; } 
NSRect;
 
 #define NativeRectangle NSRect
 
-#define CONVERT_TO_XRECT(xr, nr)               \
+#define CONVERT_TO_EMACS_RECT(xr, nr)          \
   ((xr).x     = (nr).origin.x,                 \
    (xr).y     = (nr).origin.y,                 \
    (xr).width = (nr).size.width,               \
    (xr).height = (nr).size.height)
 
-#define CONVERT_FROM_XRECT(xr, nr)             \
+#define CONVERT_FROM_EMACS_RECT(xr, nr)                \
   ((nr).origin.x    = (xr).x,                  \
    (nr).origin.y    = (xr).y,                  \
    (nr).size.width  = (xr).width,              \
diff --git a/src/nsimage.m b/src/nsimage.m
index 33236c4..0249d22 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -313,8 +313,8 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
   if (bmRep == nil || color == nil)
     return self;
 
-  if ([color colorSpaceName] != NSCalibratedRGBColorSpace)
-    rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+  if ([color colorSpace] != [NSColorSpace deviceRGBColorSpace])
+    rgbColor = [color colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]];
   else
     rgbColor = color;
 
diff --git a/src/nsmenu.m b/src/nsmenu.m
index fd13233..3fe06cd 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -668,9 +668,9 @@ ns_activate_menubar (struct frame *f)
       /* Draw radio buttons and tickboxes.  */
       if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE ||
                            wv->button_type == BUTTON_TYPE_RADIO))
-        [item setState: NSOnState];
+        [item setState: NSControlStateValueOn];
       else
-        [item setState: NSOffState];
+        [item setState: NSControlStateValueOff];
 
       [item setTag: (NSInteger)wv->call_data];
     }
@@ -1594,7 +1594,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, 
Lisp_Object contents)
   [cell setBordered: NO];
   [cell setEnabled: NO];
   [cell setCellAttribute: NSCellIsInsetButton to: 8];
-  [cell setBezelStyle: NSRoundedBezelStyle];
+  [cell setBezelStyle: NSBezelStyleRounded];
 
   matrix = [[NSMatrix alloc] initWithFrame: contentRect
                                       mode: NSHighlightModeMatrix
@@ -1607,7 +1607,6 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, 
Lisp_Object contents)
   [matrix autorelease];
 
   [[self contentView] addSubview: matrix];
-  [self setOneShot: YES];
   [self setReleasedWhenClosed: YES];
   [self setHidesOnDeactivate: YES];
   return self;
diff --git a/src/nsselect.m b/src/nsselect.m
index cf36c86..b044fe6 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -57,7 +57,7 @@ symbol_to_nsstring (Lisp_Object sym)
   if (EQ (sym, QCLIPBOARD))   return NSPasteboardNameGeneral;
   if (EQ (sym, QPRIMARY))     return NXPrimaryPboard;
   if (EQ (sym, QSECONDARY))   return NXSecondaryPboard;
-  if (EQ (sym, QTEXT))        return NSStringPboardType;
+  if (EQ (sym, QTEXT))        return NSPasteboardTypeString;
   return [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (sym))];
 }
 
@@ -76,11 +76,11 @@ ns_string_to_symbol (NSString *t)
     return QPRIMARY;
   if ([t isEqualToString: NXSecondaryPboard])
     return QSECONDARY;
-  if ([t isEqualToString: NSStringPboardType])
+  if ([t isEqualToString: NSPasteboardTypeString])
     return QTEXT;
   if ([t isEqualToString: NSFilenamesPboardType])
     return QFILE_NAME;
-  if ([t isEqualToString: NSTabularTextPboardType])
+  if ([t isEqualToString: NSPasteboardTypeTabularText])
     return QTEXT;
   return intern ([t UTF8String]);
 }
@@ -193,7 +193,7 @@ ns_string_to_pasteboard_internal (id pb, Lisp_Object str, 
NSString *gtype)
       else
         {
          // Used for ns-own-selection-internal.
-         eassert (gtype == NSStringPboardType);
+         eassert (gtype == NSPasteboardTypeString);
           [pb setString: nsStr forType: gtype];
         }
       [nsStr release];
@@ -345,7 +345,7 @@ anything that the functions on `selection-converter-alist' 
know about.  */)
   }
 
   /* We only support copy of text.  */
-  type = NSStringPboardType;
+  type = NSPasteboardTypeString;
   target_symbol = ns_string_to_symbol (type);
   if (STRINGP (value))
     {
@@ -472,9 +472,9 @@ nxatoms_of_nsselect (void)
             [NSNumber numberWithLong:0], NSPasteboardNameGeneral,
             [NSNumber numberWithLong:0], NXPrimaryPboard,
             [NSNumber numberWithLong:0], NXSecondaryPboard,
-            [NSNumber numberWithLong:0], NSStringPboardType,
+            [NSNumber numberWithLong:0], NSPasteboardTypeString,
             [NSNumber numberWithLong:0], NSFilenamesPboardType,
-            [NSNumber numberWithLong:0], NSTabularTextPboardType,
+            [NSNumber numberWithLong:0], NSPasteboardTypeTabularText,
         nil] retain];
 }
 
diff --git a/src/nsterm.h b/src/nsterm.h
index 683f2dd..1e56276 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -872,10 +872,10 @@ struct ns_display_info
   Lisp_Object rdb;
 
   /* The cursor to use for vertical scroll bars.  */
-  Cursor vertical_scroll_bar_cursor;
+  Emacs_Cursor vertical_scroll_bar_cursor;
 
   /* The cursor to use for horizontal scroll bars.  */
-  Cursor horizontal_scroll_bar_cursor;
+  Emacs_Cursor horizontal_scroll_bar_cursor;
 
   /* Information about the range of text currently shown in
      mouse-face.  */
@@ -931,24 +931,24 @@ struct ns_output
 #endif
 
   /* NSCursors are initialized in initFrameFromEmacs.  */
-  Cursor text_cursor;
-  Cursor nontext_cursor;
-  Cursor modeline_cursor;
-  Cursor hand_cursor;
-  Cursor hourglass_cursor;
-  Cursor horizontal_drag_cursor;
-  Cursor vertical_drag_cursor;
-  Cursor left_edge_cursor;
-  Cursor top_left_corner_cursor;
-  Cursor top_edge_cursor;
-  Cursor top_right_corner_cursor;
-  Cursor right_edge_cursor;
-  Cursor bottom_right_corner_cursor;
-  Cursor bottom_edge_cursor;
-  Cursor bottom_left_corner_cursor;
+  Emacs_Cursor text_cursor;
+  Emacs_Cursor nontext_cursor;
+  Emacs_Cursor modeline_cursor;
+  Emacs_Cursor hand_cursor;
+  Emacs_Cursor hourglass_cursor;
+  Emacs_Cursor horizontal_drag_cursor;
+  Emacs_Cursor vertical_drag_cursor;
+  Emacs_Cursor left_edge_cursor;
+  Emacs_Cursor top_left_corner_cursor;
+  Emacs_Cursor top_edge_cursor;
+  Emacs_Cursor top_right_corner_cursor;
+  Emacs_Cursor right_edge_cursor;
+  Emacs_Cursor bottom_right_corner_cursor;
+  Emacs_Cursor bottom_edge_cursor;
+  Emacs_Cursor bottom_left_corner_cursor;
 
   /* NS-specific */
-  Cursor current_pointer;
+  Emacs_Cursor current_pointer;
 
   /* lord knows why Emacs needs to know about our Window ids.. */
   Window window_desc, parent_desc;
@@ -997,12 +997,6 @@ struct x_output
 #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc)
 #define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f)
 
-/* This is the `Display *' which frame F is on.  */
-#define FRAME_NS_DISPLAY(f) (0)
-#define FRAME_X_DISPLAY(f) (0)
-#define FRAME_X_SCREEN(f) (0)
-#define FRAME_X_VISUAL(f) FRAME_DISPLAY_INFO(f)->visual
-
 #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color)
 #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color)
 
@@ -1140,10 +1134,10 @@ extern void ns_set_doc_edited (void);
 extern bool
 ns_defined_color (struct frame *f,
                   const char *name,
-                  XColor *color_def, bool alloc,
+                  Emacs_Color *color_def, bool alloc,
                   bool makeIndex);
 extern void
-ns_query_color (void *col, XColor *color_def, bool setPixel);
+ns_query_color (void *col, Emacs_Color *color_def, bool setPixel);
 
 #ifdef __OBJC__
 extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
@@ -1171,10 +1165,6 @@ extern void ns_release_autorelease_pool (void *);
 extern const char *ns_get_defaults_value (const char *key);
 extern void ns_init_locale (void);
 
-#ifdef NS_IMPL_COCOA
-extern void ns_enable_screen_updates (void);
-#endif
-
 /* in nsmenu */
 extern void update_frame_tool_bar (struct frame *f);
 extern void free_frame_tool_bar (struct frame *f);
@@ -1342,4 +1332,14 @@ enum NSWindowTabbingMode
 /* Deprecated in macOS 10.13.  */
 #define NSPasteboardNameGeneral NSGeneralPboard
 #endif
+
+#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_14)
+/* Deprecated in macOS 10.14.  */
+#define NSPasteboardTypeString NSStringPboardType
+#define NSPasteboardTypeTabularText NSTabularTextPboardType
+#define NSPasteboardTypeURL NSURLPboardType
+#define NSControlStateValueOn NSOnState
+#define NSControlStateValueOff NSOffState
+#define NSBezelStyleRounded NSRoundedBezelStyle
+#endif
 #endif /* HAVE_NS */
diff --git a/src/nsterm.m b/src/nsterm.m
index cdf1916..0cae5e9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -160,20 +160,28 @@ char const * nstrace_fullscreen_type_name (int fs_type)
 
 - (NSColor *)colorUsingDefaultColorSpace
 {
-  /* FIXMES: We're checking for colorWithSRGBRed here so this will
-     only work in the same place as in the method above.  It should
-     really be a check whether we're on macOS 10.7 or above.  */
+  /* FIXME: We're checking for colorWithSRGBRed here so this will only
+     work in the same place as in the method above.  It should really
+     be a check whether we're on macOS 10.7 or above.  */
 #if defined (NS_IMPL_COCOA) \
   && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
-  if (ns_use_srgb_colorspace
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
-      && [NSColor respondsToSelector:
-                    @selector(colorWithSRGBRed:green:blue:alpha:)]
+  if ([NSColor respondsToSelector:
+                 @selector(colorWithSRGBRed:green:blue:alpha:)])
 #endif
-      )
-    return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
+    {
+      if (ns_use_srgb_colorspace)
+        return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
+      else
+        return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]];
+    }
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+  else
 #endif
+#endif /* NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070  */
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070
   return [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+#endif
 }
 
 @end
@@ -283,9 +291,6 @@ static int ns_window_num = 0;
 static BOOL ns_fake_keydown = NO;
 #ifdef NS_IMPL_COCOA
 static BOOL ns_menu_bar_is_hidden = NO;
-
-/* The number of times NSDisableScreenUpdates has been called.  */
-static int disable_screen_updates_count = 0;
 #endif
 /* static int debug_lock = 0; */
 
@@ -688,40 +693,6 @@ ns_release_autorelease_pool (void *pool)
 }
 
 
-#ifdef NS_IMPL_COCOA
-/* Disabling screen updates can be used to make several actions appear
-   "atomic" to the end user.  It seems some actions can still update
-   the display, though.
-
-   When we re-enable screen updates the number of calls to
-   NSEnableScreenUpdates should match the number to
-   NSDisableScreenUpdates.
-
-   We use these functions to prevent the user seeing a blank frame
-   after it has been resized.  ns_set_window_size disables updates and
-   when redisplay completes unwind_redisplay enables them again
-   (bug#30699).  */
-
-static void
-ns_disable_screen_updates (void)
-{
-  NSDisableScreenUpdates ();
-  disable_screen_updates_count++;
-}
-
-void
-ns_enable_screen_updates (void)
-/* Re-enable screen updates.  Called from unwind_redisplay.  */
-{
-  while (disable_screen_updates_count > 0)
-    {
-      NSEnableScreenUpdates ();
-      disable_screen_updates_count--;
-    }
-}
-#endif
-
-
 static BOOL
 ns_menu_bar_should_be_hidden (void)
 /* True, if the menu bar should be hidden.  */
@@ -1106,7 +1077,7 @@ static void
 ns_update_begin (struct frame *f)
 /* --------------------------------------------------------------------------
    Prepare for a grouped sequence of drawing calls
-   external (RIF) call; whole frame, called before update_window_begin
+   external (RIF) call; whole frame, called before gui_update_window_begin
    -------------------------------------------------------------------------- 
*/
 {
 #ifdef NS_IMPL_COCOA
@@ -1129,80 +1100,10 @@ ns_update_begin (struct frame *f)
 
 
 static void
-ns_update_window_begin (struct window *w)
-/* --------------------------------------------------------------------------
-   Prepare for a grouped sequence of drawing calls
-   external (RIF) call; for one window, called after update_begin
-   -------------------------------------------------------------------------- 
*/
-{
-  struct frame *f = XFRAME (WINDOW_FRAME (w));
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-
-  NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_begin");
-  w->output_cursor = w->cursor;
-
-  block_input ();
-
-  if (f == hlinfo->mouse_face_mouse_frame)
-    {
-      /* Don't do highlighting for mouse motion during the update.  */
-      hlinfo->mouse_face_defer = 1;
-
-        /* If the frame needs to be redrawn,
-           simply forget about any prior mouse highlighting.  */
-      if (FRAME_GARBAGED_P (f))
-        hlinfo->mouse_face_window = Qnil;
-
-      /* (further code for mouse faces ifdef'd out in other terms elided) */
-    }
-
-  unblock_input ();
-}
-
-
-static void
-ns_update_window_end (struct window *w, bool cursor_on_p,
-                      bool mouse_face_overwritten_p)
-/* --------------------------------------------------------------------------
-   Finished a grouped sequence of drawing calls
-   external (RIF) call; for one window called before update_end
-   -------------------------------------------------------------------------- 
*/
-{
-  NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_end");
-
-  /* note: this fn is nearly identical in all terms */
-  if (!w->pseudo_window_p)
-    {
-      block_input ();
-
-      if (cursor_on_p)
-       display_and_set_cursor (w, 1,
-                               w->output_cursor.hpos, w->output_cursor.vpos,
-                               w->output_cursor.x, w->output_cursor.y);
-
-      if (draw_window_fringes (w, 1))
-       {
-         if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
-           gui_draw_right_divider (w);
-         else
-           gui_draw_vertical_border (w);
-       }
-
-      unblock_input ();
-    }
-
-  /* If a row with mouse-face was overwritten, arrange for
-     frame_up_to_date to redisplay the mouse highlight.  */
-  if (mouse_face_overwritten_p)
-    reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame)));
-}
-
-
-static void
 ns_update_end (struct frame *f)
 /* --------------------------------------------------------------------------
    Finished a grouped sequence of drawing calls
-   external (RIF) call; for whole frame, called after update_window_end
+   external (RIF) call; for whole frame, called after gui_update_window_end
    -------------------------------------------------------------------------- 
*/
 {
   NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end");
@@ -1849,15 +1750,6 @@ ns_set_window_size (struct frame *f,
 
   block_input ();
 
-#ifdef NS_IMPL_COCOA
-  /* To prevent showing the user a blank frame, stop updates being
-     flushed to the screen until after redisplay has completed.  This
-     breaks live resize (resizing with a mouse), so don't do it if
-     we're in a live resize loop.  */
-  if (![view inLiveResize])
-    ns_disable_screen_updates ();
-#endif
-
   if (pixelwise)
     {
       pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
@@ -2397,7 +2289,7 @@ ns_color_index_to_rgba(int idx, struct frame *f)
 }
 
 void
-ns_query_color(void *col, XColor *color_def, bool setPixel)
+ns_query_color(void *col, Emacs_Color *color_def, bool setPixel)
 /* --------------------------------------------------------------------------
          Get ARGB values out of NSColor col and put them into color_def.
          If setPixel, set the pixel to a concatenated version.
@@ -2420,7 +2312,7 @@ ns_query_color(void *col, XColor *color_def, bool 
setPixel)
 bool
 ns_defined_color (struct frame *f,
                   const char *name,
-                  XColor *color_def,
+                  Emacs_Color *color_def,
                   bool alloc,
                   bool makeIndex)
 /* --------------------------------------------------------------------------
@@ -2448,7 +2340,7 @@ ns_defined_color (struct frame *f,
 }
 
 static void
-ns_query_frame_background_color (struct frame *f, XColor *bgcolor)
+ns_query_frame_background_color (struct frame *f, Emacs_Color *bgcolor)
 /* --------------------------------------------------------------------------
      External (hook): Store F's background color into *BGCOLOR
    -------------------------------------------------------------------------- 
*/
@@ -2585,8 +2477,7 @@ ns_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
 
   /* Clear the mouse-moved flag for every frame on this display.  */
   FOR_EACH_FRAME (tail, frame)
-    if (FRAME_NS_P (XFRAME (frame))
-        && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp))
+    if (FRAME_NS_P (XFRAME (frame)))
       XFRAME (frame)->mouse_moved = 0;
 
   dpyinfo->last_mouse_scroll_bar = nil;
@@ -2647,7 +2538,7 @@ ns_frame_up_to_date (struct frame *f)
 
 
 static void
-ns_define_frame_cursor (struct frame *f, Cursor cursor)
+ns_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
 /* --------------------------------------------------------------------------
     External (RIF): set frame mouse pointer type.
    -------------------------------------------------------------------------- 
*/
@@ -5038,6 +4929,18 @@ ns_judge_scroll_bars (struct frame *f)
 
 /* ==========================================================================
 
+    Image Hooks
+
+   ========================================================================== 
*/
+
+static void
+ns_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap)
+{
+  ns_release_object (pixmap);
+}
+
+/* ==========================================================================
+
     Initialization
 
    ========================================================================== 
*/
@@ -5166,8 +5069,8 @@ static struct redisplay_interface ns_redisplay_interface =
   gui_clear_end_of_line,
   ns_scroll_run,
   ns_after_update_window_line,
-  ns_update_window_begin,
-  ns_update_window_end,
+  NULL, /* update_window_begin */
+  NULL, /* update_window_end   */
   0, /* flush_display */
   gui_clear_window_mouse_face,
   gui_get_glyph_overhangs,
@@ -5266,6 +5169,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
   terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar;
   terminal->judge_scroll_bars_hook = ns_judge_scroll_bars;
   terminal->get_string_resource_hook = ns_get_string_resource;
+  terminal->free_pixmap = ns_free_pixmap;
   terminal->delete_frame_hook = ns_destroy_window;
   terminal->delete_terminal_hook = ns_delete_terminal;
   /* Other hooks are NULL by default.  */
@@ -5517,14 +5421,14 @@ ns_term_init (Lisp_Object display_name)
 
   NSTRACE_MSG ("Input/output types");
 
-  ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
-  ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
+  ns_send_types = [[NSArray arrayWithObjects: NSPasteboardTypeString, nil] 
retain];
+  ns_return_types = [[NSArray arrayWithObjects: NSPasteboardTypeString, nil]
                       retain];
   ns_drag_types = [[NSArray arrayWithObjects:
-                            NSStringPboardType,
-                            NSTabularTextPboardType,
+                            NSPasteboardTypeString,
+                            NSPasteboardTypeTabularText,
                             NSFilenamesPboardType,
-                            NSURLPboardType, nil] retain];
+                            NSPasteboardTypeURL, nil] retain];
 
   /* If fullscreen is in init/default-frame-alist, focus isn't set
      right for fullscreen windows, so set this.  */
@@ -8334,6 +8238,9 @@ not_in_argv (NSString *arg)
     {
       return NO;
     }
+  /* FIXME: NSFilenamesPboardType is deprecated in 10.14, but the
+     NSURL method can only handle one file at a time.  Stick with the
+     existing code at the moment.  */
   else if ([type isEqualToString: NSFilenamesPboardType])
     {
       NSArray *files;
@@ -8428,8 +8335,8 @@ not_in_argv (NSString *arg)
 
   NSTRACE ("[EmacsView writeSelectionToPasteboard:types:]");
 
-  /* We only support NSStringPboardType.  */
-  if ([types containsObject:NSStringPboardType] == NO) {
+  /* We only support NSPasteboardTypeString.  */
+  if ([types containsObject:NSPasteboardTypeString] == NO) {
     return NO;
   }
 
@@ -8443,7 +8350,7 @@ not_in_argv (NSString *arg)
   if (! STRINGP (val))
     return NO;
 
-  typesDeclared = [NSArray arrayWithObject:NSStringPboardType];
+  typesDeclared = [NSArray arrayWithObject:NSPasteboardTypeString];
   [pb declareTypes:typesDeclared owner:nil];
   ns_string_to_pasteboard (pb, val);
   return YES;
@@ -9105,10 +9012,12 @@ not_in_argv (NSString *arg)
       last_hit_part = horizontal ? scroll_bar_before_handle : 
scroll_bar_above_handle; break;
     case NSScrollerIncrementPage:
       last_hit_part = horizontal ? scroll_bar_after_handle : 
scroll_bar_below_handle; break;
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070
     case NSScrollerDecrementLine:
       last_hit_part = horizontal ? scroll_bar_left_arrow : 
scroll_bar_up_arrow; break;
     case NSScrollerIncrementLine:
       last_hit_part = horizontal ? scroll_bar_right_arrow : 
scroll_bar_down_arrow; break;
+#endif
     case NSScrollerKnob:
       last_hit_part = horizontal ? scroll_bar_horizontal_handle : 
scroll_bar_handle; break;
     case NSScrollerKnobSlot:  /* GNUstep-only */
diff --git a/src/print.c b/src/print.c
index 68ed678..406abbf 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1361,6 +1361,19 @@ print_prune_string_charset (Lisp_Object string)
   return string;
 }
 
+#ifdef HAVE_MODULES
+/* Return a data pointer equal to FUNCPTR.  */
+
+static void const *
+data_from_funcptr (void (*funcptr) (void))
+{
+  /* The module code, and the POSIX API for dynamic linking, already
+     assume that function and data pointers are represented
+     interchangeably, so it's OK to assume that here too.  */
+  return (void const *) funcptr;
+}
+#endif
+
 static bool
 print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
                  char *buf)
@@ -1788,23 +1801,20 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
       {
        print_c_string ("#<module function ", printcharfun);
         module_funcptr ptr = module_function_address (XMODULE_FUNCTION (obj));
-        const char *file = NULL;
-       const char *symbol = NULL;
+       char const *file;
+       char const *symbol;
        dynlib_addr (ptr, &file, &symbol);
 
        if (symbol == NULL)
          {
-           print_c_string ("at ", printcharfun);
-           enum { pointer_bufsize = sizeof ptr * 16 / CHAR_BIT + 2 + 1 };
-           char buffer[pointer_bufsize];
-           int needed = snprintf (buffer, sizeof buffer, "%p", ptr);
-           const char p0x[] = "0x";
-           eassert (needed <= sizeof buffer);
-           /* ANSI C doesn't guarantee that %p produces a string that
-              begins with a "0x".  */
-           if (c_strncasecmp (buffer, p0x, sizeof (p0x) - 1) != 0)
-             print_c_string (p0x, printcharfun);
-           print_c_string (buffer, printcharfun);
+           uintptr_t ui = (uintptr_t) data_from_funcptr (ptr);
+
+           /* In theory this assignment could lose info on pre-C99
+              hosts, but in practice it doesn't.  */
+           uprintmax_t up = ui;
+
+           int len = sprintf (buf, "at 0x%"pMx, up);
+           strout (buf, len, len, printcharfun);
          }
        else
          print_c_string (symbol, printcharfun);
@@ -1832,7 +1842,9 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
 {
   char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT),
                max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t),
-                    40))];
+                    max ((sizeof "at 0x"
+                          + (sizeof (uprintmax_t) * CHAR_BIT + 4 - 1) / 4),
+                         40)))];
   current_thread->stack_top = buf;
   maybe_quit ();
 
diff --git a/src/search.c b/src/search.c
index dfbae5c..8a0f707 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1324,12 +1324,7 @@ search_buffer_non_re (Lisp_Object string, ptrdiff_t pos,
     }
   else
     {
-      /* Converting multibyte to single-byte.
-
-         ??? Perhaps this conversion should be done in a special way
-         by subtracting nonascii-insert-offset from each non-ASCII char,
-         so that only the multibyte chars which really correspond to
-         the chosen single-byte character set can possibly match.  */
+      /* Converting multibyte to single-byte.  */
       raw_pattern_size = SCHARS (string);
       raw_pattern_size_byte = SCHARS (string);
       raw_pattern = SAFE_ALLOCA (raw_pattern_size + 1);
diff --git a/src/termhooks.h b/src/termhooks.h
index 54f09e0..f182712 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -496,7 +496,7 @@ struct terminal
 
    If MAKEINDEX (on NS), set COLOR_DEF pixel to ARGB.  */
   bool (*defined_color_hook) (struct frame *f, const char *color_name,
-                              XColor *color_def,
+                              Emacs_Color *color_def,
                               bool alloc,
                               bool makeIndex);
 
@@ -515,13 +515,13 @@ struct terminal
 
   /* This hook is called to store the frame's background color into
      BGCOLOR.  */
-  void (*query_frame_background_color) (struct frame *f, XColor *bgcolor);
+  void (*query_frame_background_color) (struct frame *f, Emacs_Color *bgcolor);
 
 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
   /* On frame F, translate pixel colors to RGB values for the NCOLORS
      colors in COLORS.  Use cached information, if available.  */
 
-  void (*query_colors) (struct frame *f, XColor *colors, int ncolors);
+  void (*query_colors) (struct frame *f, Emacs_Color *colors, int ncolors);
 #endif
   /* Return the current position of the mouse.
 
@@ -741,6 +741,15 @@ struct terminal
                                             const char *name,
                                             const char *class);
 
+  /* Image hooks */
+#ifdef HAVE_WINDOW_SYSTEM
+  /* Free the pixmap PIXMAP on F.  */
+  void (*free_pixmap) (struct frame *f, Emacs_Pixmap pixmap);
+
+#endif
+
+  /* Deletion hooks */
+
   /* Called to delete the device-specific portions of a frame that is
      on this terminal device. */
   void (*delete_frame_hook) (struct frame *);
diff --git a/src/timefns.c b/src/timefns.c
index 5005c73..7b5af6a 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1488,10 +1488,11 @@ usage: (encode-time &optional TIME FORM &rest 
OBSOLESCENT-ARGUMENTS)  */)
       tm.tm_mon  = check_tm_member (XCAR (a), 1); a = XCDR (a);
       tm.tm_year = check_tm_member (XCAR (a), TM_YEAR_BASE); a = XCDR (a);
       a = XCDR (a);
-      if (SYMBOLP (XCAR (a)))
-       tm.tm_isdst = !NILP (XCAR (a));
+      Lisp_Object dstflag = XCAR (a);
       a = XCDR (a);
       zone = XCAR (a);
+      if (SYMBOLP (dstflag) && !FIXNUMP (zone) && !CONSP (zone))
+       tm.tm_isdst = !NILP (dstflag);
     }
   else if (nargs < 6)
     xsignal2 (Qwrong_number_of_arguments, Qencode_time, make_fixnum (nargs));
diff --git a/src/w32.c b/src/w32.c
index 082a66b..833ff4c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2003,6 +2003,13 @@ getloadavg (double loadavg[], int nelem)
       loadavg[elem] = avg;
     }
 
+  /* Always return at least one element, otherwise load-average
+     returns nil, and Lisp programs might decide we cannot measure
+     system load.  For example, jit-lock-stealth-load's defcustom
+     might decide that feature is "unsupported".  */
+  if (elem == 0)
+    loadavg[elem++] = 0.09;    /* < display-time-load-average-threshold */
+
   return elem;
 }
 
@@ -2644,7 +2651,7 @@ unsetenv (const char *name)
   /* It is safe to use 'alloca' with 32K size, since the stack is at
      least 2MB, and we set it to 8MB in the link command line.  */
   var = alloca (name_len + 2);
-  strncpy (var, name, name_len);
+  memcpy (var, name, name_len);
   var[name_len++] = '=';
   var[name_len] = '\0';
   return _putenv (var);
@@ -6054,7 +6061,7 @@ readlink (const char *name, char *buf, size_t buf_size)
          lname_size = strlen (resolved) + 1;
          if (lname_size <= buf_size)
            size_to_copy = lname_size;
-         strncpy (buf, resolved, size_to_copy);
+         memcpy (buf, resolved, size_to_copy);
          /* Success!  */
          retval = size_to_copy;
        }
diff --git a/src/w32fns.c b/src/w32fns.c
index 525642b..bb74fcc 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1174,7 +1174,7 @@ gamma_correct (struct frame *f, COLORREF *color)
    If ALLOC is nonzero, allocate a new colormap cell.  */
 
 bool
-w32_defined_color (struct frame *f, const char *color, XColor *color_def,
+w32_defined_color (struct frame *f, const char *color, Emacs_Color *color_def,
                   bool alloc_p, bool _makeIndex)
 {
   register Lisp_Object tem;
@@ -1248,7 +1248,7 @@ w32_defined_color (struct frame *f, const char *color, 
XColor *color_def,
 static int
 w32_decode_color (struct frame *f, Lisp_Object arg, int def)
 {
-  XColor cdef;
+  Emacs_Color cdef;
 
   CHECK_STRING (arg);
 
@@ -2247,15 +2247,15 @@ w32_set_z_group (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_value)
 
 /* Subroutines for creating a frame.  */
 
-Cursor w32_load_cursor (LPCTSTR);
+HCURSOR w32_load_cursor (LPCTSTR);
 
-Cursor
+HCURSOR
 w32_load_cursor (LPCTSTR name)
 {
   /* Try first to load cursor from application resource.  */
-  Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL),
-                            name, IMAGE_CURSOR, 0, 0,
-                            LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED);
+  HCURSOR cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL),
+                              name, IMAGE_CURSOR, 0, 0,
+                              LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED);
   if (!cursor)
     {
       /* Then try to load a shared predefined cursor.  */
@@ -5217,7 +5217,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM 
lParam)
 
     case WM_EMACS_SETCURSOR:
       {
-       Cursor cursor = (Cursor) wParam;
+       HCURSOR cursor = (HCURSOR) wParam;
        f = w32_window_to_frame (dpyinfo, hwnd);
        if (f && cursor)
          {
@@ -5559,22 +5559,19 @@ w32_icon (struct frame *f, Lisp_Object parms)
 static void
 w32_make_gc (struct frame *f)
 {
-  XGCValues gc_values;
+  Emacs_GC gc_values;
 
   block_input ();
 
   /* Create the GC's of this frame.
      Note that many default values are used.  */
 
-  /* Normal video */
-  gc_values.font = FRAME_FONT (f);
-
   /* Cursor has cursor-color background, background-color foreground.  */
   gc_values.foreground = FRAME_BACKGROUND_PIXEL (f);
   gc_values.background = f->output_data.w32->cursor_pixel;
   f->output_data.w32->cursor_gc
     = XCreateGC (NULL, FRAME_W32_WINDOW (f),
-                (GCFont | GCForeground | GCBackground),
+                (GCForeground | GCBackground),
                 &gc_values);
 
   /* Reliefs.  */
@@ -6100,7 +6097,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, 
Sxw_color_defined_p, 1, 2, 0,
        doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object color, Lisp_Object frame)
 {
-  XColor foo;
+  Emacs_Color foo;
   struct frame *f = decode_window_system_frame (frame);
 
   CHECK_STRING (color);
@@ -6115,7 +6112,7 @@ DEFUN ("xw-color-values", Fxw_color_values, 
Sxw_color_values, 1, 2, 0,
        doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object color, Lisp_Object frame)
 {
-  XColor foo;
+  Emacs_Color foo;
   struct frame *f = decode_window_system_frame (frame);
 
   CHECK_STRING (color);
diff --git a/src/w32font.c b/src/w32font.c
index 848016d..bd68e22 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -433,7 +433,7 @@ w32font_encode_char (struct font *font, int c)
    CODE (length NGLYPHS).  Apparently metrics can be NULL, in this
    case just return the overall width.  */
 void
-w32font_text_extents (struct font *font, unsigned *code,
+w32font_text_extents (struct font *font, const unsigned *code,
                      int nglyphs, struct font_metrics *metrics)
 {
   int i;
diff --git a/src/w32font.h b/src/w32font.h
index 65f42a3..c7bb7f3 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -74,7 +74,7 @@ int w32font_open_internal (struct frame *f, Lisp_Object 
font_entity,
                            int pixel_size, Lisp_Object font_object);
 void w32font_close (struct font *font);
 int w32font_has_char (Lisp_Object entity, int c);
-void w32font_text_extents (struct font *font, unsigned *code, int nglyphs,
+void w32font_text_extents (struct font *font, const unsigned *code, int 
nglyphs,
                           struct font_metrics *metrics);
 int w32font_draw (struct glyph_string *s, int from, int to,
                   int x, int y, bool with_background);
diff --git a/src/w32gui.h b/src/w32gui.h
index 5dcbbd9..62bad33 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -27,41 +27,11 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
 #define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p))))
 
-/* Emulate X GC's by keeping color and font info in a structure.  */
-typedef struct _XGCValues
-{
-  COLORREF foreground;
-  COLORREF background;
-  struct font *font;
-} XGCValues;
-
-#define GCForeground 0x01
-#define GCBackground 0x02
-#define GCFont 0x03
-
-typedef HBITMAP Pixmap;
-typedef HBITMAP Bitmap;
+typedef HBITMAP Emacs_Pixmap;
 
-typedef XGCValues * GC;
-typedef COLORREF Color;
 typedef HWND Window;
 typedef HDC Display;  /* HDC so it doesn't conflict with xpm lib.  */
-typedef HCURSOR Cursor;
-
-#define No_Cursor (0)
-
-#define XChar2b wchar_t
-
-/* Dealing with bits of wchar_t as if they were an XChar2b.  */
-#define STORE_XCHAR2B(chp, byte1, byte2) \
-  ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
-
-#define XCHAR2B_BYTE1(chp) \
-  (((*(chp)) & 0xff00) >> 8)
-
-#define XCHAR2B_BYTE2(chp) \
-  ((*(chp)) & 0x00ff)
-
+typedef HCURSOR Emacs_Cursor;
 
 /* Windows equivalent of XImage.  */
 typedef struct _XImage
@@ -110,20 +80,15 @@ extern HINSTANCE hinst;
 #define PBaseSize      (1L << 8) /* program specified base for incrementing */
 #define PWinGravity    (1L << 9) /* program specified window gravity */
 
-typedef struct {
-    int x, y;
-    unsigned width, height;
-} XRectangle;
-
 #define NativeRectangle RECT
 
-#define CONVERT_TO_XRECT(xr,nr)                        \
+#define CONVERT_TO_EMACS_RECT(xr,nr)            \
   ((xr).x = (nr).left,                         \
    (xr).y = (nr).top,                          \
    (xr).width = ((nr).right - (nr).left),      \
    (xr).height = ((nr).bottom - (nr).top))
 
-#define CONVERT_FROM_XRECT(xr,nr)              \
+#define CONVERT_FROM_EMACS_RECT(xr,nr)         \
   ((nr).left = (xr).x,                         \
    (nr).top = (xr).y,                          \
    (nr).right = ((xr).x + (xr).width),         \
diff --git a/src/w32term.c b/src/w32term.c
index 451dd54..5726124 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -85,7 +85,7 @@ static int any_help_event_p;
 extern unsigned int msh_mousewheel;
 
 extern int w32_codepage_for_font (char *fontname);
-extern Cursor w32_load_cursor (LPCTSTR name);
+extern HCURSOR w32_load_cursor (LPCTSTR name);
 
 
 /* This is display since w32 does not support multiple ones.  */
@@ -166,7 +166,7 @@ int w32_message_fd = -1;
 
 static void w32_handle_tool_bar_click (struct frame *,
                                        struct input_event *);
-static void w32_define_cursor (Window, Cursor);
+static void w32_define_cursor (Window, Emacs_Cursor);
 
 static void w32_scroll_bar_clear (struct frame *);
 static void w32_raise_frame (struct frame *);
@@ -237,23 +237,21 @@ record_event (char *locus, int type)
 
 
 static void
-XChangeGC (void *ignore, XGCValues *gc, unsigned long mask,
-          XGCValues *xgcv)
+XChangeGC (void *ignore, Emacs_GC *gc, unsigned long mask,
+          Emacs_GC *egc)
 {
   if (mask & GCForeground)
-    gc->foreground = xgcv->foreground;
+    gc->foreground = egc->foreground;
   if (mask & GCBackground)
-    gc->background = xgcv->background;
-  if (mask & GCFont)
-    gc->font = xgcv->font;
+    gc->background = egc->background;
 }
 
-XGCValues *
-XCreateGC (void *ignore, HWND wignore, unsigned long mask, XGCValues *xgcv)
+Emacs_GC *
+XCreateGC (void *ignore, HWND wignore, unsigned long mask, Emacs_GC *egc)
 {
-  XGCValues *gc = xzalloc (sizeof (XGCValues));
+  Emacs_GC *gc = xzalloc (sizeof (*gc));
 
-  XChangeGC (ignore, gc, mask, xgcv);
+  XChangeGC (ignore, gc, mask, egc);
 
   return gc;
 }
@@ -337,7 +335,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color)
 
   int wave_height = 3 * scale_y, wave_length = 2 * scale_x, thickness = 
scale_y;
   int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax;
-  XRectangle wave_clip, string_clip, final_clip;
+  Emacs_Rectangle wave_clip, string_clip, final_clip;
   RECT w32_final_clip, w32_string_clip;
   HPEN hp, oldhp;
 
@@ -356,14 +354,14 @@ w32_draw_underwave (struct glyph_string *s, COLORREF 
color)
   wave_clip.height = wave_height;
 
   get_glyph_string_clip_rect (s, &w32_string_clip);
-  CONVERT_TO_XRECT (string_clip, w32_string_clip);
+  CONVERT_TO_EMACS_RECT (string_clip, w32_string_clip);
 
   if (!gui_intersect_rectangles (&wave_clip, &string_clip, &final_clip))
     return;
 
   hp = CreatePen (PS_SOLID, thickness, color);
   oldhp = SelectObject (s->hdc, hp);
-  CONVERT_FROM_XRECT (final_clip, w32_final_clip);
+  CONVERT_FROM_EMACS_RECT (final_clip, w32_final_clip);
   w32_set_clip_rectangle (s->hdc, &w32_final_clip);
 
   /* Draw the waves */
@@ -396,7 +394,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color)
 
 /* Draw a hollow rectangle at the specified position.  */
 static void
-w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y,
+w32_draw_rectangle (HDC hdc, Emacs_GC *gc, int x, int y,
                     int width, int height)
 {
   HBRUSH hb, oldhb;
@@ -529,7 +527,7 @@ w32_display_pixel_width (struct w32_display_info *dpyinfo)
 
 /* Start an update of frame F.  This function is installed as a hook
    for update_begin, i.e. it is called when update_begin is called.
-   This function is called prior to calls to w32_update_window_begin
+   This function is called prior to calls to gui_update_window_begin
    for each window being updated.  */
 
 static void
@@ -555,58 +553,12 @@ w32_update_begin (struct frame *f)
 static void
 w32_update_window_begin (struct window *w)
 {
-  struct frame *f = XFRAME (WINDOW_FRAME (w));
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-
   /* Hide the system caret during an update.  */
   if (w32_use_visible_system_caret && w32_system_caret_hwnd)
     {
       SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0,
                          0, 6000, NULL);
     }
-
-  w->output_cursor = w->cursor;
-
-  block_input ();
-
-  if (f == hlinfo->mouse_face_mouse_frame)
-    {
-      /* Don't do highlighting for mouse motion during the update.  */
-      hlinfo->mouse_face_defer = true;
-
-      /* If F needs to be redrawn, simply forget about any prior mouse
-        highlighting.  */
-      if (FRAME_GARBAGED_P (f))
-       hlinfo->mouse_face_window = Qnil;
-
-#if 0 /* Rows in a current matrix containing glyphs in mouse-face have
-        their mouse_face_p flag set, which means that they are always
-        unequal to rows in a desired matrix which never have that
-        flag set.  So, rows containing mouse-face glyphs are never
-        scrolled, and we don't have to switch the mouse highlight off
-        here to prevent it from being scrolled.  */
-
-      /* Can we tell that this update does not affect the window
-        where the mouse highlight is?  If so, no need to turn off.
-        Likewise, don't do anything if the frame is garbaged;
-        in that case, the frame's current matrix that we would use
-        is all wrong, and we will redisplay that line anyway.  */
-      if (!NILP (hlinfo->mouse_face_window)
-         && w == XWINDOW (hlinfo->mouse_face_window))
-       {
-         int i;
-
-          for (i = 0; i < w->desired_matrix->nrows; ++i)
-           if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i))
-             break;
-
-         if (i < w->desired_matrix->nrows)
-           clear_mouse_face (hlinfo);
-       }
-#endif /* 0 */
-    }
-
-  unblock_input ();
 }
 
 /* Draw a vertical window border from (x,y0) to (x,y1)  */
@@ -694,39 +646,8 @@ w32_draw_window_divider (struct window *w, int x0, int x1, 
int y0, int y1)
 
 static void
 w32_update_window_end (struct window *w, bool cursor_on_p,
-                    bool mouse_face_overwritten_p)
+                       bool mouse_face_overwritten_p)
 {
-  if (!w->pseudo_window_p)
-    {
-      block_input ();
-
-      if (cursor_on_p)
-       display_and_set_cursor (w, true,
-                               w->output_cursor.hpos, w->output_cursor.vpos,
-                               w->output_cursor.x, w->output_cursor.y);
-
-      if (draw_window_fringes (w, true))
-       {
-         if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
-           gui_draw_right_divider (w);
-         else
-           gui_draw_vertical_border (w);
-       }
-
-      unblock_input ();
-    }
-
-  /* If a row with mouse-face was overwritten, arrange for
-     XTframe_up_to_date to redisplay the mouse highlight.  */
-  if (mouse_face_overwritten_p)
-    {
-      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-
-      hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
-      hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
-      hlinfo->mouse_face_window = Qnil;
-    }
-
   /* Unhide the caret.  This won't actually show the cursor, unless it
      was visible before the corresponding call to HideCaret in
      w32_update_window_begin.  */
@@ -983,38 +904,37 @@ w32_set_cursor_gc (struct glyph_string *s)
   else
     {
       /* Cursor on non-default face: must merge.  */
-      XGCValues xgcv;
+      Emacs_GC egc;
       unsigned long mask;
 
-      xgcv.background = s->f->output_data.w32->cursor_pixel;
-      xgcv.foreground = s->face->background;
+      egc.background = s->f->output_data.w32->cursor_pixel;
+      egc.foreground = s->face->background;
 
       /* If the glyph would be invisible, try a different foreground.  */
-      if (xgcv.foreground == xgcv.background)
-       xgcv.foreground = s->face->foreground;
-      if (xgcv.foreground == xgcv.background)
-       xgcv.foreground = s->f->output_data.w32->cursor_foreground_pixel;
-      if (xgcv.foreground == xgcv.background)
-       xgcv.foreground = s->face->foreground;
+      if (egc.foreground == egc.background)
+       egc.foreground = s->face->foreground;
+      if (egc.foreground == egc.background)
+       egc.foreground = s->f->output_data.w32->cursor_foreground_pixel;
+      if (egc.foreground == egc.background)
+       egc.foreground = s->face->foreground;
 
       /* Make sure the cursor is distinct from text in this face.  */
-      if (xgcv.background == s->face->background
-         && xgcv.foreground == s->face->foreground)
+      if (egc.background == s->face->background
+         && egc.foreground == s->face->foreground)
        {
-         xgcv.background = s->face->foreground;
-         xgcv.foreground = s->face->background;
+         egc.background = s->face->foreground;
+         egc.foreground = s->face->background;
        }
 
       IF_DEBUG (w32_check_font (s->f, s->font));
-      xgcv.font = s->font;
-      mask = GCForeground | GCBackground | GCFont;
+      mask = GCForeground | GCBackground;
 
       if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc)
        XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc,
-                  mask, &xgcv);
+                  mask, &egc);
       else
        FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc
-         = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &xgcv);
+         = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &egc);
 
       s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc;
     }
@@ -1049,21 +969,20 @@ w32_set_mouse_face_gc (struct glyph_string *s)
     {
       /* Otherwise construct scratch_cursor_gc with values from FACE
         but font FONT.  */
-      XGCValues xgcv;
+      Emacs_GC egc;
       unsigned long mask;
 
-      xgcv.background = s->face->background;
-      xgcv.foreground = s->face->foreground;
+      egc.background = s->face->background;
+      egc.foreground = s->face->foreground;
       IF_DEBUG (w32_check_font (s->f, s->font));
-      xgcv.font = s->font;
-      mask = GCForeground | GCBackground | GCFont;
+      mask = GCForeground | GCBackground;
 
       if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc)
        XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc,
-                  mask, &xgcv);
+                  mask, &egc);
       else
        FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc
-         = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &xgcv);
+         = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &egc);
 
       s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc;
     }
@@ -1178,14 +1097,10 @@ w32_compute_glyph_string_overhangs (struct glyph_string 
*s)
       && s->first_glyph->type == CHAR_GLYPH
       && !s->font_not_found_p)
     {
-      unsigned *code = alloca (sizeof (unsigned) * s->nchars);
       struct font *font = s->font;
       struct font_metrics metrics;
-      int i;
 
-      for (i = 0; i < s->nchars; i++)
-       code[i] = s->char2b[i];
-      font->driver->text_extents (font, code, s->nchars, &metrics);
+      font->driver->text_extents (font, s->char2b, s->nchars, &metrics);
       s->right_overhang = (metrics.rbearing > metrics.width
                           ? metrics.rbearing - metrics.width : 0);
       s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
@@ -1430,7 +1345,7 @@ static void
 w32_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
 {
   struct glyph *glyph = s->first_glyph;
-  XChar2b char2b[8];
+  unsigned char2b[8];
   int x, i, j;
   bool with_background;
 
@@ -1487,16 +1402,12 @@ w32_draw_glyphless_glyph_string_foreground (struct 
glyph_string *s)
        {
          struct font *font = s->font;
          int upper_len = (len + 1) / 2;
-         unsigned code;
          HFONT old_font;
 
          old_font = SelectObject (s->hdc, FONT_HANDLE (font));
          /* It is certain that all LEN characters in STR are ASCII.  */
          for (j = 0; j < len; j++)
-           {
-             code = font->driver->encode_char (font, str[j]);
-             STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
-           }
+            char2b[j] = font->driver->encode_char (font, str[j]) & 0xFFFF;
          font->driver->draw (s, 0, upper_len,
                              x + glyph->slice.glyphless.upper_xoff,
                              s->ybase + glyph->slice.glyphless.upper_yoff,
@@ -1594,7 +1505,7 @@ w32_alloc_lighter_color (struct frame *f, COLORREF *color,
    colors in COLORS.  On W32, we no longer try to map colors to
    a palette.  */
 static void
-w32_query_colors (struct frame *f, XColor *colors, int ncolors)
+w32_query_colors (struct frame *f, Emacs_Color *colors, int ncolors)
 {
   int i;
 
@@ -1611,7 +1522,7 @@ w32_query_colors (struct frame *f, XColor *colors, int 
ncolors)
 /* Store F's background color into *BGCOLOR.  */
 
 static void
-w32_query_frame_background_color (struct frame *f, XColor *bgcolor)
+w32_query_frame_background_color (struct frame *f, Emacs_Color *bgcolor)
 {
   bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
   w32_query_colors (f, bgcolor, 1);
@@ -1628,7 +1539,7 @@ static void
 w32_setup_relief_color (struct frame *f, struct relief *relief, double factor,
                        int delta, COLORREF default_pixel)
 {
-  XGCValues xgcv;
+  Emacs_GC egc;
   struct w32_output *di = f->output_data.w32;
   unsigned long mask = GCForeground;
   COLORREF pixel;
@@ -1640,22 +1551,21 @@ w32_setup_relief_color (struct frame *f, struct relief 
*relief, double factor,
   /* TODO: Free colors (if using palette)? */
 
   /* Allocate new color.  */
-  xgcv.foreground = default_pixel;
+  egc.foreground = default_pixel;
   pixel = background;
   if (w32_alloc_lighter_color (f, &pixel, factor, delta))
-    xgcv.foreground = relief->pixel = pixel;
+    egc.foreground = relief->pixel = pixel;
 
-  xgcv.font = NULL;    /* avoid compiler warnings */
   if (relief->gc == 0)
     {
 #if 0 /* TODO: stipple */
-      xgcv.stipple = dpyinfo->gray;
+      egc.stipple = dpyinfo->gray;
       mask |= GCStipple;
 #endif
-      relief->gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, &xgcv);
+      relief->gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, &egc);
     }
   else
-    XChangeGC (NULL, relief->gc, mask, &xgcv);
+    XChangeGC (NULL, relief->gc, mask, &egc);
 }
 
 
@@ -1704,7 +1614,7 @@ w32_draw_relief_rect (struct frame *f,
                      RECT *clip_rect)
 {
   int i;
-  XGCValues gc;
+  Emacs_GC gc;
   HDC hdc = get_frame_dc (f);
 
   if (raised_p)
@@ -2363,7 +2273,7 @@ w32_draw_stretch_glyph_string (struct glyph_string *s)
       /* Clear rest using the GC of the original non-cursor face.  */
       if (width < background_width)
        {
-         XGCValues *gc = s->face->gc;
+         Emacs_GC *gc = s->face->gc;
          int y = s->y;
          int w = background_width - width, h = s->height;
          RECT r;
@@ -2859,7 +2769,7 @@ w32_scroll_run (struct window *w, struct run *run)
 
   block_input ();
 
-  /* Cursor off.  Will be switched on again in w32_update_window_end.  */
+  /* Cursor off.  Will be switched on again in gui_update_window_end.  */
   gui_clear_cursor (w);
 
   {
@@ -3506,7 +3416,7 @@ static void w32_horizontal_scroll_bar_report_motion 
(struct frame **, Lisp_Objec
                                                      Lisp_Object *, 
Lisp_Object *,
                                                      Time *);
 static void
-w32_define_cursor (Window window, Cursor cursor)
+w32_define_cursor (Window window, Emacs_Cursor cursor)
 {
   PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0);
 }
@@ -5883,7 +5793,7 @@ w32_draw_bar_cursor (struct window *w, struct glyph_row 
*row,
 /* RIF: Define cursor CURSOR on frame F.  */
 
 static void
-w32_define_frame_cursor (struct frame *f, Cursor cursor)
+w32_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
 {
   w32_define_cursor (FRAME_W32_WINDOW (f), cursor);
 }
@@ -6946,6 +6856,7 @@ w32_wm_set_size_hint (struct frame *f, long flags, bool 
user_position)
   leave_crit ();
 }
 
+
 /***********************************************************************
                                Fonts
  ***********************************************************************/
@@ -7017,6 +6928,18 @@ w32_toggle_invisible_pointer (struct frame *f, bool 
invisible)
   unblock_input ();
 }
 
+
+/***********************************************************************
+                            Image Hooks
+ ***********************************************************************/
+
+static void
+w32_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap)
+{
+  DeleteObject (pixmap);
+}
+
+
 /***********************************************************************
                            Initialization
  ***********************************************************************/
@@ -7196,6 +7119,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
   terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;
   terminal->judge_scroll_bars_hook = w32_judge_scroll_bars;
   terminal->get_string_resource_hook = w32_get_string_resource;
+  terminal->free_pixmap = w32_free_pixmap;
   terminal->delete_frame_hook = w32_destroy_window;
   terminal->delete_terminal_hook = w32_delete_terminal;
   /* Other hooks are NULL by default.  */
@@ -7271,7 +7195,7 @@ w32_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
 
   /* initialize palette with white and black */
   {
-    XColor color;
+    Emacs_Color color;
     w32_defined_color (0, "white", &color, true, false);
     w32_defined_color (0, "black", &color, true, false);
   }
diff --git a/src/w32term.h b/src/w32term.h
index de372d7..729e8d0 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -56,7 +56,7 @@ extern BOOL bUseDflt;
 
 struct w32_bitmap_record
 {
-  Pixmap pixmap;
+  Emacs_Pixmap pixmap;
   char *file;
   HINSTANCE hinst; /* Used to load the file */
   int refcount;
@@ -114,10 +114,10 @@ struct w32_display_info
   Window root_window;
 
   /* The cursor to use for vertical scroll bars.  */
-  Cursor vertical_scroll_bar_cursor;
+  HCURSOR vertical_scroll_bar_cursor;
 
   /* The cursor to use for horizontal scroll bars.  */
-  Cursor horizontal_scroll_bar_cursor;
+  HCURSOR horizontal_scroll_bar_cursor;
 
   /* Resource data base */
   const char *rdb;
@@ -142,7 +142,7 @@ struct w32_display_info
   int smallest_font_height;
 
   /* Reusable Graphics Context for drawing a cursor in a non-default face. */
-  XGCValues *scratch_cursor_gc;
+  Emacs_GC *scratch_cursor_gc;
 
   /* Information about the range of text currently shown in
      mouse-face.  */
@@ -241,7 +241,7 @@ extern void w32_set_scroll_bar_default_height (struct frame 
*);
 
 extern struct w32_display_info *w32_term_init (Lisp_Object,
                                               char *, char *);
-extern bool w32_defined_color (struct frame *, const char *, XColor *,
+extern bool w32_defined_color (struct frame *, const char *, Emacs_Color *,
                                bool, bool);
 extern int w32_display_pixel_height (struct w32_display_info *);
 extern int w32_display_pixel_width (struct w32_display_info *);
@@ -308,7 +308,7 @@ struct w32_output
   HPALETTE old_palette;
 
   /* Here are the Graphics Contexts for the default font.  */
-  XGCValues *cursor_gc;                                /* cursor drawing */
+  Emacs_GC *cursor_gc;                 /* cursor drawing */
 
   /* The window used for this frame.
      May be zero while the frame object is being created
@@ -348,27 +348,27 @@ struct w32_output
   COLORREF scroll_bar_background_pixel;
 
   /* Descriptor for the cursor in use for this window.  */
-  Cursor text_cursor;
-  Cursor nontext_cursor;
-  Cursor modeline_cursor;
-  Cursor hand_cursor;
-  Cursor hourglass_cursor;
-  Cursor horizontal_drag_cursor;
-  Cursor vertical_drag_cursor;
-  Cursor left_edge_cursor;
-  Cursor top_left_corner_cursor;
-  Cursor top_edge_cursor;
-  Cursor top_right_corner_cursor;
-  Cursor right_edge_cursor;
-  Cursor bottom_right_corner_cursor;
-  Cursor bottom_edge_cursor;
-  Cursor bottom_left_corner_cursor;
+  HCURSOR text_cursor;
+  HCURSOR nontext_cursor;
+  HCURSOR modeline_cursor;
+  HCURSOR hand_cursor;
+  HCURSOR hourglass_cursor;
+  HCURSOR horizontal_drag_cursor;
+  HCURSOR vertical_drag_cursor;
+  HCURSOR left_edge_cursor;
+  HCURSOR top_left_corner_cursor;
+  HCURSOR top_edge_cursor;
+  HCURSOR top_right_corner_cursor;
+  HCURSOR right_edge_cursor;
+  HCURSOR bottom_right_corner_cursor;
+  HCURSOR bottom_edge_cursor;
+  HCURSOR bottom_left_corner_cursor;
 
   /* Non-zero means hourglass cursor is currently displayed.  */
   unsigned hourglass_p : 1;
 
   /* Non-hourglass cursor that is currently active.  */
-  Cursor current_cursor;
+  HCURSOR current_cursor;
 
   DWORD dwStyle;
 
@@ -388,7 +388,7 @@ struct w32_output
   /* Relief GCs, colors etc.  */
   struct relief
   {
-    XGCValues *gc;
+    Emacs_GC *gc;
     unsigned long pixel;
   }
   black_relief, white_relief;
@@ -420,9 +420,6 @@ extern struct w32_output w32term_display;
 /* This gives the w32_display_info structure for the display F is on.  */
 #define FRAME_DISPLAY_INFO(f) ((void) (f), (&one_w32_display_info))
 
-/* This is the `Display *' which frame F is on.  */
-#define FRAME_X_DISPLAY(f) (0)
-
 #define FRAME_NORMAL_PLACEMENT(F) ((F)->output_data.w32->normal_placement)
 #define FRAME_PREV_FSMODE(F)      ((F)->output_data.w32->prev_fsmode)
 
@@ -724,7 +721,7 @@ extern void complete_deferred_msg (HWND hwnd, UINT msg, 
LRESULT result);
 extern BOOL parse_button (int, int, int *, int *);
 
 extern void w32_sys_ring_bell (struct frame *f);
-extern void w32_query_color (struct frame *, XColor *);
+extern void w32_query_color (struct frame *, Emacs_Color *);
 extern void w32_delete_display (struct w32_display_info *dpyinfo);
 
 #define FILE_NOTIFICATIONS_SIZE 16384
@@ -808,7 +805,7 @@ typedef struct tagTRACKMOUSEEVENT
 struct image;
 struct face;
 
-XGCValues *XCreateGC (void *, HWND, unsigned long, XGCValues *);
+Emacs_GC *XCreateGC (void *, HWND, unsigned long, Emacs_GC *);
 
 typedef DWORD (WINAPI * ClipboardSequence_Proc) (void);
 typedef BOOL (WINAPI * AppendMenuW_Proc) (
diff --git a/src/window.c b/src/window.c
index 30ffad0..deeb4f6 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3947,8 +3947,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
   b->display_error_modiff = 0;
 
   /* Update time stamps of buffer display.  */
-  if (FIXNUMP (BVAR (b, display_count)))
-    bset_display_count (b, make_fixnum (XFIXNUM (BVAR (b, display_count)) + 
1));
+  if (INTEGERP (BVAR (b, display_count)))
+    bset_display_count (b, Fadd1 (BVAR (b, display_count)));
   bset_display_time (b, Fcurrent_time ());
 
   w->window_end_pos = 0;
@@ -4089,7 +4089,7 @@ displaying that buffer.  */)
       return Qt;
     }
 
-  if (WINDOWP (object))
+  if (WINDOW_LIVE_P (object))
     {
       struct window *w = XWINDOW (object);
       mark_window_display_accurate (object, false);
diff --git a/src/xdisp.c b/src/xdisp.c
index c677831..a448c90 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -376,7 +376,26 @@ static Lisp_Object list_of_error;
               || it->s[IT_BYTEPOS (*it)] == '\t'))                     \
        || (IT_BYTEPOS (*it) < ZV_BYTE                                  \
           && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' '                 \
-              || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t'))))         \
+              || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t'))))
+
+/* If all the conditions needed to print the fill column indicator are
+   met, return the (nonnegative) column number, else return a negative
+   value.  */
+static int
+fill_column_indicator_column (struct it *it)
+{
+  if (Vdisplay_fill_column_indicator
+      && it->continuation_lines_width == 0
+      && CHARACTERP (Vdisplay_fill_column_indicator_character))
+    {
+      Lisp_Object col = (EQ (Vdisplay_fill_column_indicator_column, Qt)
+                        ? BVAR (current_buffer, fill_column)
+                        : Vdisplay_fill_column_indicator_column);
+      if (RANGED_FIXNUMP (0, col, INT_MAX))
+       return XFIXNUM (col);
+    }
+  return -1;
+}
 
 /* True means print newline to stdout before next mini-buffer message.  */
 
@@ -2070,7 +2089,7 @@ frame_to_window_pixel_xy (struct window *w, int *x, int 
*y)
 int
 get_glyph_string_clip_rects (struct glyph_string *s, NativeRectangle *rects, 
int n)
 {
-  XRectangle r;
+  Emacs_Rectangle r;
 
   if (n <= 0)
     return 0;
@@ -2132,7 +2151,7 @@ get_glyph_string_clip_rects (struct glyph_string *s, 
NativeRectangle *rects, int
         take the intersection with the rectangle of the cursor.  */
       if (s->for_overlaps & OVERLAPS_ERASED_CURSOR)
        {
-         XRectangle rc, r_save = r;
+         Emacs_Rectangle rc, r_save = r;
 
          rc.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (s->w, s->w->phys_cursor.x);
          rc.y = s->w->phys_cursor.y;
@@ -2198,7 +2217,7 @@ get_glyph_string_clip_rects (struct glyph_string *s, 
NativeRectangle *rects, int
 
   if (s->row->clip)
     {
-      XRectangle r_save = r;
+      Emacs_Rectangle r_save = r;
 
       if (! gui_intersect_rectangles (&r_save, s->row->clip, &r))
        r.width = 0;
@@ -2207,8 +2226,8 @@ get_glyph_string_clip_rects (struct glyph_string *s, 
NativeRectangle *rects, int
   if ((s->for_overlaps & OVERLAPS_BOTH) == 0
       || ((s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1))
     {
-#ifdef CONVERT_FROM_XRECT
-      CONVERT_FROM_XRECT (r, *rects);
+#ifdef CONVERT_FROM_EMACS_RECT
+      CONVERT_FROM_EMACS_RECT (r, *rects);
 #else
       *rects = r;
 #endif
@@ -2220,10 +2239,10 @@ get_glyph_string_clip_rects (struct glyph_string *s, 
NativeRectangle *rects, int
         multiple clipping rectangles, we exclude the row of the glyph
         string from the clipping rectangle.  This is to avoid drawing
         the same text on the environment with anti-aliasing.  */
-#ifdef CONVERT_FROM_XRECT
-      XRectangle rs[2];
+#ifdef CONVERT_FROM_EMACS_RECT
+      Emacs_Rectangle rs[2];
 #else
-      XRectangle *rs = rects;
+      Emacs_Rectangle *rs = rects;
 #endif
       int i = 0, row_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, s->row->y);
 
@@ -2256,9 +2275,9 @@ get_glyph_string_clip_rects (struct glyph_string *s, 
NativeRectangle *rects, int
        }
 
       n = i;
-#ifdef CONVERT_FROM_XRECT
+#ifdef CONVERT_FROM_EMACS_RECT
       for (i = 0; i < n; i++)
-       CONVERT_FROM_XRECT (rs[i], rects[i]);
+       CONVERT_FROM_EMACS_RECT (rs[i], rects[i]);
 #endif
       return n;
     }
@@ -13977,12 +13996,6 @@ redisplay_internal (void)
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS)
   if (popup_activated ())
     {
-#ifdef NS_IMPL_COCOA
-      /* On macOS we may have disabled screen updates due to window
-         resizing.  We should re-enable them so the popup can be
-         displayed.  */
-      ns_enable_screen_updates ();
-#endif
       return;
     }
 #endif
@@ -14785,12 +14798,6 @@ unwind_redisplay (void)
 {
   redisplaying_p = false;
   unblock_buffer_flips ();
-#ifdef NS_IMPL_COCOA
-  /* On macOS we may have disabled screen updates due to window
-     resizing.  When redisplay completes we want to re-enable
-     them.  */
-  ns_enable_screen_updates ();
-#endif
 }
 
 
@@ -18031,12 +18038,14 @@ try_window_reusing_current_matrix (struct window *w)
 
          if (run.height > 0 && run.current_y != run.desired_y)
            {
+#ifdef HAVE_WINDOW_SYSTEM
              update_begin (f);
-             FRAME_RIF (f)->update_window_begin_hook (w);
+             gui_update_window_begin (w);
              FRAME_RIF (f)->clear_window_mouse_face (w);
              FRAME_RIF (f)->scroll_run_hook (w, &run);
-             FRAME_RIF (f)->update_window_end_hook (w, false, false);
+             gui_update_window_end (w, false, false);
              update_end (f);
+#endif
            }
 
          /* Shift current matrix down by nrows_scrolled lines.  */
@@ -18195,12 +18204,14 @@ try_window_reusing_current_matrix (struct window *w)
 
       if (run.height)
        {
+#ifdef HAVE_WINDOW_SYSTEM
          update_begin (f);
-         FRAME_RIF (f)->update_window_begin_hook (w);
+         gui_update_window_begin (w);
          FRAME_RIF (f)->clear_window_mouse_face (w);
          FRAME_RIF (f)->scroll_run_hook (w, &run);
-         FRAME_RIF (f)->update_window_end_hook (w, false, false);
+         gui_update_window_end (w, false, false);
          update_end (f);
+#endif
        }
 
       /* Adjust Y positions of reused rows.  */
@@ -19148,10 +19159,12 @@ try_window_id (struct window *w)
 
       if (FRAME_WINDOW_P (f))
        {
-         FRAME_RIF (f)->update_window_begin_hook (w);
+#ifdef HAVE_WINDOW_SYSTEM
+         gui_update_window_begin (w);
          FRAME_RIF (f)->clear_window_mouse_face (w);
          FRAME_RIF (f)->scroll_run_hook (w, &run);
-         FRAME_RIF (f)->update_window_end_hook (w, false, false);
+         gui_update_window_end (w, false, false);
+#endif
        }
       else
        {
@@ -20147,15 +20160,53 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
          it->what = IT_CHARACTER;
          memset (&it->position, 0, sizeof it->position);
          it->object = Qnil;
-         it->c = it->char_to_display = ' ';
          it->len = 1;
 
+         int local_default_face_id =
+           lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
+         struct face* default_face =
+           FACE_FROM_ID_OR_NULL (it->f, local_default_face_id);
+
+         /* Corner case for when display-fill-column-indicator-mode
+            is active and the extra character should be added in the
+            same place than the line.  */
+         int indicator_column = (it->w->pseudo_window_p == 0
+                                 ? fill_column_indicator_column (it)
+                                 : -1);
+         if (0 <= indicator_column)
+           {
+              struct font *font =
+                default_face->font ?
+                  default_face->font : FRAME_FONT (it->f);
+              const int char_width =
+                font->average_width ?
+                  font->average_width : font->space_width;
+
+              int column_x;
+              if (!INT_MULTIPLY_WRAPV (indicator_column, char_width,
+                                       &column_x)
+                  && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x,
+                                     &column_x)
+                  && it->current_x == column_x)
+                {
+                  it->c = it->char_to_display =
+                    XFIXNAT (Vdisplay_fill_column_indicator_character);
+                  it->face_id =
+                    merge_faces (it->w, Qfill_column_indicator,
+                                 0, saved_face_id);
+                  face = FACE_FROM_ID (it->f, it->face_id);
+                  goto produce_glyphs;
+                }
+           }
+
+         it->c = it->char_to_display = ' ';
          /* If the default face was remapped, be sure to use the
             remapped face for the appended newline.  */
          if (default_face_p)
-           it->face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
+           it->face_id = local_default_face_id;
          else if (it->face_before_selective_p)
            it->face_id = it->saved_face_id;
+
          face = FACE_FROM_ID (it->f, it->face_id);
          it->face_id = FACE_FOR_CHAR (it->f, face, 0, -1, Qnil);
          /* In R2L rows, we will prepend a stretch glyph that will
@@ -20169,6 +20220,7 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
              && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x)
            it->end_of_box_run_p = false;
 
+       produce_glyphs:
          PRODUCE_GLYPHS (it);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -20317,7 +20369,8 @@ extend_face_to_end_of_line (struct it *it)
 #ifdef HAVE_WINDOW_SYSTEM
       && !face->stipple
 #endif
-      && !it->glyph_row->reversed_p)
+      && !it->glyph_row->reversed_p
+      && !Vdisplay_fill_column_indicator)
     return;
 
   /* Set the glyph row flag indicating that the face of the last glyph
@@ -20369,6 +20422,82 @@ extend_face_to_end_of_line (struct it *it)
                default_face->id;
              it->glyph_row->used[RIGHT_MARGIN_AREA] = 1;
            }
+
+         /* Display fill column indicator if not in modeline or
+            toolbar and display fill column indicator mode is
+            active.  */
+         int indicator_column = (it->w->pseudo_window_p == 0
+                                 ? fill_column_indicator_column (it)
+                                 : -1);
+         if (0 <= indicator_column)
+            {
+             struct font *font =
+               default_face->font ? default_face->font : FRAME_FONT (f);
+             const int char_width =
+               font->average_width ?
+                 font->average_width : font->space_width;
+
+             int column_x;
+             if (!INT_MULTIPLY_WRAPV (indicator_column, char_width, &column_x)
+                 && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, &column_x)
+                 && it->current_x <= column_x
+                 && column_x <= it->last_visible_x)
+               {
+                 const char saved_char = it->char_to_display;
+                 const struct text_pos saved_pos = it->position;
+                 const bool saved_avoid_cursor = it->avoid_cursor_p;
+                 const int saved_face_id = it->face_id;
+                 const bool saved_box_start = it->start_of_box_run_p;
+                 Lisp_Object save_object = it->object;
+
+                 /* The stretch width needs to considet the latter
+                    added glyph.  */
+                 const int stretch_width =
+                   column_x - it->current_x - char_width;
+
+                 memset (&it->position, 0, sizeof it->position);
+                 it->avoid_cursor_p = true;
+                 it->object = Qnil;
+
+                 /* Only generate a stretch glyph if there is distance
+                    between current_x and and the indicator position.  */
+                 if (stretch_width > 0)
+                   {
+                     int stretch_ascent = (((it->ascent + it->descent)
+                                            * FONT_BASE (font)) / FONT_HEIGHT 
(font));
+                     append_stretch_glyph (it, Qnil, stretch_width,
+                                           it->ascent + it->descent,
+                                           stretch_ascent);
+                   }
+
+                 /* Generate the glyph indicator only if
+                    append_space_for_newline didn't already.  */
+                 if (it->current_x < column_x)
+                   {
+                     it->char_to_display =
+                       XFIXNAT (Vdisplay_fill_column_indicator_character);
+                     it->face_id =
+                       merge_faces (it->w, Qfill_column_indicator,
+                                    0, saved_face_id);
+                     PRODUCE_GLYPHS (it);
+                   }
+
+                 /* Restore the face after the indicator was generated.  */
+                 it->face_id = saved_face_id;
+
+                 /* If there is space after the indicator generate an
+                    extra empty glyph to restore the face.  Issue was
+                    observed in X systems.  */
+                 it->char_to_display = ' ';
+                 PRODUCE_GLYPHS (it);
+
+                 it->char_to_display = saved_char;
+                 it->position = saved_pos;
+                 it->avoid_cursor_p = saved_avoid_cursor;
+                 it->start_of_box_run_p = saved_box_start;
+                 it->object = save_object;
+               }
+            }
        }
 #ifdef HAVE_WINDOW_SYSTEM
       if (it->glyph_row->reversed_p)
@@ -20377,7 +20506,7 @@ extend_face_to_end_of_line (struct it *it)
             rightmost glyph will be drawn flushed all the way to the
             right margin of the window.  The stretch glyph that will
             occupy the empty space, if any, to the left of the
-            glyphs.  */
+            glyph.  */
          struct font *font = face->font ? face->font : FRAME_FONT (f);
          struct glyph *row_start = it->glyph_row->glyphs[TEXT_AREA];
          struct glyph *row_end = row_start + it->glyph_row->used[TEXT_AREA];
@@ -20490,10 +20619,35 @@ extend_face_to_end_of_line (struct it *it)
        it->face_id = default_face->id;
       else
        it->face_id = face->id;
-      PRODUCE_GLYPHS (it);
 
-      while (it->current_x <= it->last_visible_x)
-       PRODUCE_GLYPHS (it);
+      /* Display fill-column indicator if needed.  */
+      int indicator_column = fill_column_indicator_column (it);
+      if (0 <= indicator_column
+         && INT_ADD_WRAPV (it->lnum_pixel_width, indicator_column,
+                           &indicator_column))
+       indicator_column = -1;
+      do
+       {
+         int saved_face_id;
+         bool indicate = it->current_x == indicator_column;
+         if (indicate)
+           {
+             saved_face_id = it->face_id;
+             it->face_id =
+               merge_faces (it->w, Qfill_column_indicator, 0, saved_face_id);
+             it->c = it->char_to_display =
+               XFIXNAT (Vdisplay_fill_column_indicator_character);
+           }
+
+         PRODUCE_GLYPHS (it);
+
+         if (indicate)
+           {
+             it->face_id = saved_face_id;
+             it->c = it->char_to_display = ' ';
+           }
+       }
+      while (it->current_x <= it->last_visible_x);
 
       if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0
          && (it->glyph_row->used[RIGHT_MARGIN_AREA]
@@ -20583,7 +20737,8 @@ highlight_trailing_whitespace (struct it *it)
       if (!row->reversed_p)
        {
          while (glyph >= start
-                && glyph->type == CHAR_GLYPH
+                && (glyph->type == CHAR_GLYPH
+                    || glyph->type == STRETCH_GLYPH)
                 && NILP (glyph->object))
            --glyph;
        }
@@ -23843,7 +23998,8 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
                               ? string_byte_to_char (elt, bytepos)
                               : bytepos);
                    spec = decode_mode_spec (it->w, c, field, &string);
-                   multibyte = STRINGP (string) && STRING_MULTIBYTE (string);
+                   eassert (NILP (string) || STRINGP (string));
+                   multibyte = !NILP (string) && STRING_MULTIBYTE (string);
 
                    switch (mode_line_target)
                      {
@@ -24519,8 +24675,9 @@ percent99 (ptrdiff_t n, ptrdiff_t d)
 
 /* Return a string for the output of a mode line %-spec for window W,
    generated by character C.  FIELD_WIDTH > 0 means pad the string
-   returned with spaces to that value.  Return a Lisp string in
-   *STRING if the resulting string is taken from that Lisp string.
+   returned with spaces to that value.  Set *STRING to be a Lisp
+   string if the resulting string is taken from that Lisp string;
+   otherwise, set *STRING to Qnil.
 
    Note we operate on the current buffer for most purposes.  */
 
@@ -25729,7 +25886,7 @@ dump_glyph_string (struct glyph_string *s)
 #endif /* GLYPH_DEBUG */
 
 /* Initialize glyph string S.  CHAR2B is a suitably allocated vector
-   of XChar2b structures for S; it can't be allocated in
+   of 2-byte unsigned integers for S; it can't be allocated in
    init_glyph_string because it must be allocated via `alloca'.  W
    is the window on which S is drawn.  ROW and AREA are the glyph row
    and area within the row from which S is constructed.  START is the
@@ -25759,7 +25916,7 @@ init_glyph_string (struct glyph_string *s,
 #ifdef HAVE_NTGUI
                   HDC hdc,
 #endif
-                  XChar2b *char2b, struct window *w, struct glyph_row *row,
+                  unsigned *char2b, struct window *w, struct glyph_row *row,
                   enum glyph_row_area area, int start, enum draw_glyphs_face 
hl)
 {
   memset (s, 0, sizeof *s);
@@ -25768,7 +25925,6 @@ init_glyph_string (struct glyph_string *s,
 #ifdef HAVE_NTGUI
   s->hdc = hdc;
 #endif
-  s->display = FRAME_X_DISPLAY (s->f);
   s->char2b = char2b;
   s->hl = hl;
   s->row = row;
@@ -25839,7 +25995,7 @@ append_glyph_string (struct glyph_string **head, struct 
glyph_string **tail,
 
 static struct face *
 get_char_face_and_encoding (struct frame *f, int c, int face_id,
-                           XChar2b *char2b, bool display_p)
+                           unsigned *char2b, bool display_p)
 {
   struct face *face = FACE_FROM_ID (f, face_id);
   unsigned code = 0;
@@ -25851,7 +26007,8 @@ get_char_face_and_encoding (struct frame *f, int c, int 
face_id,
       if (code == FONT_INVALID_CODE)
        code = 0;
     }
-  STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
+  /* Ensure that the code is only 2 bytes wide.  */
+  *char2b = code & 0xFFFF;
 
   /* Make sure X resources of the face are allocated.  */
 #ifdef HAVE_X_WINDOWS
@@ -25872,7 +26029,7 @@ get_char_face_and_encoding (struct frame *f, int c, int 
face_id,
 
 static struct face *
 get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
-                            XChar2b *char2b)
+                            unsigned *char2b)
 {
   struct face *face;
   unsigned code = 0;
@@ -25894,7 +26051,8 @@ get_glyph_face_and_encoding (struct frame *f, struct 
glyph *glyph,
        code = 0;
     }
 
-  STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
+  /* Ensure that the code is only 2 bytes wide.  */
+  *char2b = code & 0xFFFF;
   return face;
 }
 
@@ -25903,7 +26061,7 @@ get_glyph_face_and_encoding (struct frame *f, struct 
glyph *glyph,
    Return true iff FONT has a glyph for C.  */
 
 static bool
-get_char_glyph_code (int c, struct font *font, XChar2b *char2b)
+get_char_glyph_code (int c, struct font *font, unsigned *char2b)
 {
   unsigned code;
 
@@ -25914,7 +26072,9 @@ get_char_glyph_code (int c, struct font *font, XChar2b 
*char2b)
 
   if (code == FONT_INVALID_CODE)
     return false;
-  STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
+
+  /* Ensure that the code is only 2 bytes wide.  */
+  *char2b = code & 0xFFFF;
   return true;
 }
 
@@ -26027,7 +26187,8 @@ fill_gstring_glyph_string (struct glyph_string *s, int 
face_id,
       Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i);
       unsigned code = LGLYPH_CODE (lglyph);
 
-      STORE_XCHAR2B ((s->char2b + i), code >> 8, code & 0xFF);
+      /* Ensure that the code is only 2 bytes wide.  */
+      s->char2b[i] = code & 0xFFFF;
     }
   s->width = composition_gstring_width (lgstring, s->cmp_from, s->cmp_to, 
NULL);
   return glyph - s->row->glyphs[s->area];
@@ -26206,17 +26367,16 @@ fill_stretch_glyph_string (struct glyph_string *s, 
int start, int end)
 }
 
 static struct font_metrics *
-get_per_char_metric (struct font *font, XChar2b *char2b)
+get_per_char_metric (struct font *font, const unsigned *char2b)
 {
   static struct font_metrics metrics;
-  unsigned code;
 
   if (! font)
     return NULL;
-  code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b);
-  if (code == FONT_INVALID_CODE)
+  if (*char2b == FONT_INVALID_CODE)
     return NULL;
-  font->driver->text_extents (font, &code, 1, &metrics);
+
+  font->driver->text_extents (font, char2b, 1, &metrics);
   return &metrics;
 }
 
@@ -26234,7 +26394,7 @@ normal_char_ascent_descent (struct font *font, int c, 
int *ascent, int *descent)
 
   if (FONT_TOO_HIGH (font))
     {
-      XChar2b char2b;
+      unsigned char2b;
 
       /* Get metrics of C, defaulting to a reasonably sized ASCII
         character.  */
@@ -26281,7 +26441,7 @@ gui_get_glyph_overhangs (struct glyph *glyph, struct 
frame *f, int *left, int *r
 
   if (glyph->type == CHAR_GLYPH)
     {
-      XChar2b char2b;
+      unsigned char2b;
       struct face *face = get_glyph_face_and_encoding (f, glyph, &char2b);
       if (face->font)
        {
@@ -26595,7 +26755,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, 
bool backward_p)
      do                                                                        
   \
        {                                                                  \
         int face_id;                                                      \
-        XChar2b *char2b;                                                  \
+        unsigned *char2b;                                         \
                                                                           \
         face_id = (row)->glyphs[area][START].face_id;                     \
                                                                           \
@@ -26624,7 +26784,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, 
bool backward_p)
     struct face *base_face = FACE_FROM_ID (f, face_id);                    \
     ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id;                \
     struct composition *cmp = composition_table[cmp_id];                   \
-    XChar2b *char2b;                                                       \
+    unsigned *char2b;                                                      \
     struct glyph_string *first_s = NULL;                                   \
     int n;                                                                 \
                                                                            \
@@ -26656,7 +26816,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, 
bool backward_p)
 #define BUILD_GSTRING_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
   do {                                                                   \
     int face_id;                                                         \
-    XChar2b *char2b;                                                     \
+    unsigned *char2b;                                                    \
     Lisp_Object gstring;                                                 \
                                                                          \
     face_id = (row)->glyphs[area][START].face_id;                        \
@@ -28249,7 +28409,7 @@ gui_produce_glyphs (struct it *it)
 
   if (it->what == IT_CHARACTER)
     {
-      XChar2b char2b;
+      unsigned char2b;
       struct face *face = FACE_FROM_ID (it->f, it->face_id);
       struct font *font = face->font;
       struct font_metrics *pcm = NULL;
@@ -28648,7 +28808,7 @@ gui_produce_glyphs (struct it *it)
          int lbearing, rbearing;
          int i, width, ascent, descent;
          int c;
-         XChar2b char2b;
+         unsigned char2b;
          struct font_metrics *pcm;
          ptrdiff_t pos;
 
@@ -30969,7 +31129,7 @@ Returns the alist element for the first matching AREA 
in MAP.  */)
 
 /* Display frame CURSOR, optionally using shape defined by POINTER.  */
 static void
-define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer)
+define_frame_cursor1 (struct frame *f, Emacs_Cursor cursor, Lisp_Object 
pointer)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   if (!FRAME_WINDOW_P (f))
@@ -31021,7 +31181,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, 
int x, int y,
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-  Cursor cursor = No_Cursor;
+  Emacs_Cursor cursor = No_Cursor;
   Lisp_Object pointer = Qnil;
   int dx, dy, width, height;
   ptrdiff_t charpos;
@@ -31334,7 +31494,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
   enum window_part part = ON_NOTHING;
   Lisp_Object window;
   struct window *w;
-  Cursor cursor = No_Cursor;
+  Emacs_Cursor cursor = No_Cursor;
   Lisp_Object pointer = Qnil;  /* Takes precedence over cursor!  */
   struct buffer *b;
 
@@ -31642,7 +31802,9 @@ note_mouse_highlight (struct frame *f, int x, int y)
             is currently hidden to avoid Bug#30519.  */
          || (!hlinfo->mouse_face_hidden
              && OVERLAYP (hlinfo->mouse_face_overlay)
-             && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay)))
+             /* It's possible the overlay was deleted (Bug#35273).  */
+              && XMARKER (OVERLAY_START (hlinfo->mouse_face_overlay))->buffer
+              && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay)))
        {
          /* Find the highest priority overlay with a mouse-face.  */
          Lisp_Object overlay = Qnil;
@@ -31951,7 +32113,7 @@ cancel_mouse_face (struct frame *f)
    which intersects rectangle R.  R is in window-relative coordinates.  */
 
 static void
-expose_area (struct window *w, struct glyph_row *row, XRectangle *r,
+expose_area (struct window *w, struct glyph_row *row, const Emacs_Rectangle *r,
             enum glyph_row_area area)
 {
   struct glyph *first = row->glyphs[area];
@@ -32009,7 +32171,7 @@ expose_area (struct window *w, struct glyph_row *row, 
XRectangle *r,
    true if mouse-face was overwritten.  */
 
 static bool
-expose_line (struct window *w, struct glyph_row *row, XRectangle *r)
+expose_line (struct window *w, struct glyph_row *row, const Emacs_Rectangle *r)
 {
   eassert (row->enabled_p);
 
@@ -32044,7 +32206,7 @@ static void
 expose_overlaps (struct window *w,
                 struct glyph_row *first_overlapping_row,
                 struct glyph_row *last_overlapping_row,
-                XRectangle *r)
+                const Emacs_Rectangle *r)
 {
   struct glyph_row *row;
 
@@ -32070,9 +32232,9 @@ expose_overlaps (struct window *w,
 /* Return true if W's cursor intersects rectangle R.  */
 
 static bool
-phys_cursor_in_rect_p (struct window *w, XRectangle *r)
+phys_cursor_in_rect_p (struct window *w, const Emacs_Rectangle *r)
 {
-  XRectangle cr, result;
+  Emacs_Rectangle cr, result;
   struct glyph *cursor_glyph;
   struct glyph_row *row;
 
@@ -32230,10 +32392,10 @@ gui_draw_bottom_divider (struct window *w)
    mouse-face.  */
 
 static bool
-expose_window (struct window *w, XRectangle *fr)
+expose_window (struct window *w, const Emacs_Rectangle *fr)
 {
   struct frame *f = XFRAME (w->frame);
-  XRectangle wr, r;
+  Emacs_Rectangle wr, r;
   bool mouse_face_overwritten_p = false;
 
   /* If window is not yet fully initialized, do nothing.  This can
@@ -32392,7 +32554,7 @@ expose_window (struct window *w, XRectangle *fr)
    true if the exposure overwrites mouse-face.  */
 
 static bool
-expose_window_tree (struct window *w, XRectangle *r)
+expose_window_tree (struct window *w, const Emacs_Rectangle *r)
 {
   struct frame *f = XFRAME (w->frame);
   bool mouse_face_overwritten_p = false;
@@ -32420,7 +32582,7 @@ expose_window_tree (struct window *w, XRectangle *r)
 void
 expose_frame (struct frame *f, int x, int y, int w, int h)
 {
-  XRectangle r;
+  Emacs_Rectangle r;
   bool mouse_face_overwritten_p = false;
 
   TRACE ((stderr, "expose_frame "));
@@ -32507,10 +32669,11 @@ expose_frame (struct frame *f, int x, int y, int w, 
int h)
    empty.  */
 
 bool
-gui_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result)
+gui_intersect_rectangles (const Emacs_Rectangle *r1, const Emacs_Rectangle *r2,
+                          Emacs_Rectangle *result)
 {
-  XRectangle *left, *right;
-  XRectangle *upper, *lower;
+  const Emacs_Rectangle *left, *right;
+  const Emacs_Rectangle *upper, *lower;
   bool intersection_p = false;
 
   /* Rearrange so that R1 is the left-most rectangle.  */
@@ -32656,6 +32819,9 @@ be let-bound around code that needs to disable messages 
temporarily. */);
   /* Name of a text property which disables line-number display.  */
   DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable");
 
+  /* Name of the face used to display fill column indicator character.  */
+  DEFSYM (Qfill_column_indicator, "fill-column-indicator");
+
   /* Name and number of the face used to highlight escape glyphs.  */
   DEFSYM (Qescape_glyph, "escape-glyph");
 
@@ -33228,6 +33394,30 @@ either `relative' or `visual'.  */);
   DEFSYM (Qdisplay_line_numbers_widen, "display-line-numbers-widen");
   Fmake_variable_buffer_local (Qdisplay_line_numbers_widen);
 
+  DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator,
+    doc: /* Non-nil means display the fill column indicator.  */);
+  Vdisplay_fill_column_indicator = false;
+  DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator");
+  Fmake_variable_buffer_local (Qdisplay_fill_column_indicator);
+
+  DEFVAR_LISP ("display-fill-column-indicator-column", 
Vdisplay_fill_column_indicator_column,
+    doc: /* Column for indicator when `display-fill-column-indicator'
+is non-nil.  The default value is t which means that the indicator
+will use the `fill-column' variable.  If it is set to an integer the
+indicator will be drawn in that column.  */);
+  Vdisplay_fill_column_indicator_column = Qt;
+  DEFSYM (Qdisplay_fill_column_indicator_column, 
"display-fill-column-indicator-column");
+  Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column);
+
+  DEFVAR_LISP ("display-fill-column-indicator-character", 
Vdisplay_fill_column_indicator_character,
+    doc: /* Character to draw the indicator when
+`display-fill-column-indicator' is non-nil.  The default is U+2502 but
+a good alternative is (ascii 124) if the font in fill-column-indicator
+face does not support Unicode characters.  */);
+  Vdisplay_fill_column_indicator_character = Qnil;
+  DEFSYM (Qdisplay_fill_column_indicator_character, 
"display-fill-column-indicator-character");
+  Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character);
+
   DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay,
     doc: /* Non-nil means don't eval Lisp during redisplay.  */);
   inhibit_eval_during_redisplay = false;
diff --git a/src/xfaces.c b/src/xfaces.c
index 7e04c0e..d211ec8 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -348,7 +348,7 @@ static void free_face_cache (struct face_cache *);
 static bool merge_face_ref (struct window *w,
                             struct frame *, Lisp_Object, Lisp_Object *,
                            bool, struct named_merge_point *);
-static int color_distance (XColor *x, XColor *y);
+static int color_distance (Emacs_Color *x, Emacs_Color *y);
 
 #ifdef HAVE_WINDOW_SYSTEM
 static void set_font_frame_param (Lisp_Object, Lisp_Object);
@@ -513,12 +513,12 @@ x_free_gc (struct frame *f, GC gc)
 #ifdef HAVE_NTGUI
 /* W32 emulation of GCs */
 
-static GC
-x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
+static Emacs_GC *
+x_create_gc (struct frame *f, unsigned long mask, Emacs_GC *egc)
 {
-  GC gc;
+  Emacs_GC *gc;
   block_input ();
-  gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv);
+  gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, egc);
   unblock_input ();
   IF_DEBUG (++ngcs);
   return gc;
@@ -528,7 +528,7 @@ x_create_gc (struct frame *f, unsigned long mask, XGCValues 
*xgcv)
 /* Free GC which was used on frame F.  */
 
 static void
-x_free_gc (struct frame *f, GC gc)
+x_free_gc (struct frame *f, Emacs_GC *gc)
 {
   IF_DEBUG ((--ngcs, eassert (ngcs >= 0)));
   xfree (gc);
@@ -539,18 +539,18 @@ x_free_gc (struct frame *f, GC gc)
 #ifdef HAVE_NS
 /* NS emulation of GCs */
 
-static GC
+static Emacs_GC *
 x_create_gc (struct frame *f,
             unsigned long mask,
-            XGCValues *xgcv)
+            Emacs_GC *egc)
 {
-  GC gc = xmalloc (sizeof *gc);
-  *gc = *xgcv;
+  Emacs_GC *gc = xmalloc (sizeof *gc);
+  *gc = *egc;
   return gc;
 }
 
 static void
-x_free_gc (struct frame *f, GC gc)
+x_free_gc (struct frame *f, Emacs_GC *gc)
 {
   xfree (gc);
 }
@@ -802,7 +802,7 @@ load_pixmap (struct frame *f, Lisp_Object name)
 
 
 /***********************************************************************
-                               X Colors
+                            Color Handling
  ***********************************************************************/
 
 /* Parse RGB_LIST, and fill in the RGB fields of COLOR.
@@ -810,7 +810,7 @@ load_pixmap (struct frame *f, Lisp_Object name)
    Return true iff RGB_LIST is OK.  */
 
 static bool
-parse_rgb_list (Lisp_Object rgb_list, XColor *color)
+parse_rgb_list (Lisp_Object rgb_list, Emacs_Color *color)
 {
 #define PARSE_RGB_LIST_FIELD(field)                                    \
   if (CONSP (rgb_list) && FIXNUMP (XCAR (rgb_list)))                   \
@@ -835,8 +835,8 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
    returned in it.  */
 
 static bool
-tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
-                 XColor *std_color)
+tty_lookup_color (struct frame *f, Lisp_Object color, Emacs_Color *tty_color,
+                 Emacs_Color *std_color)
 {
   Lisp_Object frame, color_desc;
 
@@ -897,7 +897,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, 
XColor *tty_color,
 
 bool
 tty_defined_color (struct frame *f, const char *color_name,
-                  XColor *color_def, bool alloc, bool _makeIndex)
+                  Emacs_Color *color_def, bool alloc, bool _makeIndex)
 {
   bool status = true;
 
@@ -965,7 +965,7 @@ tty_color_name (struct frame *f, int idx)
 static bool
 face_color_gray_p (struct frame *f, const char *color_name)
 {
-  XColor color;
+  Emacs_Color color;
   bool gray_p;
 
   if (FRAME_TERMINAL (f)->defined_color_hook
@@ -994,7 +994,7 @@ face_color_supported_p (struct frame *f, const char 
*color_name,
                        bool background_p)
 {
   Lisp_Object frame;
-  XColor not_used;
+  Emacs_Color not_used;
 
   XSETFRAME (frame, f);
   return
@@ -1043,7 +1043,7 @@ COLOR must be a valid color name.  */)
 
 static unsigned long
 load_color2 (struct frame *f, struct face *face, Lisp_Object name,
-             enum lface_attribute_index target_index, XColor *color)
+             enum lface_attribute_index target_index, Emacs_Color *color)
 {
   eassert (STRINGP (name));
   eassert (target_index == LFACE_FOREGROUND_INDEX
@@ -1117,7 +1117,7 @@ unsigned long
 load_color (struct frame *f, struct face *face, Lisp_Object name,
            enum lface_attribute_index target_index)
 {
-  XColor color;
+  Emacs_Color color;
   return load_color2 (f, face, name, target_index, &color);
 }
 
@@ -1134,7 +1134,7 @@ load_face_colors (struct frame *f, struct face *face,
                  Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
   Lisp_Object fg, bg, dfg;
-  XColor xfg, xbg;
+  Emacs_Color xfg, xbg;
 
   bg = attrs[LFACE_BACKGROUND_INDEX];
   fg = attrs[LFACE_FOREGROUND_INDEX];
@@ -2265,11 +2265,12 @@ filter_face_ref (Lisp_Object face_ref,
 }
 
 /* Merge face attributes from the lisp `face reference' FACE_REF on
-   frame F into the face attribute vector TO.  If ERR_MSGS,
-   problems with FACE_REF cause an error message to be shown.  Return
-   true if no errors occurred (regardless of the value of ERR_MSGS).
-   Use NAMED_MERGE_POINTS to detect loops in face inheritance or
-   list structure; it may be 0 for most callers.
+   frame F into the face attribute vector TO as appropriate for
+   window W; W is used only for filtering face specs.  If ERR_MSGS
+   is non-zero, problems with FACE_REF cause an error message to be
+   shown.  Return true if no errors occurred (regardless of the value
+   of ERR_MSGS).  Use NAMED_MERGE_POINTS to detect loops in face
+   inheritance or list structure; it may be 0 for most callers.
 
    FACE_REF may be a single face specification or a list of such
    specifications.  Each face specification can be:
@@ -2286,9 +2287,10 @@ filter_face_ref (Lisp_Object face_ref,
 
    4. Conses of the form
    (:filtered (:window PARAMETER VALUE) FACE-SPECIFICATION),
-   which applies FACE-SPECIFICATION only if the
-   given face attributes are being evaluated in the context of a
-   window with a parameter named PARAMETER being EQ VALUE.
+   which applies FACE-SPECIFICATION only if the given face attributes
+   are being evaluated in the context of a window with a parameter
+   named PARAMETER being EQ VALUE.  In this case, W specifies the window
+   for which the filtered face spec is to be evaluated.
 
    5. nil, which means to merge nothing.
 
@@ -4138,25 +4140,25 @@ prepare_face_for_display (struct frame *f, struct face 
*face)
 
   if (face->gc == 0)
     {
-      XGCValues xgcv;
+      Emacs_GC egc;
       unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures;
 
-      xgcv.foreground = face->foreground;
-      xgcv.background = face->background;
+      egc.foreground = face->foreground;
+      egc.background = face->background;
 #ifdef HAVE_X_WINDOWS
-      xgcv.graphics_exposures = False;
+      egc.graphics_exposures = False;
 #endif
 
       block_input ();
 #ifdef HAVE_X_WINDOWS
       if (face->stipple)
        {
-         xgcv.fill_style = FillOpaqueStippled;
-         xgcv.stipple = image_bitmap_pixmap (f, face->stipple);
+         egc.fill_style = FillOpaqueStippled;
+         egc.stipple = image_bitmap_pixmap (f, face->stipple);
          mask |= GCFillStyle | GCStipple;
        }
 #endif
-      face->gc = x_create_gc (f, mask, &xgcv);
+      face->gc = x_create_gc (f, mask, &egc);
       if (face->font)
        font_prepare_for_face (f, face);
       unblock_input ();
@@ -4168,7 +4170,7 @@ prepare_face_for_display (struct frame *f, struct face 
*face)
 /* Returns the `distance' between the colors X and Y.  */
 
 static int
-color_distance (XColor *x, XColor *y)
+color_distance (Emacs_Color *x, Emacs_Color *y)
 {
   /* This formula is from a paper titled `Colour metric' by Thiadmer Riemersma.
      Quoting from that paper:
@@ -4203,7 +4205,7 @@ two lists of the form (RED GREEN BLUE) aforementioned. */)
    Lisp_Object metric)
 {
   struct frame *f = decode_live_frame (frame);
-  XColor cdef1, cdef2;
+  Emacs_Color cdef1, cdef2;
 
   if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1))
       && !(STRINGP (color1)
@@ -4883,8 +4885,8 @@ tty_supports_face_attributes_p (struct frame *f,
 {
   int weight, slant;
   Lisp_Object val, fg, bg;
-  XColor fg_tty_color, fg_std_color;
-  XColor bg_tty_color, bg_std_color;
+  Emacs_Color fg_tty_color, fg_std_color;
+  Emacs_Color bg_tty_color, bg_std_color;
   unsigned test_caps = 0;
   Lisp_Object *def_attrs = def_face->lface;
 
@@ -4986,7 +4988,7 @@ tty_supports_face_attributes_p (struct frame *f,
       else
        /* Make sure the color is really different than the default.  */
        {
-         XColor def_fg_color;
+         Emacs_Color def_fg_color;
          if (tty_lookup_color (f, def_fg, &def_fg_color, 0)
              && (color_distance (&fg_tty_color, &def_fg_color)
                  <= TTY_SAME_COLOR_THRESHOLD))
@@ -5010,7 +5012,7 @@ tty_supports_face_attributes_p (struct frame *f,
       else
        /* Make sure the color is really different than the default.  */
        {
-         XColor def_bg_color;
+         Emacs_Color def_bg_color;
          if (tty_lookup_color (f, def_bg, &def_bg_color, 0)
              && (color_distance (&bg_tty_color, &def_bg_color)
                  <= TTY_SAME_COLOR_THRESHOLD))
diff --git a/src/xfns.c b/src/xfns.c
index 7ef69f1..460dd13 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -653,7 +653,7 @@ gamma_correct (struct frame *f, XColor *color)
 
 bool
 x_defined_color (struct frame *f, const char *color_name,
-                XColor *color, bool alloc_p, bool _makeIndex)
+                Emacs_Color *color, bool alloc_p, bool _makeIndex)
 {
   bool success_p = false;
   Colormap cmap = FRAME_X_COLORMAP (f);
@@ -2784,6 +2784,9 @@ set_up_x_back_buffer (struct frame *f)
   block_input ();
   if (FRAME_X_WINDOW (f) && !FRAME_X_DOUBLE_BUFFERED_P (f))
     {
+#ifdef USE_CAIRO
+      x_cr_destroy_frame_context (f);
+#endif
       FRAME_X_RAW_DRAWABLE (f) = FRAME_X_WINDOW (f);
       if (FRAME_DISPLAY_INFO (f)->supports_xdbe)
         {
@@ -2813,6 +2816,9 @@ tear_down_x_back_buffer (struct frame *f)
     {
       if (FRAME_X_DOUBLE_BUFFERED_P (f))
         {
+#ifdef USE_CAIRO
+         x_cr_destroy_frame_context (f);
+#endif
           XdbeDeallocateBackBufferName (FRAME_X_DISPLAY (f),
                                         FRAME_X_DRAWABLE (f));
           FRAME_X_RAW_DRAWABLE (f) = FRAME_X_WINDOW (f);
diff --git a/src/xfont.c b/src/xfont.c
index 5ecbd6d..81808e7 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -46,18 +46,20 @@ struct xfont_info
 
 /* Prototypes of support functions.  */
 
-static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *);
+static XCharStruct *xfont_get_pcm (XFontStruct *, unsigned char2b);
 
 /* Get metrics of character CHAR2B in XFONT.  Value is null if CHAR2B
    is not contained in the font.  */
 
 static XCharStruct *
-xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
+xfont_get_pcm (XFontStruct *xfont, unsigned char2b)
 {
   /* The result metric information.  */
   XCharStruct *pcm = NULL;
+  const unsigned char byte1 = char2b >> 8;
+  const unsigned char byte2 = char2b & 0xFF;
 
-  eassert (xfont && char2b);
+  eassert (xfont);
 
   if (xfont->per_char != NULL)
     {
@@ -66,13 +68,13 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
          /* min_char_or_byte2 specifies the linear character index
             corresponding to the first element of the per_char array,
             max_char_or_byte2 is the index of the last character.  A
-            character with non-zero CHAR2B->byte1 is not in the font.
+            character with non-zero byte1 is not in the font.
             A character with byte2 less than min_char_or_byte2 or
             greater max_char_or_byte2 is not in the font.  */
-         if (char2b->byte1 == 0
-             && char2b->byte2 >= xfont->min_char_or_byte2
-             && char2b->byte2 <= xfont->max_char_or_byte2)
-           pcm = xfont->per_char + char2b->byte2 - xfont->min_char_or_byte2;
+         if (byte1 == 0
+             && byte2 >= xfont->min_char_or_byte2
+             && byte2 <= xfont->max_char_or_byte2)
+           pcm = xfont->per_char + byte2 - xfont->min_char_or_byte2;
        }
       else
        {
@@ -89,14 +91,14 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
             D = max_char_or_byte2 - min_char_or_byte2 + 1
             / = integer division
             \ = integer modulus  */
-         if (char2b->byte1 >= xfont->min_byte1
-             && char2b->byte1 <= xfont->max_byte1
-             && char2b->byte2 >= xfont->min_char_or_byte2
-             && char2b->byte2 <= xfont->max_char_or_byte2)
+         if (byte1 >= xfont->min_byte1
+             && byte1 <= xfont->max_byte1
+             && byte2 >= xfont->min_char_or_byte2
+             && byte2 <= xfont->max_char_or_byte2)
            pcm = (xfont->per_char
                   + ((xfont->max_char_or_byte2 - xfont->min_char_or_byte2 + 1)
-                     * (char2b->byte1 - xfont->min_byte1))
-                  + (char2b->byte2 - xfont->min_char_or_byte2));
+                     * (byte1 - xfont->min_byte1))
+                  + (byte2 - xfont->min_char_or_byte2));
        }
     }
   else
@@ -104,8 +106,8 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
       /* If the per_char pointer is null, all glyphs between the first
         and last character indexes inclusive have the same
         information, as given by both min_bounds and max_bounds.  */
-      if (char2b->byte2 >= xfont->min_char_or_byte2
-         && char2b->byte2 <= xfont->max_char_or_byte2)
+      if (byte2 >= xfont->min_char_or_byte2
+         && byte2 <= xfont->max_char_or_byte2)
        pcm = &xfont->max_bounds;
     }
 
@@ -193,7 +195,6 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct 
*xfont,
        {
          int c = XFIXNUM (XCAR (chars));
          unsigned code = ENCODE_CHAR (charset, c);
-         XChar2b char2b;
 
          if (code == CHARSET_INVALID_CODE (charset))
            break;
@@ -201,9 +202,7 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct 
*xfont,
            continue;
          if (code >= 0x10000)
            break;
-         char2b.byte1 = code >> 8;
-         char2b.byte2 = code & 0xFF;
-         if (! xfont_get_pcm (xfont, &char2b))
+         if (! xfont_get_pcm (xfont, code))
            break;
        }
       return (NILP (chars));
@@ -216,7 +215,6 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct 
*xfont,
        {
          int c = XFIXNUM (AREF (chars, i));
          unsigned code = ENCODE_CHAR (charset, c);
-         XChar2b char2b;
 
          if (code == CHARSET_INVALID_CODE (charset))
            continue;
@@ -224,9 +222,7 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct 
*xfont,
            break;
          if (code >= 0x10000)
            continue;
-         char2b.byte1 = code >> 8;
-         char2b.byte2 = code & 0xFF;
-         if (xfont_get_pcm (xfont, &char2b))
+         if (xfont_get_pcm (xfont, code))
            break;
        }
       return (i >= 0);
@@ -801,11 +797,9 @@ xfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   else
     {
       XCharStruct *pcm;
-      XChar2b char2b;
       Lisp_Object val;
 
-      char2b.byte1 = 0x00, char2b.byte2 = 0x20;
-      pcm = xfont_get_pcm (xfont, &char2b);
+      pcm = xfont_get_pcm (xfont, 0x20);
       if (pcm)
        font->space_width = pcm->width;
       else
@@ -823,8 +817,8 @@ xfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
            {
              int width = font->space_width, n = pcm != NULL;
 
-             for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
-               if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
+             for (unsigned char2b = 33; char2b <= 126; ++char2b)
+               if ((pcm = xfont_get_pcm (xfont, char2b)) != NULL)
                  width += pcm->width, n++;
              if (n > 0)
                font->average_width = width / n;
@@ -934,7 +928,6 @@ xfont_encode_char (struct font *font, int c)
   XFontStruct *xfont = ((struct xfont_info *) font)->xfont;
   struct charset *charset;
   unsigned code;
-  XChar2b char2b;
 
   charset = CHARSET_FROM_ID (font->encoding_charset);
   code = ENCODE_CHAR (charset, c);
@@ -946,13 +939,11 @@ xfont_encode_char (struct font *font, int c)
       return (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset)
              ? code : FONT_INVALID_CODE);
     }
-  char2b.byte1 = code >> 8;
-  char2b.byte2 = code & 0xFF;
-  return (xfont_get_pcm (xfont, &char2b) ? code : FONT_INVALID_CODE);
+  return (xfont_get_pcm (xfont, code) ? code : FONT_INVALID_CODE);
 }
 
 static void
-xfont_text_extents (struct font *font, unsigned int *code,
+xfont_text_extents (struct font *font, const unsigned int *code,
                    int nglyphs, struct font_metrics *metrics)
 {
   XFontStruct *xfont = ((struct xfont_info *) font)->xfont;
@@ -961,13 +952,11 @@ xfont_text_extents (struct font *font, unsigned int *code,
 
   for (i = 0, first = true; i < nglyphs; i++)
     {
-      XChar2b char2b;
       static XCharStruct *pcm;
 
       if (code[i] >= 0x10000)
        continue;
-      char2b.byte1 = code[i] >> 8, char2b.byte2 = code[i] & 0xFF;
-      pcm = xfont_get_pcm (xfont, &char2b);
+      pcm = xfont_get_pcm (xfont, code[i]);
       if (! pcm)
        continue;
       if (first)
@@ -1000,6 +989,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int 
x, int y,
             bool with_background)
 {
   XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont;
+  Display *display = FRAME_X_DISPLAY (s->f);
   int len = to - from;
   GC gc = s->gc;
   int i;
@@ -1007,7 +997,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int 
x, int y,
   if (s->gc != s->face->gc)
     {
       block_input ();
-      XSetFont (s->display, gc, xfont->fid);
+      XSetFont (display, gc, xfont->fid);
       unblock_input ();
     }
 
@@ -1016,26 +1006,26 @@ xfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
       USE_SAFE_ALLOCA;
       char *str = SAFE_ALLOCA (len);
       for (i = 0; i < len ; i++)
-       str[i] = XCHAR2B_BYTE2 (s->char2b + from + i);
+       str[i] = s->char2b[from + i] & 0xFF;
       block_input ();
       if (with_background)
        {
          if (s->padding_p)
            for (i = 0; i < len; i++)
-              XDrawImageString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE 
(s->f),
+              XDrawImageString (display, FRAME_X_DRAWABLE (s->f),
                                gc, x + i, y, str + i, 1);
          else
-            XDrawImageString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
+            XDrawImageString (display, FRAME_X_DRAWABLE (s->f),
                              gc, x, y, str, len);
        }
       else
        {
          if (s->padding_p)
            for (i = 0; i < len; i++)
-              XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
+              XDrawString (display, FRAME_X_DRAWABLE (s->f),
                           gc, x + i, y, str + i, 1);
          else
-            XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
+            XDrawString (display, FRAME_X_DRAWABLE (s->f),
                         gc, x, y, str, len);
        }
       unblock_input ();
@@ -1048,21 +1038,51 @@ xfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
     {
       if (s->padding_p)
        for (i = 0; i < len; i++)
-          XDrawImageString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
-                             gc, x + i, y, s->char2b + from + i, 1);
+          {
+            const unsigned code = s->char2b[from + i];
+            const XChar2b char2b = { .byte1 = code >> 8,
+                                     .byte2 = code & 0xFF };
+            XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f),
+                                gc, x + i, y, &char2b, 1);
+          }
       else
-        XDrawImageString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
-                           gc, x, y, s->char2b + from, len);
+        {
+          USE_SAFE_ALLOCA;
+          const unsigned *code = s->char2b + from;
+          XChar2b *char2b;
+          SAFE_NALLOCA (char2b, 1, len);
+          for (int i = 0; i < len; ++i)
+            char2b[i] = (XChar2b) { .byte1 = code[i] >> 8,
+                                    .byte2 = code[i] & 0xFF };
+          XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f),
+                              gc, x, y, char2b, len);
+          SAFE_FREE ();
+        }
     }
   else
     {
       if (s->padding_p)
        for (i = 0; i < len; i++)
-          XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
-                        gc, x + i, y, s->char2b + from + i, 1);
+          {
+            const unsigned code = s->char2b[from + i];
+            const XChar2b char2b = { .byte1 = code >> 8,
+                                     .byte2 = code & 0xFF };
+            XDrawString16 (display, FRAME_X_DRAWABLE (s->f),
+                           gc, x + i, y, &char2b, 1);
+          }
       else
-        XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
-                      gc, x, y, s->char2b + from, len);
+        {
+          USE_SAFE_ALLOCA;
+          const unsigned *code = s->char2b + from;
+          XChar2b *char2b;
+          SAFE_NALLOCA (char2b, 1, len);
+          for (int i = 0; i < len; ++i)
+            char2b[i] = (XChar2b) { .byte1 = code[i] >> 8,
+                                    .byte2 = code[i] & 0xFF };
+          XDrawString16 (display, FRAME_X_DRAWABLE (s->f),
+                         gc, x, y, char2b, len);
+          SAFE_FREE ();
+        }
     }
   unblock_input ();
 
diff --git a/src/xftfont.c b/src/xftfont.c
index f7b87f9..08e4edb 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -119,120 +119,18 @@ xftfont_match (struct frame *f, Lisp_Object spec)
 
 static FcChar8 ascii_printable[95];
 
-static void
-xftfont_fix_match (FcPattern *pat, FcPattern *match)
-{
-  /*  These values are not used for matching (except antialias), but for
-      rendering, so make sure they are carried over to the match.
-      We also put antialias here because most fonts are antialiased, so
-      the match will have antialias true.  */
-
-  FcBool b = FcTrue;
-  int i;
-  double dpi;
-
-  FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b);
-  if (! b)
-    {
-      FcPatternDel (match, FC_ANTIALIAS);
-      FcPatternAddBool (match, FC_ANTIALIAS, FcFalse);
-    }
-  FcPatternGetBool (pat, FC_HINTING, 0, &b);
-  if (! b)
-    {
-      FcPatternDel (match, FC_HINTING);
-      FcPatternAddBool (match, FC_HINTING, FcFalse);
-    }
-#ifndef FC_HINT_STYLE
-# define FC_HINT_STYLE "hintstyle"
-#endif
-  if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i))
-    {
-      FcPatternDel (match, FC_HINT_STYLE);
-      FcPatternAddInteger (match, FC_HINT_STYLE, i);
-    }
-#ifndef FC_LCD_FILTER
-  /* Older fontconfig versions don't have FC_LCD_FILTER. */
-#define FC_LCD_FILTER "lcdfilter"
-#endif
-  if (FcResultMatch == FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &i))
-    {
-      FcPatternDel (match, FC_LCD_FILTER);
-      FcPatternAddInteger (match, FC_LCD_FILTER, i);
-    }
-  if (FcResultMatch == FcPatternGetInteger (pat, FC_RGBA, 0, &i))
-    {
-      FcPatternDel (match, FC_RGBA);
-      FcPatternAddInteger (match, FC_RGBA, i);
-    }
-  if (FcResultMatch == FcPatternGetDouble (pat, FC_DPI, 0, &dpi))
-    {
-      FcPatternDel (match, FC_DPI);
-      FcPatternAddDouble (match, FC_DPI, dpi);
-    }
-}
-
-static void
-xftfont_add_rendering_parameters (FcPattern *pat, Lisp_Object entity)
-{
-  Lisp_Object tail;
-  int ival;
-
-  for (tail = AREF (entity, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR 
(tail))
-    {
-      Lisp_Object key = XCAR (XCAR (tail));
-      Lisp_Object val = XCDR (XCAR (tail));
-
-      if (EQ (key, QCantialias))
-          FcPatternAddBool (pat, FC_ANTIALIAS, NILP (val) ? FcFalse : FcTrue);
-      else if (EQ (key, QChinting))
-       FcPatternAddBool (pat, FC_HINTING, NILP (val) ? FcFalse : FcTrue);
-      else if (EQ (key, QCautohint))
-       FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue);
-      else if (EQ (key, QChintstyle))
-       {
-         if (FIXNUMP (val))
-           FcPatternAddInteger (pat, FC_HINT_STYLE, XFIXNUM (val));
-          else if (SYMBOLP (val)
-                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
-           FcPatternAddInteger (pat, FC_HINT_STYLE, ival);
-       }
-      else if (EQ (key, QCrgba))
-       {
-         if (FIXNUMP (val))
-           FcPatternAddInteger (pat, FC_RGBA, XFIXNUM (val));
-          else if (SYMBOLP (val)
-                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
-           FcPatternAddInteger (pat, FC_RGBA, ival);
-       }
-      else if (EQ (key, QClcdfilter))
-       {
-         if (FIXNUMP (val))
-           FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XFIXNUM (val));
-          else if (SYMBOLP (val)
-                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
-           FcPatternAddInteger (pat, FC_LCD_FILTER, ival);
-       }
-#ifdef FC_EMBOLDEN
-      else if (EQ (key, QCembolden))
-       FcPatternAddBool (pat, FC_EMBOLDEN, NILP (val) ? FcFalse : FcTrue);
-#endif
-    }
-}
-
 static Lisp_Object
 xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 {
   FcResult result;
   Display *display = FRAME_X_DISPLAY (f);
-  Lisp_Object val, filename, idx, font_object;
+  Lisp_Object val, filename, font_object;
   FcPattern *pat = NULL, *match;
   struct font_info *xftfont_info = NULL;
   struct font *font;
   double size = 0;
   XftFont *xftfont = NULL;
   int spacing;
-  int i;
   XGlyphInfo extents;
   FT_Face ft_face;
   FcMatrix *matrix;
@@ -242,52 +140,17 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
     return Qnil;
   val = XCDR (val);
   filename = XCAR (val);
-  idx = XCDR (val);
   size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
-  pat = FcPatternCreate ();
-  FcPatternAddInteger (pat, FC_WEIGHT, FONT_WEIGHT_NUMERIC (entity));
-  i = FONT_SLANT_NUMERIC (entity) - 100;
-  if (i < 0) i = 0;
-  FcPatternAddInteger (pat, FC_SLANT, i);
-  FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity));
-  FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size);
-  val = AREF (entity, FONT_FAMILY_INDEX);
-  if (! NILP (val))
-    FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val)));
-  val = AREF (entity, FONT_FOUNDRY_INDEX);
-  if (! NILP (val))
-    FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) SDATA (SYMBOL_NAME 
(val)));
-  val = AREF (entity, FONT_SPACING_INDEX);
-  if (! NILP (val))
-    FcPatternAddInteger (pat, FC_SPACING, XFIXNUM (val));
-  val = AREF (entity, FONT_DPI_INDEX);
-  if (! NILP (val))
-    {
-      double dbl = XFIXNUM (val);
-
-      FcPatternAddDouble (pat, FC_DPI, dbl);
-    }
-  val = AREF (entity, FONT_AVGWIDTH_INDEX);
-  if (FIXNUMP (val) && XFIXNUM (val) == 0)
-    FcPatternAddBool (pat, FC_SCALABLE, FcTrue);
-  /* This is necessary to identify the exact font (e.g. 10x20.pcf.gz
-     over 10x20-ISO8859-1.pcf.gz).  */
-  FcPatternAddCharSet (pat, FC_CHARSET, ftfont_get_fc_charset (entity));
-
-  xftfont_add_rendering_parameters (pat, entity);
-
-  FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename));
-  FcPatternAddInteger (pat, FC_INDEX, XFIXNUM (idx));
-
 
   block_input ();
 
+  pat = ftfont_entity_pattern (entity, pixel_size);
   /* Substitute in values from X resources and XftDefaultSet.  */
   XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
   match = XftFontMatch (display, FRAME_X_SCREEN_NUMBER (f), pat, &result);
-  xftfont_fix_match (pat, match);
+  ftfont_fix_match (pat, match);
 
   FcPatternDestroy (pat);
   xftfont = XftFontOpenPattern (display, match);
@@ -544,7 +407,7 @@ xftfont_encode_char (struct font *font, int c)
 }
 
 static void
-xftfont_text_extents (struct font *font, unsigned int *code,
+xftfont_text_extents (struct font *font, const unsigned int *code,
                      int nglyphs, struct font_metrics *metrics)
 {
   struct font_info *xftfont_info = (struct font_info *) font;
@@ -629,8 +492,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int 
x, int y,
     }
   code = alloca (sizeof (FT_UInt) * len);
   for (i = 0; i < len; i++)
-    code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
-              | XCHAR2B_BYTE2 (s->char2b + from + i));
+    code[i] = s->char2b[from + i];
 
   if (s->padding_p)
     for (i = 0; i < len; i++)
@@ -704,7 +566,7 @@ xftfont_cached_font_ok (struct frame *f, Lisp_Object 
font_object,
   bool ok = false;
   int i1, i2, r1, r2;
 
-  xftfont_add_rendering_parameters (pat, entity);
+  ftfont_add_rendering_parameters (pat, entity);
   XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
 
   r1 = FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b1);
@@ -818,12 +680,6 @@ syms_of_xftfont (void)
 #ifdef HAVE_HARFBUZZ
   DEFSYM (Qxfthb, "xfthb");
 #endif /* HAVE_HARFBUZZ */
-  DEFSYM (QChinting, ":hinting");
-  DEFSYM (QCautohint, ":autohint");
-  DEFSYM (QChintstyle, ":hintstyle");
-  DEFSYM (QCrgba, ":rgba");
-  DEFSYM (QCembolden, ":embolden");
-  DEFSYM (QClcdfilter, ":lcdfilter");
 
   DEFVAR_BOOL ("xft-font-ascent-descent-override",
               xft_font_ascent_descent_override,
diff --git a/src/xterm.c b/src/xterm.c
index dd19b8b..559d1b4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -201,7 +201,6 @@ enum xembed_message
     XEMBED_ACTIVATE_ACCELERATOR   = 14
   };
 
-static void x_free_cr_resources (struct frame *);
 static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
 static void x_raise_frame (struct frame *);
 static void x_lower_frame (struct frame *);
@@ -298,7 +297,10 @@ record_event (char *locus, int type)
 #ifdef USE_CAIRO
 
 #define FRAME_CR_CONTEXT(f)    ((f)->output_data.x->cr_context)
-#define FRAME_CR_SURFACE(f)    ((f)->output_data.x->cr_surface)
+#define FRAME_CR_SURFACE_DESIRED_WIDTH(f) \
+  ((f)->output_data.x->cr_surface_desired_width)
+#define FRAME_CR_SURFACE_DESIRED_HEIGHT(f) \
+  ((f)->output_data.x->cr_surface_desired_height)
 
 static struct x_gc_ext_data *
 x_gc_get_ext_data (struct frame *f, GC gc, int create_if_not_found_p)
@@ -333,19 +335,28 @@ x_extension_initialize (struct x_display_info *dpyinfo)
   dpyinfo->ext_codes = ext_codes;
 }
 
-static void
-x_cr_destroy_surface (struct frame *f)
+void
+x_cr_destroy_frame_context (struct frame *f)
 {
-  if (FRAME_CR_SURFACE (f))
+  if (FRAME_CR_CONTEXT (f))
     {
-      cairo_t *cr = FRAME_CR_CONTEXT (f);
-      cairo_surface_destroy (FRAME_CR_SURFACE (f));
-      FRAME_CR_SURFACE (f) = 0;
-      if (cr) cairo_destroy (cr);
+      cairo_destroy (FRAME_CR_CONTEXT (f));
       FRAME_CR_CONTEXT (f) = NULL;
     }
 }
 
+static void
+x_cr_update_surface_desired_size (struct frame *f, int width, int height)
+{
+  if (FRAME_CR_SURFACE_DESIRED_WIDTH (f) != width
+      || FRAME_CR_SURFACE_DESIRED_HEIGHT (f) != height)
+    {
+      x_cr_destroy_frame_context (f);
+      FRAME_CR_SURFACE_DESIRED_WIDTH (f) = width;
+      FRAME_CR_SURFACE_DESIRED_HEIGHT (f) = height;
+    }
+}
+
 cairo_t *
 x_begin_cr_clip (struct frame *f, GC gc)
 {
@@ -353,21 +364,19 @@ x_begin_cr_clip (struct frame *f, GC gc)
 
   if (!cr)
     {
-
-      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,
-                                       scale * FRAME_PIXEL_WIDTH (f),
-                                       scale * FRAME_PIXEL_HEIGHT (f));
-       }
-      cr = cairo_create (FRAME_CR_SURFACE (f));
-      FRAME_CR_CONTEXT (f) = cr;
+      int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
+      int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
+      cairo_surface_t *surface;
+      if (FRAME_X_DOUBLE_BUFFERED_P (f))
+       surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f),
+                                            FRAME_X_RAW_DRAWABLE (f),
+                                            FRAME_X_VISUAL (f),
+                                            width, height);
+      else
+       surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+                                             width, height);
+      cr = FRAME_CR_CONTEXT (f) = cairo_create (surface);
+      cairo_surface_destroy (surface);
     }
   cairo_save (cr);
 
@@ -395,6 +404,8 @@ void
 x_end_cr_clip (struct frame *f)
 {
   cairo_restore (FRAME_CR_CONTEXT (f));
+  if (FRAME_X_DOUBLE_BUFFERED_P (f))
+    x_mark_frame_dirty (f);
 }
 
 void
@@ -532,11 +543,11 @@ x_cr_draw_frame (cairo_t *cr, struct frame *f)
   width = FRAME_PIXEL_WIDTH (f);
   height = FRAME_PIXEL_HEIGHT (f);
 
-  x_free_cr_resources (f);
+  cairo_t *saved_cr = FRAME_CR_CONTEXT (f);
   FRAME_CR_CONTEXT (f) = cr;
   x_clear_area (f, 0, 0, width, height);
   expose_frame (f, 0, 0, width, height);
-  FRAME_CR_CONTEXT (f) = NULL;
+  FRAME_CR_CONTEXT (f) = saved_cr;
 }
 
 static cairo_status_t
@@ -615,11 +626,11 @@ x_cr_export_frames (Lisp_Object frames, 
cairo_surface_type_t surface_type)
 
   while (1)
     {
-      x_free_cr_resources (f);
+      cairo_t *saved_cr = FRAME_CR_CONTEXT (f);
       FRAME_CR_CONTEXT (f) = cr;
       x_clear_area (f, 0, 0, width, height);
       expose_frame (f, 0, 0, width, height);
-      FRAME_CR_CONTEXT (f) = NULL;
+      FRAME_CR_CONTEXT (f) = saved_cr;
 
       if (NILP (frames))
        break;
@@ -654,35 +665,6 @@ x_cr_export_frames (Lisp_Object frames, 
cairo_surface_type_t surface_type)
 #endif /* USE_CAIRO */
 
 static void
-x_free_cr_resources (struct frame *f)
-{
-#ifdef USE_CAIRO
-  if (f == NULL)
-    {
-      Lisp_Object rest, frame;
-      FOR_EACH_FRAME (rest, frame)
-       if (FRAME_X_P (XFRAME (frame)))
-         x_free_cr_resources (XFRAME (frame));
-    }
-  else
-    {
-      cairo_t *cr = FRAME_CR_CONTEXT (f);
-
-      if (cr)
-       {
-         cairo_surface_t *surface = cairo_get_target (cr);
-
-         if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XLIB)
-           {
-             cairo_destroy (cr);
-             FRAME_CR_CONTEXT (f) = NULL;
-           }
-       }
-    }
-#endif
-}
-
-static void
 x_set_clip_rectangles (struct frame *f, GC gc, XRectangle *rectangles, int n)
 {
   XSetClipRectangles (FRAME_X_DISPLAY (f), gc, 0, 0, rectangles, n, Unsorted);
@@ -989,77 +971,16 @@ x_set_frame_alpha (struct frame *f)
 
 /* Start an update of frame F.  This function is installed as a hook
    for update_begin, i.e. it is called when update_begin is called.
-   This function is called prior to calls to x_update_window_begin for
+   This function is called prior to calls to gui_update_window_begin for
    each window being updated.  Currently, there is nothing to do here
    because all interesting stuff is done on a window basis.  */
 
 static void
 x_update_begin (struct frame *f)
 {
-#ifdef USE_CAIRO
-  if (FRAME_TOOLTIP_P (f) && !FRAME_VISIBLE_P (f))
-    return;
-
-  if (! FRAME_CR_SURFACE (f))
-    {
-      int width, height;
-#ifdef USE_GTK
-      if (FRAME_GTK_WIDGET (f))
-        {
-          GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
-         int scale = xg_get_scale (f);
-         width = scale * gdk_window_get_width (w);
-         height = scale * gdk_window_get_height (w);
-        }
-      else
-#endif
-        {
-          width = FRAME_PIXEL_WIDTH (f);
-          height = FRAME_PIXEL_HEIGHT (f);
-          if (! FRAME_EXTERNAL_TOOL_BAR (f))
-            height += FRAME_TOOL_BAR_HEIGHT (f);
-          if (! FRAME_EXTERNAL_MENU_BAR (f))
-            height += FRAME_MENU_BAR_HEIGHT (f);
-        }
-
-      if (width > 0 && height > 0)
-        {
-          block_input();
-          FRAME_CR_SURFACE (f) = cairo_image_surface_create
-            (CAIRO_FORMAT_ARGB32, width, height);
-          unblock_input();
-        }
-    }
-#endif /* USE_CAIRO */
-}
-
-/* Start update of window W.  */
-
-static void
-x_update_window_begin (struct window *w)
-{
-  struct frame *f = XFRAME (WINDOW_FRAME (w));
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-
-  w->output_cursor = w->cursor;
-
-  block_input ();
-
-  if (f == hlinfo->mouse_face_mouse_frame)
-    {
-      /* Don't do highlighting for mouse motion during the update.  */
-      hlinfo->mouse_face_defer = true;
-
-      /* If F needs to be redrawn, simply forget about any prior mouse
-        highlighting.  */
-      if (FRAME_GARBAGED_P (f))
-       hlinfo->mouse_face_window = Qnil;
-    }
-
-  unblock_input ();
+  /* Nothing to do.  */
 }
 
-
 /* Draw a vertical window border from (x,y0) to (x,y1)  */
 
 static void
@@ -1139,55 +1060,6 @@ x_draw_window_divider (struct window *w, int x0, int x1, 
int y0, int y1)
     }
 }
 
-/* End update of window W.
-
-   Draw vertical borders between horizontally adjacent windows, and
-   display W's cursor if CURSOR_ON_P is non-zero.
-
-   MOUSE_FACE_OVERWRITTEN_P non-zero means that some row containing
-   glyphs in mouse-face were overwritten.  In that case we have to
-   make sure that the mouse-highlight is properly redrawn.
-
-   W may be a menu bar pseudo-window in case we don't have X toolkit
-   support.  Such windows don't have a cursor, so don't display it
-   here.  */
-
-static void
-x_update_window_end (struct window *w, bool cursor_on_p,
-                    bool mouse_face_overwritten_p)
-{
-  if (!w->pseudo_window_p)
-    {
-      block_input ();
-
-      if (cursor_on_p)
-       display_and_set_cursor (w, true,
-                               w->output_cursor.hpos, w->output_cursor.vpos,
-                               w->output_cursor.x, w->output_cursor.y);
-
-      if (draw_window_fringes (w, true))
-       {
-         if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
-           gui_draw_right_divider (w);
-         else
-           gui_draw_vertical_border (w);
-       }
-
-      unblock_input ();
-    }
-
-  /* If a row with mouse-face was overwritten, arrange for
-     XTframe_up_to_date to redisplay the mouse highlight.  */
-  if (mouse_face_overwritten_p)
-    {
-      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-
-      hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
-      hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
-      hlinfo->mouse_face_window = Qnil;
-    }
-}
-
 /* Show the frame back buffer.  If frame is double-buffered,
    atomically publish to the user's screen graphics updates made since
    the last call to show_back_buffer.  */
@@ -1198,6 +1070,11 @@ show_back_buffer (struct frame *f)
   if (FRAME_X_DOUBLE_BUFFERED_P (f))
     {
 #ifdef HAVE_XDBE
+#ifdef USE_CAIRO
+      cairo_t *cr = FRAME_CR_CONTEXT (f);
+      if (cr)
+       cairo_surface_flush (cairo_get_target (cr));
+#endif
       XdbeSwapInfo swap_info;
       memset (&swap_info, 0, sizeof (swap_info));
       swap_info.swap_window = FRAME_X_WINDOW (f);
@@ -1234,30 +1111,33 @@ x_update_end (struct frame *f)
   MOUSE_HL_INFO (f)->mouse_face_defer = false;
 
 #ifdef USE_CAIRO
-  if (FRAME_CR_SURFACE (f))
+  if (!FRAME_X_DOUBLE_BUFFERED_P (f))
     {
-      cairo_t *cr;
-      cairo_surface_t *surface;
-      int width, height;
-
       block_input ();
-      width = FRAME_PIXEL_WIDTH (f);
-      height = FRAME_PIXEL_HEIGHT (f);
-      if (! FRAME_EXTERNAL_TOOL_BAR (f))
-       height += FRAME_TOOL_BAR_HEIGHT (f);
-      if (! FRAME_EXTERNAL_MENU_BAR (f))
-       height += FRAME_MENU_BAR_HEIGHT (f);
-      surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f),
-                                          FRAME_X_DRAWABLE (f),
-                                          FRAME_DISPLAY_INFO (f)->visual,
-                                          width,
-                                          height);
-      cr = cairo_create (surface);
-      cairo_surface_destroy (surface);
-
-      cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), 0, 0);
-      cairo_paint (cr);
-      cairo_destroy (cr);
+      cairo_surface_t *source_surface = cairo_get_target (FRAME_CR_CONTEXT 
(f));
+      if (source_surface)
+       {
+         cairo_t *cr;
+         cairo_surface_t *surface;
+         int width, height;
+
+         width = FRAME_PIXEL_WIDTH (f);
+         height = FRAME_PIXEL_HEIGHT (f);
+         if (! FRAME_EXTERNAL_TOOL_BAR (f))
+           height += FRAME_TOOL_BAR_HEIGHT (f);
+         if (! FRAME_EXTERNAL_MENU_BAR (f))
+           height += FRAME_MENU_BAR_HEIGHT (f);
+         surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f),
+                                              FRAME_X_DRAWABLE (f),
+                                              FRAME_X_VISUAL (f),
+                                              width, height);
+         cr = cairo_create (surface);
+         cairo_surface_destroy (surface);
+
+         cairo_set_source_surface (cr, source_surface, 0, 0);
+         cairo_paint (cr);
+         cairo_destroy (cr);
+       }
       unblock_input ();
     }
 #endif
@@ -1530,6 +1410,7 @@ x_set_cursor_gc (struct glyph_string *s)
       /* Cursor on non-default face: must merge.  */
       XGCValues xgcv;
       unsigned long mask;
+      Display *display = FRAME_X_DISPLAY (s->f);
 
       xgcv.background = s->f->output_data.x->cursor_pixel;
       xgcv.foreground = s->face->background;
@@ -1555,11 +1436,11 @@ x_set_cursor_gc (struct glyph_string *s)
       mask = GCForeground | GCBackground | GCGraphicsExposures;
 
       if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc)
-       XChangeGC (s->display, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc,
+       XChangeGC (display, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc,
                   mask, &xgcv);
       else
        FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc
-          = XCreateGC (s->display, FRAME_X_DRAWABLE (s->f), mask, &xgcv);
+          = XCreateGC (display, FRAME_X_DRAWABLE (s->f), mask, &xgcv);
 
       s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc;
     }
@@ -1595,6 +1476,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
         except for FONT.  */
       XGCValues xgcv;
       unsigned long mask;
+      Display *display = FRAME_X_DISPLAY (s->f);
 
       xgcv.background = s->face->background;
       xgcv.foreground = s->face->foreground;
@@ -1602,11 +1484,11 @@ x_set_mouse_face_gc (struct glyph_string *s)
       mask = GCForeground | GCBackground | GCGraphicsExposures;
 
       if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc)
-       XChangeGC (s->display, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc,
+       XChangeGC (display, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc,
                   mask, &xgcv);
       else
        FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc
-          = XCreateGC (s->display, FRAME_X_DRAWABLE (s->f), mask, &xgcv);
+          = XCreateGC (display, FRAME_X_DRAWABLE (s->f), mask, &xgcv);
 
       s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc;
 
@@ -1717,13 +1599,8 @@ x_compute_glyph_string_overhangs (struct glyph_string *s)
 
       if (s->first_glyph->type == CHAR_GLYPH)
        {
-         unsigned *code = alloca (sizeof (unsigned) * s->nchars);
          struct font *font = s->font;
-         int i;
-
-         for (i = 0; i < s->nchars; i++)
-           code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
-         font->driver->text_extents (font, code, s->nchars, &metrics);
+         font->driver->text_extents (font, s->char2b, s->nchars, &metrics);
        }
       else
        {
@@ -1748,11 +1625,12 @@ x_compute_glyph_string_overhangs (struct glyph_string 
*s)
 static void
 x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
 {
+  Display *display = FRAME_X_DISPLAY (s->f);
   XGCValues xgcv;
-  XGetGCValues (s->display, s->gc, GCForeground | GCBackground, &xgcv);
-  XSetForeground (s->display, s->gc, xgcv.background);
+  XGetGCValues (display, s->gc, GCForeground | GCBackground, &xgcv);
+  XSetForeground (display, s->gc, xgcv.background);
   x_fill_rectangle (s->f, s->gc, x, y, w, h);
-  XSetForeground (s->display, s->gc, xgcv.foreground);
+  XSetForeground (display, s->gc, xgcv.foreground);
 }
 
 
@@ -1773,13 +1651,15 @@ x_draw_glyph_string_background (struct glyph_string *s, 
bool force_p)
 
       if (s->stippled_p)
        {
+          Display *display = FRAME_X_DISPLAY (s->f);
+
          /* Fill background with a stipple pattern.  */
-         XSetFillStyle (s->display, s->gc, FillOpaqueStippled);
+         XSetFillStyle (display, s->gc, FillOpaqueStippled);
          x_fill_rectangle (s->f, s->gc, s->x,
                          s->y + box_line_width,
                          s->background_width,
                          s->height - 2 * box_line_width);
-         XSetFillStyle (s->display, s->gc, FillSolid);
+         XSetFillStyle (display, s->gc, FillSolid);
          s->background_filled_p = true;
        }
       else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
@@ -1946,7 +1826,7 @@ static void
 x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
 {
   struct glyph *glyph = s->first_glyph;
-  XChar2b char2b[8];
+  unsigned char2b[8];
   int x, i, j;
 
   /* If first glyph of S has a left box line, start drawing the text
@@ -1997,14 +1877,10 @@ x_draw_glyphless_glyph_string_foreground (struct 
glyph_string *s)
       if (str)
        {
          int upper_len = (len + 1) / 2;
-         unsigned code;
 
          /* It is assured that all LEN characters in STR is ASCII.  */
          for (j = 0; j < len; j++)
-           {
-             code = s->font->driver->encode_char (s->font, str[j]);
-             STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
-           }
+            char2b[j] = s->font->driver->encode_char (s->font, str[j]) & 
0xFFFF;
          s->font->driver->draw (s, 0, upper_len,
                                 x + glyph->slice.glyphless.upper_xoff,
                                 s->ybase + glyph->slice.glyphless.upper_yoff,
@@ -2667,7 +2543,7 @@ x_setup_relief_colors (struct glyph_string *s)
       XGCValues xgcv;
 
       /* Get the background color of the face.  */
-      XGetGCValues (s->display, s->gc, GCBackground, &xgcv);
+      XGetGCValues (FRAME_X_DISPLAY (s->f), s->gc, GCBackground, &xgcv);
       color = xgcv.background;
     }
 
@@ -2877,10 +2753,11 @@ x_draw_box_rect (struct glyph_string *s,
                 int left_x, int top_y, int right_x, int bottom_y, int width,
                 bool left_p, bool right_p, XRectangle *clip_rect)
 {
+  Display *display = FRAME_X_DISPLAY (s->f);
   XGCValues xgcv;
 
-  XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-  XSetForeground (s->display, s->gc, s->face->box_color);
+  XGetGCValues (display, s->gc, GCForeground, &xgcv);
+  XSetForeground (display, s->gc, s->face->box_color);
   x_set_clip_rectangles (s->f, s->gc, clip_rect, 1);
 
   /* Top.  */
@@ -2901,7 +2778,7 @@ x_draw_box_rect (struct glyph_string *s,
     x_fill_rectangle (s->f, s->gc,
                    right_x - width + 1, top_y, width, bottom_y - top_y + 1);
 
-  XSetForeground (s->display, s->gc, xgcv.foreground);
+  XSetForeground (display, s->gc, xgcv.foreground);
   x_reset_clip_rectangles (s->f, s->gc);
 }
 
@@ -2964,6 +2841,7 @@ x_composite_image (struct glyph_string *s, Pixmap dest,
                    int srcX, int srcY, int dstX, int dstY,
                    int width, int height)
 {
+  Display *display = FRAME_X_DISPLAY (s->f);
 #ifdef HAVE_XRENDER
   if (s->img->picture)
     {
@@ -2973,27 +2851,27 @@ x_composite_image (struct glyph_string *s, Pixmap dest,
 
       /* 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 = XRenderFindVisualFormat (display,
+                                                DefaultVisual (display, 0));
+      destination = XRenderCreatePicture (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,
+      XRenderComposite (display, PictOpOver,
                         s->img->picture, s->img->mask_picture, destination,
                         srcX, srcY,
                         srcX, srcY,
                         dstX, dstY,
                         width, height);
 
-      XRenderFreePicture (s->display, destination);
+      XRenderFreePicture (display, destination);
       return;
     }
 #endif
 
-  XCopyArea (s->display, s->img->pixmap,
+  XCopyArea (display, s->img->pixmap,
             dest, s->gc,
             srcX, srcY,
             width, height, dstX, dstY);
@@ -3068,7 +2946,7 @@ x_draw_image_foreground (struct glyph_string *s)
          xgcv.clip_x_origin = x;
          xgcv.clip_y_origin = y;
          xgcv.function = GXcopy;
-         XChangeGC (s->display, s->gc, mask, &xgcv);
+         XChangeGC (FRAME_X_DISPLAY (s->f), s->gc, mask, &xgcv);
 
          get_glyph_string_clip_rect (s, &clip_rect);
          image_rect.x = x;
@@ -3217,6 +3095,8 @@ x_draw_image_foreground_1 (struct glyph_string *s, Pixmap 
pixmap)
 
   if (s->img->pixmap)
     {
+      Display *display = FRAME_X_DISPLAY (s->f);
+
       if (s->img->mask)
        {
          /* We can't set both a clip mask and use XSetClipRectangles
@@ -3232,16 +3112,16 @@ x_draw_image_foreground_1 (struct glyph_string *s, 
Pixmap pixmap)
          xgcv.clip_x_origin = x - s->slice.x;
          xgcv.clip_y_origin = y - s->slice.y;
          xgcv.function = GXcopy;
-         XChangeGC (s->display, s->gc, mask, &xgcv);
+         XChangeGC (display, s->gc, mask, &xgcv);
 
-         XCopyArea (s->display, s->img->pixmap, pixmap, s->gc,
+         XCopyArea (display, s->img->pixmap, pixmap, s->gc,
                     s->slice.x, s->slice.y,
                     s->slice.width, s->slice.height, x, y);
-         XSetClipMask (s->display, s->gc, None);
+         XSetClipMask (display, s->gc, None);
        }
       else
        {
-         XCopyArea (s->display, s->img->pixmap, pixmap, s->gc,
+         XCopyArea (display, s->img->pixmap, pixmap, s->gc,
                     s->slice.x, s->slice.y,
                     s->slice.width, s->slice.height, x, y);
 
@@ -3276,10 +3156,12 @@ x_draw_glyph_string_bg_rect (struct glyph_string *s, 
int x, int y, int w, int h)
 {
   if (s->stippled_p)
     {
+      Display *display = FRAME_X_DISPLAY (s->f);
+
       /* Fill background with a stipple pattern.  */
-      XSetFillStyle (s->display, s->gc, FillOpaqueStippled);
+      XSetFillStyle (display, s->gc, FillOpaqueStippled);
       x_fill_rectangle (s->f, s->gc, x, y, w, h);
-      XSetFillStyle (s->display, s->gc, FillSolid);
+      XSetFillStyle (display, s->gc, FillSolid);
     }
   else
     x_clear_glyph_string_rect (s, x, y, w, h);
@@ -3307,6 +3189,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
   int box_line_vwidth = max (s->face->box_line_width, 0);
   int height;
 #ifndef USE_CAIRO
+  Display *display = FRAME_X_DISPLAY (s->f);
   Pixmap pixmap = None;
 #endif
 
@@ -3337,34 +3220,34 @@ x_draw_image_glyph_string (struct glyph_string *s)
          int depth = DefaultDepthOfScreen (screen);
 
          /* Create a pixmap as large as the glyph string.  */
-          pixmap = XCreatePixmap (s->display, FRAME_X_DRAWABLE (s->f),
+          pixmap = XCreatePixmap (display, FRAME_X_DRAWABLE (s->f),
                                  s->background_width,
                                  s->height, depth);
 
          /* Don't clip in the following because we're working on the
             pixmap.  */
-         XSetClipMask (s->display, s->gc, None);
+         XSetClipMask (display, s->gc, None);
 
          /* Fill the pixmap with the background color/stipple.  */
          if (s->stippled_p)
            {
              /* Fill background with a stipple pattern.  */
-             XSetFillStyle (s->display, s->gc, FillOpaqueStippled);
-             XSetTSOrigin (s->display, s->gc, - s->x, - s->y);
-             XFillRectangle (s->display, pixmap, s->gc,
+             XSetFillStyle (display, s->gc, FillOpaqueStippled);
+             XSetTSOrigin (display, s->gc, - s->x, - s->y);
+             XFillRectangle (display, pixmap, s->gc,
                              0, 0, s->background_width, s->height);
-             XSetFillStyle (s->display, s->gc, FillSolid);
-             XSetTSOrigin (s->display, s->gc, 0, 0);
+             XSetFillStyle (display, s->gc, FillSolid);
+             XSetTSOrigin (display, s->gc, 0, 0);
            }
          else
            {
              XGCValues xgcv;
-             XGetGCValues (s->display, s->gc, GCForeground | GCBackground,
+             XGetGCValues (display, s->gc, GCForeground | GCBackground,
                            &xgcv);
-             XSetForeground (s->display, s->gc, xgcv.background);
-             XFillRectangle (s->display, pixmap, s->gc,
+             XSetForeground (display, s->gc, xgcv.background);
+             XFillRectangle (display, pixmap, s->gc,
                              0, 0, s->background_width, s->height);
-             XSetForeground (s->display, s->gc, xgcv.foreground);
+             XSetForeground (display, s->gc, xgcv.foreground);
            }
        }
       else
@@ -3396,9 +3279,9 @@ x_draw_image_glyph_string (struct glyph_string *s)
     {
       x_draw_image_foreground_1 (s, pixmap);
       x_set_glyph_string_clipping (s);
-      XCopyArea (s->display, pixmap, FRAME_X_DRAWABLE (s->f), s->gc,
+      XCopyArea (display, pixmap, FRAME_X_DRAWABLE (s->f), s->gc,
                 0, 0, s->background_width, s->height, s->x, s->y);
-      XFreePixmap (s->display, pixmap);
+      XFreePixmap (display, pixmap);
     }
   else
 #endif /* ! USE_CAIRO */
@@ -3459,6 +3342,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
        {
          int y = s->y;
          int w = background_width - width, h = s->height;
+          Display *display = FRAME_X_DISPLAY (s->f);
          XRectangle r;
          GC gc;
 
@@ -3481,17 +3365,17 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
          if (s->face->stipple)
            {
              /* Fill background with a stipple pattern.  */
-             XSetFillStyle (s->display, gc, FillOpaqueStippled);
+             XSetFillStyle (display, gc, FillOpaqueStippled);
              x_fill_rectangle (s->f, gc, x, y, w, h);
-             XSetFillStyle (s->display, gc, FillSolid);
+             XSetFillStyle (display, gc, FillSolid);
            }
          else
            {
              XGCValues xgcv;
-             XGetGCValues (s->display, gc, GCForeground | GCBackground, &xgcv);
-             XSetForeground (s->display, gc, xgcv.background);
+             XGetGCValues (display, gc, GCForeground | GCBackground, &xgcv);
+             XSetForeground (display, gc, xgcv.background);
              x_fill_rectangle (s->f, gc, x, y, w, h);
-             XSetForeground (s->display, gc, xgcv.foreground);
+             XSetForeground (display, gc, xgcv.foreground);
            }
 
          x_reset_clip_rectangles (s->f, gc);
@@ -3546,10 +3430,12 @@ x_get_scale_factor(Display *disp, int *scale_x, int 
*scale_y)
 static void
 x_draw_underwave (struct glyph_string *s)
 {
+  Display *display = FRAME_X_DISPLAY (s->f);
+
   /* Adjust for scale/HiDPI.  */
   int scale_x, scale_y;
 
-  x_get_scale_factor (s->display, &scale_x, &scale_y);
+  x_get_scale_factor (display, &scale_x, &scale_y);
 
   int wave_height = 3 * scale_y, wave_length = 2 * scale_x;
 
@@ -3579,7 +3465,7 @@ x_draw_underwave (struct glyph_string *s)
   if (!gui_intersect_rectangles (&wave_clip, &string_clip, &final_clip))
     return;
 
-  XSetClipRectangles (s->display, s->gc, 0, 0, &final_clip, 1, Unsorted);
+  XSetClipRectangles (display, s->gc, 0, 0, &final_clip, 1, Unsorted);
 
   /* Draw the waves */
 
@@ -3598,16 +3484,16 @@ x_draw_underwave (struct glyph_string *s)
 
   while (x1 <= xmax)
     {
-      XSetLineAttributes (s->display, s->gc, thickness, LineSolid, CapButt,
+      XSetLineAttributes (display, s->gc, thickness, LineSolid, CapButt,
                           JoinRound);
-      XDrawLine (s->display, FRAME_X_DRAWABLE (s->f), s->gc, x1, y1, x2, y2);
+      XDrawLine (display, FRAME_X_DRAWABLE (s->f), s->gc, x1, y1, x2, y2);
       x1  = x2, y1 = y2;
       x2 += dx, y2 = y0 + odd*dy;
       odd = !odd;
     }
 
   /* Restore previous clipping rectangle(s) */
-  XSetClipRectangles (s->display, s->gc, 0, 0, s->clip, s->num_clips, 
Unsorted);
+  XSetClipRectangles (display, s->gc, 0, 0, s->clip, s->num_clips, Unsorted);
 #endif /* not USE_CAIRO */
 }
 
@@ -3724,11 +3610,12 @@ x_draw_glyph_string (struct glyph_string *s)
                 x_draw_underwave (s);
               else
                 {
+                  Display *display = FRAME_X_DISPLAY (s->f);
                   XGCValues xgcv;
-                  XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-                  XSetForeground (s->display, s->gc, s->face->underline_color);
+                  XGetGCValues (display, s->gc, GCForeground, &xgcv);
+                  XSetForeground (display, s->gc, s->face->underline_color);
                   x_draw_underwave (s);
-                  XSetForeground (s->display, s->gc, xgcv.foreground);
+                  XSetForeground (display, s->gc, xgcv.foreground);
                 }
             }
           else if (s->face->underline_type == FACE_UNDER_LINE)
@@ -3808,12 +3695,13 @@ x_draw_glyph_string (struct glyph_string *s)
                                 s->x, y, s->width, thickness);
               else
                 {
+                  Display *display = FRAME_X_DISPLAY (s->f);
                   XGCValues xgcv;
-                  XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-                  XSetForeground (s->display, s->gc, s->face->underline_color);
+                  XGetGCValues (display, s->gc, GCForeground, &xgcv);
+                  XSetForeground (display, s->gc, s->face->underline_color);
                   x_fill_rectangle (s->f, s->gc,
                                   s->x, y, s->width, thickness);
-                  XSetForeground (s->display, s->gc, xgcv.foreground);
+                  XSetForeground (display, s->gc, xgcv.foreground);
                 }
             }
         }
@@ -3827,12 +3715,13 @@ x_draw_glyph_string (struct glyph_string *s)
                            s->width, h);
          else
            {
+              Display *display = FRAME_X_DISPLAY (s->f);
              XGCValues xgcv;
-             XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-             XSetForeground (s->display, s->gc, s->face->overline_color);
+             XGetGCValues (display, s->gc, GCForeground, &xgcv);
+             XSetForeground (display, s->gc, s->face->overline_color);
              x_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
                              s->width, h);
-             XSetForeground (s->display, s->gc, xgcv.foreground);
+             XSetForeground (display, s->gc, xgcv.foreground);
            }
        }
 
@@ -3856,12 +3745,13 @@ x_draw_glyph_string (struct glyph_string *s)
                            s->width, h);
          else
            {
+              Display *display = FRAME_X_DISPLAY (s->f);
              XGCValues xgcv;
-             XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-             XSetForeground (s->display, s->gc, s->face->strike_through_color);
+             XGetGCValues (display, s->gc, GCForeground, &xgcv);
+             XSetForeground (display, s->gc, s->face->strike_through_color);
              x_fill_rectangle (s->f, s->gc, s->x, glyph_y + dy,
                              s->width, h);
-             XSetForeground (s->display, s->gc, xgcv.foreground);
+             XSetForeground (display, s->gc, xgcv.foreground);
            }
        }
 
@@ -4306,11 +4196,25 @@ x_scroll_run (struct window *w, struct run *run)
 
   block_input ();
 
-  /* Cursor off.  Will be switched on again in x_update_window_end.  */
+  /* Cursor off.  Will be switched on again in gui_update_window_end.  */
   gui_clear_cursor (w);
 
 #ifdef USE_CAIRO
-  if (FRAME_CR_CONTEXT (f))
+  if (FRAME_X_DOUBLE_BUFFERED_P (f))
+    {
+      cairo_t *cr = FRAME_CR_CONTEXT (f);
+      if (cr)
+       cairo_surface_flush (cairo_get_target (cr));
+      XCopyArea (FRAME_X_DISPLAY (f),
+                FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f),
+                f->output_data.x->normal_gc,
+                x, from_y,
+                width, height,
+                x, to_y);
+      if (cr)
+       cairo_surface_mark_dirty (cairo_get_target (cr));
+    }
+  else if (FRAME_CR_CONTEXT (f))
     {
       cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                                       width, height);
@@ -8287,7 +8191,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              fit in 81 bytes.  So, we must prepare sufficient
              bytes for copy_buffer.  513 bytes (256 chars for
              two-byte character set) seems to be a fairly good
-             approximation.  -- 2000.8.10 address@hidden  */
+             approximation.  -- 2000.8.10 address@hidden  */
           unsigned char copy_buffer[513];
           unsigned char *copy_bufptr = copy_buffer;
           int copy_bufsiz = sizeof (copy_buffer);
@@ -8768,7 +8672,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
         font_drop_xrender_surfaces (f);
       unblock_input ();
 #ifdef USE_CAIRO
-      if (f) x_cr_destroy_surface (f);
+      if (f)
+       x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width,
+                                         configureEvent.xconfigure.height);
 #endif
 #ifdef USE_GTK
       if (!f
@@ -8782,7 +8688,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
           xg_frame_resized (f, configureEvent.xconfigure.width,
                             configureEvent.xconfigure.height);
 #ifdef USE_CAIRO
-          x_cr_destroy_surface (f);
+         x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width,
+                                           configureEvent.xconfigure.height);
 #endif
           f = 0;
         }
@@ -9440,7 +9347,7 @@ x_draw_bar_cursor (struct window *w, struct glyph_row 
*row, int width, enum text
 /* RIF: Define cursor CURSOR on frame F.  */
 
 static void
-x_define_frame_cursor (struct frame *f, Cursor cursor)
+x_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
 {
   if (!f->pointer_invisible
       && f->output_data.x->current_cursor != cursor)
@@ -11892,7 +11799,9 @@ x_free_frame_resources (struct frame *f)
        free_frame_xic (f);
 #endif
 
-      x_free_cr_resources (f);
+#ifdef USE_CAIRO
+      x_cr_destroy_frame_context (f);
+#endif
 #ifdef USE_X_TOOLKIT
       if (f->output_data.x->widget)
        {
@@ -12239,6 +12148,17 @@ x_check_font (struct frame *f, struct font *font)
 
 
 /***********************************************************************
+                             Image Hooks
+ ***********************************************************************/
+
+static void
+x_free_pixmap (struct frame *f, Emacs_Pixmap pixmap)
+{
+  XFreePixmap (FRAME_X_DISPLAY (f), pixmap);
+}
+
+
+/***********************************************************************
                            Initialization
  ***********************************************************************/
 
@@ -13145,8 +13065,8 @@ static struct redisplay_interface x_redisplay_interface 
=
     gui_clear_end_of_line,
     x_scroll_run,
     x_after_update_window_line,
-    x_update_window_begin,
-    x_update_window_end,
+    NULL, /* update_window_begin */
+    NULL, /* update_window_end   */
     x_flip_and_flush,
     gui_clear_window_mouse_face,
     gui_get_glyph_overhangs,
@@ -13314,6 +13234,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
   terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar;
   terminal->judge_scroll_bars_hook = XTjudge_scroll_bars;
   terminal->get_string_resource_hook = x_get_string_resource;
+  terminal->free_pixmap = x_free_pixmap;
   terminal->delete_frame_hook = x_destroy_window;
   terminal->delete_terminal_hook = x_delete_terminal;
   /* Other hooks are NULL by default.  */
diff --git a/src/xterm.h b/src/xterm.h
index 266a42a..ce1443c 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -725,13 +725,12 @@ struct x_output
 #ifdef USE_CAIRO
   /* Cairo drawing context.  */
   cairo_t *cr_context;
-  /* Cairo surface for double buffering */
-  cairo_surface_t *cr_surface;
+  /* Width and height reported by the last ConfigureNotify event.
+     They are used when creating the cairo surface next time.  */
+  int cr_surface_desired_width, cr_surface_desired_height;
 #endif
 };
 
-#define No_Cursor (None)
-
 enum
 {
   /* Values for focus_state, used as bit mask.
@@ -1107,6 +1106,7 @@ extern int x_dispatch_event (XEvent *, Display *);
 #endif
 extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
 #ifdef USE_CAIRO
+extern void x_cr_destroy_frame_context (struct frame *);
 extern cairo_t *x_begin_cr_clip (struct frame *, GC);
 extern void x_end_cr_clip (struct frame *);
 extern void x_set_cr_source_with_gc_foreground (struct frame *, GC);
@@ -1222,7 +1222,8 @@ extern void destroy_frame_xic (struct frame *);
 extern void xic_set_preeditarea (struct window *, int, int);
 extern void xic_set_statusarea (struct frame *);
 extern void xic_set_xfontset (struct frame *, const char *);
-extern bool x_defined_color (struct frame *, const char *, XColor *, bool, 
bool);
+extern bool x_defined_color (struct frame *, const char *, Emacs_Color *,
+                             bool, bool);
 #ifdef HAVE_X_I18N
 extern void free_frame_xic (struct frame *);
 # if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
@@ -1261,15 +1262,6 @@ extern void x_session_close (void);
 
 #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
 
-#define STORE_XCHAR2B(chp, b1, b2) \
-  ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
-
-#define XCHAR2B_BYTE1(chp) \
-  ((chp)->byte1)
-
-#define XCHAR2B_BYTE2(chp) \
-  ((chp)->byte2)
-
 #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight)     \
   ((nr).x = (rx),                                      \
    (nr).y = (ry),                                      \
diff --git a/test/Makefile.in b/test/Makefile.in
index ec20a42..c180995 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -254,8 +254,6 @@ else
 FPIC_CFLAGS = -fPIC
 endif
 
-HYBRID_MALLOC = @HYBRID_MALLOC@
-LIBEGNU_ARCHIVE = ../lib/lib$(if $(HYBRID_MALLOC),e)gnu.a
 GMP_LIB = @GMP_LIB@
 GMP_OBJ = $(if @GMP_OBJ@, ../src/@GMP_OBJ@)
 
@@ -266,11 +264,16 @@ MODULE_CFLAGS = -I../src -I$(srcdir)/../lib \
   $(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 
$(LIBEGNU_ARCHIVE)
+src/emacs-module-tests.log src/emacs-module-tests.elc: $(test_module)
+
+# In the compilation command, we can't use any object or archive file
+# as source because those are not compiled with -fPIC.  Therefore we
+# use only source files.
+$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h
        $(AM_V_at)${MKDIR_P} $(dir $@)
        $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \
-         -o $@ $< $(LIBEGNU_ARCHIVE) $(GMP_LIB) $(GMP_OBJ)
+         -o $@ $< $(GMP_LIB) $(GMP_OBJ:.o=.c) \
+         $(srcdir)/../lib/timespec.c $(srcdir)/../lib/gettime.c
 endif
 
 ## Check that there is no 'automated' subdirectory, which would
diff --git a/test/data/emacs-module/mod-test.c 
b/test/data/emacs-module/mod-test.c
index b7007bd..2891b73 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -19,7 +19,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include "config.h"
 
+#undef NDEBUG
 #include <assert.h>
+
 #include <errno.h>
 #include <limits.h>
 #include <stdio.h>
@@ -316,16 +318,6 @@ Fmod_test_invalid_finalizer (emacs_env *env, ptrdiff_t 
nargs, emacs_value *args,
 }
 
 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);
@@ -345,16 +337,10 @@ 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]);
+  const struct timespec until = env->extract_time (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)
     {
@@ -393,7 +379,11 @@ Fmod_test_nanoseconds (emacs_env *env, ptrdiff_t nargs, 
emacs_value *args, void
   struct emacs_mpz nanoseconds;
   assert (LONG_MIN <= time.tv_sec && time.tv_sec <= LONG_MAX);
   mpz_init_set_si (nanoseconds.value, time.tv_sec);
+#ifdef __MINGW32__
+  _Static_assert (1000000000 <= ULONG_MAX, "unsupported architecture");
+#else
   static_assert (1000000000 <= ULONG_MAX, "unsupported architecture");
+#endif
   mpz_mul_ui (nanoseconds.value, nanoseconds.value, 1000000000);
   assert (0 <= time.tv_nsec && time.tv_nsec <= ULONG_MAX);
   mpz_add_ui (nanoseconds.value, nanoseconds.value, time.tv_nsec);
@@ -445,6 +435,11 @@ bind_function (emacs_env *env, const char *name, 
emacs_value Sfun)
 int
 emacs_module_init (struct emacs_runtime *ert)
 {
+  /* Check that EMACS_MAJOR_VERSION is defined and an integral
+     constant.  */
+  char dummy[EMACS_MAJOR_VERSION];
+  assert (27 <= sizeof dummy);
+
   if (ert->size < sizeof *ert)
     {
       fprintf (stderr, "Runtime size of runtime structure (%"pT" bytes) "
diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el
index 6e8219d..5024a2d 100644
--- a/test/lisp/autorevert-tests.el
+++ b/test/lisp/autorevert-tests.el
@@ -1,4 +1,4 @@
-;;; auto-revert-tests.el --- Tests of auto-revert
+;;; auto-revert-tests.el --- Tests of auto-revert   -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
@@ -19,6 +19,33 @@
 
 ;;; Commentary:
 
+;; Some of the tests require access to a remote host files.  Since
+;; this could be problematic, a mock-up connection method "mock" is
+;; used.  Emulating a remote connection, it simply calls "sh -i".
+;; Tramp's file name handlers still run, so this test is sufficient
+;; except for connection establishing.
+
+;; If you want to test a real Tramp connection, set
+;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to
+;; overwrite the default value.  If you want to skip tests accessing a
+;; 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 
`auto-revert-test-all'.
 
 ;;; Code:
@@ -26,8 +53,14 @@
 (require 'ert)
 (require 'ert-x)
 (require 'autorevert)
-(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
-      auto-revert-stop-on-user-input nil)
+(require 'tramp)
+
+(setq auto-revert-debug nil
+      auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
+      auto-revert-stop-on-user-input nil
+      file-notify-debug nil
+      tramp-verbose 0
+      tramp-message-show-message nil)
 
 (defconst auto-revert--timeout 10
   "Time to wait for a message.")
@@ -35,19 +68,90 @@
 (defvar auto-revert--messages nil
   "Used to collect messages issued during a section of a test.")
 
+;; There is no default value on w32 systems, which could work out of the box.
+(defconst auto-revert-test-remote-temporary-file-directory
+  (cond
+   ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY"))
+   ((eq system-type 'windows-nt) null-device)
+   (t (add-to-list
+       'tramp-methods
+       '("mock"
+        (tramp-login-program        "sh")
+        (tramp-login-args           (("-i")))
+        (tramp-remote-shell         "/bin/sh")
+        (tramp-remote-shell-args    ("-c"))
+        (tramp-connection-timeout   10)))
+      (add-to-list
+       'tramp-default-host-alist
+       `("\\`mock\\'" nil ,(system-name)))
+      ;; Emacs' Makefile sets $HOME to a nonexistent value.  Needed in
+      ;; batch mode only, therefore.  `temporary-file-directory' might
+      ;; be quoted, so we unquote it just in case.
+      (unless (and (null noninteractive) (file-directory-p "~/"))
+        (setenv "HOME" (file-name-unquote temporary-file-directory)))
+      (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 auto-revert--test-enabled-remote-checked nil
+  "Cached result of `auto-revert--test-enabled-remote'.
+If the function did run, the value is a cons cell, the `cdr'
+being the result.")
+
+(defun auto-revert--test-enabled-remote ()
+  "Whether remote file access is enabled."
+  (unless (consp auto-revert--test-enabled-remote-checked)
+    (setq
+     auto-revert--test-enabled-remote-checked
+     (cons
+      t (ignore-errors
+         (and
+          (file-remote-p auto-revert-test-remote-temporary-file-directory)
+          (file-directory-p auto-revert-test-remote-temporary-file-directory)
+          (file-writable-p
+            auto-revert-test-remote-temporary-file-directory))))))
+  ;; Return result.
+  (cdr auto-revert--test-enabled-remote-checked))
+
 (defun auto-revert--wait-for-revert (buffer)
   "Wait until a message reports reversion of BUFFER.
 This expects `auto-revert--messages' to be bound by
 `ert-with-message-capture' before calling."
-  (with-timeout (auto-revert--timeout nil)
-    (while
-        (null (string-match
-               (format-message "Reverting buffer `%s'." (buffer-name buffer))
-               auto-revert--messages))
+  ;; Remote files do not cooperate well with timers.  So we count ourselves.
+  (let ((ct (current-time)))
+    (while (and (< (float-time (time-subtract (current-time) ct))
+                   auto-revert--timeout)
+                (null (string-match
+                       (format-message
+                        "Reverting buffer `%s'\\." (buffer-name buffer))
+                       auto-revert--messages)))
       (if (with-current-buffer buffer auto-revert-use-notify)
           (read-event nil nil 0.1)
         (sleep-for 0.1)))))
 
+(defmacro auto-revert--deftest-remote (test docstring)
+  "Define ert `TEST-remote' for remote files."
+  (declare (indent 1))
+  `(ert-deftest ,(intern (concat (symbol-name test) "-remote")) ()
+     ,docstring
+     :tags '(:expensive-test)
+     (let ((temporary-file-directory
+           auto-revert-test-remote-temporary-file-directory)
+           (auto-revert-remote-files t)
+          (ert-test (ert-get-test ',test))
+           vc-handled-backends)
+       (skip-unless (auto-revert--test-enabled-remote))
+       (tramp-cleanup-connection
+       (tramp-dissect-file-name temporary-file-directory) nil 'keep-password)
+       (condition-case err
+           (funcall (ert-test-body ert-test))
+         (error (message "%s" err) (signal (car err) (cdr err)))))))
+
 (ert-deftest auto-revert-test00-auto-revert-mode ()
   "Check autorevert for a file."
   ;; `auto-revert-buffers' runs every 5".  And we must wait, until the
@@ -93,13 +197,16 @@ This expects `auto-revert--messages' to be bound by
         (kill-buffer buf))
       (ignore-errors (delete-file tmpfile)))))
 
+(auto-revert--deftest-remote auto-revert-test00-auto-revert-mode
+  "Check autorevert for a remote file.")
+
 ;; This is inspired by Bug#21841.
 (ert-deftest auto-revert-test01-auto-revert-several-files ()
   "Check autorevert for several files at once."
   :tags '(:expensive-test)
-  (skip-unless (executable-find "cp"))
+  (skip-unless (executable-find "cp" (file-remote-p temporary-file-directory)))
 
-  (let* ((cp (executable-find "cp"))
+  (let* ((cp (executable-find "cp" (file-remote-p temporary-file-directory)))
          (tmpdir1 (make-temp-file "auto-revert-test" 'dir))
          (tmpdir2 (make-temp-file "auto-revert-test" 'dir))
          (tmpfile1
@@ -139,7 +246,9 @@ This expects `auto-revert--messages' to be bound by
           ;; Strange, that `copy-directory' does not work as expected.
           ;; The following shell command is not portable on all
           ;; platforms, unfortunately.
-          (shell-command (format "%s -f %s/* %s" cp tmpdir2 tmpdir1))
+          (shell-command
+           (format "%s -f %s/* %s"
+                   cp (file-local-name tmpdir2) (file-local-name tmpdir1)))
 
           ;; Check, that the buffers have been reverted.
           (dolist (buf (list buf1 buf2))
@@ -155,6 +264,9 @@ This expects `auto-revert--messages' to be bound by
       (ignore-errors (delete-directory tmpdir1 'recursive))
       (ignore-errors (delete-directory tmpdir2 'recursive)))))
 
+(auto-revert--deftest-remote auto-revert-test01-auto-revert-several-files
+  "Check autorevert for several remote files at once.")
+
 ;; This is inspired by Bug#23276.
 (ert-deftest auto-revert-test02-auto-revert-deleted-file ()
   "Check autorevert for a deleted file."
@@ -185,8 +297,8 @@ This expects `auto-revert--messages' to be bound by
             (add-hook
              'before-revert-hook
              (lambda ()
-               ;; Temporarily.
-               (message "%s deleted" buffer-file-name)
+               (when auto-revert-debug
+                 (message "%s deleted" buffer-file-name))
                (delete-file buffer-file-name))
              nil t)
 
@@ -198,8 +310,9 @@ This expects `auto-revert--messages' to be bound by
             ;; notification should be disabled, falling back to
             ;; polling.
             (should (string-match "any text" (buffer-string)))
-            ;; With w32notify, the 'stopped' events are not sent.
+            ;; With w32notify, and on emba, the `stopped' events are not sent.
             (or (eq file-notify--library 'w32notify)
+                (getenv "EMACS_EMBA_CI")
                 (should-not auto-revert-notify-watch-descriptor))
 
             ;; Once the file has been recreated, the buffer shall be
@@ -231,6 +344,9 @@ This expects `auto-revert--messages' to be bound by
         (kill-buffer buf))
       (ignore-errors (delete-file tmpfile)))))
 
+(auto-revert--deftest-remote auto-revert-test02-auto-revert-deleted-file
+  "Check autorevert for a deleted remote file.")
+
 (ert-deftest auto-revert-test03-auto-revert-tail-mode ()
   "Check autorevert tail mode."
   ;; `auto-revert-buffers' runs every 5".  And we must wait, until the
@@ -266,6 +382,9 @@ This expects `auto-revert--messages' to be bound by
       (ignore-errors (kill-buffer buf))
       (ignore-errors (delete-file tmpfile)))))
 
+(auto-revert--deftest-remote auto-revert-test03-auto-revert-tail-mode
+  "Check remote autorevert tail mode.")
+
 (ert-deftest auto-revert-test04-auto-revert-mode-dired ()
   "Check autorevert for dired."
   ;; `auto-revert-buffers' runs every 5".  And we must wait, until the
@@ -314,6 +433,114 @@ This expects `auto-revert--messages' to be bound by
         (kill-buffer buf))
       (ignore-errors (delete-file tmpfile)))))
 
+(auto-revert--deftest-remote auto-revert-test04-auto-revert-mode-dired
+  "Check remote autorevert for dired.")
+
+(defun auto-revert-test--write-file (string file)
+  "Write STRING to FILE."
+  (write-region string nil file nil 'no-message))
+
+(defun auto-revert-test--buffer-string (buffer)
+  "Contents of BUFFER as a string."
+  (with-current-buffer buffer
+    (buffer-string)))
+
+(defun auto-revert-test--wait-for (pred max-wait)
+  "Wait until PRED is true, or MAX-WAIT seconds elapsed."
+  (let ((ct (current-time)))
+    (while (and (< (float-time (time-subtract (current-time) ct)) max-wait)
+                (not (funcall pred)))
+      (read-event nil nil 0.1))))
+
+(defun auto-revert-test--wait-for-buffer-text (buffer string max-wait)
+  "Wait until BUFFER has the contents STRING, or MAX-WAIT seconds elapsed."
+  (auto-revert-test--wait-for
+   (lambda () (string-equal (auto-revert-test--buffer-string buffer) string))
+   max-wait))
+
+(ert-deftest auto-revert-test05-global-notify ()
+  "Test `global-auto-revert-mode' without polling."
+  :tags '(:expensive-test)
+  (skip-unless (or file-notify--library
+                   (file-remote-p temporary-file-directory)))
+  (let* ((auto-revert-use-notify t)
+         (auto-revert-avoid-polling t)
+         (was-in-global-auto-revert-mode global-auto-revert-mode)
+         (file-1 (make-temp-file "global-auto-revert-test-1"))
+         (file-2 (make-temp-file "global-auto-revert-test-2"))
+         (file-3 (make-temp-file "global-auto-revert-test-3"))
+         (file-2b (concat file-2 "-b"))
+         buf-1 buf-2 buf-3)
+    (unwind-protect
+        (progn
+          (setq buf-1 (find-file-noselect file-1))
+          (setq buf-2 (find-file-noselect file-2))
+          (auto-revert-test--write-file "1-a" file-1)
+          (should (equal (auto-revert-test--buffer-string buf-1) ""))
+
+          (global-auto-revert-mode 1)   ; Turn it on.
+
+          (should (buffer-local-value
+                   'auto-revert-notify-watch-descriptor buf-1))
+          (should (buffer-local-value
+                   'auto-revert-notify-watch-descriptor buf-2))
+
+          ;; buf-1 should have been reverted immediately when the mode
+          ;; was enabled.
+          (should (equal (auto-revert-test--buffer-string buf-1) "1-a"))
+
+          ;; Alter a file.
+          (auto-revert-test--write-file "2-a" file-2)
+          ;; Allow for some time to handle notification events.
+          (auto-revert-test--wait-for-buffer-text buf-2 "2-a" 1)
+          (should (equal (auto-revert-test--buffer-string buf-2) "2-a"))
+
+          ;; Visit a file, and modify it on disk.
+          (setq buf-3 (find-file-noselect file-3))
+          ;; Newly opened buffers won't be use notification until the
+          ;; first poll cycle; wait for it.
+          (auto-revert-test--wait-for
+           (lambda () (buffer-local-value
+                       'auto-revert-notify-watch-descriptor buf-3))
+           (+ auto-revert-interval 1))
+          (should (buffer-local-value
+                   'auto-revert-notify-watch-descriptor buf-3))
+          (auto-revert-test--write-file "3-a" file-3)
+          (auto-revert-test--wait-for-buffer-text buf-3 "3-a" 1)
+          (should (equal (auto-revert-test--buffer-string buf-3) "3-a"))
+
+          ;; Delete a visited file, and re-create it with new contents.
+          (delete-file file-1)
+          (sleep-for 0.5)
+          (should (equal (auto-revert-test--buffer-string buf-1) "1-a"))
+          (auto-revert-test--write-file "1-b" file-1)
+          (auto-revert-test--wait-for-buffer-text buf-1 "1-b"
+           (+ auto-revert-interval 1))
+          (should (buffer-local-value
+                   'auto-revert-notify-watch-descriptor buf-1))
+
+          ;; Write a buffer to a new file, then modify the new file on disk.
+          (with-current-buffer buf-2
+            (write-file file-2b))
+          (should (equal (auto-revert-test--buffer-string buf-2) "2-a"))
+          (auto-revert-test--write-file "2-b" file-2b)
+          (auto-revert-test--wait-for-buffer-text buf-2 "2-b"
+           (+ auto-revert-interval 1))
+          (should (buffer-local-value
+                   'auto-revert-notify-watch-descriptor buf-2)))
+
+      ;; Clean up.
+      (unless was-in-global-auto-revert-mode
+        (global-auto-revert-mode 0))    ; Turn it off.
+      (dolist (buf (list buf-1 buf-2 buf-3))
+        (ignore-errors (kill-buffer buf)))
+      (dolist (file (list file-1 file-2 file-2b file-3))
+        (ignore-errors (delete-file file)))
+      )))
+
+(auto-revert--deftest-remote auto-revert-test04-auto-revert-mode-dired
+  "Test `global-auto-revert-mode' without polling for remote buffers.")
+
 (defun auto-revert-test-all (&optional interactive)
   "Run all tests for \\[auto-revert]."
   (interactive "p")
diff --git a/test/lisp/delim-col-tests.el b/test/lisp/delim-col-tests.el
new file mode 100644
index 0000000..f2a0377
--- /dev/null
+++ b/test/lisp/delim-col-tests.el
@@ -0,0 +1,181 @@
+;;; delim-col-tests.el --- Tests for delim-col.el  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <address@hidden>
+
+;; 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:
+
+(require 'ert)
+(require 'delim-col)
+
+(ert-deftest delim-col-tests-delimit-columns ()
+  (with-temp-buffer
+    (insert "a b       c\n")
+    (delimit-columns-region (point-min) (point-max))
+    (should (equal (buffer-string) "a, b, c\n")))
+  (with-temp-buffer
+    (insert "a b       c       d\n"
+            "aaaa      bb      ccc     ddddd\n"
+            "aaa       bbb     cccc    dddd\n"
+            "aa        bb      ccccccc ddd\n")
+    (delimit-columns-region (point-min) (point-max))
+    (should (equal (buffer-string)
+                   (concat "a,    b,   c,       d    \n"
+                           "aaaa, bb,  ccc,     ddddd\n"
+                           "aaa,  bbb, cccc,    dddd \n"
+                           "aa,   bb,  ccccccc, ddd  \n")))))
+
+(ert-deftest delim-col-tests-delimit-rectangle ()
+  (with-temp-buffer
+    (insert "a b       c       d\n"
+            "aaaa      bb      ccc     ddddd\n"
+            "aaa       bbb     cccc    dddd\n"
+            "aa        bb      ccccccc ddd\n")
+    (delimit-columns-rectangle 3 58) ; from first b to last c
+    (should (equal (buffer-string)
+                   (concat "a  b,   c          d\n"
+                           "aaaa       bb,  ccc        ddddd\n"
+                           "aaa        bbb, cccc       dddd\n"
+                           "aa bb,  ccccccc    ddd\n")))))
+
+(ert-deftest delim-col-tests-delimit-columns-str-separator ()
+  (let ((delimit-columns-str-separator ":"))
+    (with-temp-buffer
+      (insert "a       b\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string) "a:b\n")))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aa      bb      cc      dd\n")
+      (delimit-columns-rectangle 3 16) ; from first b to last c
+      (should (equal (buffer-string)
+                     (concat "a        b: c    d\n"
+                             "aa       bb:cc   dd\n"))))))
+
+(ert-deftest delim-col-tests-delimit-columns-str-before-after ()
+  (let ((delimit-columns-str-before "[ ")
+        (delimit-columns-str-after " ]"))
+    (with-temp-buffer
+      (insert "a       b       c\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string) "[ a, b, c ]\n")))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aaaa    bb      ccc     ddddd\n"
+              "aaa     bbb     cccc    dddd\n"
+              "aa      bb      ccccccc ddd\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string)
+                     (concat "[ a,    b,   c,       d     ]\n"
+                             "[ aaaa, bb,  ccc,     ddddd ]\n"
+                             "[ aaa,  bbb, cccc,    dddd  ]\n"
+                             "[ aa,   bb,  ccccccc, ddd   ]\n"))))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aaaa    bb      ccc     ddddd\n"
+              "aaa     bbb     cccc    dddd\n"
+              "aa      bb      ccccccc ddd\n")
+     (delimit-columns-rectangle 3 58)   ; from first b to last c
+     (should (equal (buffer-string)
+                    (concat "a [ b,   c       ]        d\n"
+                            "aaaa      [ bb,  ccc     ]        ddddd\n"
+                            "aaa       [ bbb, cccc    ]        dddd\n"
+                            "aa        [ bb,  ccccccc ]        ddd\n"))))))
+
+(ert-deftest delim-col-tests-delimit-colummns-before-after ()
+  (let ((delimit-columns-before "<")
+        (delimit-columns-after ">"))
+    (with-temp-buffer
+      (insert "a       b\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string) "<a>, <b>\n")))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aa      bb      cc      dd\n")
+      (delimit-columns-rectangle 3 17)
+      (should (equal (buffer-string)
+                     (concat "a        <b>,  <c>       d\n"
+                             "aa       <bb>, <cc>      dd\n"))))))
+
+(ert-deftest delim-col-tests-delimit-columns-separator ()
+  (let ((delimit-columns-separator ","))
+    (with-temp-buffer
+      (insert "a,b,c\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string) "a, b, c\n")))))
+
+(ert-deftest delim-col-tests-delimit-columns-format/nil ()
+  (let ((delimit-columns-format nil))
+    (with-temp-buffer
+      (insert "a       b\n"
+              "aa      bb\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string)
+                     (concat "a, b\n"
+                             "aa, bb\n"))))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aa      bb      cc      dd\n")
+      (delimit-columns-rectangle 3 17) ; from first b to last c
+      (should (equal (buffer-string)
+                     (concat "a        b, c    d\n"
+                             "aa       bb, cc  dd\n"))))))
+
+(ert-deftest delim-col-tests-delimit-columns-format/separator ()
+  (let ((delimit-columns-format 'separator)
+        (delimit-columns-before "<")
+        (delimit-columns-after ">"))
+    (with-temp-buffer
+      (insert "a       b\n"
+              "aa      bb\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string)
+                     (concat "<a> , <b> \n"
+                             "<aa>, <bb>\n"))))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aa      bb      cc      dd\n")
+      (delimit-columns-rectangle 3 17) ; from first b to last c
+      (should (equal (buffer-string)
+                     (concat "a        <b> , <c>       d\n"
+                             "aa       <bb>, <cc>      dd\n"))))))
+
+(ert-deftest delim-col-tests-delimit-columns-format/padding ()
+  (let ((delimit-columns-format 'padding)
+        (delimit-columns-before "<")
+        (delimit-columns-after ">"))
+    (with-temp-buffer
+      (insert "a       b\n"
+              "aa      bb\n")
+      (delimit-columns-region (point-min) (point-max))
+      (should (equal (buffer-string)
+                     (concat "<a >, <b >\n"
+                             "<aa>, <bb>\n"))))
+    (with-temp-buffer
+      (insert "a       b       c       d\n"
+              "aa      bb      cc      dd\n")
+      (delimit-columns-rectangle 3 17)  ; from first b to last c
+      (should (equal (buffer-string)
+                     (concat "a        <b >, <c >      d\n"
+                             "aa       <bb>, <cc>      dd\n"))))))
+
+(provide 'delim-col-tests)
+;;; delim-col-tests.el ends here
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el 
b/test/lisp/emacs-lisp/cl-macs-tests.el
index 989553b..09ce660 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -513,4 +513,21 @@ collection clause."
    (macroexpand '(cl-defstruct (hash-table (:predicate hash-table-p))))
    :type 'wrong-type-argument))
 
+(ert-deftest cl-macs-test--symbol-macrolet ()
+  ;; A `setq' shouldn't be converted to a `setf' just because it occurs within
+  ;; a symbol-macrolet!
+  (should-error
+   ;; Use `eval' so the error is signaled when running the test rather than
+   ;; when macroexpanding it.
+   (eval '(let ((l (list 1))) (cl-symbol-macrolet ((x 1)) (setq (car l) 0)))))
+  ;; Make sure `gv-synthetic-place' isn't macro-expanded before `setf' gets to
+  ;; see its `gv-expander'.
+  (should (equal (let ((l '(0)))
+                   (let ((cl (car l)))
+                     (cl-symbol-macrolet
+                         ((p (gv-synthetic-place cl (lambda (v) `(setcar l 
,v)))))
+                       (cl-incf p)))
+                   l)
+                 '(1))))
+
 ;;; cl-macs-tests.el ends here
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index ea6df0f..e6a35c4 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -696,6 +696,17 @@ Do not override for `prot-2'."
   (setq eitest-II3 (clone eitest-II2 "eitest-II3 Test."))
   (oset eitest-II3 slot3 'penguin)
 
+  ;; Test that slots are non-initialized slots are unbounded
+  (oref eitest-II2 slot1)
+  (should (slot-boundp eitest-II2 'slot1))
+  (should-not (slot-boundp eitest-II2 'slot2))
+  (should-not (slot-boundp eitest-II2 'slot3))
+  (should-not (slot-boundp eitest-II3 'slot2))
+  (should-not (slot-boundp eitest-II3 'slot1))
+  (should-not (slot-boundp eitest-II3 'slot2))
+  (should (eieio-instance-inheritor-slot-boundp eitest-II3 'slot2))
+  (should (slot-boundp eitest-II3 'slot3))
+
   ;; Test level 1 inheritance
   (should (eq (oref eitest-II3 slot1) 'moose))
   ;; Test level 2 inheritance
@@ -862,8 +873,7 @@ Subclasses to override slot attributes.")
     (should (oref obj1 a-slot))))
 
 (defclass NAMED (eieio-named)
-  ((some-slot :initform nil)
-   )
+  ((some-slot :initform nil))
   "A class inheriting from eieio-named.")
 
 (ert-deftest eieio-test-35-named-object ()
@@ -902,6 +912,48 @@ Subclasses to override slot attributes.")
   (should
    (fboundp 'eieio--defalias)))
 
+(ert-deftest eieio-test-38-clone-named-object ()
+  (let* ((A (NAMED :object-name "aa"))
+         (B (clone A :object-name "bb"))
+         (C (clone A "cc"))
+         (D (clone A))
+         (E (clone D)))
+    (should (string= "aa" (oref A object-name)))
+    (should (string= "bb" (oref B object-name)))
+    (should (string= "cc" (oref C object-name)))
+    (should (string= "aa-1" (oref D object-name)))
+    (should (string= "aa-2" (oref E object-name)))))
+
+(defclass TII (eieio-instance-inheritor)
+  ((a :initform 1 :initarg :a)
+   (b :initarg :b)
+   (c :initarg :c))
+  "Instance Inheritor test class.")
+
+(ert-deftest eieio-test-39-clone-instance-inheritor-with-args ()
+  (let* ((A (TII))
+         (B (clone A :b "bb"))
+         (C (clone B :a "aa")))
+
+    (should (string= "aa" (oref C :a)))
+    (should (string= "bb" (oref C :b)))
+
+    (should (slot-boundp A :a))
+    (should-not (slot-boundp A :b))
+    (should-not (slot-boundp A :c))
+
+    (should-not (slot-boundp B :a))
+    (should (slot-boundp B :b))
+    (should-not (slot-boundp A :c))
+
+    (should (slot-boundp C :a))
+    (should-not (slot-boundp C :b))
+    (should-not (slot-boundp C :c))
+
+    (should (eieio-instance-inheritor-slot-boundp C :a))
+    (should (eieio-instance-inheritor-slot-boundp C :b))
+    (should-not (eieio-instance-inheritor-slot-boundp C :c))))
+
 
 (provide 'eieio-tests)
 
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el 
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index a637074..6363244 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -136,6 +136,34 @@ noindent\" 3
     (indent-sexp)
     (should (equal (buffer-string) "(())"))))
 
+(ert-deftest indent-sexp-stop-before-eol-comment ()
+  "`indent-sexp' shouldn't look for more sexps after an eol comment."
+  ;; See https://debbugs.gnu.org/35286.
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (let ((str "() ;;\n  x"))
+      (insert str)
+      (goto-char (point-min))
+      (indent-sexp)
+      ;; The "x" is in the next sexp, so it shouldn't get indented.
+      (should (equal (buffer-string) str)))))
+
+(ert-deftest indent-sexp-stop-before-eol-non-lisp ()
+  "`indent-sexp' shouldn't be too agressive in non-Lisp modes."
+  ;; See https://debbugs.gnu.org/35286#13.
+  (with-temp-buffer
+    (prolog-mode)
+    (let ((str "\
+x(H) -->
+    {y(H)}.
+a(A) -->
+    b(A)."))
+      (insert str)
+      (search-backward "{")
+      (indent-sexp)
+      ;; There's no line-spanning sexp, so nothing should be indented.
+      (should (equal (buffer-string) str)))))
+
 (ert-deftest lisp-indent-region ()
   "Test basics of `lisp-indent-region'."
   (with-temp-buffer
diff --git a/test/lisp/emacs-lisp/map-tests.el 
b/test/lisp/emacs-lisp/map-tests.el
index a54af80..5e044d4 100644
--- a/test/lisp/emacs-lisp/map-tests.el
+++ b/test/lisp/emacs-lisp/map-tests.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index 4a5919e..6f392d6 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -107,7 +107,13 @@
                    "ab"))
     (should (equal (and (string-match (rx (or "a" "ab" "abc")) s)
                         (match-string 0 s))
-                   "a"))))
+                   "a")))
+  ;; Test zero-argument `or'.
+  (should (equal (rx (or)) regexp-unmatchable)))
+
+(ert-deftest rx-seq ()
+  ;; Test zero-argument `seq'.
+  (should (equal (rx (seq)) "")))
 
 (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 ef05e2b..8f66ba4 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/thunk-tests.el 
b/test/lisp/emacs-lisp/thunk-tests.el
index caa2c41..69bfc19 100644
--- a/test/lisp/emacs-lisp/thunk-tests.el
+++ b/test/lisp/emacs-lisp/thunk-tests.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index a40dc72..9dfa794 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -195,7 +195,8 @@ Return nil when any other file notification watch is still 
active."
         file-notify--test-events nil
         file-notify--test-monitors nil))
 
-(setq password-cache-expiry nil
+(setq file-notify-debug nil
+      password-cache-expiry nil
       tramp-verbose 0
       tramp-message-show-message nil)
 
@@ -515,8 +516,9 @@ and the event to `file-notify--test-events'."
     (unless (string-match
             (regexp-quote ".#")
             (file-notify--event-file-name file-notify--test-event))
-      ;;(message "file-notify--test-event-handler result: %s event: %S"
-               ;;(null (ert-test-failed-p result)) file-notify--test-event)
+      (when file-notify-debug
+        (message "file-notify--test-event-handler result: %s event: %S"
+                 (null (ert-test-failed-p result)) file-notify--test-event))
       (setq file-notify--test-events
            (append file-notify--test-events `(,file-notify--test-event))
            file-notify--test-results
@@ -680,17 +682,18 @@ delivered."
               (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))
              ;; On emba, `deleted' and `stopped' events of the
              ;; directory are not detected.
              ((getenv "EMACS_EMBA_CI")
               '(created changed deleted))
+            ;; There are two `deleted' events, for the file and for
+            ;; the directory.  Except for cygwin, kqueue and remote
+            ;; files.  And cygwin does not raise a `changed' event.
+            ((eq system-type 'cygwin)
+             '(created deleted stopped))
+            ((or (string-equal (file-notify--test-library) "kqueue")
+                 (file-remote-p temporary-file-directory))
+             '(created changed deleted stopped))
             (t '(created changed deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -740,6 +743,9 @@ delivered."
              ;; directory are not detected.
              ((getenv "EMACS_EMBA_CI")
               '(created changed created changed deleted deleted))
+             ;; Remote files return two `deleted' events.
+            ((file-remote-p temporary-file-directory)
+             '(created changed created changed deleted deleted stopped))
             (t '(created changed created changed
                  deleted deleted deleted stopped)))
          (write-region
@@ -784,18 +790,19 @@ delivered."
               (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 raises `created' and `deleted' events instead
-            ;; of a `renamed' event.
-            ((eq system-type 'cygwin)
-             '(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))
+            ;; There are two `deleted' events, for the file and for
+            ;; the directory.  Except for cygwin, kqueue and remote
+            ;; files.  And cygwin raises `created' and `deleted'
+            ;; events instead of a `renamed' event.
+            ((eq system-type 'cygwin)
+             '(created created deleted deleted stopped))
+            ((or (string-equal (file-notify--test-library) "kqueue")
+                 (file-remote-p temporary-file-directory))
+             '(created changed renamed deleted stopped))
             (t '(created changed renamed deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -1039,11 +1046,12 @@ delivered."
                '((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.
+              ;; the directory.  Except for cygwin, kqueue and remote
+              ;; files.  And cygwin does not raise a `changed' event.
               ((eq system-type 'cygwin)
                '(created deleted stopped))
-              ((string-equal (file-notify--test-library) "kqueue")
+              ((or (string-equal (file-notify--test-library) "kqueue")
+                   (file-remote-p temporary-file-directory))
                '(created changed deleted stopped))
               (t '(created changed deleted deleted stopped)))
            (write-region
@@ -1259,7 +1267,8 @@ delivered."
         (file-notify--test-with-events
             (cond
              ;; On cygwin we only get the `changed' event.
-             ((eq system-type 'cygwin) '(changed))
+             ((eq system-type 'cygwin)
+              '(changed))
              (t '(renamed created changed)))
           ;; The file is renamed when creating a backup.  It shall
           ;; still be watched.
@@ -1400,11 +1409,15 @@ the file watch."
                  (cond
                  ;; w32notify does not raise `deleted' and `stopped'
                  ;; events for the watched directory.
-                  ((string-equal (file-notify--test-library) "w32notify") '())
+                  ((string-equal (file-notify--test-library) "w32notify")
+                   '())
                   ;; On emba, `deleted' and `stopped' events of the
                   ;; directory are not detected.
                   ((getenv "EMACS_EMBA_CI")
                    '())
+                  ;; Remote files send just one `stopped' event.
+                  ((file-remote-p temporary-file-directory)
+                   '(stopped))
                   (t '(deleted stopped))))))
           (delete-directory file-notify--test-tmpfile 'recursive))
         (unless (getenv "EMACS_EMBA_CI")
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index ae8ea41..fe2e958 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1244,5 +1244,20 @@ See <https://debbugs.gnu.org/35241>."
                     (executable-find (file-name-nondirectory tmpfile))))))
       (delete-file tmpfile))))
 
+(ert-deftest files-tests-dont-rewrite-precious-files ()
+  "Test that `file-precious-flag' forces files to be saved by
+renaming only, rather than modified in-place."
+  (let* ((temp-file-name (make-temp-file "files-tests"))
+         (advice (lambda (_start _end filename &rest _r)
+                   (should-not (string= filename temp-file-name)))))
+    (unwind-protect
+        (with-current-buffer (find-file-noselect temp-file-name)
+          (advice-add #'write-region :before advice)
+          (setq-local file-precious-flag t)
+          (insert "foobar")
+          (should (null (save-buffer))))
+      (ignore-errors (advice-remove #'write-region advice))
+      (ignore-errors (delete-file temp-file-name)))))
+
 (provide 'files-tests)
 ;;; files-tests.el ends here
diff --git a/test/lisp/font-lock-tests.el b/test/lisp/font-lock-tests.el
new file mode 100644
index 0000000..5d12703
--- /dev/null
+++ b/test/lisp/font-lock-tests.el
@@ -0,0 +1,41 @@
+;;; font-lock-tests.el --- Test suite for font-lock. -*- lexical-binding: t -*-
+
+;; Copyright (C) 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/>.
+
+;;; Code:
+(require 'ert)
+
+(ert-deftest font-lock-test-append-anonymous-face ()
+  "Ensure `font-lock-append-text-property' does not splice anonymous faces."
+  (with-temp-buffer
+    (insert "foo")
+    (add-text-properties 1 3 '(face italic))
+    (font-lock-append-text-property 1 3 'face '(:strike-through t))
+    (should (equal (get-text-property 1 'face (current-buffer))
+                   '(italic (:strike-through t))))))
+
+(ert-deftest font-lock-test-prepend-anonymous-face ()
+  "Ensure `font-lock-prepend-text-property' does not splice anonymous faces."
+  (with-temp-buffer
+    (insert "foo")
+    (add-text-properties 1 3 '(face italic))
+    (font-lock-prepend-text-property 1 3 'face '(:strike-through t))
+    (should (equal (get-text-property 1 'face (current-buffer))
+                   '((:strike-through t) italic)))))
+
+;; font-lock-tests.el ends here
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index e31ac6a..2e94830 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/test/lisp/image-file-tests.el b/test/lisp/image-file-tests.el
new file mode 100644
index 0000000..b3676d1
--- /dev/null
+++ b/test/lisp/image-file-tests.el
@@ -0,0 +1,44 @@
+;;; image-file-tests.el --- Test suite for image-files  -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 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/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+(require 'image-file)
+
+(defconst image-file-tests-data-directory
+  (expand-file-name "data/image" (getenv "EMACS_TEST_DIRECTORY"))
+  "Directory containing image test data.")
+
+(ert-deftest insert-image-file ()
+  (skip-unless (image-type-available-p 'png))
+  (with-temp-buffer
+    (set-buffer-multibyte t)
+    (insert-image-file (expand-file-name "blank-100x200.png"
+                                         image-file-tests-data-directory))
+    (should (image--get-image)))
+  (with-temp-buffer
+    (set-buffer-multibyte nil)
+    (insert-image-file (expand-file-name "blank-100x200.png"
+                                         image-file-tests-data-directory))
+    (should (image--get-image))))
+
+;;; image-file-tests.el ends here
diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el
index 89b926e..621646e 100644
--- a/test/lisp/image-tests.el
+++ b/test/lisp/image-tests.el
@@ -22,6 +22,10 @@
 (require 'ert)
 (require 'image)
 
+(defconst image-tests--emacs-images-directory
+  (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY"))
+  "Directory containing Emacs images.")
+
 (ert-deftest image--set-property ()
   "Test `image--set-property' behavior."
   (let ((image (list 'image)))
@@ -42,4 +46,11 @@
     (setf (image-property image :width) nil)
     (should (equal image '(image)))))
 
+(ert-deftest image-type-from-file-header-test ()
+  "Test image-type-from-file-header."
+  (should (eq 'svg
+             (image-type-from-file-header
+              (expand-file-name "splash.svg"
+                                image-tests--emacs-images-directory)))))
+
 ;;; image-tests.el ends here
diff --git a/test/lisp/mail/footnote-tests.el b/test/lisp/mail/footnote-tests.el
new file mode 100644
index 0000000..464443f
--- /dev/null
+++ b/test/lisp/mail/footnote-tests.el
@@ -0,0 +1,47 @@
+;;; footnote-tests.el --- Tests for footnote-mode    -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2019  Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <address@hidden>
+;; Keywords:
+
+;; 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:
+
+(ert-deftest footnote-tests-same-place ()
+  (with-temp-buffer
+    (footnote-mode 1)
+    (insert "hello world")
+    (beginning-of-line) (forward-word)
+    (footnote-add-footnote)
+    (insert "footnote")
+    (footnote-back-to-message)
+    (should (equal (buffer-substring (point-min) (point))
+                   "hello[1]"))
+    (beginning-of-line) (forward-word)
+    (footnote-add-footnote)
+    (insert "other footnote")
+    (footnote-back-to-message)
+    (should (equal (buffer-substring (point-min) (point))
+                   "hello[1]"))
+    (should (equal (buffer-substring (point-min) (line-end-position))
+                   "hello[1][2] world"))))
+
+(provide 'footnote-tests)
+;;; footnote-tests.el ends here
diff --git a/test/lisp/md4-tests.el b/test/lisp/md4-tests.el
index 9712411..56b09c1 100644
--- a/test/lisp/md4-tests.el
+++ b/test/lisp/md4-tests.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 4495a1f..5fc37c1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -41,6 +41,7 @@
 
 ;;; Code:
 
+(require 'cl-lib)
 (require 'dired)
 (require 'ert)
 (require 'ert-x)
@@ -2270,6 +2271,37 @@ This checks also `file-name-as-directory', 
`file-name-directory',
        ;; Cleanup.
        (ignore-errors (delete-file tmp-name))))))
 
+;; The following test is inspired by Bug#35497.
+(ert-deftest tramp-test10-write-region-file-precious-flag ()
+  "Check that `file-precious-flag' is respected with Tramp in use."
+  (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-sh-p))
+  ;; The bug is fixed in Emacs 27.1.
+  (skip-unless (tramp--test-emacs27-p))
+
+  (let* ((tmp-name (tramp--test-make-temp-name))
+         written-files
+         (advice (lambda (_start _end filename &rest _r)
+                   (push filename written-files))))
+
+    (unwind-protect
+        (with-current-buffer (find-file-noselect tmp-name)
+          ;; Write initial contents.  Adapt `visited-file-modtime'
+          ;; in order to suppress confirmation.
+          (insert "foo")
+          (write-region nil nil tmp-name)
+          (set-visited-file-modtime)
+          ;; Run the test.
+          (advice-add 'write-region :before advice)
+          (setq-local file-precious-flag t)
+          (insert "bar")
+          (should (null (save-buffer)))
+          (should-not (cl-member tmp-name written-files :test #'string=)))
+
+      ;; Cleanup.
+      (ignore-errors (advice-remove 'write-region advice))
+      (ignore-errors (delete-file tmp-name)))))
+
 (ert-deftest tramp-test11-copy-file ()
   "Check `copy-file'."
   (skip-unless (tramp--test-enabled))
@@ -2762,7 +2794,9 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
            ;; returns `file-missing'.
            (delete-directory tmp-name1 'recursive)
            (with-temp-buffer
-             (should-error (insert-directory tmp-name1 nil))))
+             (should-error
+              (insert-directory tmp-name1 nil)
+              :type tramp-file-missing)))
 
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
@@ -3846,6 +3880,10 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
 (defun tramp--test-timeout-handler (&rest _ignore)
   "Timeout handler, reporting a failed test."
   (interactive)
+  (let ((proc (get-buffer-process (current-buffer))))
+    (when (processp proc)
+      (tramp--test-message
+       "cmd: %s\n%s" (process-command proc) (buffer-string))))
   (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
 
 (ert-deftest tramp-test29-start-file-process ()
@@ -3926,7 +3964,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
-  ;; `make-process' supports file name handlers since Emacs 27.
+  ;; `make-process' has been inserted in Emacs 25.1.  It supports file
+  ;; name handlers since Emacs 27.
   (skip-unless (tramp--test-emacs27-p))
 
   (tramp--test-instrument-test-case 0
@@ -3934,15 +3973,16 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
     (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))
+      (should-not (with-no-warnings (make-process)))
 
       ;; Simple process.
       (unwind-protect
          (with-temp-buffer
            (setq proc
-                 (make-process
-                  :name "test1" :buffer (current-buffer) :command '("cat")
-                  :file-handler t))
+                 (with-no-warnings
+                   (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")
@@ -3964,10 +4004,11 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
            (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))
+                 (with-no-warnings
+                   (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))
@@ -3984,12 +4025,13 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
       (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))
+                 (with-no-warnings
+                   (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")
@@ -4009,12 +4051,13 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
       (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))
+                 (with-no-warnings
+                   (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")
@@ -4037,11 +4080,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
          (unwind-protect
              (with-temp-buffer
                (setq proc
-                     (make-process
-                      :name "test5" :buffer (current-buffer)
-                      :command '("cat" "/")
-                      :stderr stderr
-                      :file-handler t))
+                     (with-no-warnings
+                       (make-process
+                        :name "test5" :buffer (current-buffer)
+                        :command '("cat" "/")
+                        :stderr stderr
+                        :file-handler t)))
                (should (processp proc))
                ;; Read stderr.
                (with-current-buffer stderr
@@ -4188,18 +4232,17 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-file tmp-name)))
 
-      ;; Test `shell-command-width' of `async-shell-command'.
-      ;; Since Emacs 27.1.
-      (when (and (boundp 'shell-command-width)
+      ;; Test `async-shell-command-width'.  Since Emacs 27.1.
+      (when (and (boundp 'async-shell-command-width)
                 (zerop (call-process "tput" nil nil nil "cols"))
                  (zerop (process-file "tput" nil nil nil "cols")))
-       (let (shell-command-width)
+       (let (async-shell-command-width)
          (should
           (string-equal
            (format "%s\n" (car (process-lines "tput" "cols")))
            (tramp--test-shell-command-to-string-asynchronously
             "tput cols")))
-         (setq shell-command-width 1024)
+         (setq async-shell-command-width 1024)
          (should
           (string-equal
            "1024\n"
@@ -5720,7 +5763,7 @@ Since it unloads Tramp, it shall be the last test to run."
          (ert-fail (format "`%s' still bound" x)))))
   ;; The defstruct `tramp-file-name' and all its internal functions
   ;; shall be purged.
-  (should-not (cl--find-class 'tramp-file-name))
+  (should-not (with-no-warnings (cl--find-class 'tramp-file-name)))
   (mapatoms
    (lambda (x)
      (and (functionp x)
diff --git a/test/lisp/nxml/nxml-mode-tests.el 
b/test/lisp/nxml/nxml-mode-tests.el
new file mode 100644
index 0000000..92744be
--- /dev/null
+++ b/test/lisp/nxml/nxml-mode-tests.el
@@ -0,0 +1,82 @@
+;;; nxml-mode-tests.el --- Test NXML Mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 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
+;; 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/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'nxml-mode)
+
+(defun nxml-mode-tests-correctly-indented-string (str)
+  (with-temp-buffer
+    (nxml-mode)
+    (insert str)
+    (indent-region (point-min) (point-max))
+    (equal (buffer-string) str)))
+
+(ert-deftest nxml-indent-line-after-attribute ()
+  (should (nxml-mode-tests-correctly-indented-string "
+<settings
+    xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\";
+    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";
+    xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0
+                        https://maven.apache.org/xsd/settings-1.0.0.xsd\";>
+  <mirrors>
+    ...
+  </mirrors>
+</settings>
+"))
+  (should (nxml-mode-tests-correctly-indented-string "\
+<x>
+  <abc xx=\"x/x/x/x/x/x/x/
+           y/y/y/y/y/y/
+           \">
+    <zzz/>
+  </abc>
+  <nl>&#10;</nl>
+</x>
+")))
+
+(ert-deftest nxml-balanced-close-start-tag-inline ()
+  (with-temp-buffer
+    (nxml-mode)
+    (insert "<a><b c=\"\"</a>")
+    (search-backward "</a>")
+    (nxml-balanced-close-start-tag-inline)
+    (should (equal (buffer-string) "<a><b c=\"\"></b></a>"))))
+
+(ert-deftest nxml-mode-font-lock-quotes ()
+  (with-temp-buffer
+    (nxml-mode)
+    (insert "<x a=\"dquote attr\" b='squote attr'>\"dquote text\"'squote 
text'</x>")
+    (font-lock-ensure)
+    (let ((squote-txt-pos (search-backward "squote text"))
+          (dquote-txt-pos (search-backward "dquote text"))
+          (squote-att-pos (search-backward "squote attr"))
+          (dquote-att-pos (search-backward "dquote attr")))
+      ;; Just make sure that each quote uses the same face for quoted
+      ;; attribute values, and a different face for quoted text
+      ;; outside tags.  Don't test `font-lock-string-face' vs
+      ;; `nxml-attribute-value' here.
+      (should (equal (get-text-property squote-att-pos 'face)
+                     (get-text-property dquote-att-pos 'face)))
+      (should (equal (get-text-property squote-txt-pos 'face)
+                     (get-text-property dquote-txt-pos 'face)))
+      (should-not (equal (get-text-property squote-txt-pos 'face)
+                         (get-text-property dquote-att-pos 'face))))))
+
+(provide 'nxml-mode-tests)
+;;; nxml-mode-tests.el ends here
diff --git a/test/lisp/org/org-tests.el b/test/lisp/org/org-tests.el
index 4b82aa8..33f9e45 100644
--- a/test/lisp/org/org-tests.el
+++ b/test/lisp/org/org-tests.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index b940f45..a517909 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -260,6 +260,19 @@ foo = long_function_name(
    (should (eq (car (python-indent-context)) :inside-paren-newline-start))
    (should (= (python-indent-calculate-indentation) 4))))
 
+(ert-deftest python-indent-hanging-close-paren ()
+  "Like first pep8 case, but with hanging close paren." ;; See Bug#20742.
+  (python-tests-with-temp-buffer
+   "\
+foo = long_function_name(var_one, var_two,
+                         var_three, var_four
+                         )
+"
+   (should (= (python-indent-calculate-indentation) 0))
+   (python-tests-look-at ")")
+   (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
+   (should (= (python-indent-calculate-indentation) 25))))
+
 (ert-deftest python-indent-base-case ()
   "Check base case does not trigger errors."
   (python-tests-with-temp-buffer
diff --git a/test/lisp/soundex-tests.el b/test/lisp/soundex-tests.el
index d8d79b8..4de45f9 100644
--- a/test/lisp/soundex-tests.el
+++ b/test/lisp/soundex-tests.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/test/lisp/tempo-tests.el b/test/lisp/tempo-tests.el
new file mode 100644
index 0000000..6e610ff
--- /dev/null
+++ b/test/lisp/tempo-tests.el
@@ -0,0 +1,228 @@
+;;; tempo-tests.el --- Test suite for tempo.el  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; Author: Federico Tedin <address@hidden>
+;; Keywords: abbrev
+
+;; 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/>.
+
+;;; Code:
+
+(require 'tempo)
+(eval-when-compile (require 'cl-lib))
+
+(ert-deftest tempo-string-element-test ()
+  "Test a template containing a string element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("GNU Emacs Tempo test"))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "GNU Emacs Tempo test"))))
+
+(ert-deftest tempo-p-bare-element-test ()
+  "Test a template containing a bare `p' element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("abcde" p))
+    (tempo-insert-template 'tempo-template-test nil)
+    (tempo-forward-mark)
+    (should (equal (point) 6))))
+
+(ert-deftest tempo-r-bare-element-test ()
+  "Test a template containing a bare `r' element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("abcde" r "ghijk"))
+    (insert "F")
+    (set-mark (point))
+    (goto-char (point-min))
+    (tempo-insert-template 'tempo-template-test t)
+    (should (equal (buffer-string) "abcdeFghijk"))))
+
+(ert-deftest tempo-p-element-test ()
+  "Testing template containing a `p' (prompt) element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("hello " (p ">")))
+    (let ((tempo-interactive t))
+      (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "world")))
+        (tempo-insert-template 'tempo-template-test nil))
+      (should (equal (buffer-string) "hello world")))))
+
+(ert-deftest tempo-P-element-test ()
+  "Testing template containing a `P' (prompt) element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("hello " (P ">")))
+    ;; By default, `tempo-interactive' is nil, `P' should ignore this.
+    (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "world")))
+      (tempo-insert-template 'tempo-template-test nil))
+    (should (equal (buffer-string) "hello world"))))
+
+(ert-deftest tempo-r-element-test ()
+  "Testing template containing an `r' (with prompt) element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("abcde" (r ">") "ghijk"))
+    (let ((tempo-interactive t))
+      (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "F")))
+        (tempo-insert-template 'tempo-template-test nil))
+      (should (equal (buffer-string) "abcdeFghijk")))))
+
+(ert-deftest tempo-s-element-test ()
+  "Testing template containing an `s' element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("hello " (p ">" P1) " " (s P1)))
+    (let ((tempo-interactive t))
+      (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "world!")))
+        (tempo-insert-template 'tempo-template-test nil))
+      (should (equal (buffer-string) "hello world! world!")))))
+
+(ert-deftest tempo-&-element-test ()
+  "Testing template containing an `&' element."
+  (tempo-define-template "test" '(& "test"))
+  (with-temp-buffer
+    (insert "  ")
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "  test")))
+  (with-temp-buffer
+    (insert "hello")
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "hello\ntest"))))
+
+(ert-deftest tempo-%-element-test ()
+  "Testing template containing an `%' element."
+  (tempo-define-template "test" '("test" %))
+  (with-temp-buffer
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "test")))
+  (with-temp-buffer
+    (insert "hello")
+    (goto-char (point-min))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "test\nhello"))))
+
+(ert-deftest tempo-n-element-test ()
+  "Testing template containing an `n' element."
+  (tempo-define-template "test" '("test" n "test"))
+  (with-temp-buffer
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "test\ntest"))))
+
+(ert-deftest tempo-n>-element-test ()
+  "Testing template containing an `n>' element."
+  (tempo-define-template "test" '("(progn" n> "(list 1 2 3))"))
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (tempo-insert-template 'tempo-template-test nil)
+    ;; Tempo should have inserted two spaces before (list 1 2 3)
+    (should (equal (buffer-string) "(progn\n  (list 1 2 3))"))))
+
+(ert-deftest tempo->-element-test ()
+  "Testing template containing a `>' element."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(progn\n)")
+    (backward-char)
+    (tempo-define-template "test" '("(list 1 2 3)" >))
+    (tempo-insert-template 'tempo-template-test nil)
+    ;; Tempo should have inserted two spaces before (list 1 2 3)
+    (should (equal (buffer-string) "(progn\n  (list 1 2 3))"))))
+
+(ert-deftest tempo-r>-bare-element-test ()
+  "Testing template containing a bare `r>' element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("(progn" n r> ")"))
+    (emacs-lisp-mode)
+    (insert "(list 1 2 3)")
+    (set-mark (point))
+    (goto-char (point-min))
+    (tempo-insert-template 'tempo-template-test t)
+    ;; Tempo should have inserted two spaces before (list 1 2 3)
+    (should (equal (buffer-string) "(progn\n  (list 1 2 3))"))))
+
+(ert-deftest tempo-r>-element-test ()
+  "Testing template containing an `r>' (with prompt) element."
+  (tempo-define-template "test" '("(progn" n (r> ":") ")"))
+  (with-temp-buffer
+    ;; Test on-region use
+    (emacs-lisp-mode)
+    (insert "(list 1 2 3)")
+    (set-mark (point))
+    (goto-char (point-min))
+    (tempo-insert-template 'tempo-template-test t)
+    (should (equal (buffer-string) "(progn\n  (list 1 2 3))")))
+  (with-temp-buffer
+    ;; Test interactive use
+    (emacs-lisp-mode)
+    (let ((tempo-interactive t))
+      (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "  (list 1 2 
3)")))
+        (tempo-insert-template 'tempo-template-test nil))
+      (should (equal (buffer-string) "(progn\n  (list 1 2 3))")))))
+
+(ert-deftest tempo-o-element-test ()
+  "Testing template containing an `o' element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("test" o))
+    (insert "hello")
+    (goto-char (point-min))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "test\nhello"))
+    (should (equal (point) 5))))
+
+(ert-deftest tempo-nil-element-test ()
+  "Testing template with nil elements."
+  (with-temp-buffer
+    (tempo-define-template "test" '("Hello," nil " World!"))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "Hello, World!"))))
+
+(ert-deftest tempo-eval-element-test ()
+  "Testing template with Emacs Lisp expressions."
+  (with-temp-buffer
+    (tempo-define-template "test" '((int-to-string (+ 1 1)) "=" (concat "1" 
"+1")))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "2=1+1"))))
+
+(ert-deftest tempo-l-element-test ()
+  "Testing template containing an `l' element."
+  (with-temp-buffer
+    (tempo-define-template "test" '("list: " (l "1, " "2, " (int-to-string (+ 
1 2)))))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "list: 1, 2, 3"))))
+
+(ert-deftest tempo-tempo-user-elements-test ()
+  "Testing a template with elements for `tempo-user-elements'."
+  (with-temp-buffer
+    (make-local-variable 'tempo-user-elements)
+    (add-to-list 'tempo-user-elements (lambda (x) (int-to-string (* x x))))
+    (tempo-define-template "test" '(1 " " 2 " " 3 " " 4))
+    (tempo-insert-template 'tempo-template-test nil)
+    (should (equal (buffer-string) "1 4 9 16"))))
+
+(ert-deftest tempo-expand-tag-test ()
+  "Testing expansion of a template with a tag."
+  (with-temp-buffer
+    (tempo-define-template "test" '("Hello, World!") "hello")
+    (insert "hello")
+    (tempo-complete-tag)
+    (should (equal (buffer-string) "Hello, World!"))))
+
+(ert-deftest tempo-expand-partial-tag-test ()
+  "Testing expansion of a template with a tag, with a partial match."
+  (with-temp-buffer
+    (tempo-define-template "test" '("Hello, World!") "hello")
+    (insert "hel")
+    (tempo-complete-tag)
+    (should (equal (buffer-string) "Hello, World!"))))
+
+(provide 'tempo-tests)
+;;; tempo-tests.el ends here
diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el
index 9f5dcd5..6923096 100644
--- a/test/lisp/term-tests.el
+++ b/test/lisp/term-tests.el
@@ -119,7 +119,141 @@ line3\r
 line4\r
 line5\r
 line6\r
-"))))
+")))
+
+  ;; test reverse scrolling
+  (should (equal "line1
+line7
+line6
+line2
+line5"
+                 (term-test-screen-from-input 40 5
+                                              '("\e[0;0H"
+                                                "\e[J"
+                                                "line1\r
+line2\r
+line3\r
+line4\r
+line5"
+                                                "\e[2;4r"
+                                                "\e[2;0H"
+                                                "\e[2;0H"
+                                                "\eMline6"
+                                                "\e[2;0H"
+                                                "\eMline7"))))
+
+  ;; test scrolling down
+  (should (equal "line1
+line3
+line4
+line7
+line5"
+                 (term-test-screen-from-input 40 5
+                                              '("\e[0;0H"
+                                                "\e[J"
+                                                "line1\r
+line2\r
+line3\r
+line4\r
+line5"
+                                                "\e[2;4r"
+                                                "\e[2;0H"
+                                                "\e[4;5H"
+                                                "\n\rline7"))))
+
+  ;; setting the scroll region end beyond the max height should not
+  ;; turn on term-scroll-with-delete
+  (should (equal "line1
+line2
+line3
+line4
+line5
+line6
+line7"
+                 (term-test-screen-from-input 40 5
+                                                      '("\e[1;10r"
+                                                        "line1\r
+line2\r
+line3\r
+line4\r
+line5\r
+line6\r
+line7"))))
+
+
+  ;; resetting the terminal should set the scroll region end to (1- 
term-height).
+  (should (equal "
+line1
+line2
+line3
+line4
+"
+                 (term-test-screen-from-input 40 5
+                                                      '("\e[1;10r"
+                                                        "\ec" ;reset
+                                                        "line1\r
+line2\r
+line3\r
+line4\r
+line5"
+                                                        "\e[1;1H"
+                                                        "\e[L"))))
+
+  ;; scroll region should be limited to the (1- term-height).  Note,
+  ;; this fixes an off by one error when comparing the scroll region
+  ;; end with term-height.
+  (should (equal "
+line1
+line2
+line3
+line4
+"
+                 (term-test-screen-from-input 40 5
+                                              '("\e[1;6r"
+                                                "line1\r
+line2\r
+line3\r
+line4\r
+line5"
+                                                "\e[1;1H" ;go back to home
+                                                "\e[L"    ;insert a new line 
at the top
+                                                ))))
+
+  ;; setting the scroll region to the entire height should not turn on
+  ;; term-scroll-with-delete
+  (should (equal "line1
+line2
+line3
+line4
+line5
+line6"
+                 (term-test-screen-from-input 40 5
+                                                      '("\e[1;5r"
+                                                        "line1\r
+line2\r
+line3\r
+line4\r
+line5\r
+line6"))))
+
+  ;; reset should reset term-scroll-with-delete
+  (should (equal "line1
+line2
+line3
+line4
+line5
+line6
+line7"
+                 (term-test-screen-from-input 40 5
+                                              '("\e[2;5r" ;set the region
+                                                "\ec" ;reset
+                                                "line1\r
+line2\r
+line3\r
+line4\r
+line5\r
+line6\r
+line7")))))
 
 (ert-deftest term-set-directory ()
   (let ((term-ansi-at-user (user-real-login-name)))
diff --git a/test/lisp/textmodes/sgml-mode-tests.el 
b/test/lisp/textmodes/sgml-mode-tests.el
index 61ae87e..1b8965e 100644
--- a/test/lisp/textmodes/sgml-mode-tests.el
+++ b/test/lisp/textmodes/sgml-mode-tests.el
@@ -125,7 +125,6 @@ The point is set to the beginning of the buffer."
      (should (string= content (buffer-string))))))
 
 (ert-deftest sgml-delete-tag-bug-8203-should-not-delete-apostrophe ()
-  :expected-result :failed
   (sgml-with-content
    "<title>Winter is comin'</title>"
    (sgml-delete-tag 1)
@@ -161,5 +160,16 @@ The point is set to the beginning of the buffer."
       (sgml-quote (point-min) (point-max) t)
       (should (string= "&&" (buffer-string))))))
 
+(ert-deftest sgml-tests--quotes-syntax ()
+  (with-temp-buffer
+    (sgml-mode)
+    (insert "a\"b <tag>c'd</tag>")
+    (should (= 1 (car (syntax-ppss (1- (point-max))))))
+    (should (= 0 (car (syntax-ppss (point-max)))))
+    (erase-buffer)
+    (insert "<tag>c>d</tag>")
+    (should (= 1 (car (syntax-ppss (1- (point-max))))))
+    (should (= 0 (car (syntax-ppss (point-max)))))))
+
 (provide 'sgml-mode-tests)
 ;;; sgml-mode-tests.el ends here
diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el
index 676d461..d809b64 100644
--- a/test/lisp/vc/diff-mode-tests.el
+++ b/test/lisp/vc/diff-mode-tests.el
@@ -1,7 +1,6 @@
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Dima Kogan <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/vc/smerge-mode-tests.el 
b/test/lisp/vc/smerge-mode-tests.el
index 032afa9..67f6468 100644
--- a/test/lisp/vc/smerge-mode-tests.el
+++ b/test/lisp/vc/smerge-mode-tests.el
@@ -1,7 +1,5 @@
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el
index 8fa16cd..04c869e 100644
--- a/test/lisp/vc/vc-bzr-tests.el
+++ b/test/lisp/vc/vc-bzr-tests.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/vc/vc-hg-tests.el b/test/lisp/vc/vc-hg-tests.el
index 1bdc320..7fc8461 100644
--- a/test/lisp/vc/vc-hg-tests.el
+++ b/test/lisp/vc/vc-hg-tests.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
-;; Maintainer: address@hidden
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/xdg-tests.el b/test/lisp/xdg-tests.el
index 9c81506..b8bd606 100644
--- a/test/lisp/xdg-tests.el
+++ b/test/lisp/xdg-tests.el
@@ -2,7 +2,6 @@
 
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
 ;; Author: Mark Oteiza <address@hidden>
 
 ;; This file is part of GNU Emacs.
diff --git a/test/manual/biditest.el b/test/manual/biditest.el
index d813642..f257910 100644
--- a/test/manual/biditest.el
+++ b/test/manual/biditest.el
@@ -3,7 +3,6 @@
 ;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
-;; Maintainer: address@hidden
 ;; Package: emacs
 
 ;; This program is free software: you can redistribute it and/or modify
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 250aeb1..30ad340 100644
--- a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
+++ b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
@@ -4,7 +4,6 @@
 ;; Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
-;; Maintainer: address@hidden
 ;; Keywords: tools
 
 ;; This file is part of GNU Emacs.
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 173b636..5349de0 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -1,4 +1,4 @@
-;;; Test GNU Emacs modules.
+;;; emacs-module-tests --- Test GNU Emacs modules.  -*- lexical-binding: t; -*-
 
 ;; Copyright 2015-2019 Free Software Foundation, Inc.
 
@@ -17,6 +17,14 @@
 ;; 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:
+
+;; Unit tests for the dynamic module facility.  See Info node `(elisp)
+;; Writing Dynamic Modules'.  These tests make use of a small test
+;; module in test/data/emacs-module.
+
+;;; Code:
+
 (require 'cl-lib)
 (require 'ert)
 (require 'help-fns)
@@ -137,8 +145,9 @@ changes."
 ;;
 
 (defun multiply-string (s n)
+  "Return N copies of S concatenated together."
   (let ((res ""))
-    (dotimes (i n)
+    (dotimes (_ n)
       (setq res (concat res s)))
     res))
 
@@ -304,7 +313,7 @@ Interactively, you can try hitting \\[keyboard-quit] to 
quit."
                          ;; 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)))
+                         (time-add nil (if noninteractive 0.1 5))
                          ;; should_quit or process_input
                          arg))
                       'finished))
diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el
index f1d1110..d92ebcb 100644
--- a/test/src/lcms-tests.el
+++ b/test/src/lcms-tests.el
@@ -2,8 +2,6 @@
 
 ;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
-;; Maintainer: address@hidden
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el
index 5c858ef..2c90af7 100644
--- a/test/src/timefns-tests.el
+++ b/test/src/timefns-tests.el
@@ -142,3 +142,9 @@
                      (< 0.99 (/ x y) 1.01)
                      (< 0.99 (/ (- (float-time a)) (float-time b))
                         1.01))))))))
+
+(ert-deftest encode-time-dst-numeric-zone ()
+    "Check for Bug#35502."
+    (should (time-equal-p
+             (encode-time '(29 31 17 30 4 2019 2 t 7200))
+             '(23752 27217))))



reply via email to

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