emacs-diffs
[Top][All Lists]
Advanced

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

scratch/oclosure 9a5f7d03f9: Merge branch 'trunk' into oclosure


From: Stefan Monnier
Subject: scratch/oclosure 9a5f7d03f9: Merge branch 'trunk' into oclosure
Date: Wed, 5 Jan 2022 19:22:07 -0500 (EST)

branch: scratch/oclosure
commit 9a5f7d03f9781f9088af20750c33d96b8a2fc208
Merge: 3906eb80b6 61f8f7f68f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

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

diff --git a/.gitattributes b/.gitattributes
index a99cf12af5..43b73635a5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,6 @@
 # Attributes of Emacs files in the Git repository.
 
-# Copyright 2015-2021 Free Software Foundation, Inc.
+# Copyright 2015-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/.gitignore b/.gitignore
index f1abb2ab68..35ff949e93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
 # Files that Git should ignore in the Emacs source directory.
 
-# Copyright 2009-2021 Free Software Foundation, Inc.
+# Copyright 2009-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -159,6 +159,7 @@ test/manual/etags/CTAGS
 test/manual/indent/*.new
 test/lisp/gnus/mml-sec-resources/random_seed
 test/lisp/play/fortune-resources/fortunes.dat
+test/**/*.xml
 
 # ctags, etags.
 TAGS
@@ -316,3 +317,9 @@ lib-src/seccomp-filter.bpf
 lib-src/seccomp-filter.pfc
 lib-src/seccomp-filter-exec.bpf
 lib-src/seccomp-filter-exec.pfc
+
+# gsettings schema
+/etc/*.gschema.valid
+
+# Ignore directory made by admin/make-manuals.
+manual/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 402c17ddb8..3d027171d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2022 Free Software Foundation, Inc.
 #
 #  This file is part of GNU Emacs.
 #
diff --git a/ChangeLog.1 b/ChangeLog.1
index 756dce3e47..cd31aacafb 100644
--- a/ChangeLog.1
+++ b/ChangeLog.1
@@ -14700,7 +14700,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/ChangeLog.2 b/ChangeLog.2
index 3e227675e0..cf19abaa13 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -35787,7 +35787,7 @@ See ChangeLog.1 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2015-2021 Free Software Foundation, Inc.
+  Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/ChangeLog.3 b/ChangeLog.3
index b149c8295b..177321dc45 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -233420,7 +233420,7 @@ See ChangeLog.2 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2015-2021 Free Software Foundation, Inc.
+  Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/GNUmakefile b/GNUmakefile
index 76fd77ba1b..8eb61dc0ad 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,6 +1,6 @@
 # Build Emacs from a fresh tarball or version-control checkout.
 
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
+# Copyright (C) 2011-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -36,31 +36,31 @@
 
 ifeq (help,$(filter help,$(MAKECMDGOALS)))
 help:
-       @echo "NOTE:  This is a brief summary of some common make targets."
-       @echo "For more detailed information, please read the files INSTALL,"
-       @echo "INSTALL.REPO, Makefile or visit this URL:"
-       @echo 
"https://www.gnu.org/prep/standards/html_node/Standard-Targets.html";
-       @echo ""
-       @echo "make all              -- compile and build Emacs"
-       @echo "make install          -- install Emacs"
-       @echo "make TAGS             -- update tags tables"
-       @echo "make clean            -- delete built files but preserve 
configuration"
-       @echo "make mostlyclean      -- like 'make clean', but leave those 
files that"
-       @echo "                         usually do not need to be recompiled"
-       @echo "make distclean        -- delete all build and configuration 
files,"
-       @echo "                         leave only files included in source 
distribution"
-       @echo "make maintainer-clean -- delete almost everything that can be 
regenerated"
-       @echo "make extraclean       -- like maintainer-clean, and also delete"
-       @echo "                         backup and autosave files"
-       @echo "make bootstrap        -- delete all compiled files to force a 
new bootstrap"
-       @echo "                         from a clean slate, then build in the 
normal way"
-       @echo "make uninstall        -- remove files installed by 'make 
install'"
-       @echo "make check            -- run the Emacs test suite"
-       @echo "make docs             -- generate Emacs documentation in info 
format"
-       @echo "make html             -- generate documentation in html format"
-       @echo "make ps               -- generate documentation in ps format"
-       @echo "make pdf              -- generate documentation in pdf format "
-       @exit
+       $(info $ NOTE:  This is a brief summary of some common make targets.)
+       $(info $ For more detailed information, please read the files INSTALL,)
+       $(info $ INSTALL.REPO, Makefile or visit this URL:)
+       $(info $ 
https://www.gnu.org/prep/standards/html_node/Standard-Targets.html)
+       $(info $ )
+       $(info $ make all              -- compile and build Emacs)
+       $(info $ make install          -- install Emacs)
+       $(info $ make TAGS             -- update tags tables)
+       $(info $ make clean            -- delete built files but preserve 
configuration)
+       $(info $ make mostlyclean      -- like 'make clean', but leave those 
files that)
+       $(info $                          usually do not need to be recompiled)
+       $(info $ make distclean        -- delete all build and configuration 
files,)
+       $(info $                          leave only files included in source 
distribution)
+       $(info $ make maintainer-clean -- delete almost everything that can be 
regenerated)
+       $(info $ make extraclean       -- like maintainer-clean, and also 
delete)
+       $(info $                          backup and autosave files)
+       $(info $ make bootstrap        -- delete all compiled files to force a 
new bootstrap)
+       $(info $                          from a clean slate, then build in the 
normal way)
+       $(info $ make uninstall        -- remove files installed by 'make 
install')
+       $(info $ make check            -- run the Emacs test suite)
+       $(info $ make docs             -- generate Emacs documentation in info 
format)
+       $(info $ make html             -- generate documentation in html format)
+       $(info $ make ps               -- generate documentation in ps format)
+       $(info $ make pdf              -- generate documentation in pdf format )
+       @:
 
 .PHONY: help
 
@@ -79,7 +79,7 @@ else
 ifeq ($(filter-out %clean,$(or $(MAKECMDGOALS),default)),)
 
 $(MAKECMDGOALS):
-       @echo >&2 'No Makefile; skipping $@.'
+       $(warning No Makefile; skipping $@.)
 
 else
 
@@ -97,18 +97,18 @@ default $(ORDINARY_GOALS): Makefile
 .NOTPARALLEL:
 
 configure:
-       @echo >&2 'There seems to be no "configure" file in this directory.'
-       @echo >&2 Running ./autogen.sh ...
+       $(warning There seems to be no "configure" file in this directory.)
+       $(warning Running ./autogen.sh ...)
        ./autogen.sh
        @echo >&2 '"configure" file built.'
 
 Makefile: configure
-       @echo >&2 'There seems to be no Makefile in this directory.'
+       $(warning There seems to be no Makefile in this directory.)
 ifeq ($(configure),default)
-       @echo >&2 'Running ./configure ...'
+       $(warning Running ./configure ...)
        ./configure
 else
-       @echo >&2 'Running ./configure '$(configure)'...'
+       $(warning Running ./configure $(configure)...)
        ./configure $(configure)
 endif
        @echo >&2 'Makefile built.'
diff --git a/INSTALL b/INSTALL
index 21298422af..02d5a09d63 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 GNU Emacs Installation Guide
-Copyright (C) 1992, 1994, 1996-1997, 2000-2021 Free Software Foundation,
+Copyright (C) 1992, 1994, 1996-1997, 2000-2022 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
@@ -324,6 +324,10 @@ Use --without-toolkit-scroll-bars to disable Motif or 
Xaw3d scroll bars.
 Use --without-xim to inhibit the default use of X Input Methods.
 In this case, the X resource useXIM can be used to turn on use of XIM.
 
+Use --with-xinput2 to enable the use of version 2 of the X Input
+Extension.  This enables support for touchscreens, pinch gestures, and
+scroll wheels that report scroll deltas at pixel-level precision.
+
 Use --disable-largefile to omit support for files larger than 2GB, and
 --disable-year2038 to omit support for timestamps past the year 2038,
 on systems which allow omitting such support.  This may help when
diff --git a/INSTALL.REPO b/INSTALL.REPO
index 182c2e9534..ef488f3fd9 100644
--- a/INSTALL.REPO
+++ b/INSTALL.REPO
@@ -98,7 +98,7 @@ never platform-specific.
 
 
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/Makefile.in b/Makefile.in
index e6c337385a..b72127dde6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1992-2021 Free Software Foundation, Inc.
+# Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -104,6 +104,9 @@ USE_STARTUP_NOTIFICATION = @USE_STARTUP_NOTIFICATION@
 
 HAVE_BE_APP = @HAVE_BE_APP@
 
+HAVE_PGTK = @HAVE_PGTK@
+HAVE_GSETTINGS = @HAVE_GSETTINGS@
+
 # ==================== Where To Install Things ====================
 
 # Location to install Emacs.app under GNUstep / macOS.
@@ -212,6 +215,9 @@ icondir=$(datarootdir)/icons
 # The source directory for the icon files.
 iconsrcdir=$(srcdir)/etc/images/icons
 
+# Where to install the gsettings schema file.
+gsettingsschemadir = $(datadir)/glib-2.0/schemas
+
 # ==================== Emacs-specific directories ====================
 
 # These variables hold the values Emacs will actually use.  They are
@@ -306,6 +312,8 @@ LN_S_FILEONLY = @LN_S_FILEONLY@
 # We use gzip to compress installed .el and some .txt files.
 GZIP_PROG = @GZIP_PROG@
 
+GLIB_COMPILE_SCHEMAS = glib-compile-schemas
+
 # ============================= Targets ==============================
 
 # Program name transformation.
@@ -345,7 +353,9 @@ BIN_DESTDIR='${ns_appbindir}/'
 ELN_DESTDIR = ${ns_applibdir}/
 endif
 
-all: ${SUBDIR} info
+gsettings_SCHEMAS = etc/org.gnu.emacs.defaults.gschema.xml
+
+all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid)
 
 .PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 
epaths-force-ns-self-contained etc-emacsver
 
@@ -501,7 +511,7 @@ $(srcdir)/configure: $(srcdir)/configure.ac 
$(srcdir)/m4/*.m4
 ## don't have to duplicate the list of utilities to install in
 ## this Makefile as well.
 
-install: all install-arch-indep install-etcdoc install-arch-dep 
install-$(NTDIR) blessmail install-eln
+install: all install-arch-indep install-etcdoc install-arch-dep 
install-$(NTDIR) blessmail install-eln install-gsettings-schemas
        @true
 
 ## Ensure that $subdir contains a subdirs.el file.
@@ -821,7 +831,7 @@ install-strip:
 ### create (but not the noninstalled files such as 'make all' would create).
 ###
 ### Don't delete the lisp and etc directories if they're in the source tree.
-uninstall: uninstall-$(NTDIR) uninstall-doc
+uninstall: uninstall-$(NTDIR) uninstall-doc uninstall-gsettings-schemas
        rm -f "$(DESTDIR)$(includedir)/emacs-module.h"
        $(MAKE) -C lib-src uninstall
        -unset CDPATH; \
@@ -917,7 +927,7 @@ clean_dirs = $(mostlyclean_dirs) nextstep admin/charsets 
admin/unidata
 
 $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean)))
 
-clean: $(clean_dirs:=_clean)
+clean: $(clean_dirs:=_clean) clean-gsettings-schemas
        -rm -f ./*.tmp etc/*.tmp*
        -rm -rf info-dir.*
        -rm -rf native-lisp
@@ -942,7 +952,7 @@ distclean_dirs = $(clean_dirs) leim lisp admin/grammars
 
 $(foreach dir,$(distclean_dirs),$(eval $(call 
submake_template,$(dir),distclean)))
 
-distclean: $(distclean_dirs:=_distclean)
+distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas
        ${top_distclean}
 
 ### 'bootstrap-clean'
@@ -1067,8 +1077,8 @@ info_dir_deps = \
 ## but then we would need to depend on ${INFOS}, which would
 ## slow down parallelization.
 ${srcdir}/info/dir: ${info_dir_deps}
-       $(AM_V_at)${MKDIR_P} ${srcdir}/info
-       $(AM_V_GEN)(cd ${srcdir}/doc && \
+       $(AM_V_GEN)${MKDIR_P} ${srcdir}/info
+       $(AM_V_at)(cd ${srcdir}/doc && \
         AWK='${AWK}' ../build-aux/make-info-dir ${info_dir_inputs} \
        ) >$@.tmp && mv $@.tmp $@
 
@@ -1237,3 +1247,31 @@ gitmerge:
        ${GITMERGE_EMACS} -batch --no-site-file --no-site-lisp \
          -l ${srcdir}/admin/gitmerge.el \
          --eval '(setq gitmerge-minimum-missing ${GITMERGE_NMIN})' -f gitmerge
+
+install-gsettings-schemas:
+ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
+       $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"
+       $(INSTALL_DATA) $(srcdir)/$(gsettings_SCHEMAS) 
"$(DESTDIR)$(gsettingsschemadir)"
+       if [ -z "$(DESTDIR)" ]; then $(GLIB_COMPILE_SCHEMAS) 
$(gsettingsschemadir); fi
+endif
+
+uninstall-gsettings-schemas:
+ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
+       for x in $(gsettings_SCHEMAS); do \
+         xx=`echo $$x | sed -e 's|.*/||'`; \
+         rm -f "$(DESTDIR)$(gsettingsschemadir)/$${xx}"; \
+       done
+       if [ -z "$(DESTDIR)" ]; then $(GLIB_COMPILE_SCHEMAS) 
$(gsettingsschemadir); fi
+endif
+
+clean-gsettings-schemas:
+ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
+       rm -f $(gsettings_SCHEMAS:.xml=.valid)
+endif
+
+$(gsettings_SCHEMAS:.xml=.valid): $(srcdir)/$(gsettings_SCHEMAS)
+ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
+       $(GLIB_COMPILE_SCHEMAS) --strict --dry-run 
--schema-file=$(srcdir)/$(gsettings_SCHEMAS)
+       $(MKDIR_P) $(@D)
+       touch $@
+endif
diff --git a/README b/README
index 6329a7775e..80c04e20fe 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/admin/ChangeLog.1 b/admin/ChangeLog.1
index f3de691325..9409a608cc 100644
--- a/admin/ChangeLog.1
+++ b/admin/ChangeLog.1
@@ -2577,7 +2577,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/admin/README b/admin/README
index b0336f91ff..89cdbbbfaf 100644
--- a/admin/README
+++ b/admin/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/admin/admin.el b/admin/admin.el
index ad4208beef..5f02ea8ce4 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -1,6 +1,6 @@
 ;;; admin.el --- utilities for Emacs administration  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -88,6 +88,9 @@ Optional argument DATE is the release date, default today."
     (kill-buffer)
     (message "No need to update `%s'" file)))
 
+(defvar admin-git-command (executable-find "git")
+  "The `git' program to use.")
+
 (defun set-version (root version)
   "Set Emacs version to VERSION in relevant files under ROOT.
 Root must be the root of an Emacs source tree."
@@ -96,6 +99,8 @@ Root must be the root of an Emacs source tree."
                (read-string "Version number: " emacs-version)))
   (unless (file-exists-p (expand-file-name "src/emacs.c" root))
     (user-error "%s doesn't seem to be the root of an Emacs source tree" root))
+  (unless admin-git-command
+    (user-error "Could not find git; please install git and move NEWS 
manually"))
   (message "Setting version numbers...")
   ;; There's also a "version 3" (standing for GPLv3) at the end of
   ;; `README', but since `set-version-in-file' only replaces the first
@@ -157,7 +162,13 @@ Root must be the root of an Emacs source tree."
 Documentation changes might not have been completed!"))))
     (when (and majorbump
                (not (file-exists-p oldnewsfile)))
-      (rename-file newsfile oldnewsfile)
+      (call-process admin-git-command nil nil nil
+                    "mv" newsfile oldnewsfile)
+      (when (y-or-n-p "Commit move of NEWS file?")
+        (call-process admin-git-command nil nil nil
+                      "commit" "-m" (format "; Move etc/%s to etc/%s"
+                                            (file-name-nondirectory newsfile)
+                                            (file-name-nondirectory 
oldnewsfile))))
       (find-file oldnewsfile)           ; to prompt you to commit it
       (copy-file oldnewsfile newsfile)
       (with-temp-buffer
diff --git a/admin/alloc-colors.c b/admin/alloc-colors.c
index ea5b750236..4db447332b 100644
--- a/admin/alloc-colors.c
+++ b/admin/alloc-colors.c
@@ -1,6 +1,6 @@
 /* Allocate X colors.  Used for testing with dense colormaps.
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/admin/authors.el b/admin/authors.el
index d44bb9bf8e..342f2718c8 100644
--- a/admin/authors.el
+++ b/admin/authors.el
@@ -1,6 +1,6 @@
 ;;; authors.el --- utility for maintaining Emacs's AUTHORS file  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <gerd@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/admin/automerge b/admin/automerge
index 81082f7dc6..415d717a99 100755
--- a/admin/automerge
+++ b/admin/automerge
@@ -1,7 +1,7 @@
 #!/bin/bash
 ### automerge - automatically merge the Emacs release branch to master
 
-## Copyright (C) 2018-2021 Free Software Foundation, Inc.
+## Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: Stefan Kangas <stefan@marxist.se>
diff --git a/admin/build-configs b/admin/build-configs
index 2e04e0008e..05e70786b3 100755
--- a/admin/build-configs
+++ b/admin/build-configs
@@ -1,7 +1,7 @@
 #! /usr/bin/perl
 # Build Emacs in several different configurations.
 
-# Copyright (C) 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/charsets/Makefile.in b/admin/charsets/Makefile.in
index f043077e31..572e352f4a 100644
--- a/admin/charsets/Makefile.in
+++ b/admin/charsets/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2015-2021 Free Software Foundation, Inc.
+# Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/admin/charsets/mapconv b/admin/charsets/mapconv
index f933c34ffc..9898d36e74 100755
--- a/admin/charsets/mapconv
+++ b/admin/charsets/mapconv
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2015-2021 Free Software Foundation, Inc.
+# Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/admin/charsets/mapfiles/README b/admin/charsets/mapfiles/README
index fb078269d6..0380df9ad7 100644
--- a/admin/charsets/mapfiles/README
+++ b/admin/charsets/mapfiles/README
@@ -1,4 +1,4 @@
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+Copyright (C) 2009-2022 Free Software Foundation, Inc.
 Copyright (C) 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
   Registration Number H13PRO009
diff --git a/admin/cus-test.el b/admin/cus-test.el
index 30b5f65561..8f0914ff69 100644
--- a/admin/cus-test.el
+++ b/admin/cus-test.el
@@ -1,6 +1,6 @@
 ;;; cus-test.el --- tests for custom types and load problems  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998, 2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Markus Rost <rost@math.uni-bielefeld.de>
 ;; Created: 13 Sep 1998
diff --git a/admin/diff-tar-files b/admin/diff-tar-files
index 2fe15401d0..6ab39eab2f 100755
--- a/admin/diff-tar-files
+++ b/admin/diff-tar-files
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Copyright (C) 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/find-gc.el b/admin/find-gc.el
index 1cce54ef14..1c3c419c56 100644
--- a/admin/find-gc.el
+++ b/admin/find-gc.el
@@ -1,6 +1,6 @@
 ;;; find-gc.el --- detect functions that call the garbage collector  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
diff --git a/admin/gitmerge.el b/admin/gitmerge.el
index 658ceb77f4..5da70a4028 100644
--- a/admin/gitmerge.el
+++ b/admin/gitmerge.el
@@ -1,6 +1,6 @@
 ;;; gitmerge.el --- help merge one Emacs branch into another  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Authors: David Engster <deng@randomsample.de>
 ;;          Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in
index aaf95c0897..83ac2ef46e 100644
--- a/admin/grammars/Makefile.in
+++ b/admin/grammars/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-## Copyright (C) 2013-2021 Free Software Foundation, Inc.
+## Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/admin/grammars/c.by b/admin/grammars/c.by
index 289081e3ce..2395e747fd 100644
--- a/admin/grammars/c.by
+++ b/admin/grammars/c.by
@@ -1,5 +1,5 @@
 ;;; c.by -- LL grammar for C/C++ language specification
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;;         David Ponce <david@dponce.com>
diff --git a/admin/grammars/grammar.wy b/admin/grammars/grammar.wy
index 35fb7e832e..1180dc28eb 100644
--- a/admin/grammars/grammar.wy
+++ b/admin/grammars/grammar.wy
@@ -1,6 +1,6 @@
 ;;; semantic-grammar.wy -- LALR grammar of Semantic input grammars
 ;;
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 26 Aug 2002
diff --git a/admin/grammars/java-tags.wy b/admin/grammars/java-tags.wy
index 486924b799..138adb2082 100644
--- a/admin/grammars/java-tags.wy
+++ b/admin/grammars/java-tags.wy
@@ -1,6 +1,6 @@
 ;;; java-tags.wy -- Semantic LALR grammar for Java
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 26 Aug 2002
diff --git a/admin/grammars/js.wy b/admin/grammars/js.wy
index e85db1572c..2357153ccb 100644
--- a/admin/grammars/js.wy
+++ b/admin/grammars/js.wy
@@ -1,6 +1,6 @@
 ;;; javascript-jv.wy -- LALR grammar for Javascript
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1998-2011 Ecma International.
 
 ;; Author: Joakim Verona
diff --git a/admin/grammars/make.by b/admin/grammars/make.by
index f66585e70e..193ad77fa9 100644
--- a/admin/grammars/make.by
+++ b/admin/grammars/make.by
@@ -1,6 +1,6 @@
 ;;; make.by -- BY notation for Makefiles.
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;;         David Ponce <david@dponce.com>
diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy
index 2539d1bec8..17d87e711a 100644
--- a/admin/grammars/python.wy
+++ b/admin/grammars/python.wy
@@ -1,6 +1,6 @@
 ;;; python.wy -- LALR grammar for Python
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 ;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
 ;; 2009, 2010 Python Software Foundation; All Rights Reserved
 
diff --git a/admin/grammars/scheme.by b/admin/grammars/scheme.by
index c3abb5a28e..fcf3007ae7 100644
--- a/admin/grammars/scheme.by
+++ b/admin/grammars/scheme.by
@@ -1,6 +1,6 @@
 ;;; scheme.by -- Scheme BNF language specification
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/admin/grammars/srecode-template.wy 
b/admin/grammars/srecode-template.wy
index 868a81cf18..c3531ebd54 100644
--- a/admin/grammars/srecode-template.wy
+++ b/admin/grammars/srecode-template.wy
@@ -1,6 +1,6 @@
 ;;; srecode-template.wy --- Semantic Recoder Template parser
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/admin/last-chance.el b/admin/last-chance.el
index e8021129e3..30d6a25a28 100644
--- a/admin/last-chance.el
+++ b/admin/last-chance.el
@@ -1,6 +1,6 @@
 ;;; last-chance.el --- dangling deterrence     -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Thien-Thi Nguyen <ttn@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/admin/make-emacs b/admin/make-emacs
index fa7880b566..06d5608092 100755
--- a/admin/make-emacs
+++ b/admin/make-emacs
@@ -2,7 +2,7 @@
 # Build Emacs with various options for profiling, debugging,
 # with and without warnings enabled etc.
 
-# Copyright (C) 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/make-manuals b/admin/make-manuals
index f133949520..8085412cc8 100755
--- a/admin/make-manuals
+++ b/admin/make-manuals
@@ -1,7 +1,7 @@
 #!/bin/bash
 ### make-manuals - create the Emacs manuals to upload to the gnu.org website
 
-## Copyright 2018-2021 Free Software Foundation, Inc.
+## Copyright 2018-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: emacs-devel@gnu.org
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index c9fe3b2f95..73b3d39049 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -4,7 +4,7 @@
 #
 #      admin/merge-gnulib
 
-# Copyright 2012-2021 Free Software Foundation, Inc.
+# Copyright 2012-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/merge-pkg-config b/admin/merge-pkg-config
index 1136a304dd..2f785729a6 100755
--- a/admin/merge-pkg-config
+++ b/admin/merge-pkg-config
@@ -4,7 +4,7 @@
 #
 #      admin/merge-pkg-config
 
-# Copyright 2014-2021 Free Software Foundation, Inc.
+# Copyright 2014-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/notes/copyright b/admin/notes/copyright
index 5b00c82ce9..6f7cb15334 100644
--- a/admin/notes/copyright
+++ b/admin/notes/copyright
@@ -1,4 +1,4 @@
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/admin/notes/emba b/admin/notes/emba
index f1b52b2cde..99237ea5f6 100644
--- a/admin/notes/emba
+++ b/admin/notes/emba
@@ -1,6 +1,6 @@
 -*- mode: outline; coding: utf-8 -*-
 
-Copyright (C) 2019-2021 Free Software Foundation, Inc.
+Copyright (C) 2019-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 NOTES FOR EMACS CONTINUOUS BUILD ON EMBA
@@ -63,6 +63,10 @@ They can be downloaded from the server, visiting the URL
 <https://emba.gnu.org/emacs/emacs/-/pipelines>, and selecting the job
 in question.
 
+Every pipeline generates a JUnit test report for the respective test
+jobs, which can be inspected on the pipeline web page.  This test
+report counts completed ERT tests, aborted tests are not counted.
+
 * Emba configuration
 
 The emba configuration files are hosted on
diff --git a/admin/notes/hydra b/admin/notes/hydra
index 62ad7ebf9c..0987e7be82 100644
--- a/admin/notes/hydra
+++ b/admin/notes/hydra
@@ -1,6 +1,6 @@
 -*- mode: outline; coding: utf-8 -*-
 
-Copyright (C) 2013-2021 Free Software Foundation, Inc.
+Copyright (C) 2013-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 NOTES FOR EMACS CONTINUOUS BUILD ON HYDRA
diff --git a/admin/notes/multi-tty b/admin/notes/multi-tty
index fa4df820ae..9b3f1606a1 100644
--- a/admin/notes/multi-tty
+++ b/admin/notes/multi-tty
@@ -1,6 +1,6 @@
 -*- coding: utf-8; mode: text; -*-
 
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 From README.multi-tty in the multi-tty branch.
diff --git a/admin/notes/unicode b/admin/notes/unicode
index be51d09d37..2c4b5e0106 100644
--- a/admin/notes/unicode
+++ b/admin/notes/unicode
@@ -1,6 +1,6 @@
                                             -*-mode: text; coding: utf-8;-*-
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Importing a new Unicode Standard version into Emacs
diff --git a/admin/notes/www b/admin/notes/www
index 524b908d0e..61a80e3d19 100644
--- a/admin/notes/www
+++ b/admin/notes/www
@@ -1,6 +1,6 @@
 -*- outline -*-
 
-Copyright (C) 2013-2021 Free Software Foundation, Inc.
+Copyright (C) 2013-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 NOTES FOR EMACS WWW PAGES
diff --git a/admin/notes/years b/admin/notes/years
index 19c72c3918..3df8139f9b 100644
--- a/admin/notes/years
+++ b/admin/notes/years
@@ -3,7 +3,31 @@ HOW TO MAINTAIN COPYRIGHT YEARS FOR GNU EMACS
 Maintaining copyright years is now very simple: every time a new year
 rolls around, add that year to every FSF (and AIST) copyright notice.
 Do this by running the 'admin/update-copyright' script on a fresh repo
-checkout.  Inspect the results for plausibility, then commit them.
+checkout, redirecting its output to a file, so that you could later
+examine the files that don't have copyright notices.  Inspect the
+results for plausibility, then commit them.
+
+A few known problems with the build-aux/update-copyright script:
+
+  . it doesn't update config.bat, msdos/depfiles.bat,
+    nt/configure.bat, etc/tutorials/TUTORIAL.cn, and
+    etc/tutorials/TUTORIAL.he because the "Copyright" statement begins
+    in these files after a prefix that is more than 5 characters long
+  . it doesn't update etc/tutorials/TUTORIAL.nl and
+    etc/tutorials/TUTORIAL.ro for some reason
+  . it doesn't update the second Copyright notice, the one that gets
+    output into PDF and PS, in etc/refcards/ru-refcard.tex
+  . it doesn't update etc/refcards/gnus-refcard.tex and
+    doc/misc/org.org because their Copyright statements have a
+    non-standard format
+  . several README and XPM files under etc/images/, and also
+    etc/refcards/README, msdos/README, and nt/icons/README aren't
+    updated either
+
+These files need to be updated by hand.
+
+Next, run "M-x set-copyright" from admin.el, which updates several
+copyright notices in the Emacs sources.
 
 You should also run the etags test suite in test/manual/etags/.  It
 will most probably fail because the contents of the test files changes
diff --git a/admin/nt/README-UNDUMP.W32 b/admin/nt/README-UNDUMP.W32
index aaaea3b91f..c42b7b6494 100644
--- a/admin/nt/README-UNDUMP.W32
+++ b/admin/nt/README-UNDUMP.W32
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
                           Emacs for Windows
diff --git a/admin/nt/dist-build/README-windows-binaries 
b/admin/nt/dist-build/README-windows-binaries
index b6f6e55d8c..475612ac80 100644
--- a/admin/nt/dist-build/README-windows-binaries
+++ b/admin/nt/dist-build/README-windows-binaries
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
                      Precompiled Distributions of
diff --git a/admin/nt/dist-build/build-dep-zips.py 
b/admin/nt/dist-build/build-dep-zips.py
index dfff493b64..a1d9afa517 100755
--- a/admin/nt/dist-build/build-dep-zips.py
+++ b/admin/nt/dist-build/build-dep-zips.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-## Copyright (C) 2017-2021 Free Software Foundation, Inc.
+## Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/admin/nt/dist-build/build-zips.sh 
b/admin/nt/dist-build/build-zips.sh
index 4c3a52af6a..77d20a5a7b 100755
--- a/admin/nt/dist-build/build-zips.sh
+++ b/admin/nt/dist-build/build-zips.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-## Copyright (C) 2017-2021 Free Software Foundation, Inc.
+## Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/admin/quick-install-emacs b/admin/quick-install-emacs
index 475658ae93..9a73cf5a40 100755
--- a/admin/quick-install-emacs
+++ b/admin/quick-install-emacs
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### quick-install-emacs --- do a halfway-decent job of installing emacs quickly
 
-## Copyright (C) 2001-2021 Free Software Foundation, Inc.
+## Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ## Author: Miles Bader <miles@gnu.org>
 
diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in
index 701fb92b81..45bba85213 100644
--- a/admin/unidata/Makefile.in
+++ b/admin/unidata/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2012-2021 Free Software Foundation, Inc.
+# Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -63,21 +63,21 @@ unidata.txt: ${srcdir}/UnicodeData.txt
 ## pretend that it does since other Makefiles assume that if charprop
 ## is up-to-date, the unifiles are too.
 ${unidir}/charprop.el: ${unifiles} ${srcdir}/unidata-gen.el | 
${srcdir}/unidata-gen.elc
-       $(AM_V_at)[ ! -f $@ ] || chmod +w $@
-       $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen \
+       $(AM_V_GEN)[ ! -f $@ ] || chmod +w $@
+       $(AM_V_at)${emacs} -L ${srcdir} -l unidata-gen \
          -f unidata-gen-charprop $@
 
 ${unifiles}: ${srcdir}/unidata-gen.el \
   ${srcdir}/UnicodeData.txt ${srcdir}/BidiMirroring.txt \
   ${srcdir}/BidiBrackets.txt | \
   ${srcdir}/unidata-gen.elc unidata.txt
-       $(AM_V_at)[ ! -f $@ ] || chmod +w $@
+       $(AM_V_GEN)[ ! -f $@ ] || chmod +w $@
        $(AM_V_at)${emacs} -L ${srcdir} -l unidata-gen \
          -f unidata-gen-file $@ ${srcdir}
 
 ${unidir}/emoji-labels.el: ${unidir}/../international/emoji.el \
          ${srcdir}/emoji-test.txt
-       $(AM_V_at)${emacs} -l emoji.el -f emoji--generate-file $@
+       $(AM_V_GEN)${emacs} -l emoji.el -f emoji--generate-file $@
 
 .PHONY: charscript.el
 charscript.el: ${unidir}/charscript.el
@@ -120,4 +120,3 @@ gen-clean:
 ## ref: https://lists.gnu.org/r/emacs-devel/2013-11/msg01029.html
 
 maintainer-clean: gen-clean distclean
-
diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk
index 314ac3e939..48d8c873c7 100755
--- a/admin/unidata/blocks.awk
+++ b/admin/unidata/blocks.awk
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -f
 
-## Copyright (C) 2015-2021 Free Software Foundation, Inc.
+## Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: emacs-devel@gnu.org
diff --git a/admin/unidata/emoji-zwj.awk b/admin/unidata/emoji-zwj.awk
index e704cb4526..3d605d5d64 100644
--- a/admin/unidata/emoji-zwj.awk
+++ b/admin/unidata/emoji-zwj.awk
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -f
 
-## Copyright (C) 2020 Free Software Foundation, Inc.
+## Copyright (C) 2020, 2022 Free Software Foundation, Inc.
 
 ## Author: Robert Pluim <rpluim@gmail.com>
 
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index abd41e34a4..d6b5a476bb 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -1,6 +1,6 @@
 ;;; unidata-gen.el --- Create files containing character property data  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/admin/unidata/uvs.el b/admin/unidata/uvs.el
index 0141b638fb..5a4b8e71a2 100644
--- a/admin/unidata/uvs.el
+++ b/admin/unidata/uvs.el
@@ -1,6 +1,6 @@
 ;;; uvs.el --- utility for UVS (format 14) cmap subtables in OpenType fonts  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
 
diff --git a/admin/update-copyright b/admin/update-copyright
index 86953838bd..5a04847a66 100755
--- a/admin/update-copyright
+++ b/admin/update-copyright
@@ -7,7 +7,7 @@
 # By default, this script uses the local-time calendar year.
 # Set the UPDATE_COPYRIGHT_YEAR environment variable to override the default.
 
-# Copyright 2013-2021 Free Software Foundation, Inc.
+# Copyright 2013-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/update_autogen b/admin/update_autogen
index 99297a9c0d..bfbf9d15c2 100755
--- a/admin/update_autogen
+++ b/admin/update_autogen
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 ### update_autogen - update some auto-generated files in the Emacs tree
 
-## Copyright (C) 2011-2021 Free Software Foundation, Inc.
+## Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: emacs-devel@gnu.org
diff --git a/admin/upload-manuals b/admin/upload-manuals
index 52999c2997..1fa9865e65 100755
--- a/admin/upload-manuals
+++ b/admin/upload-manuals
@@ -2,7 +2,7 @@
 
 ### upload-manuals - upload the Emacs manuals to the gnu.org website
 
-## Copyright 2018-2021 Free Software Foundation, Inc.
+## Copyright 2018-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: emacs-devel@gnu.org
diff --git a/autogen.sh b/autogen.sh
index 531e5775f9..03f647e576 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### autogen.sh - tool to help build Emacs from a repository checkout
 
-## Copyright (C) 2011-2021 Free Software Foundation, Inc.
+## Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: emacs-devel@gnu.org
diff --git a/build-aux/config.guess b/build-aux/config.guess
index e81d3ae7c2..1105a74983 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2021-06-03'
+timestamp='2021-11-30'
 
 # 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
@@ -437,7 +437,7 @@ case 
$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
        # This test works for both compilers.
        if test "$CC_FOR_BUILD" != no_compiler_found; then
            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+               (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
                grep IS_64BIT_ARCH >/dev/null
            then
                SUN_ARCH=x86_64
@@ -1522,6 +1522,9 @@ EOF
     i*86:rdos:*:*)
        GUESS=$UNAME_MACHINE-pc-rdos
        ;;
+    i*86:Fiwix:*:*)
+       GUESS=$UNAME_MACHINE-pc-fiwix
+       ;;
     *:AROS:*:*)
        GUESS=$UNAME_MACHINE-unknown-aros
        ;;
diff --git a/build-aux/config.sub b/build-aux/config.sub
index d74fb6deac..5ba9a97d2c 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2021-08-14'
+timestamp='2021-12-25'
 
 # 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
@@ -1020,6 +1020,11 @@ case $cpu-$vendor in
                ;;
 
        # Here we normalize CPU types with a missing or matching vendor
+       armh-unknown | armh-alt)
+               cpu=armv7l
+               vendor=alt
+               basic_os=${basic_os:-linux-gnueabihf}
+               ;;
        dpx20-unknown | dpx20-bull)
                cpu=rs6000
                vendor=bull
@@ -1121,7 +1126,7 @@ case $cpu-$vendor in
        xscale-* | xscalee[bl]-*)
                cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
                ;;
-       arm64-*)
+       arm64-* | aarch64le-*)
                cpu=aarch64
                ;;
 
@@ -1304,7 +1309,7 @@ esac
 if test x$basic_os != x
 then
 
-# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
 # set os.
 case $basic_os in
        gnu/linux*)
@@ -1748,7 +1753,8 @@ case $os in
             | skyos* | haiku* | rdos* | toppers* | drops* | es* \
             | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
             | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
-            | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
+            | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+            | fiwix* )
                ;;
        # This one is extra strict with allowed versions
        sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index cf0f74c644..bb4f358c5e 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Check the format of GNU Emacs change log entries.
 
-# Copyright 2014-2021 Free Software Foundation, Inc.
+# Copyright 2014-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/build-aux/git-hooks/pre-commit b/build-aux/git-hooks/pre-commit
index 719bfefc50..a55004680f 100755
--- a/build-aux/git-hooks/pre-commit
+++ b/build-aux/git-hooks/pre-commit
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Check file names in git commits for GNU Emacs.
 
-# Copyright 2014-2021 Free Software Foundation, Inc.
+# Copyright 2014-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/build-aux/git-hooks/prepare-commit-msg 
b/build-aux/git-hooks/prepare-commit-msg
index dd8434479d..7dc36f2219 100755
--- a/build-aux/git-hooks/prepare-commit-msg
+++ b/build-aux/git-hooks/prepare-commit-msg
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Check the format of GNU Emacs change log entries.
 
-# Copyright 2019-2021 Free Software Foundation, Inc.
+# Copyright 2019-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 9ff15f6019..1c6847ae3b 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -3,7 +3,7 @@
 
 # Convert git log output to ChangeLog format.
 
-# Copyright (C) 2008-2021 Free Software Foundation, Inc.
+# Copyright (C) 2008-2022 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog
index 30b2d78659..2ea2026171 100755
--- a/build-aux/gitlog-to-emacslog
+++ b/build-aux/gitlog-to-emacslog
@@ -2,7 +2,7 @@
 
 # Convert git log output to ChangeLog format for GNU Emacs.
 
-# Copyright (C) 2014-2021 Free Software Foundation, Inc.
+# Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 # Author: Paul Eggert
 
diff --git a/build-aux/make-info-dir b/build-aux/make-info-dir
index 256c9f025c..c29ea5088b 100755
--- a/build-aux/make-info-dir
+++ b/build-aux/make-info-dir
@@ -2,7 +2,7 @@
 
 ### make-info-dir - create info/dir, for systems without install-info
 
-## Copyright (C) 2013-2021 Free Software Foundation, Inc.
+## Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 ## Maintainer: emacs-devel@gnu.org
diff --git a/build-aux/move-if-change b/build-aux/move-if-change
index e85e90af50..9f7379a603 100755
--- a/build-aux/move-if-change
+++ b/build-aux/move-if-change
@@ -8,7 +8,7 @@ VERSION='2018-03-07 03:47'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2002-2021 Free Software Foundation, Inc.
+# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/msys-to-w32 b/build-aux/msys-to-w32
index e4e5e08641..2e5df8252d 100755
--- a/build-aux/msys-to-w32
+++ b/build-aux/msys-to-w32
@@ -2,7 +2,7 @@
 # Convert a MSYS path list to Windows-native format.
 # Status is zero if successful, nonzero otherwise.
 
-# Copyright (C) 2013-2021 Free Software Foundation, Inc.
+# Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index fae3a5fb33..51b25dd0a5 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -3,7 +3,7 @@
 
 # Update an FSF copyright year list to include the current year.
 
-# Copyright (C) 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2009-2022 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/update-subdirs b/build-aux/update-subdirs
index e56eea44de..95cf06bb5c 100755
--- a/build-aux/update-subdirs
+++ b/build-aux/update-subdirs
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Write into $1/subdirs.el a list of subdirs of directory $1.
 
-# Copyright (C) 1994-1995, 1997, 1999, 2001-2021 Free Software
+# Copyright (C) 1994-1995, 1997, 1999, 2001-2022 Free Software
 # Foundation, Inc.
 
 # This file is part of GNU Emacs.
diff --git a/config.bat b/config.bat
index e4332cd326..29742eec52 100644
--- a/config.bat
+++ b/config.bat
@@ -1,7 +1,7 @@
 @echo off
 rem   ----------------------------------------------------------------------
 rem   Configuration script for MSDOS
-rem   Copyright (C) 1994-1999, 2001-2021 Free Software Foundation, Inc.
+rem   Copyright (C) 1994-1999, 2001-2022 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
 
diff --git a/configure.ac b/configure.ac
index 0debc85214..baf8c8018e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl     autoconf
 dnl in the directory containing this script.
 dnl If you changed any AC_DEFINES, also run autoheader.
 dnl
-dnl Copyright (C) 1994-1996, 1999-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 1994-1996, 1999-2022 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
@@ -410,18 +410,19 @@ dnl This should be the last --with option, because 
--with-x is
 dnl added later on when we find the file name of X, and it's best to
 dnl keep them together visually.
 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
- [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, 
no)])],
+ [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, 
motif, no)])],
 [        case "${withval}" in
            y | ye | yes )      val=gtk ;;
            n | no )            val=no  ;;
            l | lu | luc | luci | lucid )       val=lucid ;;
            a | at | ath | athe | athen | athena )      val=athena ;;
+           m | mo | mot | moti | motif )       val=motif ;;
            g | gt | gtk  )     val=gtk ;;
            gtk2  )     val=gtk2 ;;
            gtk3  )     val=gtk3 ;;
            * )
 AC_MSG_ERROR(['--with-x-toolkit=$withval' is invalid;
-this option's value should be 'yes', 'no', 'lucid', 'athena', 'gtk',
+this option's value should be 'yes', 'no', 'lucid', 'athena', 'motif', 'gtk',
 'gtk2' or 'gtk3'.  'yes' and 'gtk' are synonyms.
 'athena' and 'lucid' are synonyms.])
            ;;
@@ -462,7 +463,7 @@ OPTION_DEFAULT_ON([harfbuzz],[don't use HarfBuzz for text 
shaping])
 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
 
-OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Xaw3d/GTK toolkit scroll 
bars])
+OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif/Xaw3d/GTK toolkit 
scroll bars])
 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
 OPTION_DEFAULT_ON([xim],[at runtime, default X11 XIM to off])
 OPTION_DEFAULT_ON([xdbe],[don't use X11 double buffering support])
@@ -470,6 +471,7 @@ AC_ARG_WITH([ns],[AS_HELP_STRING([--with-ns],
 [use Nextstep (macOS Cocoa or GNUstep) windowing system.
 On by default on macOS.])],[],[with_ns=maybe])
 OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])
+OPTION_DEFAULT_OFF([pgtk], [use pure GTK build without reliance on X libs 
(Wayland support) (requires cairo) - Experimental])
 
 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux 
console])
 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
@@ -1197,8 +1199,8 @@ fi)
 
 dnl Automake replacements.
 AC_DEFUN([AM_CONDITIONAL],
-  [$2 && $1=1 || $1=
-   AC_SUBST([$1])])
+  [$2 && $1_CONDITION=1 || $1_CONDITION=
+   AC_SUBST([$1_CONDITION])])
 
 dnl Prefer silent make output.  For verbose output, use
 dnl 'configure --disable-silent-rules' or 'make V=1' .
@@ -1840,8 +1842,14 @@ AC_SUBST(AUTO_DEPEND)
 ## window-system-specific substs.
 
 window_system=none
+
+if test "${with_pgtk}" = "yes"; then
+  window_system=pgtk
+fi
+
+
 AC_PATH_X
-if test "$no_x" != yes; then
+if test "$no_x" != yes && test "${with_pgtk}" != "yes"; then
   window_system=x11
 fi
 
@@ -2272,6 +2280,7 @@ term_header=
 HAVE_X_WINDOWS=no
 HAVE_X11=no
 USE_X_TOOLKIT=none
+HAVE_PGTK=no
 
 case "${window_system}" in
   x11 )
@@ -2304,10 +2313,18 @@ dnl use the toolkit if we have gtk, or X11R5 or newer.
   w32 )
     term_header=w32term.h
   ;;
+  pgtk )
+    term_header=pgtkterm.h
+    with_gtk3=yes
+    USE_X_TOOLKIT=none
+    HAVE_PGTK=yes
+    AC_DEFINE([HAVE_PGTK], 1, [Define to 1 if you have pure Gtk+-3.])
+  ;;
   haiku )
     term_header=haikuterm.h
   ;;
 esac
+AC_SUBST(HAVE_PGTK)
 
 if test "$window_system" = none && test "X$with_x" != "Xno"; then
    AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
@@ -2320,7 +2337,7 @@ if test "$window_system" = none && test "X$with_x" != 
"Xno"; then
    then
         AC_MSG_ERROR([You seem to be running X, but no X development libraries
 were found.  You should install the relevant development files for X
-and for the toolkit you want, such as Gtk+.  Also make
+and for the toolkit you want, such as Gtk+ or Motif.  Also make
 sure you have development files for image handling, i.e.
 tiff, gif, jpeg, png and xpm.
 If you are sure you want Emacs compiled without X window support, pass
@@ -2639,7 +2656,8 @@ fi
 ### Use -lrsvg-2 if available, unless '--with-rsvg=no' is specified.
 HAVE_RSVG=no
 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" \
-   || test "${opsys}" = "mingw32" || test "${HAVE_BE_APP}" = "yes"; then
+   || test "${opsys}" = "mingw32" || test "${HAVE_BE_APP}" = "yes" \
+   || test "${window_system}" = "pgtk"; then
   if test "${with_rsvg}" != "no"; then
     RSVG_REQUIRED=2.14.0
     RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
@@ -2664,7 +2682,7 @@ HAVE_WEBP=no
 if test "${with_webp}" != "no"; then
    if test "${HAVE_X11}" = "yes" || test "${opsys}" = "mingw32" \
    || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
-   || test "${HAVE_BE_APP}" = "yes"; then
+   || test "${HAVE_BE_APP}" = "yes" || test "${HAVE_PGTK}" = "yes"; then
       WEBP_REQUIRED=0.6.0
       WEBP_MODULE="libwebp >= $WEBP_REQUIRED"
 
@@ -2705,7 +2723,7 @@ fi
 
 HAVE_IMAGEMAGICK=no
 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test 
"${HAVE_W32}" = "yes" || \
-   test "${HAVE_BE_APP}" = "yes"; then
+   test "${HAVE_BE_APP}" = "yes" || test "${window_system}" = "pgtk"; then
   if test "${with_imagemagick}" != "no"; then
     if test -n "$BREW"; then
       # Homebrew doesn't link ImageMagick 6 by default, so make sure
@@ -2788,6 +2806,9 @@ if test "${opsys}" != "mingw32"; then
         AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1],
           [Define to 1 to disable Glib deprecation warnings.])
        fi
+       if test "$window_system" = pgtk; then
+         GLIB_GSETTINGS
+       fi
     else
        check_gtk2=yes
        gtk3_pkg_errors="$GTK_PKG_ERRORS "
@@ -2929,6 +2950,15 @@ AC_SUBST(XWIDGETS_OBJ)
 CFLAGS=$OLD_CFLAGS
 LIBS=$OLD_LIBS
 
+PGTK_OBJ=
+PGTK_LIBS=
+if test "$window_system" = "pgtk"; then
+  PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o pgtkmenu.o pgtkim.o xsettings.o"
+  PGTK_LIBS="$GTK_LIBS"
+fi
+AC_SUBST(PGTK_OBJ)
+AC_SUBST(PGTK_LIBS)
+
 dnl D-Bus has been tested under GNU/Linux only.  Must be adapted for
 dnl other platforms.
 HAVE_DBUS=no
@@ -2958,7 +2988,7 @@ AC_SUBST(DBUS_OBJ)
 
 dnl GSettings has been tested under GNU/Linux only.
 HAVE_GSETTINGS=no
-if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
+if test "${HAVE_X11}" = "yes" -o "${window_system}" = "pgtk" && test 
"${with_gsettings}" = "yes"; then
    EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26])
    if test "$HAVE_GSETTINGS" = "yes"; then
       old_CFLAGS=$CFLAGS
@@ -2988,11 +3018,12 @@ if test "${HAVE_X11}" = "yes" && test 
"${with_gsettings}" = "yes"; then
       LIBS=$old_LIBS
    fi
 fi
+AC_SUBST(HAVE_GSETTINGS)
 
 dnl GConf has been tested under GNU/Linux only.
 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
 HAVE_GCONF=no
-if test "${HAVE_X11}" = "yes" && test "${with_gconf}" != "no"; then
+if test "${HAVE_X11}" = "yes" -o "${window_system}" = "pgtk" && test 
"${with_gconf}" != "no"; then
    EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13])
    if test "$HAVE_GCONF" = yes; then
       AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
@@ -3391,7 +3422,7 @@ if test "${HAVE_XIM}" != "no"; then
 XrmDatabase db;
 char *res_name;
 char *res_class;
-XIMProc  callback;
+XIDProc *callback;
 XPointer *client_data;
 #ifndef __GNUC__
 /* If we're not using GCC, it's probably not XFree86, and this is
@@ -3447,6 +3478,23 @@ if test "${HAVE_X11}" = "yes"; then
     fi
   fi
 fi
+
+if test "$window_system" = "pgtk"; then
+  CAIRO_REQUIRED=1.12.0
+  CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
+  EMACS_CHECK_MODULES(CAIRO, $CAIRO_MODULE)
+  if test $HAVE_CAIRO = yes; then
+    AC_DEFINE(USE_CAIRO, 1, [Define to 1 if using cairo.])
+  else
+    AC_MSG_ERROR([cairo required but not found.])
+  fi
+
+  CFLAGS="$CFLAGS $CAIRO_CFLAGS"
+  LIBS="$LIBS $CAIRO_LIBS"
+  AC_SUBST(CAIRO_CFLAGS)
+  AC_SUBST(CAIRO_LIBS)
+fi
+
 if test "${HAVE_BE_APP}" = "yes"; then
   if test "${with_be_cairo}" != "no"; then
     CAIRO_REQUIRED=1.8.0
@@ -3583,10 +3631,34 @@ if test "${HAVE_X11}" = "yes"; then
     fi
   fi
 else # "${HAVE_X11}" != "yes"
-  HAVE_XFT=no
-  HAVE_FREETYPE=no
-  HAVE_LIBOTF=no
-  HAVE_M17N_FLT=no
+  if test $window_system = pgtk; then
+    EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
+    EMACS_CHECK_MODULES([FREETYPE], [freetype2])
+    if test "$HAVE_FONTCONFIG" != yes -o "$HAVE_FREETYPE" != yes; then
+      AC_MSG_ERROR(fontconfig and freetype is required.)
+    fi
+    HAVE_LIBOTF=no
+    AC_DEFINE(HAVE_FREETYPE, 1,
+             [Define to 1 if using the freetype and fontconfig libraries.])
+    if test "${with_libotf}" != "no"; then
+      EMACS_CHECK_MODULES([LIBOTF], [libotf])
+      if test "$HAVE_LIBOTF" = "yes"; then
+       AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
+       AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
+                    HAVE_OTF_GET_VARIATION_GLYPHS=yes,
+                    HAVE_OTF_GET_VARIATION_GLYPHS=no)
+       if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
+         AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
+                   [Define to 1 if libotf has OTF_get_variation_glyphs.])
+       fi
+      fi
+    fi
+  else
+    HAVE_XFT=no
+    HAVE_FREETYPE=no
+    HAVE_LIBOTF=no
+    HAVE_M17N_FLT=no
+  fi
 fi   # "${HAVE_X11}" != "yes"
 
 HAVE_HARFBUZZ=no
@@ -3598,6 +3670,7 @@ else
   harfbuzz_required_ver=0.9.42
 fi
 if test "${HAVE_X11}" = "yes" && test "${HAVE_FREETYPE}" = "yes" \
+        || test "$window_system" = "pgtk" \
         || test "${HAVE_W32}" = "yes"; then
   if test "${with_harfbuzz}" != "no"; then
     EMACS_CHECK_MODULES([HARFBUZZ], [harfbuzz >= $harfbuzz_required_ver])
@@ -3785,7 +3858,8 @@ AC_SUBST(LIBXPM)
 HAVE_JPEG=no
 LIBJPEG=
 if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
-   || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes"; then
+   || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
+   || test "$window_system" = "pgtk"; then
   if test "${with_jpeg}" != "no"; then
     AC_CACHE_CHECK([for jpeglib 6b or later],
       [emacs_cv_jpeglib],
@@ -4103,7 +4177,8 @@ if test "${with_png}" != no; then
   if test "$opsys" = mingw32; then
     AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
   elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
-       || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes"; then
+       || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
+       || test "$window_system" = "pgtk"; then
     EMACS_CHECK_MODULES([PNG], [libpng >= 1.0.0])
     if test $HAVE_PNG = yes; then
       LIBPNG=$PNG_LIBS
@@ -4178,7 +4253,8 @@ if test "${opsys}" = "mingw32"; then
     AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library 
(-ltiff).])
   fi
 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
-     || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes"; then
+     || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
+     || test "$window_system" = "pgtk"; then
   if test "${with_tiff}" != "no"; then
     AC_CHECK_HEADER(tiffio.h,
       [tifflibs="-lz -lm"
@@ -4208,7 +4284,7 @@ if test "${opsys}" = "mingw32"; then
   fi
 elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
         || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
-       || test "${HAVE_BE_APP}" = "yes"; then
+       || test "${HAVE_BE_APP}" = "yes" || test "$window_system" = "pgtk"; then
   AC_CHECK_HEADER(gif_lib.h,
 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
 # Earlier versions can crash Emacs, but version 5.0 removes 
EGifPutExtensionLast.
@@ -4416,6 +4492,13 @@ if test "${HAVE_X11}" = "yes" && test "${with_xinput2}" 
!= "no"; then
        AC_MSG_WARN([You are building Emacs with GTK+ 2 and the X Input 
Extension version 2.
 This might lead to problems if your version of GTK+ is not built with support 
for XInput 2.])
      fi
+     # Detect both faulty installations of libXi where gesture event
+     # types are defined but gesture event structures are not, and
+     # also where gesture event structures are empty.
+     AC_CHECK_MEMBERS([XIGesturePinchEvent.delta_unaccel_y],
+       [AC_DEFINE(HAVE_USABLE_XI_GESTURE_PINCH_EVENT, 1,
+         [Define to 1 if XInput headers define gesture structures 
correctly.])],
+       [], [[#include <X11/extensions/XInput2.h>]])
    fi
 fi
 AC_SUBST(XINPUT_CFLAGS)
@@ -5697,7 +5780,7 @@ fi
 
 version=$PACKAGE_VERSION
 
-copyright="Copyright (C) 2021 Free Software Foundation, Inc."
+copyright="Copyright (C) 2022 Free Software Foundation, Inc."
 AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
   [Short copyright string for this version of Emacs.])
 AC_SUBST(copyright)
@@ -5713,6 +5796,7 @@ AC_SUBST(prefix)
 AC_SUBST(exec_prefix)
 AC_SUBST(bindir)
 AC_SUBST(datadir)
+AC_SUBST(gsettingsschemadir)
 AC_SUBST(sharedstatedir)
 AC_SUBST(libexecdir)
 AC_SUBST(mandir)
@@ -5776,13 +5860,13 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then
   fi
 fi
 
+if test "${window_system}" = "pgtk"; then
+   FONT_OBJ="ftfont.o ftcrfont.o"
+fi
+
 if test "${HAVE_BE_APP}" = "yes" ; then
-  if test "${HAVE_FREETYPE}" = "yes" || \
-     test "${HAVE_CAIRO}" = "yes"; then
-     FONT_OBJ="$FONT_OBJ ftfont.o"
-  fi
   if test "${HAVE_CAIRO}" = "yes"; then
-    FONT_OBJ="$FONT_OBJ ftcrfont.o"
+    FONT_OBJ="$FONT_OBJ ftfont.o ftcrfont.o"
   fi
 fi
 
@@ -6176,7 +6260,7 @@ optsep=
 emacs_config_features=
 for opt in ACL BE_APP CAIRO DBUS FREETYPE GCONF GIF GLIB GMP GNUTLS GPM 
GSETTINGS \
  HARFBUZZ IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \
- M17N_FLT MODULES NATIVE_COMP NOTIFY NS OLDXMENU PDUMPER PNG RSVG SECCOMP \
+ M17N_FLT MODULES NATIVE_COMP NOTIFY NS OLDXMENU PDUMPER PGTK PNG RSVG SECCOMP 
\
  SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS \
  UNEXEC WEBP X11 XAW3D XDBE XFT XIM XINPUT2 XPM XWIDGETS X_TOOLKIT \
  ZLIB; do
diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1
index bc4dbd4705..c1c5f5407d 100644
--- a/doc/emacs/ChangeLog.1
+++ b/doc/emacs/ChangeLog.1
@@ -10919,7 +10919,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/emacs/Makefile.in b/doc/emacs/Makefile.in
index dde3ae83c1..a24c03ead3 100644
--- a/doc/emacs/Makefile.in
+++ b/doc/emacs/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1994, 1996-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1996-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi
index 972416ff1c..9f339a0357 100644
--- a/doc/emacs/abbrevs.texi
+++ b/doc/emacs/abbrevs.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Abbrevs
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index d771393ffa..d0f2cc343b 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1994--1997, 1999--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1994--1997, 1999--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @node Acknowledgments
diff --git a/doc/emacs/anti.texi b/doc/emacs/anti.texi
index 3b02187b5c..bb88fddc04 100644
--- a/doc/emacs/anti.texi
+++ b/doc/emacs/anti.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 2005--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2005--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 
 @node Antinews
diff --git a/doc/emacs/arevert-xtra.texi b/doc/emacs/arevert-xtra.texi
index 5dede6246c..a384e562e8 100644
--- a/doc/emacs/arevert-xtra.texi
+++ b/doc/emacs/arevert-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/back.texi b/doc/emacs/back.texi
index dc4e218d37..85d79913af 100644
--- a/doc/emacs/back.texi
+++ b/doc/emacs/back.texi
@@ -1,6 +1,6 @@
 \input texinfo  @c -*-texinfo-*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index c4fa0d64ed..196a28be5a 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Basic
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index c4e5bc32b7..8a8584689f 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Buffers
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index f9ea1b390f..5b68b1ef9f 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Building
diff --git a/doc/emacs/cal-xtra.texi b/doc/emacs/cal-xtra.texi
index aec2e6cc5a..7c41adf029 100644
--- a/doc/emacs/cal-xtra.texi
+++ b/doc/emacs/cal-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.  -*- coding: utf-8 -*-
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi
index 18de721e28..0ba8b2cbd0 100644
--- a/doc/emacs/calendar.texi
+++ b/doc/emacs/calendar.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.  -*- coding: utf-8 -*-
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Calendar/Diary
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 86c04c84a2..5c444fc648 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Emacs Invocation
@@ -756,6 +756,10 @@ On MS-Windows, if you set this variable, Emacs will load 
and initialize
 the network library at startup, instead of waiting until the first
 time it is required.
 
+@item WAYLAND_DISPLAY
+Pgtk Emacs (built with @option{--with-pgtk}) can run on Wayland natively.
+@env{WAYLAND_DISPLAY} specifies the connection to the compositor.
+
 @item emacs_dir
 On MS-Windows, @env{emacs_dir} is a special environment variable, which
 indicates the full path of the directory in which Emacs is installed.
diff --git a/doc/emacs/commands.texi b/doc/emacs/commands.texi
index f56f820b39..431cc2e5ce 100644
--- a/doc/emacs/commands.texi
+++ b/doc/emacs/commands.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index c4c43f2713..b2dd5eb698 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Customization
diff --git a/doc/emacs/dired-xtra.texi b/doc/emacs/dired-xtra.texi
index fc8130d8e6..454abcae4c 100644
--- a/doc/emacs/dired-xtra.texi
+++ b/doc/emacs/dired-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 48cf5630ee..700b3f2191 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Dired
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 15cad88d59..4fcd2a3f7d 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 
 @c See file emacs.texi for copying conditions.
@@ -903,6 +903,20 @@ prefix argument.
 @code{text-scale-mode} if the current font scaling is other than 1,
 and disable it otherwise.
 
+@cindex pinch to scale
+@findex text-scale-pinch
+  The command @code{text-scale-pinch} increases or decreases the text
+scale based on the distance between fingers on a touchpad when a pinch
+gesture is performed by placing two fingers on a touchpad and moving
+them towards or apart from each other.  This is only available on some
+systems with supported hardware.
+
+@findex mouse-wheel-text-scale
+  The command @code{mouse-wheel-text-scale} also changes the text
+scale.  Normally, it is run when you press @key{Ctrl} while moving the
+mouse wheel.  The text scale is increased when the wheel is moved
+downwards, and it is decreased when the wheel is moved upwards.
+
 @node Font Lock
 @section Font Lock mode
 @cindex Font Lock mode
diff --git a/doc/emacs/emacs-xtra.texi b/doc/emacs/emacs-xtra.texi
index 2d511bffbc..fbc1e1228e 100644
--- a/doc/emacs/emacs-xtra.texi
+++ b/doc/emacs/emacs-xtra.texi
@@ -16,7 +16,7 @@
 @copying
 This manual describes specialized features of Emacs.
 
-Copyright @copyright{} 2004--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index dff42c7b42..ad0fa5f0cd 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -20,7 +20,7 @@ This is the @cite{GNU Emacs Manual},
 @end ifclear
 updated for Emacs version @value{EMACSVER}.
 
-Copyright @copyright{} 1985--1987, 1993--2021 Free Software Foundation,
+Copyright @copyright{} 1985--1987, 1993--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/emacs/emerge-xtra.texi b/doc/emacs/emerge-xtra.texi
index 7bf24151e5..d7d94c8b84 100644
--- a/doc/emacs/emerge-xtra.texi
+++ b/doc/emacs/emerge-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/entering.texi b/doc/emacs/entering.texi
index 0476466da5..6069da0380 100644
--- a/doc/emacs/entering.texi
+++ b/doc/emacs/entering.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index b7016b0057..84eb7275da 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Files
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi
index 7feebddee8..d2704e25d6 100644
--- a/doc/emacs/fixit.texi
+++ b/doc/emacs/fixit.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Fixit
diff --git a/doc/emacs/fortran-xtra.texi b/doc/emacs/fortran-xtra.texi
index c8efd56c37..fc20d8ea35 100644
--- a/doc/emacs/fortran-xtra.texi
+++ b/doc/emacs/fortran-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index c14ada2957..ce43408101 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Frames
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 9c06bcc4af..7e0c84d723 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Glossary
diff --git a/doc/emacs/gnu.texi b/doc/emacs/gnu.texi
index 4d48dcdb8e..58cc6bb664 100644
--- a/doc/emacs/gnu.texi
+++ b/doc/emacs/gnu.texi
@@ -1,4 +1,4 @@
-@c Copyright (C) 1985--1987, 1993, 1995, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993, 1995, 2001--2022 Free Software
 @c Foundation, Inc.
 @c
 @c Permission is granted to anyone to make or distribute verbatim copies
diff --git a/doc/emacs/haiku.texi b/doc/emacs/haiku.texi
index d2b7eb8408..0c76990cae 100644
--- a/doc/emacs/haiku.texi
+++ b/doc/emacs/haiku.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2021 Free Software Foundation, Inc.
+@c Copyright (C) 2021--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Haiku
 @appendix Emacs and Haiku
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 20a9d8be13..5a458209d2 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Help
diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi
index d989f34556..058d313c2d 100644
--- a/doc/emacs/indent.texi
+++ b/doc/emacs/indent.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Indentation
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 375ac970d7..e3de2bc2fa 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 
@@ -929,6 +929,11 @@ so in a rectangular fashion, and killing and yanking 
operate on the
 rectangle.  @xref{Killing}.  The mode persists only as long as the
 region is active.
 
+The region-rectangle works only when the mark is active.  In
+particular, when Transient Mark mode is off (@pxref{Disabled Transient
+Mark}), in addition to typing @kbd{C-x @key{SPC}} you will need to
+activate the mark.
+
 Unlike the standard region, the region-rectangle can have its corners
 extended past the end of buffer, or inside stretches of white space
 that point normally cannot enter, like in the middle of a TAB
@@ -937,11 +942,12 @@ character.
 @findex rectangle-exchange-point-and-mark
 @findex exchange-point-and-mark@r{, in rectangle-mark-mode}
 @kindex C-x C-x@r{, in rectangle-mark-mode}
-When the region is in rectangle-mark-mode, @kbd{C-x C-x} runs the
-command @code{rectangle-exchange-point-and-mark}, which cycles between
-the four corners of the region-rectangle.  This comes in handy if you
-want to modify the dimensions of the region-rectangle before invoking
-an operation on the marked text.
+When the region is active (@pxref{Mark}) and in rectangle-mark-mode,
+@kbd{C-x C-x} runs the command
+@code{rectangle-exchange-point-and-mark}, which cycles between the
+four corners of the region-rectangle.  This comes in handy if you want
+to modify the dimensions of the region-rectangle before invoking an
+operation on the marked text.
 
 @node CUA Bindings
 @section CUA Bindings
diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi
index e0533f049e..60880941db 100644
--- a/doc/emacs/kmacro.texi
+++ b/doc/emacs/kmacro.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Keyboard Macros
diff --git a/doc/emacs/m-x.texi b/doc/emacs/m-x.texi
index 7b9b40388c..a98b879c88 100644
--- a/doc/emacs/m-x.texi
+++ b/doc/emacs/m-x.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node M-x
@@ -60,6 +60,7 @@ the option @code{read-extended-command-predicate} to exclude 
those
 irrelevant commands from completion results.
 
 @kindex M-S-x
+@kindex M-X
   Conversely, Emacs can exclude all commands except those that are
 particularly relevant to the current buffer.  The @kbd{M-S-x} (that's
 ``meta shift x'') command works just like @kbd{M-x}, but instead of
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 99c67ed09e..ab143707fd 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2000--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2000--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Mac OS / GNUstep
 @appendix Emacs and macOS / GNUstep
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index ebd72fa2a0..9a23f23e0e 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual., Abbrevs, This is part of the Emacs 
manual., Top
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Maintaining
diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi
index 2461cb0f6a..91c44d527b 100644
--- a/doc/emacs/mark.texi
+++ b/doc/emacs/mark.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Mark
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index b0f6e424a7..979be34fac 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Minibuffer
@@ -497,7 +497,10 @@ falls back on the next style.
 @vindex completion-styles
   The list variable @code{completion-styles} specifies the completion
 styles to use.  Each list element is the name of a completion style (a
-Lisp symbol).  The default completion styles are (in order):
+Lisp symbol).  The available style symbols are stored in the variable
+@code{completion-styles-alist} (@pxref{Completion Variables,,, elisp,
+The Emacs Lisp Reference Manual}).  The default completion styles are
+(in order):
 
 @table @code
 @item basic
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 1f2c852fac..df1e5ef238 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index 9014221edf..c348130807 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Modes
diff --git a/doc/emacs/msdos-xtra.texi b/doc/emacs/msdos-xtra.texi
index 114700f08d..57e1ac90a5 100644
--- a/doc/emacs/msdos-xtra.texi
+++ b/doc/emacs/msdos-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi
index 20eaa0bcb6..e30d623a77 100644
--- a/doc/emacs/msdos.texi
+++ b/doc/emacs/msdos.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Microsoft Windows
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 121d696730..09fedb7f9f 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1997, 1999--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1997, 1999--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node International
 @chapter International Character Set Support
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 570afd5be2..caa65bf33b 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Packages
diff --git a/doc/emacs/picture-xtra.texi b/doc/emacs/picture-xtra.texi
index a04b72d38d..f5c827ea17 100644
--- a/doc/emacs/picture-xtra.texi
+++ b/doc/emacs/picture-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 85ed65a495..ff4405f1fb 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 1999--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Programs
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index df1eec04c0..fb93601879 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Registers
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi
index e7ca2ae48b..e38bde036a 100644
--- a/doc/emacs/rmail.texi
+++ b/doc/emacs/rmail.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Rmail
diff --git a/doc/emacs/screen.texi b/doc/emacs/screen.texi
index 2ff808e040..954d7a1c83 100644
--- a/doc/emacs/screen.texi
+++ b/doc/emacs/screen.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Screen
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index fbbb1f6e68..c12992c239 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Search
@@ -1448,9 +1448,13 @@ letter @code{a} as well as all the other variants like 
@code{@'a}.
 
 @vindex char-fold-include
 @vindex char-fold-exclude
+@vindex char-fold-override
   You can add new foldings using the customizable variable
 @code{char-fold-include}, or remove the existing ones using the
-customizable variable @code{char-fold-exclude}.
+customizable variable @code{char-fold-exclude}.  You can also
+customize @code{char-fold-override} to @code{t} to disable all the
+character equivalences except those you add yourself using
+@code{char-fold-include}.
 
 @node Replace
 @section Replacement Commands
diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi
index 174e52ac9a..ea87e0a77b 100644
--- a/doc/emacs/sending.texi
+++ b/doc/emacs/sending.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Sending Mail
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index ead0f699bb..c5b54777a8 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Text
@@ -474,8 +474,8 @@ insert a curved quote even when Electric Quote is disabled 
or
 inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
 @t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
 @xref{Inserting Text}.  Note that the value of
-@code{electric-quote-chars} does not affect these keybindings, they
-are not keybindings of @code{electric-quote-mode} but bound in
+@code{electric-quote-chars} does not affect these key bindings, they
+are not key bindings of @code{electric-quote-mode} but bound in
 @code{global-map}.
 
 @node Filling
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index 027086cab5..e966565f00 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/vc-xtra.texi b/doc/emacs/vc-xtra.texi
index 51b9d66778..1ed2d62566 100644
--- a/doc/emacs/vc-xtra.texi
+++ b/doc/emacs/vc-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included in emacs-xtra.texi when producing the printed
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index 4cd00cba6c..2d984f4b92 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 2004--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2004--2022 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in vc-xtra.texi (when producing the
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 27c754133f..4a3862562c 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2021 Free Software
+@c Copyright (C) 1985--1987, 1993--1995, 1997, 2000--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Windows
@@ -605,7 +605,7 @@ selects the window immediately to the right of the 
currently selected
 one, and similarly for the left, up, and down counterparts.
 @code{windmove-default-keybindings} binds these commands to
 @kbd{S-right} etc.; doing so disables shift selection for those keys
-(@pxref{Shift Selection}).  In the same way as keybindings can be
+(@pxref{Shift Selection}).  In the same way as key bindings can be
 defined for commands that select windows directionally, you can use
 @code{windmove-display-default-keybindings} to define keybindings for
 commands that specify in what direction to display the window for the
@@ -613,7 +613,7 @@ buffer that the next command is going to display.  Also 
there is
 @code{windmove-delete-default-keybindings} to define keybindings for
 commands that delete windows directionally, and
 @code{windmove-swap-states-default-keybindings} that defines
-keybindings for commands that swap the window contents of the selected
+key bindings for commands that swap the window contents of the selected
 window with the window in the specified direction.
 
   The command @kbd{M-x compare-windows} lets you compare the text
diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi
index a7bd006df4..ef3d4c768c 100644
--- a/doc/emacs/xresources.texi
+++ b/doc/emacs/xresources.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1987, 1993--1995, 1997, 2001--2021 Free Software
+@c Copyright (C) 1987, 1993--1995, 1997, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node X Resources
diff --git a/doc/lispintro/ChangeLog.1 b/doc/lispintro/ChangeLog.1
index bb4323a773..a581faa73b 100644
--- a/doc/lispintro/ChangeLog.1
+++ b/doc/lispintro/ChangeLog.1
@@ -782,7 +782,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/lispintro/Makefile.in b/doc/lispintro/Makefile.in
index 294b310d67..d554f3d7a6 100644
--- a/doc/lispintro/Makefile.in
+++ b/doc/lispintro/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1994-1999, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994-1999, 2001-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/lispintro/README b/doc/lispintro/README
index eca19c76a4..b6dc23bb90 100644
--- a/doc/lispintro/README
+++ b/doc/lispintro/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/doc/lispintro/cons-1.eps b/doc/lispintro/cons-1.eps
index 4877df7135..f2e445b851 100644
--- a/doc/lispintro/cons-1.eps
+++ b/doc/lispintro/cons-1.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:26:58 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-2.eps b/doc/lispintro/cons-2.eps
index 48fdc7e876..fd607021e7 100644
--- a/doc/lispintro/cons-2.eps
+++ b/doc/lispintro/cons-2.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:26:39 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-2a.eps b/doc/lispintro/cons-2a.eps
index 81053d3f26..23051ef7fc 100644
--- a/doc/lispintro/cons-2a.eps
+++ b/doc/lispintro/cons-2a.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Tue Mar 14 15:09:30 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-3.eps b/doc/lispintro/cons-3.eps
index e6a80f1c8b..24fb0e1100 100644
--- a/doc/lispintro/cons-3.eps
+++ b/doc/lispintro/cons-3.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:25:41 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-4.eps b/doc/lispintro/cons-4.eps
index c1aac9c09b..70a82103f5 100644
--- a/doc/lispintro/cons-4.eps
+++ b/doc/lispintro/cons-4.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:25:06 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-5.eps b/doc/lispintro/cons-5.eps
index a0918a92c5..03391127b0 100644
--- a/doc/lispintro/cons-5.eps
+++ b/doc/lispintro/cons-5.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:27:28 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/drawers.eps b/doc/lispintro/drawers.eps
index 725bd9723c..7e3c83deb6 100644
--- a/doc/lispintro/drawers.eps
+++ b/doc/lispintro/drawers.eps
@@ -9,7 +9,7 @@
 %%EndComments
 %%BeginProlog
 
-% Copyright (C) 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index 9f1f10e8d6..9d4520b040 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -117,7 +117,7 @@ Edition @value{edition-number}, @value{update-date}
 @sp 1
 Distributed with Emacs version @value{EMACSVER}.
 @sp 1
-Copyright @copyright{} 1990--1995, 1997, 2001--2021 Free Software
+Copyright @copyright{} 1990--1995, 1997, 2001--2022 Free Software
 Foundation, Inc.
 @sp 1
 
@@ -688,7 +688,7 @@ Your @file{.emacs} File
 * Text and Auto-fill::          Automatically wrap lines.
 * Mail Aliases::                Use abbreviations for email addresses.
 * Indent Tabs Mode::            Don't use tabs with @TeX{}
-* Keybindings::                 Create some personal keybindings.
+* Key Bindings::                Create some personal key bindings.
 * Keymaps::                     More about key binding.
 * Loading Files::               Load (i.e., evaluate) files automatically.
 * Autoload::                    Make functions available.
@@ -3358,7 +3358,7 @@ Both the examples just mentioned work identically to move 
point forward
 three sentences.  (Since @code{multiply-by-seven} is not bound to a key,
 it could not be used as an example of key binding.)
 
-(@xref{Keybindings, , Some Keybindings}, to learn how to bind a command
+(@xref{Key Bindings, , Some Key Bindings}, to learn how to bind a command
 to a key.)
 
 A @dfn{prefix argument} is passed to an interactive function by typing the
@@ -4896,25 +4896,6 @@ result of this, point is placed at the beginning of the 
buffer and mark
 is set at the end of the buffer.  The whole buffer is, therefore, the
 region.
 
-@c FIXME: the definition of append-to-buffer has been changed (in
-@c 2010-03-30).
-@c In Bug#8275, Stefan Monner <monnier@iro.umontreal.ca> writes:
-@c >> Do you want to fix this, or shall I try?  The problem is that
-@c >> append-to-buffer now uses let* and with-current-buffer, so this might
-@c >> break the flow of the text.  At this point in the book, let* and
-@c >> with-current-buffer are not yet introduced.
-@c >
-@c > Here are some thoughts:
-@c > - I don't think it's of any importance that the example code be
-@c >   identical to the currently used code.
-@c > - append-to-buffer might not be the best example since AFAICT copying
-@c >   text from one buffer to another is not a common operation and in most
-@c >   cases this is done via buffer-substring + insert (often with some
-@c >   processing on the string between the two) rather than with
-@c >   insert-buffer-substring which is a rarely used function.
-@c > - yes, I think the text would benefit from some rethink to try and present
-@c >   with-current-buffer in preference to set-buffer, but it's not
-@c >   a simple fix.
 @node append-to-buffer
 @section The Definition of @code{append-to-buffer}
 @findex append-to-buffer
@@ -4949,8 +4930,9 @@ buffer to which the text will go, the window it comes 
from and goes
 to, and the region that will be copied.
 
 @need 1250
-Here is the complete text of the function:
+Here is a possible implementation of the function:
 
+@c GNU Emacs 22
 @smallexample
 @group
 (defun append-to-buffer (buffer start end)
@@ -5017,7 +4999,9 @@ name.  (The function can handle either.)
 Since the @code{append-to-buffer} function will be used interactively,
 the function must have an @code{interactive} expression.  (For a
 review of @code{interactive}, see @ref{Interactive, , Making a
-Function Interactive}.)  The expression reads as follows:
+Function Interactive}.)
+
+The expression reads as follows:
 
 @smallexample
 @group
@@ -5046,7 +5030,7 @@ for true.
 
 The first argument to @code{other-buffer}, the exception, is yet
 another function, @code{current-buffer}.  That is not going to be
-returned.  The second argument is the symbol for true, @code{t}. that
+returned.  The second argument is the symbol for true, @code{t}.  That
 tells @code{other-buffer} that it may show visible buffers (except in
 this case, it will not show the current buffer, which makes sense).
 
@@ -5082,33 +5066,6 @@ point and mark.  That argument worked fine.)
 @node append-to-buffer body
 @subsection The Body of @code{append-to-buffer}
 
-@ignore
-in GNU Emacs 22   in    /usr/local/src/emacs/lisp/simple.el
-
-(defun append-to-buffer (buffer start end)
-  "Append to specified buffer the text of the region.
-It is inserted into that buffer before its point.
-
-When calling from a program, give three arguments:
-BUFFER (or buffer name), START and END.
-START and END specify the portion of the current buffer to be copied."
-  (interactive
-   (list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
-         (region-beginning) (region-end)))
-  (let ((oldbuf (current-buffer)))
-    (save-excursion
-      (let* ((append-to (get-buffer-create buffer))
-             (windows (get-buffer-window-list append-to t t))
-             point)
-        (set-buffer append-to)
-        (setq point (point))
-        (barf-if-buffer-read-only)
-        (insert-buffer-substring oldbuf start end)
-        (dolist (window windows)
-          (when (= (window-point window) point)
-            (set-window-point window (point))))))))
-@end ignore
-
 The body of the @code{append-to-buffer} function begins with @code{let}.
 
 As we have seen before (@pxref{let, , @code{let}}), the purpose of a
@@ -5127,7 +5084,7 @@ whole by showing a template for @code{append-to-buffer} 
with the
   "@var{documentation}@dots{}"
   (interactive @dots{})
   (let ((@var{variable} @var{value}))
-        @var{body}@dots{})
+        @var{body}@dots{}))
 @end group
 @end smallexample
 
@@ -5247,19 +5204,39 @@ of filling in the slots of a template:
 
 @need 1200
 @noindent
+@anchor{let* introduced}
+@findex let*
 In this function, the body of the @code{save-excursion} contains only
 one expression, the @code{let*} expression.  You know about a
-@code{let} function.  The @code{let*} function is different.  It has a
-@samp{*} in its name.  It enables Emacs to set each variable in its
-varlist in sequence, one after another.
+@code{let} function.  The @code{let*} function is different.  It
+enables Emacs to set each variable in its varlist in sequence, one
+after another; such that variables in the latter part of the varlist
+can make use of the values to which Emacs set variables earlier in the
+varlist.
 
-Its critical feature is that variables later in the varlist can make
-use of the values to which Emacs set variables earlier in the varlist.
-@xref{fwd-para let, , The @code{let*} expression}.
+Looking at the @code{let*} expression in @code{append-to-buffer}:
 
-We will skip functions like @code{let*} and focus on two: the
-@code{set-buffer} function and the @code{insert-buffer-substring}
-function.
+@smallexample
+@group
+(let* ((append-to (get-buffer-create buffer))
+       (windows (get-buffer-window-list append-to t t))
+       point)
+  BODY...)
+@end group
+@end smallexample
+
+@noindent
+we see that @code{append-to} is bound to the value returned by the
+@w{@code{(get-buffer-create buffer)}}. On the next line,
+@code{append-to} is used as an argument to
+@code{get-buffer-window-list}; this would not be possible with the
+@code{let} expression.  Note that @code{point} is automatically bound
+to @code{nil}, the same way as it would be done in the @code{let}
+statement.
+
+Now let's focus on the functions @code{set-buffer} and
+@code{insert-buffer-substring} in the body of the @code{let*}
+expression.
 
 @need 1250
 In the old days, the @code{set-buffer} expression was simply
@@ -5277,27 +5254,8 @@ but now it is
 @end smallexample
 
 @noindent
-@code{append-to} is bound to @code{(get-buffer-create buffer)} earlier
-on in the @code{let*} expression.  That extra binding would not be
-necessary except for that @code{append-to} is used later in the
-varlist as an argument to @code{get-buffer-window-list}.
-
-@ignore
-in GNU Emacs 22
-
-  (let ((oldbuf (current-buffer)))
-    (save-excursion
-      (let* ((append-to (get-buffer-create buffer))
-             (windows (get-buffer-window-list append-to t t))
-             point)
-        (set-buffer append-to)
-        (setq point (point))
-        (barf-if-buffer-read-only)
-        (insert-buffer-substring oldbuf start end)
-        (dolist (window windows)
-          (when (= (window-point window) point)
-            (set-window-point window (point))))))))
-@end ignore
+This is because @code{append-to} was bound to @code{(get-buffer-create
+buffer)} earlier on in the @code{let*} expression.
 
 The @code{append-to-buffer} function definition inserts text from the
 buffer in which you are currently to a named buffer.  It happens that
@@ -5394,6 +5352,12 @@ an argument and insert the region into the current 
buffer.
 @item mark-whole-buffer
 Mark the whole buffer as a region.  Normally bound to @kbd{C-x h}.
 
+@item let*
+Declare a list of variables and give them an initial value; then
+evaluate the rest of the expressions in the body of @code{let*}.  The
+values of the variables can be used to bind ensuing variables in the
+list.
+
 @item set-buffer
 Switch the attention of Emacs to another buffer, but do not change the
 window being displayed.  Used when the program rather than a human is
@@ -12896,25 +12860,12 @@ familiar part of this function.
 @node fwd-para let
 @unnumberedsubsec The @code{let*} expression
 
-The next line of the @code{forward-paragraph} function begins a
-@code{let*} expression.  This is different from @code{let}.  The
-symbol is @code{let*} not @code{let}.
-
 @findex let*
-The @code{let*} special form is like @code{let} except that Emacs sets
-each variable in sequence, one after another, and variables in the
-latter part of the varlist can make use of the values to which Emacs
-set variables in the earlier part of the varlist.
-
-@ignore
-( refappend save-excursion, , code save-excursion in code append-to-buffer .)
-@end ignore
-
-(@ref{append save-excursion, , @code{save-excursion} in 
@code{append-to-buffer}}.)
-
-In the @code{let*} expression in this function, Emacs binds a total of
-seven variables:  @code{opoint}, @code{fill-prefix-regexp},
-@code{parstart}, @code{parsep}, @code{sp-parstart}, @code{start}, and
+The next line of the @code{forward-paragraph} function begins a
+@code{let*} expression (@pxref{let* introduced,,@code{let*}
+introduced}), in which Emacs binds a total of seven variables:
+@code{opoint}, @code{fill-prefix-regexp}, @code{parstart},
+@code{parsep}, @code{sp-parstart}, @code{start}, and
 @code{found-start}.
 
 The variable @code{parsep} appears twice, first, to remove instances
@@ -13711,7 +13662,7 @@ syntax table determines which characters these are."
 @end ifinfo
 
 @need 1000
-If you wish, you can also install this keybinding by evaluating it:
+If you wish, you can also install this key binding by evaluating it:
 
 @smallexample
 (global-set-key "\C-c=" '@value{COUNT-WORDS})
@@ -14663,7 +14614,7 @@ almost the same code as for the recursive version of
 
 @need 800
 @noindent
-Let's re-use @kbd{C-c =} as a convenient keybinding:
+Let's re-use @kbd{C-c =} as a convenient key binding:
 
 @smallexample
 (global-set-key "\C-c=" 'count-words-defun)
@@ -14671,7 +14622,7 @@ Let's re-use @kbd{C-c =} as a convenient keybinding:
 
 Now we can try out @code{count-words-defun}: install both
 @code{count-words-in-defun} and @code{count-words-defun}, and set the
-keybinding.  Then copy the following to an Emacs Lisp buffer (like,
+key binding.  Then copy the following to an Emacs Lisp buffer (like,
 for instance, @file{*scratch*}), place the cursor within the
 definition, and use the @kbd{C-c =} command.
 
@@ -16013,7 +15964,7 @@ placing point somewhere in the buffer, typing 
@kbd{M-:}, typing the
 and then typing @key{RET}.  This causes Emacs to evaluate the
 expression in the minibuffer, but to use as the value of point the
 position of point in the @file{*scratch*} buffer.  (@kbd{M-:}  is the
-keybinding for @code{eval-expression}. Also, @code{nil} does not
+key binding for @code{eval-expression}. Also, @code{nil} does not
 appear in the @file{*scratch*} buffer since the expression is
 evaluated in the minibuffer.)
 
@@ -16580,7 +16531,7 @@ expressions in Emacs Lisp you can change or extend 
Emacs.
 * Text and Auto-fill::          Automatically wrap lines.
 * Mail Aliases::                Use abbreviations for email addresses.
 * Indent Tabs Mode::            Don't use tabs with @TeX{}
-* Keybindings::                 Create some personal keybindings.
+* Key Bindings::                Create some personal key bindings.
 * Keymaps::                     More about key binding.
 * Loading Files::               Load (i.e., evaluate) files automatically.
 * Autoload::                    Make functions available.
@@ -17124,10 +17075,10 @@ Files'' in @cite{The GNU Emacs Manual}.
 @end iftex
 
 @need 1700
-@node Keybindings
-@section Some Keybindings
+@node Key Bindings
+@section Some Key Bindings
 
-Now for some personal keybindings:
+Now for some personal key bindings:
 
 @smallexample
 @group
@@ -17149,10 +17100,10 @@ This also shows how to set a key globally, for all 
modes.
 @cindex Key setting globally
 @findex global-set-key
 The command is @code{global-set-key}.  It is followed by the
-keybinding.  In a @file{.emacs} file, the keybinding is written as
+key binding.  In a @file{.emacs} file, the keybinding is written as
 shown: @code{\C-c} stands for Control-C, which means to press the
 control key and the @kbd{c} key at the same time.  The @code{w} means
-to press the @kbd{w} key.  The keybinding is surrounded by double
+to press the @kbd{w} key.  The key binding is surrounded by double
 quotation marks.  In documentation, you would write this as
 @w{@kbd{C-c w}}.  (If you were binding a @key{META} key, such as
 @kbd{M-c}, rather than a @key{CTRL} key, you would write
@@ -17166,26 +17117,26 @@ would first try to evaluate the symbol to determine 
its value.
 
 These three things, the double quotation marks, the backslash before
 the @samp{C}, and the single-quote are necessary parts of
-keybinding that I tend to forget.  Fortunately, I have come to
+key binding that I tend to forget.  Fortunately, I have come to
 remember that I should look at my existing @file{.emacs} file, and
 adapt what is there.
 
-As for the keybinding itself: @kbd{C-c w}.  This combines the prefix
+As for the key binding itself: @kbd{C-c w}.  This combines the prefix
 key, @kbd{C-c}, with a single character, in this case, @kbd{w}.  This
 set of keys, @kbd{C-c} followed by a single character, is strictly
 reserved for individuals' own use.  (I call these @dfn{own} keys, since
 these are for my own use.)  You should always be able to create such a
-keybinding for your own use without stomping on someone else's
-keybinding.  If you ever write an extension to Emacs, please avoid
+key binding for your own use without stomping on someone else's
+key binding.  If you ever write an extension to Emacs, please avoid
 taking any of these keys for public use.  Create a key like @kbd{C-c
 C-w} instead.  Otherwise, we will run out of own keys.
 
 @need 1250
-Here is another keybinding, with a comment:
+Here is another key binding, with a comment:
 
 @smallexample
 @group
-;;; Keybinding for 'occur'
+;;; Key binding for 'occur'
 ; I use occur a lot, so let's bind it to a key:
 (global-set-key "\C-co" 'occur)
 @end group
@@ -17245,8 +17196,8 @@ but moves point into that window.
 @cindex Rebinding keys
 
 Emacs uses @dfn{keymaps} to record which keys call which commands.
-When you use @code{global-set-key} to set the keybinding for a single
-command in all parts of Emacs, you are specifying the keybinding in
+When you use @code{global-set-key} to set the key binding for a single
+command in all parts of Emacs, you are specifying the key binding in
 @code{current-global-map}.
 
 Specific modes, such as C mode or Text mode, have their own keymaps;
@@ -17501,7 +17452,7 @@ Here is the definition:
 @end smallexample
 
 @need 1250
-Now for the keybinding.
+Now for the key binding.
 
 Function keys as well as mouse button events and non-@sc{ascii}
 characters are written within square brackets, without quotation
@@ -17806,7 +17757,7 @@ Some systems bind keys unpleasantly.  Sometimes, for 
example, the
 @key{CTRL} key appears in an awkward spot rather than at the far left
 of the home row.
 
-Usually, when people fix these sorts of keybindings, they do not
+Usually, when people fix these sorts of key bindings, they do not
 change their @file{~/.emacs} file.  Instead, they bind the proper keys
 on their consoles with the @code{loadkeys} or @code{install-keymap}
 commands in their boot script and then include @code{xmodmap} commands
diff --git a/doc/lispintro/lambda-1.eps b/doc/lispintro/lambda-1.eps
index 43b2d08aed..a9adeae357 100644
--- a/doc/lispintro/lambda-1.eps
+++ b/doc/lispintro/lambda-1.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:31:53 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/lambda-2.eps b/doc/lispintro/lambda-2.eps
index c6c71f2b77..05cf437b1e 100644
--- a/doc/lispintro/lambda-2.eps
+++ b/doc/lispintro/lambda-2.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:33:09 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/lambda-3.eps b/doc/lispintro/lambda-3.eps
index ae939d537f..8ff4c7c4fc 100644
--- a/doc/lispintro/lambda-3.eps
+++ b/doc/lispintro/lambda-3.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:33:49 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (william@cs.UCLA.edu)
 
-% Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispref/ChangeLog.1 b/doc/lispref/ChangeLog.1
index bd7a9c4e79..7c7d49967c 100644
--- a/doc/lispref/ChangeLog.1
+++ b/doc/lispref/ChangeLog.1
@@ -13989,7 +13989,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1998-2021 Free Software Foundation, Inc.
+  Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/lispref/Makefile.in b/doc/lispref/Makefile.in
index a7701c5f98..8a61adf232 100644
--- a/doc/lispref/Makefile.in
+++ b/doc/lispref/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1990-1996, 1998-2021 Free Software Foundation, Inc.
+# Copyright (C) 1990-1996, 1998-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/lispref/README b/doc/lispref/README
index 9b99837130..70c0242123 100644
--- a/doc/lispref/README
+++ b/doc/lispref/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.  -*- outline -*-
+Copyright (C) 2001-2022 Free Software Foundation, Inc.  -*- outline -*-
 See the end of the file for license conditions.
 
 
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi
index 71fac1ae3b..a366e9c7bc 100644
--- a/doc/lispref/abbrevs.texi
+++ b/doc/lispref/abbrevs.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 1999, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1994, 1999, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Abbrevs
diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi
index 45cbff61e0..09103cbeab 100644
--- a/doc/lispref/anti.texi
+++ b/doc/lispref/anti.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1999, 2002--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1999, 2002--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
 @c This node must have no pointers.
diff --git a/doc/lispref/back.texi b/doc/lispref/back.texi
index c238863833..d0f56f49bc 100644
--- a/doc/lispref/back.texi
+++ b/doc/lispref/back.texi
@@ -1,6 +1,6 @@
 \input texinfo  @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2001--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @c
 @c %**start of header
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi
index 85a4f9e0ac..d99487368b 100644
--- a/doc/lispref/backups.texi
+++ b/doc/lispref/backups.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1999, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1995, 1999, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Backups and Auto-Saving
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 6a0095dca9..1fe5a60b35 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Buffers
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index cc1c216d57..0f12fa7241 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Command Loop
@@ -630,17 +630,26 @@ any modes that are derived from @code{dired-mode}).  Any 
number of
 modes can be added to the @code{interactive} form.
 
 @vindex read-extended-command-predicate
-Specifying modes may affect completion in @kbd{M-x}, depending on the
+Specifying modes affects command completion in @kbd{M-S-x}
+(@code{execute-extended-command-for-buffer}, @pxref{Interactive
+Call}).  It may also affect completion in @kbd{M-x}, depending on the
 value of @code{read-extended-command-predicate}.
 
 For instance, when using the
-@code{command-completion-default-include-p} predicate, @kbd{M-x} won't
-list commands that have been marked as being applicable to a specific
-mode (unless you are in a buffer that uses that mode, of course).
-This goes for both major and minor modes.
+@code{command-completion-default-include-p} predicate as the value of
+@code{read-extended-command-predicate}, @kbd{M-x} won't list commands
+that have been marked as being applicable to a specific mode (unless
+you are in a buffer that uses that mode, of course).  This goes for
+both major and minor modes.  (By contrast, @kbd{M-S-x} always omits
+inapplicable commands from the completion candidates.)
 
-Marking commands this way will also make @kbd{C-h m} list these
-commands (if they aren't bound to any keys).
+By default, @code{read-extended-command-predicate} is @code{nil}, and
+completion in @kbd{M-x} lists all the commands that match what the
+user has typed, whether those commands are or aren't marked as
+applicable to the current buffer's mode.
+
+Marking commands to be applicable to a mode will also make @kbd{C-h m}
+list these commands (if they aren't bound to any keys).
 
 If using this extended @code{interactive} form isn't convenient
 (because the code is supposed to work in older versions of Emacs that
@@ -857,13 +866,16 @@ non-@code{nil} if the command is to be included when 
completing in
 that buffer.
 @end deffn
 
+@kindex @kbd{M-X}
+@kindex @kbd{M-S-x}
 @deffn Command execute-extended-command-for-buffer prefix-argument
 This is like @code{execute-extended-command}, but limits the commands
 offered for completion to those commands that are of particular
 relevance to the current major mode (and enabled minor modes).  This
 includes commands that are tagged with the modes (@pxref{Using
 Interactive}), and also commands that are bound to locally active
-keymaps.
+keymaps.  This command is the normal definition of @kbd{M-S-x}
+(that's ``meta shift x'').
 @end deffn
 
 @node Distinguish Interactive
@@ -1175,6 +1187,7 @@ intended by Lisp code to be used as an event.
 * Button-Down Events::          A button was pushed and not yet released.
 * Repeat Events::               Double and triple click (or drag, or down).
 * Motion Events::               Just moving the mouse, not pushing a button.
+* Touchscreen Events::          Tapping and moving fingers on a touchscreen.
 * Focus Events::                Moving the mouse between frames.
 * Xwidget Events::              Events generated by xwidgets.
 * Misc Events::                 Other events the system can generate.
@@ -1835,6 +1848,59 @@ small movements.  Otherwise, motion events are not 
generated as long
 as the mouse cursor remains pointing to the same glyph in the text.
 @end defvar
 
+@node Touchscreen Events
+@subsection Touchscreen Events
+@cindex touchscreen events
+@cindex support for touchscreens
+
+Some window systems provide support for input devices that react to
+the user's touching the screen and moving fingers while touching the
+screen.  These input devices are known as touchscreens, and Emacs
+reports the events they generate as @dfn{touchscreen events}.
+
+Most individual events generated by a touchscreen only have meaning as
+part of a larger sequence of other events: for instance, the simple
+operation of tapping the touchscreen involves the user placing and
+raising a finger on the touchscreen, and swiping the display to
+scroll it involves placing a finger, moving it many times upwards or
+downwards, and then raising the finger.
+
+@cindex touch point, in touchscreen events
+While a simplistic model consisting of one finger is adequate for taps
+and scrolling, more complicated gestures require support for keeping
+track of multiple fingers, where the position of each finger is
+represented by a @dfn{touch point}.  For example, a ``pinch to zoom''
+gesture might consist of the user placing two fingers and moving them
+individually in opposite directions, where the distance between the
+positions of their individual points determine the amount by which to
+zoom the display, and the center of an imaginary line between those
+positions determines where to pan the display after zooming.
+
+The low-level touchscreen events described below can be used to
+implement all the touch sequences described above.  In those events,
+each point is represented by a cons of an arbitrary number identifying
+the point and a mouse position list (@pxref{Click Events}) specifying
+the position of the finger when the event occurred.
+
+@table @code
+@cindex @code{touchscreen-begin} event
+@item (touchscreen-begin @var{point})
+This event is sent when @var{point} is created by the user pressing a
+finger against the touchscreen.
+
+@cindex @code{touchscreen-update} event
+@item (touchscreen-update @var{points})
+This event is sent when a point on the touchscreen has changed
+position.  @var{points} is a list of touch points containing the
+up-to-date positions of each touch point currently on the touchscreen.
+
+@cindex @code{touchscreen-end} event
+@item (touchscreen-end @var{point})
+This event is sent when @var{point} is no longer present on the
+display, because another program took the grab, or because the user
+raised the finger from the touchscreen.
+@end table
+
 @node Focus Events
 @subsection Focus Events
 @cindex focus event
@@ -2031,6 +2097,38 @@ portable code, use the variables 
@code{mouse-wheel-up-event} and
 @code{mouse-wheel-down-event} defined in @file{mwheel.el} to determine
 what event types to expect for the mouse wheel.
 
+@cindex @code{pinch} event
+@item (pinch @var{position} @var{dx} @var{dy} @var{scale} @var{angle})
+This kind of event is generated by the user performing a ``pinch''
+gesture by placing two fingers on a touchpad and moving them towards
+or away from each other.  @var{position} is a mouse position list
+(@pxref{Click Events}) that provides the position of the mouse pointer
+when the event occurred, @var{dx} is the change in the horizontal
+distance between the fingers since the last event in the same sequence,
+@var{dy} is the vertical movement of the fingers since the last event
+in the same sequence, @var{scale} is the ratio of the current distance
+between the fingers to that distance at the start of the sequence, and
+@var{angle} is the angular difference in degrees between the direction
+of the line connecting the fingers in this event and the direction of
+that line in the last event of the same sequence.
+
+As pinch events are only sent at the beginning or during a pinch
+sequence, they do not report gestures where the user moves two fingers
+on a touchpad in a rotating fashion without pinching the fingers.
+
+All arguments after @var{position} are floating point numbers.
+
+This event is usually sent as part of a sequence, which begins with
+the user placing two fingers on the touchpad, and ends with the user
+removing those fingers.  @var{dx}, @var{dy}, and @var{angle} will be
+@code{0.0} in the first event of a sequence; subsequent events will
+report non-zero values for these members of the event structure.
+
+@var{dx} and @var{dy} are reported in imaginary relative units, in
+which @code{1.0} is the width and height of the touchpad
+respectively.  They are usually interpreted as being relative to the
+size of the object beneath the gesture: image, window, etc.
+
 @cindex @code{drag-n-drop} event
 @item (drag-n-drop @var{position} @var{files})
 This kind of event is generated when a group of files is
@@ -2946,7 +3044,7 @@ causes it to evaluate @code{help-form} and display the 
result.  It
 then continues to wait for a valid input character, or keyboard-quit.
 @end defun
 
-@defun read-multiple-choice prompt choices
+@defun read-multiple-choice prompt choices &optional help-string show-help
 Ask user a multiple choice question.  @var{prompt} should be a string
 that will be displayed as the prompt.
 
@@ -2956,6 +3054,15 @@ entry to be displayed while prompting (if there's room, 
it might be
 shortened), and the third, optional entry is a longer explanation that
 will be displayed in a help buffer if the user requests more help.
 
+If optional argument @var{help-string} is non-@code{nil}, it should be
+a string with a more detailed description of all choices.  It will be
+displayed in a help buffer instead of the default auto-generated
+description when the user types @kbd{?}.
+
+If optional argument @var{show-help} is non-@code{nil}, the help
+buffer will be displayed immediately, before any user input.  If it is
+a string, use it as the name of the help buffer.
+
 The return value is the matching value from @var{choices}.
 
 @lisp
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index 1ca1f66b95..2b6ec849d2 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1994, 2001--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Byte Compilation
 @chapter Byte Compilation
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 06da102518..634d46a785 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Control Structures
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 00287a7212..54059d7b6e 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1997--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1997--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Customization
 @chapter Customization Settings
@@ -654,10 +654,14 @@ you can specify that the value must be @code{nil} or 
@code{t}, but also
 specify the text to describe each value in a way that fits the specific
 meaning of the alternative.
 
+@item key
+The value is a valid key according to @kbd{key-valid-p}, and suitable
+for use with, for example @code{keymap-set}.
+
 @item key-sequence
 The value is a key sequence.  The customization buffer shows the key
 sequence using the same syntax as the @kbd{kbd} function.  @xref{Key
-Sequences}.
+Sequences}.  This is a legacy type; use @code{key} instead.
 
 @item coding-system
 The value must be a coding-system name, and you can do completion with
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 6548437817..469ff2d943 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1994, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Debugging
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index b82473f9c2..1b08eda200 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1995, 1998--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Display
 @chapter Emacs Display
@@ -2086,23 +2086,33 @@ displayed in a given window.  This function is used by
 (@pxref{Resizing Windows}) to make a window exactly as large as the text
 it contains.
 
-@defun window-text-pixel-size &optional window from to x-limit y-limit 
mode-lines
+@defun window-text-pixel-size &optional window from to x-limit y-limit 
mode-lines ignore-line-at-end
 This function returns the size of the text of @var{window}'s buffer in
 pixels.  @var{window} must be a live window and defaults to the
 selected one.  The return value is a cons of the maximum pixel-width
 of any text line and the maximum pixel-height of all text lines.  This
 function exists to allow Lisp programs to adjust the dimensions of
-@var{window} to the buffer text it needs to display.
+@var{window} to the buffer text it needs to display, and for other
+similar situations.
+
+The return value can also optionally (see below) include the buffer
+position of the first line whose dimensions were measured.
 
 The optional argument @var{from}, if non-@code{nil}, specifies the
 first text position to consider, and defaults to the minimum
 accessible position of the buffer.  If @var{from} is @code{t}, it
 stands for the minimum accessible position that is not a newline
-character.  The optional argument @var{to}, if non-@code{nil},
-specifies the last text position to consider, and defaults to the
-maximum accessible position of the buffer.  If @var{to} is @code{t},
-it stands for the maximum accessible position that is not a newline
-character.
+character.  If @var{from} is a cons, its @code{car} specifies a buffer
+position, and its @code{cdr} specifies the vertical offset in pixels
+from that position to the first screen line whose text is to be
+measured.  (The measurement will start from the visual beginning of
+that screen line.)  In that case, the return value will instead be a
+list of the pixel-width, pixel-height, and the buffer position of the
+first line that was measured.  The optional argument @var{to}, if
+non-@code{nil}, specifies the last text position to consider, and
+defaults to the maximum accessible position of the buffer.  If
+@var{to} is @code{t}, it stands for the maximum accessible position
+that is not a newline character.
 
 The optional argument @var{x-limit}, if non-@code{nil}, specifies the
 maximum X coordinate beyond which text should be ignored; it is
@@ -2136,6 +2146,12 @@ line, if present, in the return value.  If it is 
@code{t}, include the
 height of all of these lines, if present, in the return value.
 @end defun
 
+The optional argument @var{ignore-line-at-end} controls whether or
+not to count the height of text in @var{to}'s screen line as part of
+the returned pixel-height.  This is useful if your Lisp program is
+only interested in the dimensions of text up to and excluding the
+visual beginning of @var{to}'s screen line.
+
 @code{window-text-pixel-size} treats the text displayed in a window as a
 whole and does not care about the size of individual lines.  The
 following function does.
@@ -2785,8 +2801,8 @@ apply to.  Here are the possible values of 
@var{characteristic}:
 The kind of window system the terminal uses---either @code{graphic}
 (any graphics-capable display), @code{x}, @code{pc} (for the MS-DOS
 console), @code{w32} (for MS Windows 9X/NT/2K/XP), @code{haiku} (for
-Haiku), or @code{tty} (a non-graphics-capable display).
-@xref{Window Systems, window-system}.
+Haiku), @code{pgtk} (for GTK), or @code{tty} (a non-graphics-capable
+display).  @xref{Window Systems, window-system}.
 
 @item class
 What kinds of colors the terminal supports---either @code{color},
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 0db77255a6..eff9621628 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -1,6 +1,6 @@
 @comment -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1992--1994, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1992--1994, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index b773ba8fb9..3254a4dba8 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -99,7 +99,7 @@ This is the @cite{GNU Emacs Lisp Reference Manual}
 @end ifclear
 corresponding to Emacs version @value{EMACSVER}.
 
-Copyright @copyright{} 1990--1996, 1998--2021 Free Software Foundation,
+Copyright @copyright{} 1990--1996, 1998--2022 Free Software Foundation,
 Inc.
 
 @quotation
@@ -526,6 +526,7 @@ Variables
 * Variables with Restricted Values::  Non-constant variables whose value can
                                         @emph{not} be an arbitrary Lisp object.
 * Generalized Variables::   Extending the concept of variables.
+* Multisession Variables::  Variables that survive restarting Emacs.
 
 Scoping Rules for Variable Bindings
 
@@ -547,6 +548,10 @@ Generalized Variables
 * Setting Generalized Variables::   The @code{setf} macro.
 * Adding Generalized Variables::    Defining new @code{setf} forms.
 
+Multisession Variables
+
+* Multisession Variables::      Variables that survive restarting Emacs.
+
 Functions
 
 * What Is a Function::      Lisp functions vs. primitives; terminology.
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index f848218e26..44a62dcebc 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1993, 1999, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1993, 1999, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Standard Errors
@@ -98,6 +98,10 @@ Lisp reader, not to file I/O@.  @xref{Input Functions}.
 @item file-already-exists
 This is a subcategory of @code{file-error}.  @xref{Writing to Files}.
 
+@item permission-denied
+This is a subcategory of @code{file-error}, which occurs when the OS
+doesn't allow Emacs to access a file or a directory for some reason.
+
 @item file-date-error
 This is a subcategory of @code{file-error}.  It occurs when
 @code{copy-file} tries and fails to set the last-modification time of
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index e1998842cf..e94e222e6a 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 1998, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1994, 1998, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Evaluation
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 4b114ba111..6e59e87d28 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Files
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 00332fed0b..ceaa11529f 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Frames
@@ -216,7 +216,7 @@ The terminal and keyboard coding systems used on the 
terminal.
 @item
 The kind of display associated with the terminal.  This is the symbol
 returned by the function @code{terminal-live-p} (i.e., @code{x},
-@code{t}, @code{w32}, @code{ns}, @code{pc}, or @code{haiku}).
+@code{t}, @code{w32}, @code{ns}, @code{pc}, @code{haiku}, or @code{pgtk}).
 @xref{Frames}.
 
 @item
@@ -3165,8 +3165,7 @@ that if both frames are visible and their display areas 
overlap,
 third argument @var{above} is non-@code{nil}, this function restacks
 @var{frame1} above @var{frame2}.  This means that if both frames are
 visible and their display areas overlap, @var{frame1} will (partially)
-obscure @var{frame2}.@footnote{Restacking frames is not supported on
-Haiku, due to limitations imposed by the system.}
+obscure @var{frame2}.
 
 Technically, this function may be thought of as an atomic action
 performed in two steps: The first step removes @var{frame1}'s
@@ -3362,20 +3361,22 @@ are handy (@pxref{Window Parameters}).  These allow to 
remove an
 unwanted mode line (when @code{drag-with-header-line} is chosen) and to
 remove mouse-sensitive areas which might interfere with frame dragging.
 
-  To avoid that dragging moves a frame completely out of its parent's
-native frame, something which might happen when the mouse cursor
-overshoots and makes the frame difficult to retrieve once the mouse
-button has been released, it is advisable to set the frame's
-@code{top-visible} or @code{bottom-visible} parameter correspondingly.
-
-  The @code{top-visible} parameter specifies the number of pixels at the
-top of the frame that always remain visible within the parent's native
-frame during dragging and should be set when specifying a non-@code{nil}
-@code{drag-with-header-line} parameter.  The @code{bottom-visible}
-parameter specifies the number of pixels at the bottom of the frame that
-always remain visible within the parent's native frame during dragging
-and should be preferred when specifying a non-@code{nil}
-@code{drag-with-mode-line} parameter.
+  When the user drags a frame with a mouse and overshoots, it's easy
+to drag a frame out of the screen area of its parent.  Retrieving such
+a frame can be hairy once the mouse button has been released.  To
+prevent such a situation, it is advisable to set the frame's
+@code{top-visible} or @code{bottom-visible} parameter (@pxref{Mouse
+Dragging Parameters}).
+
+  Set the @code{top-visible} parameter of a child frame to a number
+when you intend to allow the user dragging that frame by its header
+line.  Setting @code{top-visible} to a number inhibits dragging the
+top edge of the child frame above the top edge of its parent.  Set the
+@code{bottom-visible} parameter to a number when you intend to drag
+that frame via its mode line; this inhibits dragging the bottom edge
+of the child frame beneath the bottom edge of its parent.  In either
+case, that number also specifies width and height (in pixels) of the
+area of the child frame that remains visible during dragging.
 
   When a child frame is used for displaying a buffer via
 @code{display-buffer-in-child-frame} (@pxref{Buffer Display Action
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 9c1fde06b5..96fecc8c89 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Functions
@@ -1647,9 +1647,10 @@ function will be interactive and will use the 
interactive spec of
 @var{function}.  One exception: if the interactive spec of @var{function}
 is a function (i.e., a @code{lambda} expression or an @code{fbound}
 symbol rather than an expression or a string), then the interactive
-spec of the combined function will be a call to that function with as sole
-argument the interactive spec of the original function.  To interpret the spec
-received as argument, use @code{advice-eval-interactive-spec}.
+spec of the combined function will be a call to that function with
+the interactive spec of the original function as sole argument.  To
+interpret the spec received as argument, use
+@code{advice-eval-interactive-spec}.
 
 Note: The interactive spec of @var{function} will apply to the combined
 function and should hence obey the calling convention of the combined function
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi
index 12c6a65907..a566d89824 100644
--- a/doc/lispref/hash.texi
+++ b/doc/lispref/hash.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1999, 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1999, 2001--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Hash Tables
 @chapter Hash Tables
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index e7b6406fd8..10a12940a1 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Documentation
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index e9d1e270d8..107d036202 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1993, 1998, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1993, 1998, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Standard Hooks
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 7718712b9b..bc73ff28a6 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1993, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1993, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node GNU Emacs Internals
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index c2ed96472b..5afd2f4ecf 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -1,6 +1,6 @@
 @c -*-coding: utf-8-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1994, 2001--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
 @node Introduction
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index edf1d6e83f..9d3dc8fe42 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 1998--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1994, 1998--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Keymaps
 @chapter Keymaps
@@ -357,6 +357,103 @@ A full keymap is more efficient than a sparse keymap when 
it holds
 lots of bindings; for just a few, the sparse keymap is better.
 @end defun
 
+@defun define-keymap &key options... &rest pairs...
+You can create a keymap with the functions described above, and then
+use @code{keymap-set} (@pxref{Changing Key Bindings}) to specify key
+bindings in that map.  When writing modes, however, you frequently
+have to bind a large number of keys at once, and using
+@code{keymap-set} on them all can be tedious and error-prone.  Instead
+you can use @code{define-keymap}, which creates a keymap and binds a
+number of keys.  Here's a very basic example:
+
+@lisp
+(define-keymap
+  "n" #'forward-line
+  "f" #'previous-line
+  "C-c C-c" #'quit-window)
+@end lisp
+
+This function creates a new sparse keymap, defines the keystrokes in
+@var{pairs}, and returns the new keymap.
+
+@var{pairs} is a list of alternating key bindings and key definitions,
+as accepted by @code{keymap-set}.  In addition, the key can be the
+special symbol @code{:menu}, in which case the definition should be a
+menu definition as accepted by @code{easy-menu-define} (@pxref{Easy
+Menu}).  Here's a brief example of this usage:
+
+@lisp
+(define-keymap :full t
+  "g" #'eww-reload
+  :menu '("Eww"
+          ["Exit" quit-window t]
+          ["Reload" eww-reload t]))
+@end lisp
+
+A number of keywords can be used before the key/definition pairs to
+change features of the new keymap.  If any of the feature keywords is
+missing from the @code{define-keymap} call, the default value for that
+feature is @code{nil}.  Here's a list of the available feature
+keywords:
+
+@table @code
+@item :full
+If non-@code{nil}, create a char-table keymap (as from
+@code{make-keymap}) instead of a sparse keymap (as from
+@code{make-sparse-keymap} (@pxref{Creating Keymaps}).  A sparse keymap
+is the default.
+
+@item :parent
+If non-@code{nil}, the value should be a keymap to use as the parent
+(@pxref{Inheritance and Keymaps}).
+
+@item :keymap
+If non-@code{nil}, the value should be a keymap.  Instead of creating
+a new keymap, the specified keymap is modified instead.
+
+@item :suppress
+If non-@code{nil}, the keymap will be suppressed with
+@code{suppress-keymap} (@pxref{Changing Key Bindings}).  By default,
+digits and the minus sign are exempt from suppressing, but if the
+value is @code{nodigits}, this suppresses digits and minus-sign like
+it does with other characters.
+
+@item :name
+If non-@code{nil}, the value should be a string to use as the menu for
+the keymap if you use it as a menu with @code{x-popup-menu}
+(@pxref{Pop-Up Menus}).
+
+@item :prefix
+If non-@code{nil}, the value should be a symbol to be used as a prefix
+command (@pxref{Prefix Keys}).  If this is the case, this symbol is
+returned by @code{define-keymap} instead of the map itself.
+@end table
+
+@end defun
+
+@defmac defvar-keymap name &key options... &rest pairs...
+By far, the most common thing to do with a keymap is to bind it to a
+variable.  This is what virtually all modes do---a mode called
+@code{foo} almost always has a variable called @code{foo-mode-map}.
+
+This macro defines @var{name} as a variable, passes @var{options}
+and @var{pairs} to @code{define-keymap}, and uses the result as the
+default value for the variable.
+
+@var{options} is like the keywords in @code{define-keymap}, but
+there's an additional @code{:doc} keyword that provides the doc
+string for the defined variable.
+
+Here's an example:
+
+@lisp
+(defvar-keymap eww-textarea-map
+  :parent text-mode-map
+  "RET" #'forward-line
+  "TAB" #'shr-next-link)
+@end lisp
+@end defmac
+
 @defun copy-keymap keymap
 This function returns a copy of @var{keymap}.  This is almost never
 needed.  If you want a keymap that's like another yet with a few
@@ -706,7 +803,7 @@ active keymaps, except for the global keymap.  Secondly, the
 terminal-local variable @code{overriding-terminal-local-map} specifies
 a keymap that takes precedence over @emph{all} other keymaps
 (including @code{overriding-local-map}); this is normally used for
-modal/transient keybindings (the function @code{set-transient-map}
+modal/transient key bindings (the function @code{set-transient-map}
 provides a convenient interface for this).  @xref{Controlling Active
 Maps}, for details.
 
@@ -1089,22 +1186,18 @@ macro, a symbol that leads to one of them, or 
@code{nil}.
 
   Here are the functions and variables pertaining to key lookup.
 
-@defun lookup-key keymap key &optional accept-defaults
+@defun keymap-lookup keymap key &optional accept-defaults no-remap position
 This function returns the definition of @var{key} in @var{keymap}.  All
 the other functions described in this chapter that look up keys use
-@code{lookup-key}.  Here are examples:
+@code{keymap-lookup}.  Here are examples:
 
 @example
 @group
-(lookup-key (current-global-map) "\C-x\C-f")
+(keymap-lookup (current-global-map) "C-x C-f")
     @result{} find-file
 @end group
 @group
-(lookup-key (current-global-map) (kbd "C-x C-f"))
-    @result{} find-file
-@end group
-@group
-(lookup-key (current-global-map) "\C-x\C-f12345")
+(keymap-lookup (current-global-map) "C-x C-f 1 2 3 4 5")
     @result{} 2
 @end group
 @end example
@@ -1115,9 +1208,9 @@ and have extra events at the end that do not fit into a 
single key
 sequence.  Then the value is a number, the number of events at the front
 of @var{key} that compose a complete key.
 
-If @var{accept-defaults} is non-@code{nil}, then @code{lookup-key}
+If @var{accept-defaults} is non-@code{nil}, then @code{keymap-lookup}
 considers default bindings as well as bindings for the specific events
-in @var{key}.  Otherwise, @code{lookup-key} reports only bindings for
+in @var{key}.  Otherwise, @code{keymap-lookup} reports only bindings for
 the specific sequence @var{key}, ignoring default bindings except when
 you explicitly ask about them.  (To do this, supply @code{t} as an
 element of @var{key}; see @ref{Format of Keymaps}.)
@@ -1130,11 +1223,11 @@ the second example.
 
 @example
 @group
-(lookup-key (current-global-map) "\M-f")
+(keymap-lookup (current-global-map) "M-f")
     @result{} forward-word
 @end group
 @group
-(lookup-key (current-global-map) "\ef")
+(keymap-lookup (current-global-map) "ESC f")
     @result{} forward-word
 @end group
 @end example
@@ -1145,6 +1238,20 @@ Unlike @code{read-key-sequence}, this function does not 
modify the
 specified events in ways that discard information (@pxref{Key Sequence
 Input}).  In particular, it does not convert letters to lower case and
 it does not change drag events to clicks.
+
+Like the normal command loop, @code{keymap-lookup} will remap the
+command resulting from looking up @var{key} by looking up the command
+in the current keymaps.  However, if the optional third argument
+@var{no-remap} is non-@code{nil}, @code{keymap-lookup} returns the
+command without remapping.
+
+If the optional argument @var{position} is non-@code{nil}, it
+specifies a mouse position as returned by @code{event-start} and
+@code{event-end}, and the lookup occurs in the keymaps associated with
+that position, instead of in @var{keymap}.  @var{position} can also be
+a number or a marker, in which case it is interpreted as a buffer
+position, and the function uses the keymap properties at that position
+instead of at point.
 @end defun
 
 @deffn Command undefined
@@ -1157,7 +1264,7 @@ This function returns the binding for @var{key} in the 
current
 local keymap, or @code{nil} if it is undefined there.
 
 The argument @var{accept-defaults} controls checking for default bindings,
-as in @code{lookup-key} (above).
+as in @code{keymap-lookup} (above).
 @end defun
 
 @defun keymap-global-binding key &optional accept-defaults
@@ -1165,7 +1272,7 @@ This function returns the binding for command @var{key} 
in the
 current global keymap, or @code{nil} if it is undefined there.
 
 The argument @var{accept-defaults} controls checking for default bindings,
-as in @code{lookup-key} (above).
+as in @code{keymap-lookup} (above).
 @end defun
 
 @defun minor-mode-key-binding key &optional accept-defaults
@@ -1182,7 +1289,7 @@ modes are omitted, since they would be completely 
shadowed.  Similarly,
 the list omits non-prefix bindings that follow prefix bindings.
 
 The argument @var{accept-defaults} controls checking for default
-bindings, as in @code{lookup-key} (above).
+bindings, as in @code{keymap-lookup} (above).
 @end defun
 
 @defopt meta-prefix-char
@@ -1374,100 +1481,14 @@ changing an entry in @code{ctl-x-map}, and this has 
the effect of
 changing the bindings of both @kbd{C-p C-f} and @kbd{C-x C-f} in the
 default global map.
 
-@defun define-keymap &key options... &rest pairs...
 @code{keymap-set} is the general work horse for defining a key in a
 keymap.  When writing modes, however, you frequently have to bind a
 large number of keys at once, and using @code{keymap-set} on them all
 can be tedious and error-prone.  Instead you can use
-@code{define-keymap}, which creates a keymaps and binds a number of
-keys.  Here's a very basic example:
-
-@lisp
-(define-keymap
-  "n" #'forward-line
-  "f" #'previous-line
-  "C-c C-c" #'quit-window)
-@end lisp
+@code{define-keymap}, which creates a keymap and binds a number of
+keys.  @xref{Creating Keymaps}, for details.
 
-This function creates a new sparse keymap, defines the two keystrokes
-in @var{pairs}, and returns the new keymap.
-
-@var{pairs} is a list of alternating key bindings and key definitions,
-as accepted by @code{keymap-set}.  In addition the key can be the
-special symbol @code{:menu}, in which case the definition should be a
-menu definition as accepted by @code{easy-menu-define} (@pxref{Easy
-Menu}).  Here's a brief example:
-
-@lisp
-(define-keymap :full t
-  "g" #'eww-reload
-  :menu '("Eww"
-          ["Exit" quit-window t]
-          ["Reload" eww-reload t]))
-@end lisp
-
-A number of keywords can be used before the key/definition pairs to
-changes features of the new keymap.  If the keyword is missing, the
-default value for the feature is @code{nil}.  Here's a list of the
-available keywords:
-
-@table @code
-@item :full
-If non-@code{nil}, create a chartable keymap (as from
-@code{make-keymap}) instead of a sparse keymap (as from
-@code{make-sparse-keymap} (@pxref{Creating Keymaps}).  A sparse keymap
-is the default.
-
-@item :parent
-If non-@code{nil}, this should be a keymap to use as the parent
-(@pxref{Inheritance and Keymaps}).
-
-@item :keymap
-If non-@code{nil}, this should be a keymap.  Instead of creating a new
-keymap, this keymap is modified instead.
-
-@item :suppress
-If non-@code{nil}, the keymap will be suppressed with
-@code{suppress-keymap} (@pxref{Changing Key Bindings}).  If
-@code{nodigits}, treat digits like other chars.
-
-@item :name
-If non-@code{nil}, this should be a string to use as the menu for the
-keymap if you use it as a menu with @code{x-popup-menu} (@pxref{Pop-Up
-Menus}).
-
-@item :prefix
-If non-@code{nil}, this should be a symbol to be used as a prefix
-command (@pxref{Prefix Keys}).  If this is the case, this symbol is
-returned by @code{define-keymap} instead of the map itself.
-@end table
-
-@end defun
-
-@defmac defvar-keymap name &key options... &rest pairs...
-By far, the most common thing to do with a keymap is to bind it to a
-variable.  This is what virtually all modes do---a mode called
-@code{foo} almost always has a variable called @code{foo-mode-map}.
-
-This macro defines @var{name} as a variable, and passes @var{options}
-and @var{pars} to @code{define-keymap}, and uses the result as the
-default value for the variable.
-
-@var{options} is like the keywords in @code{define-keymap}, but adds a
-@code{:doc} keyword that says what the doc string for the @var{name}
-variable should be.
-
-Here's an example:
-
-@lisp
-(defvar-keymap eww-textarea-map
-  :parent text-mode-map
-  "RET" #'forward-line
-  "TAB" #'shr-next-link)
-@end lisp
-@end defmac
-
-  The function @code{substitute-key-definition} scans a keymap for
+The function @code{substitute-key-definition} scans a keymap for
 keys that have a certain binding and rebinds them with a different
 binding.  Another feature which is cleaner and can often produce the
 same results is to remap one command into another (@pxref{Remapping
@@ -1969,7 +1990,7 @@ redefines @kbd{C-x C-\} to move down a line.
 redefines the first (leftmost) mouse button, entered with the Meta key, to
 set point where you click.
 
-@cindex non-@acronym{ASCII} text in keybindings
+@cindex non-@acronym{ASCII} text in key bindings
   Be careful when using non-@acronym{ASCII} text characters in Lisp
 specifications of keys to bind.  If these are read as multibyte text, as
 they usually will be in a Lisp file (@pxref{Loading Non-ASCII}), you
@@ -2274,7 +2295,7 @@ the keymap.  Since @code{define-key} puts new bindings at 
the front, you
 should define the menu items starting at the bottom of the menu and
 moving to the top, if you care about the order.  When you add an item to
 an existing menu, you can specify its position in the menu using
-@code{define-key-after} (@pxref{Modifying Menus}).
+@code{keymap-set-after} (@pxref{Modifying Menus}).
 
 @menu
 * Simple Menu Items::       A simple kind of menu key binding.
@@ -3028,9 +3049,9 @@ To force recalculation of the tool bar, call
   When you insert a new item in an existing menu, you probably want to
 put it in a particular place among the menu's existing items.  If you
 use @code{define-key} to add the item, it normally goes at the front of
-the menu.  To put it elsewhere in the menu, use @code{define-key-after}:
+the menu.  To put it elsewhere in the menu, use @code{keymap-set-after}:
 
-@defun define-key-after map key binding &optional after
+@defun keymap-set-after map key binding &optional after
 Define a binding in @var{map} for @var{key}, with value @var{binding},
 just like @code{define-key}, but position the binding in @var{map} after
 the binding for the event @var{after}.  The argument @var{key} should be
@@ -3044,7 +3065,7 @@ inherited keymap.
 Here is an example:
 
 @example
-(define-key-after my-menu [drink]
+(keymap-set-after my-menu "<drink>"
   '("Drink" . drink-command) 'eat)
 @end example
 
@@ -3056,7 +3077,7 @@ Here is how to insert an item called @samp{Work} in the 
@samp{Signals}
 menu of Shell mode, after the item @code{break}:
 
 @example
-(define-key-after shell-mode-map [menu-bar signals work]
+(keymap-set-after shell-mode-map "<menu-bar> <signals> <work>"
   '("Work" . work-command) 'break)
 @end example
 @end defun
diff --git a/doc/lispref/lay-flat.texi b/doc/lispref/lay-flat.texi
index 4ea58e6172..77820ed68e 100644
--- a/doc/lispref/lay-flat.texi
+++ b/doc/lispref/lay-flat.texi
@@ -1,6 +1,6 @@
 \input texinfo    @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2001--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @c
 @comment %**start of header
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index f98ae76da9..4a862ab0de 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Lists
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index ee119445e5..5957b8ac38 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Loading
@@ -291,29 +291,35 @@ a directory) or @code{nil} (which stands for the current 
working
 directory).
 @end defvar
 
-  When Emacs starts up, it sets up the value of @code{load-path}
-in several steps.  First, it initializes @code{load-path} using
-default locations set when Emacs was compiled.  Normally, this
-is a directory something like
+  When Emacs starts up, it sets up the value of @code{load-path} in
+several steps.  First, it looks for the directory containing its own
+Lisp files, using default locations set when Emacs was compiled.  It
+saves this directory in @code{lisp-directory}.  Normally, this is a
+directory where the @file{*.elc} files are installed, something like
 
 @example
 "/usr/local/share/emacs/@var{version}/lisp"
 @end example
 
-(In this and the following examples, replace @file{/usr/local} with
-the installation prefix appropriate for your Emacs.)
-These directories contain the standard Lisp files that come with
-Emacs.  If Emacs cannot find them, it will not start correctly.
+@noindent
+where @var{version} is the Emacs version.  (In this and the following
+examples, replace @file{/usr/local} with the prefix appropriate for
+your Emacs installation.)  This directory and its subdirectories
+contain the standard Lisp files that come with Emacs.  If Emacs cannot
+find its own Lisp files, it will not start correctly.
 
 If you run Emacs from the directory where it was built---that is, an
-executable that has not been formally installed---Emacs instead
-initializes @code{load-path} using the @file{lisp}
-directory in the directory containing the sources from which it
-was built.
+executable that has not been installed yet---Emacs instead initializes
+@code{lisp-directory} using the @file{lisp} subdirectory of the
+directory containing the sources from which it was built.
+
+Emacs then initializes @code{load-path} with this @code{lisp-directory}.
 @c Though there should be no *.el files in builddir/lisp, so it's pointless.
 If you built Emacs in a separate directory from the
-sources, it also adds the lisp directories from the build directory.
-(In all cases, elements are represented as absolute file names.)
+sources, it also adds the @file{lisp} subdirectory of the build directory.
+
+All of these directories are stored in the above two variables as
+absolute file names.
 
 @cindex site-lisp directories
 Unless you start Emacs with the @option{--no-site-lisp} option,
@@ -333,12 +339,12 @@ and
 @end example
 
 @noindent
-The first one is for locally installed files for a specific Emacs
-version; the second is for locally installed files meant for use
-with all installed Emacs versions.  (If Emacs is running uninstalled,
-it also adds @file{site-lisp} directories from the source and build
-directories, if they exist.  Normally these directories do not contain
-@file{site-lisp} directories.)
+The first one is for locally installed files for the current Emacs
+@var{version}; the second is for locally installed files meant for use
+with any installed Emacs version.  (If Emacs is running uninstalled,
+it also adds @file{site-lisp} subdirectories from the source and build
+directories, if they exist.  However, normally the source and build
+directories do not contain @file{site-lisp} subdirectories.)
 
 @cindex @env{EMACSLOADPATH} environment variable
 If the environment variable @env{EMACSLOADPATH} is set, it modifies
@@ -360,9 +366,10 @@ export EMACSLOADPATH=/home/foo/.emacs.d/lisp:
 @end example
 
 An empty element in the value of the environment variable, whether
-trailing (as in the above example), leading, or embedded, is replaced
-by the default value of @code{load-path} as determined by the standard
-initialization procedure.  If there are no such empty elements, then
+trailing (as in the above example, note the trailing @samp{:}),
+leading, or embedded, is replaced by the default value of
+@code{load-path} as determined by the standard initialization
+procedure.  If there are no such empty elements, then
 @env{EMACSLOADPATH} specifies the entire @code{load-path}.  You must
 include either an empty element, or the explicit path to the directory
 containing the standard Lisp files, else Emacs will not function.
@@ -391,11 +398,23 @@ add one or more directories to @code{load-path}.  For 
example:
 (push "~/.emacs.d/lisp" load-path)
 @end example
 
+@noindent
+@xref{List Variables, push}, for the description of @code{push}.
+
   Dumping Emacs uses a special value of @code{load-path}.  If you use
 a @file{site-load.el} or @file{site-init.el} file to customize the
 dumped Emacs (@pxref{Building Emacs}), any changes to @code{load-path}
 that these files make will be lost after dumping.
 
+@defvar lisp-directory
+This variable holds a string naming the directory which holds
+Emacs's own @file{*.el} and @file{*.elc} files.  This is usually the
+place where those files are located in the Emacs installation tree,
+unless Emacs is run from its build directory in which case it points
+to the @file{lisp} subdirectory in the source directory from which
+Emacs was built.
+@end defvar
+
 @deffn Command locate-library library &optional nosuffix path interactive-call
 This command finds the precise file name for library @var{library}.  It
 searches for the library in the same way @code{load} does, and the
@@ -482,7 +501,7 @@ automatically.  However, if this does make a difference, 
you can force
 a particular Lisp file to be interpreted as unibyte by writing
 @samp{coding: raw-text} in a local variables section.  With
 that designator, the file will unconditionally be interpreted as
-unibyte.  This can matter when making keybindings to
+unibyte.  This can matter when making key bindings to
 non-@acronym{ASCII} characters written as @code{?v@var{literal}}.
 
 @node Autoload
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index cf23ecb9d4..26a611613c 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1995, 1998, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Macros
diff --git a/doc/lispref/maps.texi b/doc/lispref/maps.texi
index 59c6e6f57a..90497728a1 100644
--- a/doc/lispref/maps.texi
+++ b/doc/lispref/maps.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1993, 1999, 2001--2021 Free Software Foundation,
+@c Copyright (C) 1990--1993, 1999, 2001--2022 Free Software Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Standard Keymaps
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 80f79b67e5..8362799b62 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Markers
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 281e987e7f..f05f087ba7 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Minibuffers
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 69c022e525..5fc831536e 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Modes
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index 24117b5001..f495910fcd 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1998--1999, 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1998--1999, 2001--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Non-ASCII Characters
 @chapter Non-@acronym{ASCII} Characters
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index d28e15869a..fdcda328d8 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Numbers
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index bbd3973f61..07caaa2a07 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Lisp Data Types
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index b4efc44b03..3750abc4e8 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node System Interface
@@ -1352,7 +1352,7 @@ may change as higher-resolution clocks become available.
 
 @cindex time value
   Function arguments, e.g., the @var{time} argument to
-@code{current-time-string}, accept a more-general @dfn{time value}
+@code{format-time-string}, accept a more-general @dfn{time value}
 format, which can be a Lisp timestamp, @code{nil} for the current
 time, a single floating-point number for seconds, or a list
 @code{(@var{high} @var{low} @var{micro})} or @code{(@var{high}
@@ -1507,10 +1507,7 @@ The optional @var{form} argument specifies the timestamp 
form to be
 returned.  If @var{form} is the symbol @code{integer}, this function
 returns an integer count of seconds.  If @var{form} is a positive
 integer, it specifies a clock frequency and this function returns an
-integer-pair timestamp @code{(@var{ticks}
-. @var{form})}.@footnote{Currently a positive integer @var{form}
-should be at least 65536 if the returned value is intended to be given
-to standard functions expecting Lisp timestamps.}  If @var{form} is
+integer-pair timestamp @code{(@var{ticks} . @var{form})}.  If @var{form} is
 @code{t}, this function treats it as a positive integer suitable for
 representing the timestamp; for example, it is treated as 1000000000
 if @var{time} is nil and the platform timestamp has nanosecond
@@ -1797,9 +1794,16 @@ This stands for the ISO 8601 date format, which is like
 @samp{%+4Y-%m-%d} except that any flags or field width override the
 @samp{+} and (after subtracting 6) the @samp{4}.
 @item %g
-This stands for the year corresponding to the ISO week within the century.
+@cindex ISO week, in time formatting
+This stands for the year without century (00--99) corresponding to the
+current @dfn{ISO week} number.  ISO weeks start on Monday and end on
+Sunday.  If an ISO week begins in one year and ends in another, the
+rules regarding which year @samp{%g} will produce are complex and will
+not be described here; however, in general, if most of the week's days
+are in the ending year, @samp{%g} will produce that year.
 @item %G
-This stands for the year corresponding to the ISO week.
+This stands for the year with century corresponding to the current ISO
+week number.
 @item %h
 This is a synonym for @samp{%b}.
 @item %H
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index aeb455bb25..a503a7edde 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2010--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2010--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Packaging
 @chapter Preparing Lisp code for distribution
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 769aeed75f..ca1166caac 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1995, 1998--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Positions
 @chapter Positions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index ac5d4d1627..a38a84e22b 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Processes
diff --git a/doc/lispref/records.texi b/doc/lispref/records.texi
index 573caf1672..1408485100 100644
--- a/doc/lispref/records.texi
+++ b/doc/lispref/records.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2017--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2017--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Records
 @chapter Records
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 296ce20169..c9828f9c86 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Searching and Matching
@@ -2854,7 +2854,7 @@ Display some help, then ask again.
 
 @defvar multi-query-replace-map
 This variable holds a keymap that extends @code{query-replace-map} by
-providing additional keybindings that are useful in multi-buffer
+providing additional key bindings that are useful in multi-buffer
 replacements.  The additional bindings are:
 
 @table @code
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 4a48d62f6d..c3f4cff301 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Sequences Arrays Vectors
diff --git a/doc/lispref/streams.texi b/doc/lispref/streams.texi
index 535fc958f2..c6b3397ae1 100644
--- a/doc/lispref/streams.texi
+++ b/doc/lispref/streams.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1994, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1994, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Read and Print
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 0914f20411..d31807ad2a 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Strings and Characters
diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index b30a16927e..a951e9be8a 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Symbols
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index 87ade73c2a..9120e63727 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Syntax Tables
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index b8d92f7fdc..b9df66dbdb 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1995, 1998--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Text
 @chapter Text
@@ -4793,9 +4793,8 @@ converting to and from this code.
 This function converts the region from @var{beg} to @var{end} into base
 64 code.  It returns the length of the encoded text.  An error is
 signaled if a character in the region is multibyte, i.e., in a
-multibyte buffer the region must contain only characters from the
-charsets @code{ascii}, @code{eight-bit-control} and
-@code{eight-bit-graphic}.
+multibyte buffer the region must contain only ASCII characters or raw
+bytes.
 
 Normally, this function inserts newline characters into the encoded
 text, to avoid overlong lines.  However, if the optional argument
@@ -5286,6 +5285,21 @@ Like @code{progn} (@pxref{Sequencing}), but executes 
@var{body} with a
 transaction held, and commits the transaction at the end.
 @end defmac
 
+@defun sqlite-pragma db pragma
+Execute @var{pragma} in @var{db}.  A @dfn{pragma} is usually a command
+that affects the database overall, instead of any particular table.
+For instance, to make SQLite automatically garbage collect data that's
+no longer needed, you can say:
+
+@lisp
+(sqlite-pragma db "auto_vacuum = FULL")
+@end lisp
+
+This function returns non-@code{nil} on success and @code{nil} if the
+pragma failed.  Many pragmas can only be issued when the database is
+brand new and empty.
+@end defun
+
 @defun sqlite-load-extension db module
 Load the named extension @var{module} into the database @var{db}.
 Extensions are usually shared-library files; on GNU and Unix systems,
diff --git a/doc/lispref/threads.texi b/doc/lispref/threads.texi
index a06bd3e801..35513f7262 100644
--- a/doc/lispref/threads.texi
+++ b/doc/lispref/threads.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2012--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2012--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Threads
 @chapter Threads
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index cbfcbd8d14..061a5d672e 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1993, 1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1993, 1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Tips
diff --git a/doc/lispref/two-volume-cross-refs.txt 
b/doc/lispref/two-volume-cross-refs.txt
index ad13d98dd9..e7bd4706c6 100644
--- a/doc/lispref/two-volume-cross-refs.txt
+++ b/doc/lispref/two-volume-cross-refs.txt
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See end for copying conditions.
 
 Two Volume Cross References
diff --git a/doc/lispref/two-volume.make b/doc/lispref/two-volume.make
index cf612b1257..f401d4a1f2 100644
--- a/doc/lispref/two-volume.make
+++ b/doc/lispref/two-volume.make
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2021 Free Software Foundation, Inc.
+# Copyright (C) 2007-2022 Free Software Foundation, Inc.
 # See end for copying conditions.
 
 # although it would be nice to use tex rather than pdftex to avoid
@@ -35,7 +35,7 @@ vol1.pdf: elisp1med-fns-ready elisp1med-aux-ready 
elisp1med-toc-ready
        $(tex1)
 #
 vol2.pdf: elisp2med-fns-ready elisp2med-aux-ready elisp2med-toc-ready
-       @echo "Final TeX run for volume 2..."
+       $(info Final TeX run for volume 2...)
        cp elisp2med-toc-ready elisp2-toc-ready.toc
        cp elisp2med-fns-ready vol2.fns
        cp elisp2med-aux-ready vol2.aux
@@ -123,7 +123,7 @@ elisp1med-init: elisp1-fns-ready elisp1-aux-ready 
elisp1init-toc-ready $(texinfo
        mv vol1.toc elisp1med-toc
 #
 elisp2med-init: elisp2-fns-ready elisp2-aux-ready elisp2init-toc-ready 
$(texinfodir)/texinfo.tex
-       @echo "Final TeX run for volume 2..."
+       $(info Final TeX run for volume 2...)
        cp elisp2init-toc-ready elisp2-toc-ready.toc
        cp elisp2-fns-ready vol2.fns
        cp elisp2-aux-ready vol2.aux
@@ -211,7 +211,7 @@ elisp1-init: elisp.texi
        touch $@
 #
 elisp2-init: elisp.texi
-       @echo "Initial TeX run for volume 2..."
+       $(info Initial TeX run for volume 2...)
        rm -f vol2.aux vol2.toc
        $(tex2)
        texindex vol2.??
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index abef0b3d0c..34c73e70b7 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1990--1995, 1998--2022 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Variables
 @chapter Variables
@@ -44,6 +44,7 @@ representing the variable.
 * Variables with Restricted Values::  Non-constant variables whose value can
                                         @emph{not} be an arbitrary Lisp object.
 * Generalized Variables::       Extending the concept of variables.
+* Multisession Variables::      Variables that survive restarting Emacs.
 @end menu
 
 @node Global Variables
@@ -2752,3 +2753,157 @@ form that has not already had an appropriate expansion 
defined.  In
 Common Lisp, this is not an error since the function @code{(setf
 @var{func})} might be defined later.
 @end quotation
+
+@node Multisession Variables
+@section Multisession Variables
+
+@cindex multisession variable
+  When you set a variable to a value and then close Emacs and restart
+it, that value won't be automatically restored.  Users usually set
+normal variables in their startup files, or use Customize
+(@pxref{Customization}) to set user options permanently, and various
+packages have various files wher they store the data (e.g., Gnus
+stores this in @file{.newsrc.eld} and the URL library stores cookies
+in @file{~/.emacs.d/url/cookies}).
+
+For things in between these two extremes (i.e., configuration which
+goes in the startup file, and massive application state that goes into
+separate files), Emacs provides a facility to replicate data between
+sessions called @dfn{multisession variables}.  (This facility may not
+be available on all systems.)  To give you an idea of how these are
+meant to be used, here's a small example:
+
+@lisp
+@group
+(define-multisession-variable foo-var 0)
+(defun my-adder (num)
+  (interactive "nAdd number: ")
+  (setf (multisession-value foo)
+        (+ (multisession-value foo) num))
+  (message "The new number is: %s" (multisession-value foo)))
+@end group
+@end lisp
+
+@noindent
+This defines the variable @code{foo-var} and binds it to a special
+multisession object which is initialized with the value @samp{0} (if
+the variable doesn't already exist from a previous session).  The
+@code{my-adder} command queries the user for a number, adds this to
+the old (possibly saved value), and then saves the new value.
+
+This facility isn't meant to be used for huge data structures, but
+should be performant for most values.
+
+@defmac define-multisession-variable name initial-value &optional doc &rest 
args
+This macro defines @var{name} as a multisession variable, and gives it
+the @var{initial-value} if this variable hasn't been assigned a value
+earlier.  @var{doc} is the doc string, and several keyword arguments can
+be used in @var{args}:
+
+@table @code
+@item :package @var{package-symbol}
+This keyword says that a multisession variable belongs to the package
+specified by @var{package-symbol}.  The combination of
+@var{package-symbol} and @var{name} has to be unique.  If
+@var{package-symbol} isn't given, this will default to the first
+``segment'' of the @var{name} symbol's name, which is the part of its
+name up to and excluding the first @samp{-}.  For instance, if
+@var{name} is @code{foo-var} and @var{package-symbol} isn't given,
+@var{package-symbol} will default to @code{foo}.
+
+@cindex synchronized multisession variables
+@item :synchronized @var{bool}
+Multisession variables can be @dfn{synchronized} if @var{bool} is
+non-@code{nil}.  This means that if there're two concurrent Emacs
+instances running, and the other Emacs changes the multisession
+variable @code{foo-var}, the current Emacs instance will retrieve that
+modified data when accessing the value.  If @var{synchronized} is
+@code{nil} or missing, this won't happen, and the values in all
+Emacs sessions using the variable will be independent of each other.
+
+@item :storage @var{storage}
+Use the specified @var{storage} method.  This can be either
+@code{sqlite} (in Emacs compiled with SQLite support) or @code{files}.
+If not given, this defaults to the value of the
+@code{multisession-storage} variable, described below.
+@end table
+@end defmac
+
+@defun multisession-value variable
+This function returns the current value of @var{variable}.  If this
+variable hasn't been accessed before in this Emacs session, or if it's
+changed externally, it will be read in from external storage.  If not,
+the current value in this session is returned as is.  It is an error
+to call this function for a @var{variable} that is not a multisession
+variable.
+
+Values retrieved via @code{multisession-value} may or may not be
+@code{eq} to each other, but they will always be @code{equal}.
+
+This is a generalized variable (@pxref{Generalized Variables}), so the
+way to update such a variable is to say, for instance:
+
+@lisp
+(setf (multisession-value foo-bar) 'zot)
+@end lisp
+
+Only Emacs Lisp values that have a readable print syntax
+(@pxref{Printed Representation}) can be saved this way.
+
+If the multisession variable is synchronized, setting it may update
+the value first.  For instance:
+
+@lisp
+(cl-incf (multisession-value foo-bar))
+@end lisp
+
+This first checks whether the value has changed in a different
+Emacs instance, retrieves that value, and then adds 1 to that value and
+stores it.  But note that this is done without locking, so if many
+instances are updating the value at the same time, it's unpredictable
+which instance ``wins''.
+@end defun
+
+@defun multisession-delete object
+This function deletes @var{object} and its value from its persistent
+storage.
+@end defun
+
+@c FIXME: this lacks the documentation of the form of the arguments.
+@defun make-multisession
+You can also make persistent values that aren't tied to a specific
+variable, but are tied to an explicit package and key.
+
+@example
+(setq foo (make-multisession :package "mail"
+                             :key "friends"))
+(setf (multisession-value foo) 'everybody)
+@end example
+
+This supports the same keywords as
+@code{define-multisession-variable}, but also supports a
+@code{:initial-value} keyword, which specifies the default value.
+@end defun
+
+@defopt multisession-storage
+This variable controls how the multisession variables are stored.  It
+value defaults to @code{files}, which means that the values are stored
+in a one-file-per-variable structure inside the directory specified by
+@code{multisession-directory}.  If this value is @code{sqlite}
+instead, the values are stored in an SQLite database; this is only
+available if Emacs was built with SQLite support.
+@end defopt
+
+@defopt multisession-directory
+The multisession variables are stored under this directory, which
+defaults to @file{multisession/} subdirectory of the
+@code{user-emacs-directory}, which is typically
+@file{~/.emacs.d/multisession/}.
+@end defopt
+
+@findex multisession-edit-mode
+@deffn Command list-multisession-values
+This command pops up a buffer listing all the multisession variables,
+and enters a special mode @code{multisession-edit-mode} which allows
+you to delete them and edit their values.
+@end deffn
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 395b88ed92..56b4bc5183 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990--1995, 1998--1999, 2001--2021 Free Software
+@c Copyright (C) 1990--1995, 1998--1999, 2001--2022 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Windows
@@ -4229,97 +4229,48 @@ action alist entry (@pxref{Buffer Display Action 
Alists}).
 
 @node Quitting Windows
 @section Quitting Windows
-
-When you want to get rid of a window used for displaying a buffer, you
-can call @code{delete-window} or @code{delete-windows-on}
-(@pxref{Deleting Windows}) to remove that window from its frame.  If the
-buffer is shown on a separate frame, you might want to call
-@code{delete-frame} (@pxref{Deleting Frames}) instead.  If, on the other
-hand, a window has been reused for displaying the buffer, you might
-prefer showing the buffer previously shown in that window, by calling the
-function @code{switch-to-prev-buffer} (@pxref{Window History}).
-Finally, you might want to either bury (@pxref{Buffer List}) or kill
-(@pxref{Killing Buffers}) the window's buffer.
-
-   The following command uses information on how the window for
-displaying the buffer was obtained in the first place, thus attempting
-to automate the above decisions for you.
+@cindex quitting windows
+
+After a command uses @code{display-buffer} to put a buffer on the
+screen, the user may decide to hide it and return to the previous
+configuration of the Emacs display.  We call that @dfn{quitting the
+window}.  The way to do this is to call @code{quit-window} while the
+window used by @code{display-buffer} is the selected window.
+
+The right way to restore the previous configuration of the display
+depends on what was done to the window where the buffer now appears.
+It might be right to delete that window, or delete its frame, or just
+display another buffer in that window.  One complication is that the
+user may have changed the window configuration since the act of
+displaying that buffer, and it would be undesirable to undo the user's
+explicitly requested changes.
+
+To enable @code{quit-window} to do the right thing,
+@code{display-buffer} saves information about what it did in the
+window's @code{quit-restore} parameter (@pxref{Window Parameters}).
 
 @deffn Command quit-window &optional kill window
 This command quits @var{window} and buries its buffer.  The argument
 @var{window} must be a live window and defaults to the selected one.
 With prefix argument @var{kill} non-@code{nil}, it kills the buffer
-instead of burying it.  It calls the function @code{quit-restore-window}
-described next to deal with the window and its buffer.
+instead of burying it.
 
 @vindex quit-window-hook
-The functions in @code{quit-window-hook} are run before doing anything
-else.
+The function @code{quit-window} first runs @code{quit-window-hook}.
+Then it calls the function @code{quit-restore-window}, described next,
+which does the hard work.
 @end deffn
 
+You can get more control by calling @code{quit-restore-window} instead.
+
 @defun quit-restore-window &optional window bury-or-kill
 This function handles @var{window} and its buffer after quitting.  The
 optional argument @var{window} must be a live window and defaults to
-the selected one. The function's behavior is determined by the four
-elements of the list specified by @var{window}'s @code{quit-restore}
-parameter (@pxref{Window Parameters}).
-
-The first element of the @code{quit-restore} parameter is one of the
-symbols @code{window}, meaning that the window has been specially
-created by @code{display-buffer}; @code{frame}, a separate frame has
-been created; @code{same}, the window has only ever displayed this
-buffer; or @code{other}, the window showed another buffer before.
-@code{frame} and @code{window} affect how the window is quit, while
-@code{same} and @code{other} affect the redisplay of buffers
-previously shown in @var{window}.
-
-The parameter's second element is either one of the symbols
-@code{window} or @code{frame}, or a list whose elements are the buffer
-shown in @var{window} before, that buffer's window start and window
-point positions, and @var{window}'s height at that time.  If that
-buffer is still live when @var{window} is quit, then this function may
-reuse @var{window} to display it.
-
-The third element is the window selected at the time the parameter was
-created.  If this function deletes @var{window}, it subsequently tries
-to reselect the window named by that element.
-
-The fourth element is the buffer whose display caused the creation of
-this parameter.  This function may delete @var{window} if and only if
-it still shows that buffer.
-
-This function will try to delete @var{window} if and only if (1) the
-first element of its @code{quit-restore} parameter is either
-@code{window} or @code{frame}, (2) the window has no history of
-previously-displayed buffers and (3) the fourth element of the
-@code{quit-restore} parameter specifies the buffer currently displayed
-in @var{window}.  If @var{window} is part of an atomic window
-(@pxref{Atomic Windows}), it will try to delete the root of that
-atomic window instead.  In either case, it tries to avoid signaling an
-error when @var{window} cannot be deleted.
-
-If @var{window} shall be deleted, is the only window on its frame and
-there are other frames on that frame's terminal, the value of the
-optional argument @var{bury-or-kill} determines how to proceed with
-the window.  If @var{bury-or-kill} equals @code{kill}, the frame is
-deleted unconditionally.  Otherwise, the fate of the frame is
-determined by calling @code{frame-auto-hide-function} (see below) with
-that frame as sole argument.
-
-If the second element of the @code{quit-restore} parameter is a list
-of a buffer, a window start (@pxref{Window Start and End}) and a
-window point (@pxref{Window Point}), and that buffer is still live,
-the buffer will be displayed, and start and point set accordingly.
-If, in addition, @var{window}'s buffer was temporarily resized, this
-function will also try to restore the original height of @var{window}.
-
-Otherwise, if @var{window} was previously used for displaying other
-buffers (@pxref{Window History}), the most recent buffer in that
-history will be displayed.  In either case, if @var{window} is not
-deleted, its @code{quit-restore} parameter is reset to @code{nil}.
+the selected one.  The function takes account of the @var{window}'s
+@code{quit-restore} parameter.
 
 The optional argument @var{bury-or-kill} specifies how to deal with
-@var{window}'s buffer.  The following values are handled:
+@var{window}'s buffer.  The following values are meaningful:
 
 @table @code
 @item nil
@@ -4329,25 +4280,106 @@ consequence, if @var{window} is not deleted, invoking
 
 @item append
 This means that if @var{window} is not deleted, its buffer is moved to
-the end of @var{window}'s list of previous buffers, so it's less likely
-that a future invocation of @code{switch-to-prev-buffer} will switch to
-it.  Also, it moves the buffer to the end of the frame's buffer list.
+the end of @var{window}'s list of previous buffers (@pxref{Window
+History}), so it's less likely that future invocations of
+@code{switch-to-prev-buffer} will switch to it.  Also, it moves the
+buffer to the end of the frame's buffer list (@pxref{Buffer List}).
 
 @item bury
 This means that if @var{window} is not deleted, its buffer is removed
-from @var{window}'s list of previous buffers.  Also, it moves the buffer
-to the end of the frame's buffer list.  This value provides the most
-reliable remedy to not have @code{switch-to-prev-buffer} switch to this
-buffer again without killing the buffer.
+from @var{window}'s list of previous buffers.  Also, it moves the
+buffer to the end of the frame's buffer list.  This is the most
+reliable way to prevent @code{switch-to-prev-buffer} from switching to
+this buffer again, short of killing the buffer.
 
 @item kill
 This means to kill @var{window}'s buffer.
 @end table
 
+The argument @var{bury-or-kill} also specifies what to do with
+@var{window}'s frame when @var{window} should be deleted, if it is the
+only window on its frame, and there are other frames on that frame's
+terminal.  If @var{bury-or-kill} equals @code{kill}, it means to
+delete the frame.  Otherwise, the fate of the frame is determined by
+calling @code{frame-auto-hide-function} (see below) with that frame as
+sole argument.
+
+This function always sets @var{window}'s @code{quit-restore} parameter
+to @code{nil} unless it deletes the window.
+@end defun
+
+The window @var{window}'s @code{quit-restore} parameter (@pxref{Window
+Parameters}) should be @code{nil} or a list of four elements:
+@c FIXME: describe what quit-restore-window does if this is nil.
+
+@lisp
+(@var{method} @var{obuffer} @var{owindow} @var{this-buffer})
+@end lisp
+
+The first element, @var{method}, is one of the four symbols
+@code{window}, @code{frame}, @code{same} and @code{other}.
+@code{frame} and @code{window} control how to delete @var{window},
+while @code{same} and @code{other} control displaying some other
+buffer in it.
+
+Specifically, @code{window} means that the window has been specially
+created by @code{display-buffer}; @code{frame} means that a separate
+frame has been created; @code{same}, that the window has only ever
+displayed this buffer; @code{other}, that the window showed another
+buffer before.
+
+The second element, @var{obuffer}, is either one of the symbols
+@code{window} or @code{frame}, or a list of the form
+
+@lisp
+(@var{prev-buffer} @var{prev-window-start} @var{prev-window-point} 
@var{height})
+@end lisp
+
+@noindent
+which says which buffer was shown in @var{window} before, that
+buffer's window start (@pxref{Window Start and End}) and window point
+(@pxref{Window Point}) positions at that time, and
+@var{window}'s height at that time.  If @var{prev-buffer} is still
+live when quitting @var{window}, quitting the window may reuse
+@var{window} to display @var{prev-buffer}.
+
+The third element, @var{owindow}, is the window that was selected
+just before the displaying was done.  If quitting deletes
+@var{window}, it tries to select @var{owindow}.
+
+The fourth element, @var{this-buffer}, is the buffer whose displaying
+set the @code{quit-restore} parameter.  Quitting @var{window} may delete
+that window only if it still shows that buffer.
+
+Quitting @var{window} tries to delete it if and only if (1)
+@var{method} is either @code{window} or @code{frame}, (2) the window
+has no history of previously-displayed buffers and (3)
+@var{this-buffer} equals the buffer currently displayed in
+@var{window}.  If @var{window} is part of an atomic window
+(@pxref{Atomic Windows}), quitting will try to delete the root of that
+atomic window instead.  In either case, it tries to avoid signaling an
+error when @var{window} cannot be deleted.
+
+If @var{obuffer} is a list, and @var{prev-buffer} is still live,
+quitting displays @var{prev-buffer} in @var{window} according to the
+rest of the elements of @var{obuffer}.  This includes resizing the
+window to @var{height} if it was temporarily resized to display
+@var{this-buffer}.
+
+Otherwise, if @var{window} was previously used for displaying other
+buffers (@pxref{Window History}), the most recent buffer in that
+history will be displayed.
+
+@ignore
+@c FIXME: Should we document display-buffer-reuse-window?
+If we document display-buffer-record-window, it should be with @defun.
+And maybe not here.
+
+
 Typically, the display routines run by @code{display-buffer} will set
-the @code{quit-restore} window parameter correctly.  It's also
-possible to set it manually, using the following code for displaying
-@var{buffer} in @var{window}:
+the @code{quit-restore} window parameter correctly.  You can also set
+it manually, using the following code for displaying @var{buffer} in
+@var{window}:
 
 @example
 @group
@@ -4361,11 +4393,10 @@ possible to set it manually, using the following code 
for displaying
 
 Setting the window history to @code{nil} ensures that a future call to
 @code{quit-window} can delete the window altogether.
+@end ignore
 
-@end defun
-
-The following option specifies how to deal with a frame containing just
-one window that should be either quit, or whose buffer should be buried.
+The following option specifies a function to do the right thing with a
+frame containing one window when quitting that window.
 
 @defopt frame-auto-hide-function
 The function specified by this option is called to automatically hide
@@ -4394,7 +4425,6 @@ that frame's @code{auto-hide-function} frame parameter 
(@pxref{Frame
 Interaction Parameters}).
 @end defopt
 
-
 @node Side Windows
 @section Side Windows
 @cindex side windows
diff --git a/doc/man/ChangeLog.1 b/doc/man/ChangeLog.1
index 9ad144a457..ff675d8947 100644
--- a/doc/man/ChangeLog.1
+++ b/doc/man/ChangeLog.1
@@ -176,7 +176,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2007-2021 Free Software Foundation, Inc.
+  Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/man/ebrowse.1 b/doc/man/ebrowse.1
index 7bb32b80d4..7bacdbd93e 100644
--- a/doc/man/ebrowse.1
+++ b/doc/man/ebrowse.1
@@ -82,7 +82,7 @@ should give you access to the complete manual.
 was written by Gerd Moellmann.
 .
 .SH COPYING
-Copyright 2008-2021 Free Software Foundation, Inc.
+Copyright 2008-2022 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of this
 document provided the copyright notice and this permission notice are
diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in
index b2be8bb07b..9fdf65e0ff 100644
--- a/doc/man/emacs.1.in
+++ b/doc/man/emacs.1.in
@@ -660,7 +660,7 @@ For detailed credits and acknowledgments, see the GNU Emacs 
manual.
 .
 .
 .SH COPYING
-Copyright 1995, 1999-2021 Free Software Foundation, Inc.
+Copyright 1995, 1999-2022 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of this
 document provided the copyright notice and this permission notice are
diff --git a/doc/man/etags.1 b/doc/man/etags.1
index cbd3c1a646..d345b8bd73 100644
--- a/doc/man/etags.1
+++ b/doc/man/etags.1
@@ -288,7 +288,7 @@ Stallman.
 .BR vi ( 1 ).
 
 .SH COPYING
-Copyright 1992, 1999, 2001-2021 Free Software Foundation, Inc.
+Copyright 1992, 1999, 2001-2022 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of this
 document provided the copyright notice and this permission notice are
diff --git a/doc/misc/ChangeLog.1 b/doc/misc/ChangeLog.1
index be2a7cad1b..1ee3c14fb9 100644
--- a/doc/misc/ChangeLog.1
+++ b/doc/misc/ChangeLog.1
@@ -12116,7 +12116,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/misc/Makefile.in b/doc/misc/Makefile.in
index 7982c0dc5a..6c1e9cbc91 100644
--- a/doc/misc/Makefile.in
+++ b/doc/misc/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1994, 1996-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1996-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -130,12 +130,12 @@ info: $(INFO_TARGETS)
 
 ## Used by top-level Makefile.
 ## Base file names of output info files.
+INFO_BASES = $(patsubst %.info,%,$(notdir $(INFO_INSTALL)))
 echo-info:
-       @echo "$(INFO_INSTALL) " | \
-         sed -e 's|[^ ]*/||g' -e 's/\.info//g' -e "s/  */.info /g"
+       @: $(info $(addsuffix .info,$(INFO_BASES)))
 
 echo-sources:
-       @echo ${SOURCES}
+       @: $(info $(SOURCES))
 
 dvi: $(DVI_TARGETS)
 
@@ -185,7 +185,8 @@ $(foreach ifile,$(filter-out 
info.info,$(INFO_TARGETS)),$(eval $(call info_templ
 
 ## Extra dependencies.
 
-need_emacsver = calc cl dired-x efaq efaq-w32 erc ido reftex woman
+## FIXME Updating this list manually is unreliable.
+need_emacsver = calc cl dired-x efaq efaq-w32 erc forms ido newsticker reftex 
remember woman
 need_emacsver_prefix = $(addprefix ${buildinfodir}/,${need_emacsver})
 
 $(need_emacsver_prefix:=.info) $(need_emacsver:=.dvi) $(need_emacsver:=.pdf) 
$(need_emacsver:=.html) : ${emacsdir}/emacsver.texi
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi
index 034004d1df..b28ae247ea 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -9,7 +9,7 @@
 @copying
 This file describes the Emacs auth-source library.
 
-Copyright @copyright{} 2008--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2008--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -305,7 +305,8 @@ The @dfn{Secret Service API} is a standard from
 to securely store passwords and other confidential information.  This
 API is implemented by system daemons such as the GNOME Keyring and the
 KDE Wallet (these are GNOME and KDE packages respectively and should
-be available on most modern GNU/Linux systems).
+be available on most modern GNU/Linux systems).  It has been tested
+also with KeePassXC.
 
 The auth-source library uses the @file{secrets.el} library to connect
 through the Secret Service API@.  You can also use that library in
@@ -360,15 +361,19 @@ Collections can be created and deleted by the functions
 Usually, this is not done from within Emacs.  Do not delete standard
 collections such as @code{"login"}.
 
-The special collection @code{"session"} exists for the lifetime of the
-corresponding client session (in our case, Emacs's lifetime).  It is
-created automatically when Emacs uses the Secret Service interface and
-it is deleted when Emacs is killed.  Therefore, it can be used to
-store and retrieve secret items temporarily.  The @code{"session"}
-collection is better than a persistent collection when the secret
-items should not live longer than Emacs.  The session collection can
-be specified either by the string @code{"session"}, or by @code{nil},
-whenever a collection parameter is needed in the following functions.
+With GNOME Keyring, there exists a special collection called
+@code{"session"}, which has the lifetime of the user being logged in.
+Its data are not stored on disk and go away when the user logs out.
+Therefore, it can be used to store and retrieve secret items
+temporarily.  The @code{"session"} collection is better than a
+persistent collection when the secret items should not live
+permanently.  The @code{"session"} collection can be addressed either
+by the string @code{"session"}, or by @code{nil}, whenever a
+collection parameter is needed.
+
+However, other Secret Service provider don't create this temporary
+@code{"session"} collection.  You shall check first that this
+collection exists, before you use it.
 
 @defun secrets-list-items collection
 Returns all the item labels of @var{collection} as a list.
@@ -382,7 +387,7 @@ pairs set for the created item.  The keys are keyword 
symbols,
 starting with a colon.  Example:
 
 @example
-;;; The session is "session", the label is "my item"
+;;; The collection is "session", the label is "my item"
 ;;; and the secret (password) is "geheim".
 (secrets-create-item "session" "my item" "geheim"
  :method "sudo" :user "joe" :host "remote-host")
diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi
index 5f9dc01d33..a3b0f16df9 100644
--- a/doc/misc/autotype.texi
+++ b/doc/misc/autotype.texi
@@ -11,7 +11,7 @@
 @c  @cindex autotypist
 
 @copying
-Copyright @copyright{} 1994--1995, 1999, 2001--2021 Free Software
+Copyright @copyright{} 1994--1995, 1999, 2001--2022 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/bovine.texi b/doc/misc/bovine.texi
index 9bfb117d1a..9d9aa48488 100644
--- a/doc/misc/bovine.texi
+++ b/doc/misc/bovine.texi
@@ -24,7 +24,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1999--2004, 2012--2021 Free Software Foundation,
+Copyright @copyright{} 1999--2004, 2012--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index c77ccf766f..d83edc15f3 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -95,7 +95,7 @@ This file documents Calc, the GNU Emacs calculator, included 
with
 GNU Emacs @value{EMACSVER}.
 @end ifnotinfo
 
-Copyright @copyright{} 1990--1991, 2001--2021 Free Software Foundation,
+Copyright @copyright{} 1990--1991, 2001--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index a2ff572a3f..8b36d1afd7 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -167,7 +167,7 @@ CC Mode
 @copying
 This manual is for CC Mode in Emacs.
 
-Copyright @copyright{} 1995--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -284,7 +284,6 @@ Font Locking
 * Faces::
 * Doc Comments::
 * Wrong Comment Style::
-* Found Types::
 * Misc Font Locking::
 * AWK Mode Font Locking::
 
@@ -1857,7 +1856,6 @@ sections apply to the other languages.
 * Faces::
 * Doc Comments::
 * Wrong Comment Style::
-* Found Types::
 * Misc Font Locking::
 * AWK Mode Font Locking::
 @end menu
@@ -2164,60 +2162,6 @@ which aren't of the default style will be fontified with
 @code{font-lock-warning-face}.
 @end defvar
 
-@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-@node    Found Types
-@comment  node-name,  next,  previous,  up
-@section ``Found Type'' handling.
-@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-In most languages handled by CC Mode, @dfn{found types} are recognized
-as types by their context in the source code.  These contrast with
-types which are basic to a language or are declared as types (e.g. by
-@code{typedef} in C).
-
-In earlier versions of @ccmode{}, when @code{jit-lock-mode} was
-enabled in Emacs (which it is by default), found types would
-frequently fail to get fontified properly.  This happened when the
-fontification functions scanned a use of the found type before
-scanning the code which caused it to be recognized.
-
-From @ccmode{} version 5.36, a timer mechanism scans the entire buffer
-for found types in the seconds immediately after starting the major
-mode.  When a found type gets recognized, all its occurrences in the
-buffer get marked for (re)fontification.  This scanning happens in
-short time slices interleaved with other processing, such as keyboard
-handling, so that the responsiveness of Emacs should be barely
-affected.  This mechanism can be disabled (see below).  It is only
-active when @code{jit-lock-mode} is also active.
-
-@defvar c-type-finder-time-slot
-@vindex type-finder-time-slot (c-)
-The approximate time in seconds that CC Mode spends in scanning source
-code before relinquishing control to other Emacs activities.  The
-default value is 0.05.  To disable the scanning mechanism, set this
-variable to @code{nil}.
-@end defvar
-
-@defvar c-type-finder-repeat-time
-@vindex type-finder-repeat-time (c-)
-The approximate frequency (in seconds) with which the scanning
-mechanism is triggered.  This time must be greater than
-@code{c-type-finder-time-slot}.  Its default value is 0.1.  If a less
-powerful machine becomes sluggish due to the scanning, increase the
-value of @code{c-type-finder-repeat-time} to compensate.
-@end defvar
-
-@defvar c-type-finder-chunk-size
-@vindex type-finder-chunk-size (c-)
-The approximate size (in characters) of the buffer chunk processed as
-a unit before the scanning mechanism checks whether
-@code{c-type-finder-time-slot} seconds have passed.  The default value
-is 1000.  A too small value here will cause inefficiencies due to the
-initialization which happens for each chunk, whereas a too large value
-will cause the processing to consume an excessive proportion of the
-@code{c-type-finder-repeat-time}.
-@end defvar
-
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 @node    Misc Font Locking
 @comment  node-name,  next,  previous,  up
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index 55b112cb24..a6fe29e102 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -7,7 +7,7 @@
 @copying
 This file documents the GNU Emacs Common Lisp emulation package.
 
-Copyright @copyright{} 1993, 2001--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, 2001--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 6463687793..0b4f53ba13 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -10,7 +10,7 @@
 @syncodeindex fn cp
 
 @copying
-Copyright @copyright{} 2007--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index 87a127c4f3..754ccf4065 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -20,7 +20,7 @@
 @comment %**end of header (This is for running Texinfo on a region.)
 
 @copying
-Copyright @copyright{} 1994--1995, 1999, 2001--2021 Free Software
+Copyright @copyright{} 1994--1995, 1999, 2001--2022 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/ebrowse.texi b/doc/misc/ebrowse.texi
index 8962f7c8cf..a2be0aedbc 100644
--- a/doc/misc/ebrowse.texi
+++ b/doc/misc/ebrowse.texi
@@ -11,7 +11,7 @@
 @copying
 This file documents Ebrowse, a C++ class browser for GNU Emacs.
 
-Copyright @copyright{} 2000--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2000--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi
index 5e9c3d7eef..af8e2153dd 100644
--- a/doc/misc/ede.texi
+++ b/doc/misc/ede.texi
@@ -6,7 +6,7 @@
 @copying
 This file describes EDE, the Emacs Development Environment.
 
-Copyright @copyright{} 1998--2001, 2004--2005, 2008--2021 Free Software
+Copyright @copyright{} 1998--2001, 2004--2005, 2008--2022 Free Software
 Foundation, Inc.
 
 @quotation
@@ -99,7 +99,7 @@ learn and adopt GNU ways of doing things.
 @chapter @ede{} Project Concepts
 
 @ede{} is a generic interface for managing projects.  It specifies a
-single set of menus and keybindings, while supporting multiple ways to
+single set of menus and key bindings, while supporting multiple ways to
 express a project via a build system.
 
 In the subsequent chapters, we will describe the different project
@@ -144,7 +144,7 @@ init file:
 
 Activating @ede{} adds a menu named @samp{Development} to the menu
 bar.  This menu provides several menu items for high-level @ede{}
-commands.  These menu items, and their corresponding keybindings, are
+commands.  These menu items, and their corresponding key bindings, are
 independent of the type of project you are actually working on.
 
 @node Quick Start
@@ -271,7 +271,7 @@ Projects.  You can create targets either from a buffer, or 
from a
 @code{dired} directory buffer.
 
 Note: If for some reason a directory list buffer, or file does not have the
-@samp{Project} menu item, or if @ede{} keybindings don't work, just
+@samp{Project} menu item, or if @ede{} key bindings don't work, just
 use @kbd{M-x revert-buffer @key{RET}} to force a refresh.  Sometimes
 creating a new project doesn't restart buffers correctly.
 
@@ -958,7 +958,7 @@ The example for Makefiles looks like this:
   ((buildfile :initform "Makefile"))
   "Generic Project for makefiles.")
 
-(defmethod ede-generic-setup-configuration ((proj 
ede-generic-makefile-project) config)
+(cl-defmethod ede-generic-setup-configuration ((proj 
ede-generic-makefile-project) config)
   "Set up a configuration for Make."
   (oset config build-command "make -k")
   (oset config debug-command "gdb "))
@@ -1059,7 +1059,7 @@ examples.
 @menu
 * Development Overview::
 * Detecting a Project::
-* User interface methods::      Methods associated with keybindings
+* User interface methods::      Methods associated with key bindings
 * Base project methods::        The most basic methods on @ede{} objects.
 * Sourcecode objects::          Defining new sourcecode classes.
 * Compiler and Linker objects::  Defining new compilers and linkers.
diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi
index 8162a84f61..d81ba158a1 100644
--- a/doc/misc/ediff.texi
+++ b/doc/misc/ediff.texi
@@ -26,7 +26,7 @@
 This file documents Ediff, a comprehensive visual interface to Unix diff
 and patch utilities.
 
-Copyright @copyright{} 1995--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/edt.texi b/doc/misc/edt.texi
index b4dabdb938..8b4ac0da5d 100644
--- a/doc/misc/edt.texi
+++ b/doc/misc/edt.texi
@@ -6,7 +6,7 @@
 @copying
 This file documents the EDT emulation package for Emacs.
 
-Copyright @copyright{} 1986, 1992, 1994--1995, 1999--2021 Free Software
+Copyright @copyright{} 1986, 1992, 1994--1995, 1999--2022 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi
index a5b5251d6e..8dcdb121ab 100644
--- a/doc/misc/efaq-w32.texi
+++ b/doc/misc/efaq-w32.texi
@@ -15,7 +15,7 @@ Answers to Frequently asked Questions about using Emacs on 
Microsoft Windows.
 @include emacsver.texi
 
 @copying
-Copyright @copyright{} 2008, 2010--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2008, 2010--2022 Free Software Foundation, Inc.
 
 @quotation
 This list of frequently asked questions about GNU Emacs on MS Windows
@@ -687,9 +687,9 @@ question also.
 @node CUA
 @subsection Standard Windows key bindings
 @findex cua-mode
-@cindex CUA keybindings
+@cindex CUA key bindings
 @cindex shift key, selecting with
-@cindex standard Windows keybindings
+@cindex standard Windows key bindings
 @cindex paste with C-v
 @cindex cut with C-x
 @cindex copy with C-c
@@ -697,7 +697,7 @@ question also.
 @cindex C-x to cut
 @cindex C-v to paste
 
-The keybindings of Emacs predate modern GUIs, and the keys that were
+The key bindings of Emacs predate modern GUIs, and the keys that were
 chosen by later GUIs for cut and copy were given important functions
 as extended keymaps in Emacs.  CUA mode attempts to let both bindings
 co-exist by defining C-x and C-c as @code{kill-region} and
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 28f0cb972d..ed8a919ac7 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -8,7 +8,7 @@
 @include emacsver.texi
 
 @copying
-Copyright @copyright{} 2001--2021 Free Software Foundation, Inc.@*
+Copyright @copyright{} 2001--2022 Free Software Foundation, Inc.@*
 Copyright @copyright{} 1994, 1995, 1996, 1997, 1998, 1999, 2000
 Reuven M. Lerner@*
 Copyright @copyright{} 1992, 1993 Steven Byrnes@*
diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi
index c8d488d6ed..18a2b74033 100644
--- a/doc/misc/eieio.texi
+++ b/doc/misc/eieio.texi
@@ -12,7 +12,7 @@
 @copying
 This manual documents EIEIO, an object framework for Emacs Lisp.
 
-Copyright @copyright{} 2007--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/emacs-gnutls.texi b/doc/misc/emacs-gnutls.texi
index fbc4443c0a..1b9f5e1040 100644
--- a/doc/misc/emacs-gnutls.texi
+++ b/doc/misc/emacs-gnutls.texi
@@ -9,7 +9,7 @@
 @copying
 This file describes the Emacs GnuTLS integration.
 
-Copyright @copyright{} 2012--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2012--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi
index 96a4ad556f..640712edf3 100644
--- a/doc/misc/emacs-mime.texi
+++ b/doc/misc/emacs-mime.texi
@@ -10,7 +10,7 @@
 @copying
 This file documents the Emacs MIME interface functionality.
 
-Copyright @copyright{} 1998--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1998--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/epa.texi b/doc/misc/epa.texi
index e777771cf7..70bfc0462b 100644
--- a/doc/misc/epa.texi
+++ b/doc/misc/epa.texi
@@ -10,7 +10,7 @@
 @copying
 This file describes EasyPG Assistant @value{VERSION}.
 
-Copyright @copyright{} 2007--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi
index e7286d2ebe..b9297738ea 100644
--- a/doc/misc/erc.texi
+++ b/doc/misc/erc.texi
@@ -12,7 +12,7 @@
 @copying
 This manual is for ERC @value{ERCVER} @value{ERCDIST}.
 
-Copyright @copyright{} 2005--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2005--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi
index af215482f4..0d01efb035 100644
--- a/doc/misc/ert.texi
+++ b/doc/misc/ert.texi
@@ -15,7 +15,7 @@
 @end direntry
 
 @copying
-Copyright @copyright{} 2008, 2010--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2008, 2010--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -109,6 +109,7 @@ Appendix
 @end menu
 @end ifnottex
 
+
 @node Introduction
 @chapter Introduction
 @cindex introduction to ERT
@@ -123,7 +124,7 @@ commands to run them to verify whether the definitions that 
are
 currently loaded in Emacs pass the tests.
 
 Some Lisp files have comments like the following (adapted from the
-package @code{pp.el}):
+package @file{pp.el}):
 
 @lisp
 ;; (pp-to-string '(quote quote))          ; expected: "'quote"
@@ -358,6 +359,7 @@ Prompt for a test and then show its documentation.
 
 @end table
 
+
 @node Running Tests in Batch Mode
 @section Running Tests in Batch Mode
 @cindex running tests in batch mode
@@ -375,7 +377,7 @@ emacs -batch -l ert -l my-tests.el -f 
ert-run-tests-batch-and-exit
 @end example
 
 This command will start up Emacs in batch mode, load ERT, load
-@code{my-tests.el}, and run all tests defined in it.  It will exit
+@file{my-tests.el}, and run all tests defined in it.  It will exit
 with a zero exit status if all tests passed, or nonzero if any tests
 failed or if anything else went wrong.  It will also print progress
 messages and error diagnostics to standard output.
@@ -439,10 +441,21 @@ emacs -batch -l ert -l my-tests.el \
       -eval '(ert-run-tests-batch-and-exit "to-match")'
 @end example
 
+@vindex EMACS_TEST_VERBOSE@r{, environment variable}
 By default, ERT test failure summaries are quite brief in batch
 mode---only the names of the failed tests are listed.  If the
-EMACS_TEST_VERBOSE environment variable is set, the failure summaries
-will also include the data from the failing test.
+@env{EMACS_TEST_VERBOSE} environment variable is set, the failure
+summaries will also include the data from the failing test.
+
+@vindex EMACS_TEST_JUNIT_REPORT@r{, environment variable}
+ERT can produce JUnit test reports in batch mode.  If the environment
+variable @env{EMACS_TEST_JUNIT_REPORT} is set, ERT will produce for
+every test package @file{my-tests.el} a corresponding JUnit test
+report @file{my-tests.xml}.  The function
+@code{ert-summarize-tests-batch-and-exit} collects all these package
+test reports into a new JUnit test report, with the respective name of
+that environment variable.
+
 
 @node Test Selectors
 @section Test Selectors
@@ -514,6 +527,7 @@ to find where a test was defined if the test was loaded 
from a file.
 * erts files::                  Files containing many buffer tests.
 @end menu
 
+
 @node The @code{should} Macro
 @section The @code{should} Macro
 
@@ -793,6 +807,7 @@ code is to restructure the code slightly to provide better 
interfaces
 for testing.  Usually, this makes the interfaces easier to use as
 well.
 
+
 @node erts files
 @section erts files
 
@@ -907,6 +922,7 @@ non-@code{nil} value, the test will be skipped.
 If you need to use the literal line single line @samp{=-=} in a test
 section, you can quote it with a @samp{\} character.
 
+
 @node How to Debug Tests
 @chapter How to Debug Tests
 
@@ -1108,6 +1124,7 @@ For information on mocks, stubs, fixtures, or test 
suites, see below.
 * Fixtures and Test Suites::  How ERT differs from tools for other languages.
 @end menu
 
+
 @node Mocks and Stubs
 @section Other Tools for Emacs Lisp
 @cindex mocks and stubs
@@ -1182,11 +1199,13 @@ e.g., to run quick tests during interactive development 
and slow tests less
 often.  This can be achieved with the @code{:tag} argument to
 @code{ert-deftest} and @code{tag} test selectors.
 
+
 @node Index
 @unnumbered Index
 
 @printindex cp
 
+
 @node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index a87dd4308c..83d324c7e1 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -10,7 +10,7 @@
 @copying
 This manual is for Eshell, the Emacs shell.
 
-Copyright @copyright{} 1999--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi
index b40277003c..e9cf4cfade 100644
--- a/doc/misc/eudc.texi
+++ b/doc/misc/eudc.texi
@@ -14,7 +14,7 @@ This file documents EUDC version 1.40.0.
 EUDC is the Emacs Unified Directory Client, a common interface to
 directory servers and contact information.
 
-Copyright @copyright{} 1998, 2000--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1998, 2000--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index ebfdaf546e..6d1ba3962f 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -8,7 +8,7 @@
 @copying
 This file documents the GNU Emacs Web Wowser (EWW) package.
 
-Copyright @copyright{} 2014--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2014--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -305,6 +305,7 @@ state the directionality.
 
 @vindex shr-max-image-proportion
 @vindex shr-blocked-images
+@vindex shr-allowed-images
 @cindex Image Display
   Loading random images from the web can be problematic due to their
 size or content.  By customizing @code{shr-max-image-proportion} you
@@ -312,7 +313,9 @@ can set the maximal image proportion in relation to the 
window they
 are displayed in.  E.g., 0.7 means an image is allowed to take up 70%
 of the width and height.  If Emacs supports image scaling (ImageMagick
 support required) then larger images are scaled down.  You can block
-specific images completely by customizing @code{shr-blocked-images}.
+specific images completely by customizing @code{shr-blocked-images},
+or, if you want to only allow some specific images, customize
+@code{shr-allowed-images}.
 
 @vindex shr-inhibit-images
   You can control image display by customizing
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index ca464aff66..0db02608dd 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -13,7 +13,7 @@
 @copying
 This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}).
 
-Copyright @copyright{} 2004--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/forms.texi b/doc/misc/forms.texi
index 15fcd97c5b..8c814b9c85 100644
--- a/doc/misc/forms.texi
+++ b/doc/misc/forms.texi
@@ -20,7 +20,7 @@
 @copying
 This file documents Forms mode, a form-editing major mode for GNU Emacs.
 
-Copyright @copyright{} 1989, 1997, 2001--2021 Free Software Foundation,
+Copyright @copyright{} 1989, 1997, 2001--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/gnus-coding.texi b/doc/misc/gnus-coding.texi
index 94d952b423..0858432acf 100644
--- a/doc/misc/gnus-coding.texi
+++ b/doc/misc/gnus-coding.texi
@@ -8,7 +8,7 @@
 @syncodeindex pg cp
 
 @copying
-Copyright @copyright{} 2004--2005, 2007--2021 Free Software Foundation,
+Copyright @copyright{} 2004--2005, 2007--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi
index 36c402ab35..14a8c4c12d 100644
--- a/doc/misc/gnus-faq.texi
+++ b/doc/misc/gnus-faq.texi
@@ -1,7 +1,7 @@
 @c \input texinfo @c -*-texinfo-*-
 @c Uncomment 1st line before texing this file alone.
 @c %**start of header
-@c Copyright (C) 1995, 2001--2021 Free Software Foundation, Inc.
+@c Copyright (C) 1995, 2001--2022 Free Software Foundation, Inc.
 @c
 @c @setfilename gnus-faq.info
 @c @settitle Frequently Asked Questions
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 74b5fb442e..61870311ed 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -8,7 +8,7 @@
 @syncodeindex pg cp
 
 @copying
-Copyright @copyright{} 1995--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -4499,7 +4499,7 @@ command or better use it as a prefix key.  For example:
     (gnus-group-jump-to-group "nndraft:drafts")))
 @end lisp
 
-On keys reserved for users in Emacs and on keybindings in general
+On keys reserved for users in Emacs and on key bindings in general
 @xref{Keymaps, Keymaps, , emacs, The Emacs Editor}.
 
 @item ^
@@ -13477,7 +13477,7 @@ Also @pxref{Formatting Variables}.
 @subsection Server Commands
 @cindex server commands
 
-The following keybinding are available in the server buffer.  Be aware
+The following key bindings are available in the server buffer.  Be aware
 that some of the commands will only work on servers that you've added
 through this interface (with @kbd{a}), not with servers you've defined
 in your init files.
diff --git a/doc/misc/htmlfontify.texi b/doc/misc/htmlfontify.texi
index b2216924e2..0ab000b70f 100644
--- a/doc/misc/htmlfontify.texi
+++ b/doc/misc/htmlfontify.texi
@@ -10,7 +10,7 @@
 This manual documents Htmlfontify, a source code -> crosslinked +
 formatted + syntax colorized html transformer.
 
-Copyright @copyright{} 2002--2003, 2013--2021 Free Software Foundation,
+Copyright @copyright{} 2002--2003, 2013--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi
index 3cd53c71da..26a6e6c7a3 100644
--- a/doc/misc/idlwave.texi
+++ b/doc/misc/idlwave.texi
@@ -23,7 +23,7 @@ Emacs, and interacting with an IDL shell run as a subprocess.
 This is edition @value{EDITION} of the IDLWAVE User Manual for IDLWAVE
 @value{VERSION}.
 
-Copyright @copyright{} 1999--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -2670,7 +2670,7 @@ As a special case, any error message in the output will 
be displayed
 @node Debugging IDL Programs
 @section Debugging IDL Programs
 @cindex Debugging
-@cindex Keybindings for debugging
+@cindex Key bindings for debugging
 @cindex Toolbar
 
 Programs can be compiled, run, and debugged directly from the source
diff --git a/doc/misc/ido.texi b/doc/misc/ido.texi
index 1c960940a0..c8f9762b55 100644
--- a/doc/misc/ido.texi
+++ b/doc/misc/ido.texi
@@ -7,7 +7,7 @@
 @copying
 This file documents the Ido package for GNU Emacs.
 
-Copyright @copyright{} 2013--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2013--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -476,13 +476,13 @@ M-x customize-variable @key{RET} ido-xxxxx @key{RET}
 @end example
 
 @vindex ido-setup-hook
-To modify the keybindings, use the @code{ido-setup-hook}.  For example:
+To modify the key bindings, use the @code{ido-setup-hook}.  For example:
 
 @example
 (add-hook 'ido-setup-hook 'ido-my-keys)
 
 (defun ido-my-keys ()
- "Add my keybindings for Ido."
+ "Add my key bindings for Ido."
  (define-key ido-completion-map " " 'ido-next-match))
 @end example
 
diff --git a/doc/misc/info.texi b/doc/misc/info.texi
index 27c00f3925..98e0dceb5a 100644
--- a/doc/misc/info.texi
+++ b/doc/misc/info.texi
@@ -15,7 +15,7 @@
 This file describes how to use Info, the menu-driven GNU
 documentation system.
 
-Copyright @copyright{} 1989, 1992, 1996--2021 Free Software Foundation,
+Copyright @copyright{} 1989, 1992, 1996--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/mairix-el.texi b/doc/misc/mairix-el.texi
index e57b5ed542..3632c64bd4 100644
--- a/doc/misc/mairix-el.texi
+++ b/doc/misc/mairix-el.texi
@@ -5,7 +5,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 2008--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2008--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/message.texi b/doc/misc/message.texi
index 4136ad859f..29fbdfe178 100644
--- a/doc/misc/message.texi
+++ b/doc/misc/message.texi
@@ -9,7 +9,7 @@
 @copying
 This file documents Message, the Emacs message composition mode.
 
-Copyright @copyright{} 1996--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1996--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -2553,6 +2553,22 @@ if @code{nil} let the mailer mail back a message to 
report errors.
 When non-@code{nil}, Gnus will ask for confirmation when sending a
 message.
 
+@item message-server-alist
+@vindex message-server-alist
+An alist describing the rules for generating the
+@code{X-Message-SMTP-Method} header to insert before sending out a new
+message, if the message doesn't yet have such a header.  Each element
+of the alist should be of the form
+@w{@code{(@var{cond} . @var{method})}}.  If @var{cond} is a string, it
+will be compared with the @code{From} header, and if they compare
+equal, the corresponding @var{method} will be inserted as a string
+into the message headers as the SMTP Method.  If @var{cond} is a
+function, it will be called in the message buffer without any
+arguments, and the corresponding @var{method} will be inserted into
+the message headers as the SMTP Method if the function returns a
+non-@code{nil} value; if @var{method} is nil, the value returned by
+the function @code{cond} is used instead.
+
 @end table
 
 
diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi
index d96c243f52..c1cf44a027 100644
--- a/doc/misc/mh-e.texi
+++ b/doc/misc/mh-e.texi
@@ -25,7 +25,7 @@
 This is version @value{VERSION}@value{EDITION} of @cite{The MH-E
 Manual}, last updated @value{UPDATED}.
 
-Copyright @copyright{} 1995, 2001--2003, 2005--2021 Free Software
+Copyright @copyright{} 1995, 2001--2003, 2005--2022 Free Software
 Foundation, Inc.
 
 @c This dual license has been agreed upon by the FSF.
diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org
index f67a179567..35bc8853fd 100644
--- a/doc/misc/modus-themes.org
+++ b/doc/misc/modus-themes.org
@@ -5,9 +5,9 @@
 #+options: ':t toc:nil author:t email:t num:t
 #+startup: content
 
-#+macro: stable-version 1.7.0
-#+macro: release-date 2021-11-18
-#+macro: development-version 1.8.0-dev
+#+macro: stable-version 2.0.0
+#+macro: release-date 2021-12-24
+#+macro: development-version 2.1.0-dev
 #+macro: file @@texinfo:@file{@@$1@@texinfo:}@@
 #+macro: space @@texinfo:@: @@
 #+macro: kbd @@texinfo:@kbd{@@$1@@texinfo:}@@
@@ -42,7 +42,7 @@ Current development target is {{{development-version}}}.
 :custom_id: h:b14c3fcb-13dd-4144-9d92-2c58b3ed16d3
 :end:
 
-Copyright (C) 2020-2021  Free Software Foundation, Inc.
+Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 #+begin_quote
 Permission is granted to copy, distribute and/or modify this document
@@ -82,9 +82,22 @@ themes strive to achieve as close to full face coverage as 
possible
 ([[#h:a9c8f29d-7f72-4b54-b74b-ddefe15d6a19][Face coverage]]).
 
 Furthermore, the themes are designed to empower users with red-green
-color deficiency (deuteranopia).  This is achieved through customization
-options which have the effect of replacing all relevant instances of
-green with a variant of blue 
([[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization Options]]).
+color deficiency (deuteranopia).  This is achieved in three ways:
+
+1. The conformance with the highest legibility standard means that text
+   is always readable no matter the perception of its hue.
+
+2. Most contexts use colors on the blue-cyan-magenta-purple side of the
+   spectrum.  Put differently, green and/or red are seldom used, thus
+   minimizing the potential for confusion.
+
+   [[#h:0b26cb47-9733-4cb1-87d9-50850cb0386e][Why are colors mostly variants 
of blue, magenta, cyan?]].
+
+3. In contexts where a red/green color-coding is unavoidable, we provide
+   a universal toggle to customize the themes so that a red/blue scheme
+   is used instead.
+
+   [[#h:3ed03a48-20d8-4ce7-b214-0eb7e4c79abe][Option for red-green color 
deficiency or deuteranopia]].
 
 Starting with version 0.12.0 and onwards, the themes are built into GNU
 Emacs.
@@ -279,9 +292,9 @@ With those granted, bear in mind a couple of technical 
points on
 
 2. The functions will run the ~modus-themes-after-load-theme-hook~ as
    their final step.  This can be employed for bespoke configurations
-   ([[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]]).  
Experienced users may not wish to rely
-   on such a hook and the functions that run it: they may prefer a
-   custom solution ([[#h:86f6906b-f090-46cc-9816-1fe8aeb38776][A 
theme-agnostic hook for theme loading]]).
+   ([[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]]).  
Experienced users may not wish to rely on
+   such a hook and the functions that run it: they may prefer a custom
+   solution ([[#h:86f6906b-f090-46cc-9816-1fe8aeb38776][A theme-agnostic hook 
for theme loading]]).
 
 ** Sample configuration with and without use-package
 :properties:
@@ -404,8 +417,9 @@ this manual.
       modus-themes-mixed-fonts nil
       modus-themes-subtle-line-numbers nil
       modus-themes-intense-markup t
-      modus-themes-success-deuteranopia t
+      modus-themes-deuteranopia t
       modus-themes-tabs-accented t
+      modus-themes-variable-pitch-ui nil
       modus-themes-inhibit-reload t ; only applies to `customize-set-variable' 
and related
 
       modus-themes-fringes nil ; {nil,'subtle,'intense}
@@ -418,12 +432,8 @@ this manual.
 
       ;; Options for `modus-themes-mode-line' are either nil, or a list
       ;; that can combine any of `3d' OR `moody', `borderless',
-      ;; `accented', `padded'.
-      modus-themes-mode-line '(padded accented borderless)
-
-      ;; This one only works when `modus-themes-mode-line' (above) has
-      ;; the `padded' property.  It takes a positive integer.
-      modus-themes-mode-line-padding 3
+      ;; `accented', and a natural number for extra padding
+      modus-themes-mode-line '(4 accented borderless)
 
       ;; Options for `modus-themes-syntax' are either nil (the default),
       ;; or a list of properties that may include any of those symbols:
@@ -460,32 +470,22 @@ this manual.
       ;; `no-extend', `bg-only', `accented'
       modus-themes-region '(bg-only no-extend)
 
-      ;; Options for `modus-themes-diffs': nil, 'desaturated,
-      ;; 'bg-only, 'deuteranopia, 'fg-only-deuteranopia
-      modus-themes-diffs 'fg-only-deuteranopia
+      ;; Options for `modus-themes-diffs': nil, 'desaturated, 'bg-only
+      modus-themes-diffs 'desaturated
 
       modus-themes-org-blocks 'gray-background ; 
{nil,'gray-background,'tinted-background}
 
       modus-themes-org-agenda ; this is an alist: read the manual or its doc 
string
-      '((header-block . (variable-pitch scale-title))
-        (header-date . (grayscale workaholic bold-today))
-        (event . (accented scale-small))
+      '((header-block . (variable-pitch 1.3))
+        (header-date . (grayscale workaholic bold-today 1.1))
+        (event . (accented varied))
         (scheduled . uniform)
-        (habit . traffic-light-deuteranopia))
+        (habit . traffic-light))
 
       modus-themes-headings ; this is an alist: read the manual or its doc 
string
-      '((1 . (overline background))
-        (2 . (rainbow overline))
-        (t . (semibold)))
-
-      modus-themes-variable-pitch-ui nil
-      modus-themes-variable-pitch-headings t
-      modus-themes-scale-headings t
-      modus-themes-scale-1 1.1
-      modus-themes-scale-2 1.15
-      modus-themes-scale-3 1.21
-      modus-themes-scale-4 1.27
-      modus-themes-scale-title 1.33)
+      '((1 . (overline background variable-pitch 1.3))
+        (2 . (rainbow overline 1.1))
+        (t . (semibold))))
 #+end_src
 
 ** Option for inhibiting theme reload
@@ -515,37 +515,40 @@ Enable this behaviour by setting this variable to ~nil~.
 Regardless of this option, the active theme must be reloaded for changes
 to user options to take effect 
([[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]]).
 
-** Option for color-coding success state
+** Option for red-green color deficiency or deuteranopia
 :properties:
-:alt_title: Success' color-code
-:description: Toggle blue color for success or done states
+:alt_title: Deuteranopia style
+:description: Toggle red/blue color-coding instead of red/green
 :custom_id: h:3ed03a48-20d8-4ce7-b214-0eb7e4c79abe
 :end:
-#+vindex: modus-themes-success-deuteranopia
+#+vindex: modus-themes-deuteranopia
 
-Brief: Toggle the use of blue instead of green in places which
-color-code green as "success" and red as "failure".
+Brief: When non-nil use red/blue color-coding instead of red/green,
+where appropriate.
 
-Symbol: ~modus-themes-success-deuteranopia~ (=boolean= type)
+Symbol: ~modus-themes-deuteranopia~ (=boolean= type)
 
 Possible values:
 
 1. ~nil~ (default)
 2. ~t~
 
-The default is to colorise a passing state in a green hue.  This affects
-all faces that denote "success", "done", marking a selection as opposed
-to marking for deletion, the current search match in contrast to lazily
-highlighted ones, and the like.
-
-With a non-nil value (~t~), use variants of blue instead of green.  This
-is meant to empower users with red-green color deficiency.
+This is to account for red-green color deficiency, also know as
+deuteranopia and variants.  It applies to all contexts where there can
+be a color-coded distinction between failure or success, a to-do or done
+state, a mark for deletion versus a mark for selection (e.g. in Dired),
+current and lazily highlighted search matches, removed lines in diffs as
+opposed to added ones, and so on.
 
-Diffs, which rely on a red/green dichotomy by default, can also be
-configured to meet the needs of users with deuteranopia via the option
-~modus-themes-diffs~.
+Note that this does not change all colors throughout the active theme,
+but only applies to cases that have color-coding significance.  For
+example, regular code syntax highlighting is not affected.  There is no
+such need because of the themes' overarching commitment to the highest
+legibility standard, which ensures that text is readable regardless of
+hue, as well as the predominance of colors on the
+blue-cyan-magenta-purple side of the spectrum.
 
-[[#h:ea7ac54f-5827-49bd-b09f-62424b3b6427][Option for diff buffer looks]].
+[[#h:0b26cb47-9733-4cb1-87d9-50850cb0386e][Why are colors mostly variants of 
blue, magenta, cyan?]].
 
 ** Option for more bold constructs
 :properties:
@@ -856,45 +859,44 @@ effect, color, and border visibility:
   - ~moody~
 + ~accented~
 + ~borderless~
-+ ~padded~
++ A natural number > 1 for extra padding
 
 The default (a nil value or an empty list) is a two-dimensional
-rectangle with a border around it.  The active and the inactive
-mode lines use different shades of grayscale values for the
-background, foreground, border.
-
-The ~3d~ property applies a three-dimensional effect to the
-active mode line.  The inactive mode lines remain two-dimensional
-and are toned down a bit, relative to the default style.
-
-The ~moody~ property optimizes the mode line for use with the
-library of the same name (hereinafter referred to as 'Moody').
-In practice, it removes the box effect and replaces it with
-underline and overline properties.  It also tones down the
-inactive mode lines.  Despite its intended purpose, this option
-can also be used without the Moody library (please consult the
-themes' manual on this point for more details).  If both ~3d~ and
-~moody~ properties are set, the latter takes precedence.
-
-The ~borderless~ property removes the color of the borders.  It
-does not actually remove the borders, but only makes their color
-the same as the background, effectively creating some padding.
-
-The ~accented~ property ensures that the active mode line uses a
-colored background instead of the standard shade of gray.
-
-The ~padded~ property increases the apparent height of the mode line.
-This is done by applying box effects and combining them with an
-underline and overline.  To ensure that the underline is placed at the
-bottom, set ~x-underline-at-descent-line~ to non-nil.  The ~padded~ property
-has no effect when the ~moody~ property is also used, because Moody
-already applies its own padding.  The exact value of the padding is
-controlled by the variable ~modus-themes-mode-line-padding~.
-
-[[#h:a12b4d3c-e66b-42ed-99ab-4ea039b69e2e][Option for mode line padding]].
+rectangle with a border around it.  The active and the inactive mode
+lines use different shades of grayscale values for the background,
+foreground, border.
+
+The ~3d~ property applies a three-dimensional effect to the active mode
+line.  The inactive mode lines remain two-dimensional and are toned down
+a bit, relative to the default style.
+
+The ~moody~ property optimizes the mode line for use with the library of
+the same name (hereinafter referred to as 'Moody').  In practice, it
+removes the box effect and replaces it with underline and overline
+properties.  It also tones down the inactive mode lines.  Despite its
+intended purpose, this option can also be used without the Moody library
+(please consult the themes' manual on this point for more details).  If
+both ~3d~ and ~moody~ properties are set, the latter takes precedence.
+
+The ~borderless~ property removes the color of the borders.  It does not
+actually remove the borders, but only makes their color the same as the
+background, effectively creating some padding.
+
+The ~accented~ property ensures that the active mode line uses a colored
+background instead of the standard shade of gray.
+
+A positive integer (natural number or natnum) applies a padding effect
+of NATNUM pixels at the boundaries of the mode lines.  The default value
+is 1 and does not need to be specified explicitly.  The padding has no
+effect when the ~moody~ property is also used, because Moody already
+applies its own tweaks.  To ensure that the underline is placed at the
+bottom of the mode line, set ~x-underline-at-descent-line~ to non-nil
+(this is not needed when the ~borderless~ property is also set).  For
+users on Emacs 29, the ~x-use-underline-position-properties~ variable must
+also be set to nil.
 
-Combinations of any of those properties are expressed as a list,
-like in these examples:
+Combinations of any of those properties are expressed as a list, like in
+these examples:
 
 #+begin_src emacs-lisp
 (accented)
@@ -929,31 +931,13 @@ high, because it has the adverse effect of always 
overriding the default
 colors (which have been carefully designed to be highly accessible).
 
 Furthermore, because Moody expects an underline and overline instead of
-a box style, it is advised to set ~x-underline-at-descent-line~ to a
-non-nil value.
+a box style, it is strongly advised to set ~x-underline-at-descent-line~
+to a non-nil value.
 
 Finally, note that various packages which heavily modify the mode line,
 such as =doom-modeline=, =nano-modeline=, =powerline=, =spaceline= may not look
 as intended with all possible combinations of this user option.
 
-*** Option for mode line padding
-:properties:
-:custom_id: h:a12b4d3c-e66b-42ed-99ab-4ea039b69e2e
-:end:
-#+vindex: modus-themes-mode-line-padding
-
-Brief: Set the padding of the mode lines.
-
-Symbol: ~modus-themes-mode-line-padding~ (=natnum= type)
-
-Controls the exact width of the mode line's padding.  Possible values
-are positive integers.  The default value is =6=.
-
-This customization option applies only when ~modus-themes-mode-line~ is
-configured with the ~padded~ property.
-
-[[#h:27943af6-d950-42d0-bc23-106e43f50a24][Option for mode line presentation]].
-
 ** Option for accented background in tab interfaces
 :properties:
 :alt_title: Tab style
@@ -1002,7 +986,7 @@ foreground colors for their interaction model, and (ii) 
those that
 combine background and foreground values for some of their metaphors.
 The former category encompasses Icomplete, Ido, Selectrum, Vertico, as
 well as pattern matching styles like Orderless and Flx.  The latter
-covers Helm, Ivy, and Sallet.
+covers Helm and Ivy.
 
 A value of ~nil~ (the default) will simply respect the metaphors of each
 completion framework.
@@ -1361,12 +1345,12 @@ In user configuration files the form may look like this:
 ** Option for diff buffer looks
 :properties:
 :alt_title: Diffs
-:description: Choose among intense, desaturated, or text-only diffs
+:description: Choose among intense, desaturated, or background-only diffs
 :custom_id: h:ea7ac54f-5827-49bd-b09f-62424b3b6427
 :end:
 #+vindex: modus-themes-diffs
 
-Bried: Set the overall style of diffs.
+Brief: Set the overall style of diffs.
 
 Symbol: ~modus-themes-diffs~ (=choice= type)
 
@@ -1375,11 +1359,10 @@ Possible values:
 1. ~nil~ (default)
 2. ~desaturated~
 3. ~bg-only~
-4. ~deuteranopia~
-5. ~fg-only-deuteranopia~
 
 The default (~nil~) uses fairly intense color combinations for diffs, by
-applying prominently colored backgrounds, with appropriate foregrounds.
+applying prominently colored backgrounds, with appropriately tinted
+foregrounds.
 
 Option ~desaturated~ follows the same principles as with the default
 (~nil~), though it tones down all relevant colors.
@@ -1387,24 +1370,22 @@ Option ~desaturated~ follows the same principles as 
with the default
 Option ~bg-only~ applies a background but does not override the text's
 foreground.  This makes it suitable for a non-nil value passed to
 ~diff-font-lock-syntax~ (note: Magit does not support syntax highlighting
-in diffs---last checked on 2021-04-21).
-
-Option ~deuteranopia~ is like the default (~nil~) in terms of using
-prominently colored backgrounds, except that it also accounts for
-red-green color defficiency by replacing all instances of green with
-colors on the blue side of the spectrum.  Other stylistic changes are
-made in the interest of optimizing for such a use-case.
-
-Option ~fg-only-deuteranopia~ removes all colored backgrounds, except from
-word-wise or refined changes.  Instead, it only uses color-coded
-foreground values to differentiate between added, removed, and changed
-lines.  If a background is necessary to denote context, a subtle
-grayscale value is applied.  The color used for added lines is a variant
-of blue to account for red-green color defficiency but also because
-green text alone is hard to discern in the diff's context (hard for our
-accessibility purposes).  The ~fg-only~ option that existed in older
-versions of the themes is now an alias of ~fg-only-deuteranopia~, in the
-interest of backward compatibility.
+in diffs---last checked on 2021-12-02).
+
+When the user option ~modus-themes-deuteranopia~ is non-nil, all diffs
+will use a red/blue color-coding system instead of the standard
+red/green.  Other stylistic changes are made in the interest of
+optimizing for such a use-case.
+
+[[#h:3ed03a48-20d8-4ce7-b214-0eb7e4c79abe][Option for red-green color 
deficiency or deuteranopia]].
+
+In versions before =2.0.0= there was an option for foreground-only diffs.
+This is no longer supported at the theme level because there are cases
+where the perceived contrast and overall contextuality were not good
+enough although the applied colors were technically above the 7:1
+contrast threshold.
+
+[[#h:e2aed9eb-5e1e-45ec-bbd7-bc4faeab3236][Diffs with only the foreground]].
 
 ** Option for org-mode block styles
 :properties:
@@ -1468,8 +1449,8 @@ all possible combinations:
 
 #+begin_src emacs-lisp
 (setq modus-themes-org-agenda
-      '((header-block . (variable-pitch scale-title))
-        (header-date . (grayscale workaholic bold-today))
+      '((header-block . (variable-pitch 1.5))
+        (header-date . (grayscale workaholic bold-today 1.2))
         (event . (accented italic varied))
         (scheduled . uniform)
         (habit . traffic-light)))
@@ -1483,20 +1464,31 @@ come in the form of a list that can include either or 
both of those
 properties:
 
 - ~variable-pitch~ to use a proportionately spaced typeface;
-- ~scale-title~ to increase the size to the number assigned to
-  ~modus-themes-scale-title~ 
([[#h:6868baa1-beba-45ed-baa5-5fd68322ccb3][Control the scale of headings]]) or 
~no-scale~
-  to make the font use the same height as the rest of the buffer.
+- A number as a floating point (e.g. 1.5) to set the height of the text
+  to that many times the default font height.  A float of 1.0 or the
+  symbol ~no-scale~ have the same effect of making the font to the same
+  height as the rest of the buffer.  When neither a number nor ~no-scale~
+  are present, the default is a small increase in height (a value of
+  1.15).
+- The symbol of a weight attribute adjusts the font of the heading
+  accordingly, such as ~light~, ~semibold~, etc.  Valid symbols are defined
+  in the internal variable ~modus-themes--heading-weights~.  The absence
+  of a weight means that bold will be used by virtue of inheriting the
+  ~bold~ face.
 
-In case both ~scale-title~ and ~no-scale~ are in the list, the latter takes
-precedence.
+[[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
+
+In case both a number and ~no-scale~ are in the list, the latter takes
+precedence.  If two numbers are specified, the first one is applied.
 
 Example usage:
 
 #+begin_src emacs-lisp
 (header-block . nil)
-(header-block . (scale-title))
+(header-block . (1.5))
 (header-block . (no-scale))
-(header-block . (variable-pitch scale-title))
+(header-block . (variable-pitch 1.5))
+(header-block . (variable-pitch 1.5 semibold))
 #+end_src
 
 A ~header-date~ key covers date headings.  Dates use only a foreground
@@ -1511,12 +1503,12 @@ the following properties:
   terms of color;
 - ~bold-today~ to apply a bold typographic weight to the current
   date;
-- ~bold-all~ to render all date headings in a bold weight.
-- ~scale-heading~ increases the height of the date headings to the value
-  of ~modus-themes-scale-1~ (which is the first step in the scale for
-  regular headings).
+- ~bold-all~ to render all date headings in a bold weight;
 - ~underline-today~ applies an underline to the current date while
-  removing the background it has by default.
+  removing the background it has by default;
+- A number as a floating point (e.g. 1.2) to set the height of the text
+  to that many times the default font height.  The default is the same
+  as the base font height (the equivalent of 1.0).
 
 For example:
 
@@ -1536,12 +1528,6 @@ or sexp (phases of the moon, holidays, etc.).  By 
default all those look
 the same and have a subtle foreground color (the default is a nil value
 or an empty list).  This key accepts a list of properties.  Those are:
 
-- ~scale-small~ reduces the height of the entries to the value of
-  the user option ~modus-themes-scale-small~ (0.9 the height of
-  the main font size by default).  This work best when the
-  relevant entries have no tags associated with them and when the
-  user is interested in reducing their presence in the agenda
-  view.
 - ~accented~ applies an accent value to the event's foreground,
   replacing the original gray.  It makes all entries stand out more.
 - ~italic~ adds a slant to the font's forms (italic or oblique forms,
@@ -1608,9 +1594,12 @@ passed as a symbol.  Those are:
   being too late.  The difference between ready and clear states is
   attenuated by painting both of them using shades of green.  This
   option thus highlights the alert and overdue states.
-- ~traffic-light-deuteranopia~ is like the ~traffic-light~ except its three
-  colors are red, yellow, and blue to be suitable for users with
-  red-green color deficiency (deuteranopia).
+- When ~modus-themes-deuteranopia~ is non-nil the habit graph uses a
+  three-color style like the aforementioned ~traffic-light~ variant,
+  except that shades of blue are applied instead of green.  This is
+  suitable for users with red-green color deficiency (deuteranopia).
+
+[[#h:3ed03a48-20d8-4ce7-b214-0eb7e4c79abe][Option for red-green color 
deficiency or deuteranopia]].
 
 For example:
 
@@ -1623,17 +1612,17 @@ For example:
 Putting it all together, the alist can look like this:
 
 #+begin_src emacs-lisp
-'((header-block . (scale-title variable-pitch))
+'((header-block . (1.5 variable-pitch))
   (header-date . (grayscale workaholic bold-today))
-  (event . (accented scale-small))
+  (event . (accented varied))
   (scheduled . uniform)
   (habit . traffic-light))
 
 ;; Or else:
 (setq modus-themes-org-agenda
-      '((header-block . (scale-title variable-pitch))
+      '((header-block . (1.5 variable-pitch))
         (header-date . (grayscale workaholic bold-today))
-        (event . (accented scale-small))
+        (event . (accented varied))
         (scheduled . uniform)
         (habit . traffic-light)))
 #+end_src
@@ -1659,8 +1648,9 @@ a presentation of all available properties:
 
 #+begin_src emacs-lisp
 (setq modus-themes-headings
-      '((1 . (background overline))
-        (2 . (overline rainbow))
+      '((1 . (background overline variable-pitch 1.5))
+        (2 . (overline rainbow 1.3))
+        (3 . (overline 1.1))
         (t . (monochrome))))
 #+end_src
 
@@ -1683,7 +1673,8 @@ Properties:
   - ~heavy~
   - ~extrabold~
   - ~ultrabold~
-+ ~no-bold~
++ ~no-bold~ (deprecated alias of a ~regular~ weight)
++ A floating point as a height multiple of the default
 
 By default (a ~nil~ value for this variable), all headings have a bold
 typographic weight and use a desaturated text color.
@@ -1695,10 +1686,13 @@ An ~overline~ property draws a line above the area of 
the heading.
 A ~background~ property adds a subtle tinted color to the background of
 the heading.
 
-A ~monochrome~ property makes all headings the same base color, which is
-that of the default for the active theme (black/white).  When ~background~
-is also set, ~monochrome~ changes its color to gray.  If both ~monochrome~
-and ~rainbow~ are set, the former takes precedence.
+A ~monochrome~ property makes the heading the same as the base color,
+which is that of the ~default~ face's foreground.  When ~background~ is also
+set, ~monochrome~ changes its color to gray.  If both ~monochrome~ and
+~rainbow~ are set, the former takes precedence.
+
+A ~variable-pitch~ property changes the font family of the heading to that
+of the ~variable-pitch~ face (normally a proportionately spaced typeface).
 
 The symbol of a weight attribute adjusts the font of the heading
 accordingly, such as ~light~, ~semibold~, etc.  Valid symbols are defined in
@@ -1709,13 +1703,17 @@ users are encouraged to specify a ~regular~ weight 
instead.
 
 [[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
 
+A number, expressed as a floating point (e.g. 1.5), adjusts the height
+of the heading to that many times the base font size.  The default
+height is the same as 1.0, though it need not be explicitly stated.
+
 Combinations of any of those properties are expressed as a list, like in
 these examples:
 
 #+begin_src emacs-lisp
 (semibold)
 (rainbow background)
-(overline monochrome semibold)
+(overline monochrome semibold 1.3)
 #+end_src
 
 The order in which the properties are set is not significant.
@@ -1724,8 +1722,8 @@ In user configuration files the form may look like this:
 
 #+begin_src emacs-lisp
 (setq modus-themes-headings
-      '((1 . (background overline rainbow))
-        (2 . (background overline))
+      '((1 . (background overline rainbow 1.5))
+        (2 . (background overline 1.3))
         (t . (overline semibold))))
 #+end_src
 
@@ -1750,113 +1748,6 @@ For Org users, the extent of the heading depends on the 
variable
 ~background~ properties.  Depending on the version of Org, there may be
 others, such as ~org-fontify-done-headline~.
 
-[[#h:075eb022-37a6-41a4-a040-cc189f6bfa1f][Option for scaled headings]].
-
-[[#h:97caca76-fa13-456c-aef1-a2aa165ea274][Option for variable-pitch font in 
headings]].
-
-** Option for scaled headings
-:properties:
-:alt_title: Scaled headings
-:description: Toggle scaling of headings
-:custom_id: h:075eb022-37a6-41a4-a040-cc189f6bfa1f
-:end:
-#+vindex: modus-themes-scale-headings
-
-Brief: Toggle the scaling of headings.
-
-Symbol: ~modus-themes-scale-headings~ (=boolean= type)
-
-Possible values:
-
-1. ~nil~ (default)
-2. ~t~
-
-The default is to use the same size for headings and paragraph text.
-
-With a non-nil value (~t~) make headings larger in height relative to the
-main text.  This is noticeable in modes like Org, Markdown, and Info.
-
-*** Control the scale of headings
-:properties:
-:alt_title: Scaled heading sizes
-:description: Specify rate of increase for scaled headings
-:custom_id: h:6868baa1-beba-45ed-baa5-5fd68322ccb3
-:end:
-
-Brief: Specify the height for individual heading scales.
-
-Symbols (all are =number= type):
-
-+ ~modus-themes-scale-1~
-+ ~modus-themes-scale-2~
-+ ~modus-themes-scale-3~
-+ ~modus-themes-scale-4~
-+ ~modus-themes-scale-title~
-+ ~modus-themes-scale-small~
-
-In addition to the toggle for enabling scaled headings, users can also
-specify a number of their own.
-
-+ If it is a floating point, say, =1.5=, it is interpreted as a multiple
-  of the base font size.  This is the recommended method, because it
-  will always adapt to changes in the base font size, such as while
-  using the ~text-scale-adjust~ command.
-
-+ If it is an integer, it is read as an absolute font height that is
-  1/10 of the typographic point size.  Thus a value of =18pt= must be
-  expressed as =180=.  Setting an absolute value is discouraged, as it
-  will break the layout in cases where the base font size must change,
-  such as with the ~text-scale-adjust~ command 
([[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations]]).
-  While we discourage using absolute values, we still provide for this
-  option for users who do not need to perform text-scaling operations or
-  who are content with whatever discrepancies in height.
-
-Below are the variables in their default values, using the floating
-point paradigm.  The numbers are very conservative, but one is free to
-change them to their liking, such as =1.2=, =1.4=, =1.6=, =1.8=, =2.0=---or 
use a
-resource for finding a consistent scale:
-
-#+begin_src emacs-lisp
-(setq modus-themes-scale-1 1.05
-      modus-themes-scale-2 1.1
-      modus-themes-scale-3 1.15
-      modus-themes-scale-4 1.2
-      modus-themes-scale-title 1.3
-      modus-themes-scale-small 0.9)
-#+end_src
-
-As for the application of that scale, the variables that range from
-~modus-themes-scale-1~ up to ~modus-themes-scale-4~ apply to regular
-headings within the context of the given major mode.  The former is the
-smallest, while the latter is the largest.  "Regular headings" are those
-that have a standard syntax for their scale, such as Org mode's eight
-levels of asterisks or Markdown's six columns.
-
-Whereas ~modus-themes-scale-title~ is applied to special headings that do
-not conform with the aforementioned syntax, yet which are expected to be
-larger than the largest value on that implied scale or at least have
-some unique purpose in the buffer.  Put concretely, Org's =#+title= meta
-datum is not part of the eight levels of headings in an Org file, yet is
-supposed to signify the primary header.  Similarly, the Org Agenda's
-structure headings are not part of a recognisable scale and so they also
-get ~modus-themes-scale-title~ 
([[#h:68f481bc-5904-4725-a3e6-d7ecfa7c3dbc][Option for Org agenda constructs]]).
-
-Similarly ~modus-themes-scale-small~ is not applied to regular headings,
-but reserved for special contexts where the user is presented with an
-option to use a smaller font height than the base size.  It is only
-implemented for the Org agenda.
-
-Users who wish to maintain scaled headings for the normal syntax while
-preventing special headings from standing out, can assign a value of =1.0=
-to ~modus-themes-scale-title~ to make it the same as body text (or
-whatever value would render it indistinguishable from the desired point
-of reference).
-
-Note that in earlier versions of Org, scaling would only increase the
-size of the heading, but not of keywords that were added to it, like
-"TODO".  The issue has been fixed upstream:
-<https://protesilaos.com/codelog/2020-09-24-org-headings-adapt/>.
-
 ** Option for variable-pitch font in UI elements
 :properties:
 :alt_title: UI typeface
@@ -1887,32 +1778,6 @@ is done by assigning the ~variable-pitch~ face to the 
relevant items.
 
 [[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and 
others]].
 
-** Option for variable-pitch font in headings
-:properties:
-:alt_title: Headings' typeface
-:description: Toggle the use of variable-pitch in headings
-:custom_id: h:97caca76-fa13-456c-aef1-a2aa165ea274
-:end:
-#+vindex: modus-themes-variable-pitch-headings
-
-Brief: Toggle the use of proportionately spaced (~variable-pitch~) fonts
-in headings.
-
-Symbol: ~modus-themes-variable-pitch-headings~ (=boolean= type)
-
-Possible values:
-
-1. ~nil~ (default)
-2. ~t~
-
-The default is to use the main font family, which typically is
-monospaced.
-
-With a non-nil value (~t~) apply a proportionately spaced typeface, else
-"variable-pitch", to headings (such as in Org mode).
-
-[[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and 
others]].
-
 * Advanced customization
 :properties:
 :custom_id: h:f4651d55-8c07-46aa-b52b-bed1e53463bb
@@ -3241,6 +3106,61 @@ user.  Hence our hesitation to recommend it as part of 
the standard
 setup of the Modus themes (it is generally a good idea to understand
 what the implications are of advising a function).
 
+** Diffs with only the foreground
+:properties:
+:custom_id: h:e2aed9eb-5e1e-45ec-bbd7-bc4faeab3236
+:end:
+#+cindex: Foreground-only diffs
+
+Buffers that show differences between versions of a file or buffer, such
+as in ~diff-mode~ and ~ediff~ always use color-coded background and
+foreground combinations.
+
+[[#h:ea7ac54f-5827-49bd-b09f-62424b3b6427][Option for diff buffer looks]].
+
+User may, however, prefer a style that removes the color-coded
+backgrounds from regular changes while keeping them for word-wise (aka
+"refined") changes---backgrounds for word-wise diffs are helpful in
+context.  To make this happen, one can use the ~modus-themes-with-colors~
+macro ([[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Face specs at scale using 
the themes' palette]]):
+
+#+begin_src emacs-lisp
+(defun my-modus-themes-custom-faces ()
+  (modus-themes-with-colors
+    (custom-set-faces
+     `(modus-themes-diff-added ((,class :background unspecified :foreground 
,green))) ; OR ,blue for deuteranopia
+     `(modus-themes-diff-changed ((,class :background unspecified :foreground 
,yellow)))
+     `(modus-themes-diff-removed ((,class :background unspecified :foreground 
,red)))
+
+     `(modus-themes-diff-refine-added ((,class :background ,bg-diff-added 
:foreground ,fg-diff-added)))
+     ;; `(modus-themes-diff-refine-added ((,class :background 
,bg-diff-added-deuteran :foreground ,fg-diff-added-deuteran)))
+     `(modus-themes-diff-refine-changed ((,class :background ,bg-diff-changed 
:foreground ,fg-diff-changed)))
+     `(modus-themes-diff-refine-removed ((,class :background ,bg-diff-removed 
:foreground ,fg-diff-removed)))
+
+     `(modus-themes-diff-focus-added ((,class :background ,bg-dim :foreground 
,green))) ; OR ,blue for deuteranopia
+     `(modus-themes-diff-focus-changed ((,class :background ,bg-dim 
:foreground ,yellow)))
+     `(modus-themes-diff-focus-removed ((,class :background ,bg-dim 
:foreground ,red)))
+
+     `(modus-themes-diff-heading ((,class :background ,bg-alt :foreground 
,fg-main)))
+
+     `(diff-indicator-added ((,class :foreground ,green))) ; OR ,blue for 
deuteranopia
+     `(diff-indicator-changed ((,class :foreground ,yellow)))
+     `(diff-indicator-removed ((,class :foreground ,red)))
+
+     `(magit-diff-added ((,class :background unspecified :foreground 
,green-faint)))
+     `(magit-diff-changed ((,class :background unspecified :foreground 
,yellow-faint)))
+     `(magit-diff-removed ((,class :background unspecified :foreground 
,red-faint)))
+     `(magit-diff-context-highlight ((,class :background ,bg-dim :foreground 
,fg-dim))))))
+
+;; This is so that the changes persist when switching between
+;; `modus-operandi' and `modus-vivendi'.
+(add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces)
+#+end_src
+
+This used to be an optional style of ~modus-themes-diffs~, but has been
+removed since version =2.0.0= to ensure that the accessibility standard
+and aesthetic quality of the themes is not compromised.
+
 * Face coverage
 :properties:
 :custom_id: h:a9c8f29d-7f72-4b54-b74b-ddefe15d6a19
@@ -3264,14 +3184,12 @@ affected face groups.  The items with an appended 
asterisk =*= tend to
 have lots of extensions, so the "full support" may not be 100% true…
 
 + ace-window
-+ ag
 + alert
 + all-the-icons
 + annotate
 + ansi-color
 + anzu
 + apropos
-+ apt-sources-list
 + artbollocks-mode
 + auctex and TeX
 + auto-dim-other-buffers
@@ -3284,7 +3202,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + boon
 + bookmark
 + breakpoint (provided by the built-in {{{file(gdb-mi.el)}}} library)
-+ buffer-expose
 + calendar and diary
 + calfw
 + centaur-tabs
@@ -3302,7 +3219,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + corfu
 + counsel*
 + counsel-css
-+ counsel-org-capture-string
 + cov
 + cperl-mode
 + css-mode
@@ -3314,7 +3230,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + dashboard (emacs-dashboard)
 + deadgrep
 + debbugs
-+ define-word
 + deft
 + dictionary
 + diff-hl
@@ -3327,15 +3242,12 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + dired-git-info
 + dired-narrow
 + dired-subtree
-+ diredc
 + diredfl
 + diredp (dired+)
-+ disk-usage
 + display-fill-column-indicator-mode
 + doom-modeline
 + dynamic-ruler
 + easy-jekyll
-+ easy-kill
 + ebdb
 + ediff
 + eglot
@@ -3371,7 +3283,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + flycheck-posframe
 + flymake
 + flyspell
-+ flyspell-correct
 + flx
 + freeze-it
 + frog-menu
@@ -3383,10 +3294,8 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + geiser
 + git-commit
 + git-gutter (and variants)
-+ git-lens
 + git-rebase
 + git-timemachine
-+ git-walktree
 + gnus
 + gotest
 + golden-ratio-scroll-screen
@@ -3395,21 +3304,15 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + helm-switch-shell
 + helm-xref
 + helpful
-+ highlight-blocks
-+ highlight-defined
-+ highlight-escape-sequences (~hes-mode~)
 + highlight-indentation
 + highlight-numbers
 + highlight-parentheses ([[#h:24bab397-dcb2-421d-aa6e-ec5bd622b913][Note on 
highlight-parentheses.el]])
-+ highlight-symbol
-+ highlight-tail
 + highlight-thing
 + hl-defined
 + hl-fill-column
 + hl-line-mode
 + hl-todo
 + hydra
-+ hyperlist
 + ibuffer
 + icomplete
 + icomplete-vertical
@@ -3424,7 +3327,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + interaction-log
 + ioccur
 + isearch, occur, etc.
-+ isl (isearch-light)
 + ivy*
 + ivy-posframe
 + jira (org-jira)
@@ -3448,7 +3350,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + markup-faces (~adoc-mode~)
 + mentor
 + messages
-+ minibuffer-line
 + minimap
 + mmm-mode
 + mode-line
@@ -3456,15 +3357,12 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + moody
 + mpdel
 + mu4e
-+ mu4e-conversation
 + multiple-cursors
 + nano-modeline
 + neotree
-+ no-emoji
 + notmuch
 + num3-mode
 + nxml-mode
-+ objed
 + orderless
 + org*
 + org-journal
@@ -3484,14 +3382,11 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + pandoc-mode
 + paradox
 + paren-face
-+ parrot
 + pass
 + pdf-tools
 + persp-mode
 + perspective
 + phi-grep
-+ phi-search
-+ pkgbuild-mode
 + pomidor
 + popup
 + powerline
@@ -3503,7 +3398,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + quick-peek
 + racket-mode
 + rainbow-blocks
-+ rainbow-identifiers
 + rainbow-delimiters
 + rcirc
 + recursion-indicator
@@ -3512,7 +3406,6 @@ have lots of extensions, so the "full support" may not be 
100% true…
 + ripgrep
 + rmail
 + ruler-mode
-+ sallet
 + selectrum
 + selectrum-prescient
 + semantic
@@ -3530,13 +3423,10 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + solaire
 + spaceline
 + speedbar
-+ spell-fu
-+ spray
 + stripes
 + suggest
 + switch-window
 + swiper
-+ swoop
 + sx
 + symbol-overlay
 + syslog-mode
@@ -3558,13 +3448,11 @@ have lots of extensions, so the "full support" may not 
be 100% true…
 + undo-tree
 + vc (vc-dir.el, vc-hooks.el)
 + vc-annotate (the output of {{{kbd(C-x v g)}}})
-+ vdiff
 + vertico
 + vertico-quick
 + vimish-fold
 + visible-mark
 + visual-regexp
-+ volatile-highlights
 + vterm
 + wcheck-mode
 + web-mode
@@ -3596,20 +3484,36 @@ These do not require any extra styles because they are 
configured to
 inherit from some basic faces or their dependencies which are directly
 supported by the themes.
 
++ ag
++ apt-sources-list
++ buffer-expose
 + bufler
 + counsel-notmuch
++ counsel-org-capture-string
++ define-word
++ disk-usage
++ easy-kill
 + edit-indirect
 + evil-owl
++ flyspell-correct
 + fortran-mode
++ git-walktree
 + goggles
++ highlight-defined
++ highlight-escape-sequences (~hes-mode~)
 + i3wm-config-mode
++ minibuffer-line
++ no-emoji
++ parrot
 + perl-mode
 + php-mode
 + rjsx-mode
 + side-hustle
++ spell-fu
 + swift-mode
 + tab-bar-echo-area
 + tide
++ vdiff
 + vertico-indexed
 + vertico-mouse
 
@@ -4072,11 +3976,11 @@ examples with the 4, 8, 16 colors):
 :custom_id: h:4da1d515-3e05-47ef-9e45-8251fc7e986a
 :end:
 
-The ~god-mode~ library does not provide faces that could be configured
-by the Modus themes.  Users who would like to get some visual feedback
-on the status of {{{kbd(M-x god-mode)}}} are instead encouraged by upstream
-to set up their own configurations, such as by changing the ~mode-line~
-face ([[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]]).  
This is an adaptation of the approach
+The ~god-mode~ library does not provide faces that could be configured by
+the Modus themes.  Users who would like to get some visual feedback on
+the status of {{{kbd(M-x god-mode)}}} are instead encouraged by upstream to
+set up their own configurations, such as by changing the ~mode-line~ face
+([[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]]).  This 
is an adaptation of the approach
 followed in the upstream README:
 
 #+begin_src emacs-lisp
@@ -4289,7 +4193,7 @@ you've customized any faces.
 :properties:
 :custom_id: h:b3384767-30d3-4484-ba7f-081729f03a47
 :end:
-#+cindex: Frequently Asked Questions (FAQ)
+#+cindex: Frequently Asked Questions
 
 In this section we provide answers related to some aspects of the Modus
 themes' design and application.
@@ -4620,11 +4524,12 @@ The Modus themes are a collective effort.  Every bit of 
work matters.
 + Author/maintainer :: Protesilaos Stavrou.
 
 + Contributions to code or documentation :: Anders Johansson, Basil
-  L.{{{space()}}} Contovounesios, Carlo Zancanaro, Christian Tietze, Daniel
-  Mendler, Eli Zaretskii, Fritz Grabo, Kévin Le Gouguec, Kostadin Ninev,
-  Madhavan Krishnan, Markus Beppler, Matthew Stevenson, Mauro Aranda,
-  Nicolas De Jaeghere, Philip Kaludercic, Rudolf Adamkovič, Stephen
-  Gildea, Shreyas Ragavan, Stefan Kangas, Vincent Murphy, Xinglu Chen.
+  L.{{{space()}}} Contovounesios, Björn Lindström, Carlo Zancanaro, Christian
+  Tietze, Daniel Mendler, Eli Zaretskii, Fritz Grabo, Illia Ostapyshyn,
+  Kévin Le Gouguec, Kostadin Ninev, Madhavan Krishnan, Markus Beppler,
+  Matthew Stevenson, Mauro Aranda, Nicolas De Jaeghere, Philip
+  Kaludercic, Rudolf Adamkovič, Stephen Gildea, Shreyas Ragavan, Stefan
+  Kangas, Vincent Murphy, Xinglu Chen.
 
 + Ideas and user feedback :: Aaron Jensen, Adam Porter, Adam Spiers,
   Adrian Manea, Alex Griffin, Alex Peitsinis, Alexey Shmalko, Alok
diff --git a/doc/misc/newsticker.texi b/doc/misc/newsticker.texi
index 5d052cc27d..92dba55c01 100644
--- a/doc/misc/newsticker.texi
+++ b/doc/misc/newsticker.texi
@@ -15,7 +15,7 @@ This manual documents Newsticker, a feed reader for Emacs.  It
 corresponds to Emacs version @value{EMACSVER}.
 
 @noindent
-Copyright @copyright{} 2004--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/nxml-mode.texi b/doc/misc/nxml-mode.texi
index 4ca223d46c..206da82335 100644
--- a/doc/misc/nxml-mode.texi
+++ b/doc/misc/nxml-mode.texi
@@ -9,7 +9,7 @@
 This manual documents nXML mode, an Emacs major mode for editing
 XML with RELAX NG support.
 
-Copyright @copyright{} 2007--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/octave-mode.texi b/doc/misc/octave-mode.texi
index e330606015..31d64c3d84 100644
--- a/doc/misc/octave-mode.texi
+++ b/doc/misc/octave-mode.texi
@@ -6,7 +6,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1996--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1996--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -240,7 +240,7 @@ entering Octave commands at the prompt.  The buffer is in 
Inferior
 Octave mode, which is derived from the standard Comint mode, a major
 mode for interacting with an inferior interpreter.  See the
 documentation for @code{comint-mode} for more details, and use
-@kbd{C-h b} to find out about available special keybindings.
+@kbd{C-h b} to find out about available special key bindings.
 
 You can also communicate with an inferior Octave process from within
 files with Octave code (i.e., buffers in Octave mode), using the
diff --git a/doc/misc/org-setup.org b/doc/misc/org-setup.org
index d0392f10a2..88474538e5 100644
--- a/doc/misc/org-setup.org
+++ b/doc/misc/org-setup.org
@@ -1,6 +1,6 @@
 # SETUPFILE for Org manual
 
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/doc/misc/org.org b/doc/misc/org.org
index adf24da1c3..60af81ea2c 100644
--- a/doc/misc/org.org
+++ b/doc/misc/org.org
@@ -21601,7 +21601,7 @@ that are mentioned in the manual.  For a more complete 
list, use
 
 This manual is for Org version {{{version}}}.
 
-Copyright \copy 2004--2021 Free Software Foundation, Inc.
+Copyright \copy 2004--2022 Free Software Foundation, Inc.
 
 #+begin_quote
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/pcl-cvs.texi b/doc/misc/pcl-cvs.texi
index 833326c089..80c130fb8e 100644
--- a/doc/misc/pcl-cvs.texi
+++ b/doc/misc/pcl-cvs.texi
@@ -7,7 +7,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1991--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1991--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/pgg.texi b/doc/misc/pgg.texi
index e796da6da3..304c9c8ec8 100644
--- a/doc/misc/pgg.texi
+++ b/doc/misc/pgg.texi
@@ -10,7 +10,7 @@
 This file describes PGG @value{VERSION}, an Emacs interface to various
 PGP implementations.
 
-Copyright @copyright{} 2001, 2003--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2001, 2003--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi
index f03f614275..f13ecc7d28 100644
--- a/doc/misc/rcirc.texi
+++ b/doc/misc/rcirc.texi
@@ -6,7 +6,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2006--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2006--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi
index 8bde241e18..c3b7b0b0f6 100644
--- a/doc/misc/reftex.texi
+++ b/doc/misc/reftex.texi
@@ -46,7 +46,7 @@ This manual documents @RefTeX{} (version @value{VERSION}), a 
package
 to do labels, references, citations and indices for LaTeX documents
 with Emacs.
 
-Copyright @copyright{} 1997--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1997--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/remember.texi b/doc/misc/remember.texi
index 91e67a8798..9d1fe545d4 100644
--- a/doc/misc/remember.texi
+++ b/doc/misc/remember.texi
@@ -10,7 +10,7 @@
 @copying
 This manual is for Remember Mode, as distributed with Emacs @value{EMACSVER}.
 
-Copyright @copyright{} 2001, 2004--2005, 2007--2021 Free Software
+Copyright @copyright{} 2001, 2004--2005, 2007--2022 Free Software
 Foundation, Inc.
 
 @quotation
@@ -313,7 +313,7 @@ Save (if it is modified) and bury the current buffer.
 @node Keystrokes
 @chapter Keystroke Reference
 
-@file{remember.el} defines the following keybindings by default:
+@file{remember.el} defines the following key bindings by default:
 
 @table @kbd
 
diff --git a/doc/misc/sasl.texi b/doc/misc/sasl.texi
index 847ad5ed76..4ead5a5563 100644
--- a/doc/misc/sasl.texi
+++ b/doc/misc/sasl.texi
@@ -9,7 +9,7 @@
 @copying
 This file describes the Emacs SASL library, version @value{VERSION}.
 
-Copyright @copyright{} 2000, 2004--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2004--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi
index 3f5b5917a0..3f6dcd022a 100644
--- a/doc/misc/sc.texi
+++ b/doc/misc/sc.texi
@@ -15,7 +15,7 @@
 This document describes Supercite, an Emacs package for citing and
 attributing replies to mail and news messages.
 
-Copyright @copyright{} 1993, 2001--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, 2001--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi
index 70a19484e8..3141ab7c69 100644
--- a/doc/misc/sem-user.texi
+++ b/doc/misc/sem-user.texi
@@ -1,5 +1,5 @@
 @c This is part of the Semantic manual.
-@c Copyright (C) 1999--2005, 2007, 2009--2021 Free Software Foundation,
+@c Copyright (C) 1999--2005, 2007, 2009--2022 Free Software Foundation,
 @c Inc.
 @c See file semantic.texi for copying conditions.
 
@@ -145,7 +145,7 @@ this means moving to the parent of the current tag.
 @item C-c , @key{SPC}
 Display a list of possible completions for the symbol at point
 (@code{semantic-complete-analyze-inline}).  This also activates a
-special set of keybindings for choosing a completion: @key{RET}
+special set of key bindings for choosing a completion: @key{RET}
 accepts the current completion, @kbd{M-n} and @kbd{M-p} cycle through
 possible completions, @key{TAB} completes as far as possible and then
 cycles, and @kbd{C-g} or any other key aborts the completion.
@@ -655,7 +655,7 @@ usual summary if the text at point has one of these faces.
 
 Semantic Idle Completions mode is a minor mode for performing
 @dfn{code completions} during idle time.  The completions are
-displayed inline, with keybindings that allow you to cycle through
+displayed inline, with key bindings that allow you to cycle through
 different alternatives.
 
 Semantic Idle Completions mode performs completion based on the
@@ -681,7 +681,7 @@ besselj [1 of 6 matches]
 @end example
 
 @noindent
-While the completion is being displayed, the following keybindings
+While the completion is being displayed, the following key bindings
 take effect:
 
 @table @kbd
@@ -785,7 +785,7 @@ Most of the other commands documented in this section call
 This command is bound to @kbd{C-c , @key{SPC}} when Semantic mode is
 enabled (@pxref{Semantic mode user commands}).  It displays a list of
 possible completions for the symbol at point, and activates a special
-set of keybindings for choosing a completion.
+set of key bindings for choosing a completion.
 
 You can type @key{RET} to accept the current completion, @kbd{M-n} and
 @kbd{M-p} to cycle through the possible completions, @key{TAB} to
@@ -1122,7 +1122,7 @@ that @code{grep} is much slower than the others.
 
 The commands to display symbol references are @kbd{C-c , g}
 (@code{semantic-symref-symbol} and @kbd{C-c , G}
-(@code{semantic-symref}).  These keybindings are available whenever
+(@code{semantic-symref}).  These key bindings are available whenever
 Semantic mode is enabled (@pxref{Semantic mode user commands}).
 
 @deffn Command semantic-symref-symbol sym
diff --git a/doc/misc/semantic.texi b/doc/misc/semantic.texi
index 3c4f2f0c0e..eb5c7e0e67 100644
--- a/doc/misc/semantic.texi
+++ b/doc/misc/semantic.texi
@@ -25,7 +25,7 @@
 @copying
 This manual documents the Semantic library and utilities.
 
-Copyright @copyright{} 1999--2005, 2007, 2009--2021 Free Software
+Copyright @copyright{} 1999--2005, 2007, 2009--2022 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi
index b529f0b836..0acb7bf3f1 100644
--- a/doc/misc/ses.texi
+++ b/doc/misc/ses.texi
@@ -12,7 +12,7 @@
 @copying
 This file documents @acronym{SES}: the Simple Emacs Spreadsheet.
 
-Copyright @copyright{} 2002--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2002--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/sieve.texi b/doc/misc/sieve.texi
index c30409fc32..df03dd0144 100644
--- a/doc/misc/sieve.texi
+++ b/doc/misc/sieve.texi
@@ -10,7 +10,7 @@
 @copying
 This file documents the Emacs Sieve package, for server-side mail filtering.
 
-Copyright @copyright{} 2001--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2001--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi
index f5d567533b..2e0381138f 100644
--- a/doc/misc/smtpmail.texi
+++ b/doc/misc/smtpmail.texi
@@ -4,7 +4,7 @@
 @include docstyle.texi
 @syncodeindex vr fn
 @copying
-Copyright @copyright{} 2003--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2003--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi
index 70d4b05416..13b709bfc8 100644
--- a/doc/misc/speedbar.texi
+++ b/doc/misc/speedbar.texi
@@ -5,7 +5,7 @@
 @syncodeindex fn cp
 
 @copying
-Copyright @copyright{} 1999--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -1218,4 +1218,3 @@ Two good values are @code{nil} and @code{statictag}.
 
 @bye
 @c  LocalWords:  speedbar's xref slowbar kbd subsubsection
-@c  LocalWords:  keybindings
diff --git a/doc/misc/srecode.texi b/doc/misc/srecode.texi
index 1f7473c151..a0cbf7e33f 100644
--- a/doc/misc/srecode.texi
+++ b/doc/misc/srecode.texi
@@ -16,7 +16,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2007--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -293,14 +293,14 @@ If the variable @code{srecode-takeover-INS-key} is set, 
then the key
 The most important key is bound to @code{srecode-insert} which is
 @kbd{C-c / /}, or @kbd{@key{INSERT} @key{INSERT}}.  @ref{Quick Start}.
 
-Major keybindings are:
+Major key bindings are:
 
 @table @kbd
 @item C-c / /
 Insert a template whose name is typed into the minibuffer.
 @item C-c / <lower case letter>
 Reserved for direct binding of simple templates to keys using a
-keybinding command in the template file.
+key binding command in the template file.
 @item C-c / <upper case letter>
 Reserved for template applications (Such as comment or get/set inserter.)
 @item C-c / E
@@ -1070,9 +1070,9 @@ Here is an example of wrapping a semantic tag in a 
compound value:
   "Wrap up a collection of semantic tag information.
 This class will be used to derive dictionary values.")
 
-(defmethod srecode-compound-toString((cp srecode-semantic-tag)
-                                     function
-                                     dictionary)
+(cl-defmethod srecode-compound-toString ((cp srecode-semantic-tag)
+                                         function
+                                         dictionary)
   "Convert the compound dictionary value CP to a string.
 If FUNCTION is non-nil, then FUNCTION is somehow applied to an
 aspect of the compound value."
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index e48383defc..58b6abee78 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2021-04-25.21}
+\def\texinfoversion{2022-01-02.12}
 %
 % Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc.
 %
@@ -3193,14 +3193,9 @@ end
 %    \kern-0.4pt\hrule}%
 %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
 
-% definition of @key with no lozenge.  If the current font is already
-% monospace, don't change it; that way, we respect @kbdinputstyle.  But
-% if it isn't monospace, then use \tt.
+% definition of @key with no lozenge.
 %
-\def\key#1{{\setregularquotes
-  \nohyphenation
-  \ifmonospace\else\tt\fi
-  #1}\null}
+\def\key#1{{\setregularquotes \nohyphenation \tt #1}\null}
 
 % @clicksequence{File @click{} Open ...}
 \def\clicksequence#1{\begingroup #1\endgroup}
@@ -3614,6 +3609,9 @@ $$%
 \def\quotedblbase{{\ecfont \char"12}}
 \def\quotesinglbase{{\ecfont \char"0D}}
 %
+\def\L{{\ecfont \char"8A}} % L with stroke
+\def\l{{\ecfont \char"AA}} % l with stroke
+%
 % This positioning is not perfect (see the ogonek LaTeX package), but
 % we have the precomposed glyphs for the most common cases.  We put the
 % tests to use those glyphs in the single \ogonek macro so we have fewer
@@ -7592,6 +7590,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 %
 \def\printdefunline#1#2{%
   \begingroup
+    \plainfrenchspacing
     % call \deffnheader:
     #1#2 \endheader
     % common ending:
@@ -9402,7 +9401,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \fi\fi
   %
   \ifimagevmode
-    \nobreak\medskip
+    \medskip
     % Usually we'll have text after the image which will insert
     % \parskip glue, so insert it here too to equalize the space
     % above and below.
@@ -11244,23 +11243,6 @@ directory should work if nowhere else does.}
   \defbodyindent = .5cm
 }}
 
-% Use @smallerbook to reset parameters for 6x9 trim size.
-% (Just testing, parameters still in flux.)
-\def\smallerbook{{\globaldefs = 1
-  \parskip = 1.5pt plus 1pt
-  \textleading = 12pt
-  %
-  \internalpagesizes{7.4in}{4.8in}%
-                    {-.2in}{-.4in}%
-                    {0pt}{14pt}%
-                    {9in}{6in}%
-  %
-  \lispnarrowing = 0.25in
-  \tolerance = 700
-  \contentsrightmargin = 0pt
-  \defbodyindent = .4cm
-}}
-
 % Use @afourpaper to print on European A4 paper.
 \def\afourpaper{{\globaldefs = 1
   \parskip = 3pt plus 2pt minus 1pt
@@ -11599,11 +11581,9 @@ directory should work if nowhere else does.}
 @setregularquotes
 
 @c Local variables:
-@c eval: (add-hook 'before-save-hook 'time-stamp)
+@c eval: (add-hook 'before-save-hook 'time-stamp nil t)
+@c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
 @c page-delimiter: "^\\\\message\\|emacs-page"
-@c time-stamp-start: "def\\\\texinfoversion{"
-@c time-stamp-format: "%:y-%02m-%02d.%02H"
-@c time-stamp-end: "}"
 @c End:
 
 @c vim:sw=2:
diff --git a/doc/misc/todo-mode.texi b/doc/misc/todo-mode.texi
index b3ea652a7e..85603cf593 100644
--- a/doc/misc/todo-mode.texi
+++ b/doc/misc/todo-mode.texi
@@ -9,7 +9,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2013--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2013--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 86f4d1c38e..3c15955860 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -12,7 +12,7 @@
 @footnotestyle end
 
 @copying
-Copyright @copyright{} 1999--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index 89c478035c..9e1be52cd3 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -2,7 +2,7 @@
 @c texi/trampver.texi.  Generated from trampver.texi.in by configure.
 
 @c This is part of the Emacs manual.
-@c Copyright (C) 2003--2021 Free Software Foundation, Inc.
+@c Copyright (C) 2003--2022 Free Software Foundation, Inc.
 @c See file doclicense.texi for copying conditions.
 
 @c In the Tramp GIT, the version numbers are auto-frobbed from
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 90e38e5d30..a9d06d7f5b 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -21,7 +21,7 @@
 @copying
 This is the manual for the @code{url} Emacs Lisp library.
 
-Copyright @copyright{} 1993--1999, 2002, 2004--2021 Free Software
+Copyright @copyright{} 1993--1999, 2002, 2004--2022 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/vhdl-mode.texi b/doc/misc/vhdl-mode.texi
index 7022582db5..7d451c71bd 100644
--- a/doc/misc/vhdl-mode.texi
+++ b/doc/misc/vhdl-mode.texi
@@ -10,7 +10,7 @@
 @copying
 This file documents VHDL Mode, an Emacs mode for editing VHDL code.
 
-Copyright @copyright{} 1995--2008, 2010, 2012, 2015--2021 Free Software
+Copyright @copyright{} 1995--2008, 2010, 2012, 2015--2022 Free Software
 Foundation, Inc.
 
 @quotation
@@ -928,7 +928,7 @@ If you want to customize indentation, here you go:
   (setq tab-width 8
         ;; this will make sure spaces are used instead of tabs
         indent-tabs-mode nil)
-  ;; keybindings for VHDL are put in vhdl-mode-map
+  ;; key bindings for VHDL are put in vhdl-mode-map
   (define-key vhdl-mode-map "\C-m" 'newline-and-indent)
   )
 
diff --git a/doc/misc/vip.texi b/doc/misc/vip.texi
index 92c76ad251..df65d70cb1 100644
--- a/doc/misc/vip.texi
+++ b/doc/misc/vip.texi
@@ -4,7 +4,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 1987, 2001--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 1987, 2001--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi
index e127f62bb5..b0deb31d10 100644
--- a/doc/misc/viper.texi
+++ b/doc/misc/viper.texi
@@ -8,7 +8,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 1995--1997, 2001--2021 Free Software Foundation,
+Copyright @copyright{} 1995--1997, 2001--2022 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi
index 7fd9212d71..c84b49a038 100644
--- a/doc/misc/widget.texi
+++ b/doc/misc/widget.texi
@@ -9,7 +9,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2000--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2000--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/wisent.texi b/doc/misc/wisent.texi
index c0bb7b10a4..07240e5dd3 100644
--- a/doc/misc/wisent.texi
+++ b/doc/misc/wisent.texi
@@ -24,7 +24,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1988--1993, 1995, 1998--2004, 2007, 2012--2021
+Copyright @copyright{} 1988--1993, 1995, 1998--2004, 2007, 2012--2022
 Free Software Foundation, Inc.
 
 @c Since we are both GNU manuals, we do not need to ack each other here.
diff --git a/doc/misc/woman.texi b/doc/misc/woman.texi
index 33b3a33f0f..d300cd3a3d 100644
--- a/doc/misc/woman.texi
+++ b/doc/misc/woman.texi
@@ -15,7 +15,7 @@
 This file documents WoMan: A program to browse Unix manual pages ``W.O.
 (without) man''.
 
-Copyright @copyright{} 2001--2021 Free Software Foundation, Inc.
+Copyright @copyright{} 2001--2022 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/etc/CALC-NEWS b/etc/CALC-NEWS
index da9ed66f15..217e16c108 100644
--- a/etc/CALC-NEWS
+++ b/etc/CALC-NEWS
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Calc is an advanced desk calculator for GNU Emacs.
diff --git a/etc/ChangeLog.1 b/etc/ChangeLog.1
index 629ab0b1fd..32ae5cf3bc 100644
--- a/etc/ChangeLog.1
+++ b/etc/ChangeLog.1
@@ -6891,7 +6891,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/etc/DEBUG b/etc/DEBUG
index a05aeef160..dd33b42f19 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -1,6 +1,6 @@
 Debugging GNU Emacs
 
-Copyright (C) 1985, 2000-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 2000-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 ** Preliminaries
diff --git a/etc/DISTRIB b/etc/DISTRIB
index 3dd1bf3d98..a60d140aa6 100644
--- a/etc/DISTRIB
+++ b/etc/DISTRIB
@@ -1,7 +1,7 @@
                                                -*- text -*-
             GNU Emacs availability information
 
-Copyright (C) 1986-1993, 1995, 1998, 2000-2021 Free Software Foundation,
+Copyright (C) 1986-1993, 1995, 1998, 2000-2022 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index 31ea3de620..bdcd943c37 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -1,6 +1,6 @@
 ERC NEWS                                                       -*- outline -*-
 
-Copyright (C) 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 2006-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send ERC bug reports to 'bug-gnu-emacs@gnu.org',
diff --git a/etc/ETAGS.EBNF b/etc/ETAGS.EBNF
index c72ac6f721..ac89e7436a 100644
--- a/etc/ETAGS.EBNF
+++ b/etc/ETAGS.EBNF
@@ -94,7 +94,7 @@ those.
 
 ===================== end of discussion of tag names =====================
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/ETAGS.README b/etc/ETAGS.README
index 3c56021524..af1bf10566 100644
--- a/etc/ETAGS.README
+++ b/etc/ETAGS.README
@@ -28,7 +28,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2021 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2022 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
diff --git a/etc/HELLO b/etc/HELLO
index 8bd489fb40..5b2002ff93 100644
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -96,7 +96,7 @@ Vietnamese (tiếng Việt)       Chào bạn
 
 
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 
 This file is part of GNU Emacs.
diff --git a/etc/MACHINES b/etc/MACHINES
index d883f1abd6..dcdef0c557 100644
--- a/etc/MACHINES
+++ b/etc/MACHINES
@@ -1,6 +1,6 @@
 Emacs machines list
 
-Copyright (C) 1989-1990, 1992-1993, 1998, 2001-2021 Free Software
+Copyright (C) 1989-1990, 1992-1993, 1998, 2001-2022 Free Software
 Foundation, Inc.
 See the end of the file for license conditions.
 
diff --git a/etc/MH-E-NEWS b/etc/MH-E-NEWS
index 29c48c7214..9bcfc40af2 100644
--- a/etc/MH-E-NEWS
+++ b/etc/MH-E-NEWS
@@ -1,6 +1,6 @@
 * COPYRIGHT
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 * Changes in MH-E 8.6
diff --git a/etc/NEWS b/etc/NEWS
index 807751ae12..9c892b285d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2021 Free Software Foundation, Inc.
+Copyright (C) 2021-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'.
@@ -64,6 +64,18 @@ this support.
 The named feature 'xinput2' can be used to test for the presence of
 XInput 2 support from Lisp programs.
 
+** Emacs now supports being built with pure GTK.
+To use this option, make sure the GTK 3 and Cairo development files
+are installed, and configure Emacs with the option '--with-pgtk'.
+Unlike the default X and GTK build, the resulting Emacs binary will
+work on any underlying window system supported by GDK, such as
+Wayland and Broadway.
+
+---
+** The docstrings of preloaded files are not in 'etc/DOC' any more.
+Instead, they're fetched as needed from the corresponding '.elc' file,
+as was already the case for all the non-preloaded files.
+
 
 * Startup Changes in Emacs 29.1
 
@@ -81,17 +93,16 @@ time.
 * Incompatible changes in Emacs 29.1
 
 ---
-** 'C-x 8 .' has been moved to 'C-x 8 . .'.
-This is to open up the 'C-x 8 .' map to bind further characters there.
+** Support for old EIEIO functions is not autoloaded any more.
+You need an explicit (require 'eieio-compat) to use 'defmethod'
+and 'defgeneric' (which have been made obsolete in Emacs-25 with
+'cl-defmethod' and 'cl-defgeneric').
+Similarly you might need to (require 'eieio-compat) before loading
+files that were compiled with an old EIEIO (Emacs<25).
 
 ---
-** The mode line now uses a proportional font by default.
-To get the old monospaced mode line back, customize the
-'mode-line-active' and 'mode-line-inactive' faces not to inherit from
-the 'variable-pitch' face, or add this to your "~/.emacs":
-
-    (set-face-attribute 'mode-line-active nil :inherit 'mode-line)
-    (set-face-attribute 'mode-line-inactive nil :inherit 'mode-line)
+** 'C-x 8 .' has been moved to 'C-x 8 . .'.
+This is to open up the 'C-x 8 .' map to bind further characters there.
 
 
 * Changes in Emacs 29.1
@@ -163,6 +174,15 @@ the previous definition to be discarded, which was 
probably not
 intended when this occurs in batch mode.  To remedy the error, rename
 tests so that they all have unique names.
 
++++
+*** ERT can generate JUnit test reports.
+When environment variable 'EMACS_TEST_JUNIT_REPORT' is set, ERT
+generates a JUnit test report under this file name.  This is useful
+for Emacs integration into CI/CD test environments.
+
+*** Unbound test symbols now signal an 'ert-test-unbound' error.
+This affects the 'ert-select-tests' function and its callers.
+
 ** Emoji
 
 +++
@@ -244,6 +264,11 @@ height use 'window-height' in combination with 
'body-lines'.
 ---
 *** 'C-x t RET' creates a new tab when the provided tab name doesn't exist.
 
+---
+*** New keymap 'tab-bar-history-mode-map'.
+By default, it contains 'C-c <left>' and 'C-c <right>' to browse
+the history of tab window configurations back and forward.
+
 ** Better detection of text suspiciously reordered on display.
 The function 'bidi-find-overridden-directionality' has been extended
 to detect reordering effects produced by embeddings and isolates
@@ -289,7 +314,7 @@ This command increases (or decreases) the number of empty 
lines before
 point.
 
 ---
-*** Improved mouse behavior with auto-scrolling modes.
+** Improved mouse behavior with auto-scrolling modes.
 When clicking inside the 'scroll-margin' or 'hscroll-margin' region
 the point is now moved only when releasing the mouse button.  This no
 longer results in a bogus selection, unless the mouse has been
@@ -303,6 +328,8 @@ effectively dragged.
 Customize this option to limit the number of entries in the menu
 "Edit->Paste from Kill Menu".  The default is 60.
 
+** Performing a pinch gesture on a touchpad now increases the text scale.
+
 ** show-paren-mode
 
 +++
@@ -331,6 +358,23 @@ received.
 
 * Changes in Specialized Modes and Packages in Emacs 29.1
 
+** Minibuffer and Completions
+
+*** The *Completions* buffer can now be automatically selected.
+To enable this behavior, customize the option 'completion-auto-select'
+to t.  Then pressing TAB will switch to the *Completions* buffer when
+it pops up that buffer.
+
+*** New user option 'completion-wrap-movement'.
+When non-nil, the commands 'next-completion' and 'previous-completion'
+automatically wrap around on reaching the beginning or the end of
+the *Completions* buffer.
+
+** Isearch and Replace
+
++++
+*** New user option 'char-fold-override' disables default character 
equivalences.
+
 ** New minor mode 'glyphless-display-mode'.
 This allows an easy way to toggle seeing all glyphless characters in
 the current buffer.
@@ -379,6 +423,11 @@ If non-nil, 'C-c C-a' will put attached files at the end 
of the message.
 ---
 *** Message Mode now supports image yanking.
 
+---
+*** New user option 'message-server-alist'.
+This controls automatic insertion of the "X-Message-SMTP-Method"
+header before sending a message.
+
 ** HTML Mode
 
 ---
@@ -392,6 +441,11 @@ It narrows to the current node.
 
 ** eww/shr
 
++++
+*** New user option 'shr-allowed-images'.
+This complements 'shr-blocked-images', but allows specifying just the
+allowed images.
+
 +++
 *** New user option 'shr-use-xwidgets-for-media'.
 If non-nil (and Emacs has been built with support for xwidgets),
@@ -826,9 +880,26 @@ This change is now applied in 'dired-insert-directory'.
 'unify-8859-on-decoding-mode', 'unify-8859-on-encoding-mode',
 'vc-arch-command'.
 
++++
+** Base64 encoding no longer tolerates latin-1 input.
+The functions 'base64-encode-string', 'base64url-encode-string',
+'base64-encode-region' and 'base64url-encode-region' no longer accept
+characters in the range U+0080..U+00FF as substitutes for single bytes
+in the range 128..255, but signal an error for all multibyte characters.
+The input must be encoded text.
+
 
 * Lisp Changes in Emacs 29.1
 
++++
+** New variable 'lisp-directory' holds the directory of Emacs's own Lisp files.
+
++++
+** New facility for handling session state: 'multisession-value'.
+This can be used as a convenient way to store (simple) application
+state, and 'M-x list-multisession-values' allows users to list
+(and edit) this data.
+
 +++
 ** New function 'get-display-property'.
 This is like 'get-text-property', but works on the 'display' text
@@ -848,6 +919,12 @@ This allows setting a minimum display width for a region 
of text.
 This event is sent whenever the user's finger moves off the mouse
 wheel on some mice, or when the user's finger moves off the touchpad.
 
++++
+** New event type 'pinch'.
+This event is sent when a user peforms a pinch gesture on a touchpad,
+which is comprised of placing two fingers on the touchpad and moving
+them towards or away from each other.
+
 ** Keymaps and key definitions
 
 +++
@@ -892,6 +969,10 @@ If non-nil, remove the definition from the keymap.  This 
is subtly
 different from setting a definition to nil (when the keymap has a
 parent).
 
++++
+*** 'read-multiple-choice' now takes an optional SHOW-HELP argument.
+If non-nil, show the help buffer immediately, before any user input.
+
 +++
 *** New function 'key-valid-p'.
 The 'kbd' function is quite permissive, and will try to return
@@ -904,6 +985,11 @@ syntax.
 This is like 'kbd', but only returns vectors instead of a mix of
 vectors and strings.
 
++++
+*** New ':type' for 'defcustom' for keys.
+The new 'key' type can be used for options that should be a valid key
+according to 'key-valid-p'.  The type 'key-sequence' is now obsolete.
+
 +++
 ** New substitution in docstrings and 'substitute-command-keys'.
 Use \\`KEYSEQ' to insert a literal key sequence "KEYSEQ" (for example
@@ -968,6 +1054,17 @@ when they have changed.
 This can be used to check whether a specific font has a glyph for a
 character.
 
++++
+** 'window-text-pixel-size' now accepts a new argument 'ignore-line-at-end'.
+This controls whether or not the last screen line of the text being
+measured will be counted for the purpose of calculating the text
+dimensions.
+
++++
+** 'window-text-pixel-size' understands a new meaning of 'from'.
+Specifying a cons as the from argument allows to start measuring text
+from a specified amount of pixels above or below a position.
+
 ** XDG support
 
 *** New function 'xdg-state-home' returns 'XDG_STATE_HOME' environment 
variable.
@@ -1135,10 +1232,29 @@ cookies set by web pages on disk.
 ** New variable 'help-buffer-under-preparation'.
 This variable is bound to t during the preparation of a "*Help*" buffer.
 
++++
+** Timestamps like (1 . 1000) now work without warnings being generated.
+For example, (time-add nil '(1 . 1000)) no longer warns that the
+(1 . 1000) acts like (1000 . 1000000).  This warning, which was a
+temporary transition aid for Emacs 27, has served its purpose.
+
 +++
 ** 'date-to-time' now assumes earliest values if its argument lacks
 month, day, or time.  For example, (date-to-time "2021-12-04") now
 assumes a time of 00:00 instead of signaling an error.
+
++++
+** New events for taking advantage of touchscreen devices.
+The events 'touchscreen-begin, 'touchscreen-update', and
+'touchscreen-end' have been added to take better advantage of
+touch-capable display panels.
+
++++
+** New error symbol 'permission-denied'.
+This is a subcategory of 'file-error', and is signaled when some file
+operation fails because the OS doesn't allow Emacs to access a file or
+a directory.
+
 
 * Changes in Emacs 29.1 on Non-Free Operating Systems
 
diff --git a/etc/NEWS.1-17 b/etc/NEWS.1-17
index 42a3ced1c3..ee6fa82b29 100644
--- a/etc/NEWS.1-17
+++ b/etc/NEWS.1-17
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.  26-Mar-1986
 
-Copyright (C) 1985-1986, 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 2006-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/NEWS.18 b/etc/NEWS.18
index b11a189c30..78d63e5db7 100644
--- a/etc/NEWS.18
+++ b/etc/NEWS.18
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.  17-Aug-1988
 
-Copyright (C) 1988, 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 1988, 2006-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/NEWS.19 b/etc/NEWS.19
index fd91c0842f..7eb4deaeba 100644
--- a/etc/NEWS.19
+++ b/etc/NEWS.19
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.  1992.
 
-Copyright (C) 1993-1995, 2001, 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001, 2006-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/NEWS.20 b/etc/NEWS.20
index efd0e5d5c2..2a9b0b2d25 100644
--- a/etc/NEWS.20
+++ b/etc/NEWS.20
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.  2006-05-31
 
-Copyright (C) 1999-2001, 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 1999-2001, 2006-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/NEWS.21 b/etc/NEWS.21
index b9d59594a4..52d2eb6c52 100644
--- a/etc/NEWS.21
+++ b/etc/NEWS.21
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.  2006-05-31
 
-Copyright (C) 2000-2021 Free Software Foundation, Inc.
+Copyright (C) 2000-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/NEWS.22 b/etc/NEWS.22
index 1f03dc3a13..be3167dace 100644
--- a/etc/NEWS.22
+++ b/etc/NEWS.22
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
diff --git a/etc/NEWS.23 b/etc/NEWS.23
index 8611ba53d2..da483c3e7b 100644
--- a/etc/NEWS.23
+++ b/etc/NEWS.23
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
diff --git a/etc/NEWS.24 b/etc/NEWS.24
index acf6219f74..0fd4037ed0 100644
--- a/etc/NEWS.24
+++ b/etc/NEWS.24
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2010-2021 Free Software Foundation, Inc.
+Copyright (C) 2010-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
diff --git a/etc/NEWS.25 b/etc/NEWS.25
index c533f27709..21fcd052dc 100644
--- a/etc/NEWS.25
+++ b/etc/NEWS.25
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2014-2021 Free Software Foundation, Inc.
+Copyright (C) 2014-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
diff --git a/etc/NEWS.26 b/etc/NEWS.26
index 05e8672625..a78baaea5f 100644
--- a/etc/NEWS.26
+++ b/etc/NEWS.26
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2016-2021 Free Software Foundation, Inc.
+Copyright (C) 2016-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'.
diff --git a/etc/NEWS.27 b/etc/NEWS.27
index e47f408be9..6e116533c5 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2017-2021 Free Software Foundation, Inc.
+Copyright (C) 2017-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'.
diff --git a/etc/NEWS.28 b/etc/NEWS.28
index eb65213ac2..1e882883b5 100644
--- a/etc/NEWS.28
+++ b/etc/NEWS.28
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2019-2021 Free Software Foundation, Inc.
+Copyright (C) 2019-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'.
@@ -77,9 +77,6 @@ shaping, so 'configure' now recommends that combination.
 'configure --with-xdbe=no' can now be used to disable double buffering
 at build time.
 
----
-** Support for building with Motif has been removed.
-
 ---
 ** The configure option '--without-makeinfo' has been removed.
 This was only ever relevant when building from a repository checkout.
@@ -1011,20 +1008,6 @@ file:
 
     (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1))
 
-** Xref migrated from EIEIO to cl-defstruct for its core objects.
-This means that 'oref' and 'with-slots' no longer works on them, and
-'make-instance' can no longer be used to create those instances (which
-wasn't recommended anyway).  Packages should restrict themselves to
-using functions like 'xref-make', 'xref-make-match',
-'xref-make-*-location', as well as accessor functions
-'xref-item-summary' and 'xref-item-location'.
-
-Among the benefits are better performance (noticeable when there are a
-lot of matches) and improved flexibility: 'xref-match-item' instances
-do not require that 'location' inherits from 'xref-location' anymore
-(that class was removed), so packages can create new location types to
-use with "match items" without adding EIEIO as a dependency.
-
 
 * Editing Changes in Emacs 28.1
 
@@ -1588,9 +1571,9 @@ and the result is not truncated in any way.
 It no longer has lower precedence than '+' and '-'.
 
 ---
-*** Calc now marks its windows dedicated.
-The new user option 'calc-make-windows-dedicated' controls this.  It
-is t by default; set to nil to get back the old behavior.
+*** New user option 'calc-make-windows-dedicated'.
+When this user option is non-nil, Calc will mark its windows as
+dedicated.
 
 ** Calendar
 
@@ -1966,6 +1949,13 @@ String or list of strings specifying switches for Git 
log under VC.
 If you are still using it with any regularity, please file a bug
 report with some details.
 
+---
+*** New variable 'vc-git-use-literal-pathspecs'.
+The Git backend's function now treat all file names "literally", where
+some of them previously could interpret file names (pathspecs) as
+globs when they contain appropriate characters.  Functions can bind
+the aforementioned variable to nil locally to avoid this.
+
 ** Gnus
 
 +++
@@ -3055,7 +3045,6 @@ checkdoc will now check the format of 'yes-or-no-p'.
 *** New command 'checkdoc-dired'.
 This can be used to run checkdoc on files from a Dired buffer.
 
----
 *** No longer checks for 'A-' modifiers.
 Checkdoc recommends usage of command substitutions ("\\[foo-command]")
 in favor of writing keybindings like 'C-c f'.  It now no longer warns
@@ -3724,6 +3713,20 @@ user option has been renamed to 
'find-library-source-path', and
 ---
 ** The macro 'vc-call' no longer evaluates its second argument twice.
 
+** Xref migrated from EIEIO to cl-defstruct for its core objects.
+This means that 'oref' and 'with-slots' no longer works on them, and
+'make-instance' can no longer be used to create those instances (which
+wasn't recommended anyway).  Packages should restrict themselves to
+using functions like 'xref-make', 'xref-make-match',
+'xref-make-*-location', as well as accessor functions
+'xref-item-summary' and 'xref-item-location'.
+
+Among the benefits are better performance (noticeable when there are a
+lot of matches) and improved flexibility: 'xref-match-item' instances
+do not require that 'location' inherits from 'xref-location' anymore
+(that class was removed), so packages can create new location types to
+use with "match items" without adding EIEIO as a dependency.
+
 
 * Lisp Changes in Emacs 28.1
 
@@ -3734,15 +3737,28 @@ commands as being applicable for modes derived from 
'dired-mode',
 or if the mode is a minor mode, when the current buffer has that
 minor mode activated.  Note that using this form will create byte code
 that is not compatible with byte code in previous Emacs versions.
+Also note that by default these annotations have no effect, unless the
+new option 'read-extended-command-predicate' option is customized to call
+'command-completion-default-include-p' or a similar function.
 
 +++
-** New forms to declare how completion should happen has been added.
+** New 'declare' forms to control completion of commands in 'M-x'.
 '(declare (completion PREDICATE))' can be used as a general predicate
-to say whether the command should be present when completing with
-'M-x TAB'.  '(declare (modes MODE...))' can be used as a short-hand
-way of saying that the command should be present when completing from
-buffers in major modes derived from MODE..., or, if it's a minor mode,
-when that minor mode is enabled in the current buffer.
+to say whether the command should be considered a completion candidate
+when completing with 'M-x TAB'.
+
+'(declare (modes MODE...))' can be used as a short-hand way of saying
+that the command should be considered a completion candidate when
+completing on commands from buffers in major modes derived from
+MODE..., or, if it's a minor mode, when that minor mode is enabled in
+the current buffer.
+
+Note that these forms will only have their effect if the
+'read-extended-command-predicate' option is customized to call
+'command-completion-default-include-p' or a similar function.  The
+default value of 'read-extended-command-predicate' is nil, which means
+no commands that match what you have typed are excluded from being
+completion candidates.
 
 +++
 ** 'define-minor-mode'  now takes an ':interactive' argument.
diff --git a/etc/NEXTSTEP b/etc/NEXTSTEP
index 5dd2e646ed..dacbed2045 100644
--- a/etc/NEXTSTEP
+++ b/etc/NEXTSTEP
@@ -1,4 +1,4 @@
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 This file contains information about GNU Emacs on "Nextstep" platforms.
diff --git a/etc/NXML-NEWS b/etc/NXML-NEWS
index cdce6e72ba..b5301ee2cf 100644
--- a/etc/NXML-NEWS
+++ b/etc/NXML-NEWS
@@ -1,4 +1,4 @@
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 5e7813ca7f..e4bb706e08 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -6,7 +6,7 @@ ORG NEWS -- history of user-visible changes.   -*- mode: org; 
coding: utf-8 -*-
 #+LINK: msg https://list.orgmode.org/%s/
 #+LINK: git https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=%s
 
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index acff3be7da..9040c49256 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -1,6 +1,6 @@
 Known Problems with GNU Emacs
 
-Copyright (C) 1987-1989, 1993-1999, 2001-2021 Free Software Foundation,
+Copyright (C) 1987-1989, 1993-1999, 2001-2022 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
@@ -1236,6 +1236,15 @@ A workaround is to not use 'klipper'/'clipit'.  
Upgrading 'klipper' to
 the one coming with KDE 3.3 or later might solve the problem; if it
 doesn't, set 'select-active-regions' to 'only' or nil.
 
+*** Emacs doesn't receive the key "C-.", displaying an input field instead.
+
+This is caused by the IBus Emoji input panel, which is usually bound
+to "C-.".  You can disable that panel by running the following
+command:
+
+  $ gsettings set org.freedesktop.ibus.panel.emoji hotkey "[]"
+
+
 ** Window-manager and toolkit-related problems
 
 *** Emacs built with GTK+ toolkit produces corrupted display on HiDPI screen
@@ -1328,6 +1337,12 @@ A better approach might be to avoid navigation from 
Nautilus to Emacs
 for such files, and instead to open the file in Emacs using Tramp
 remote file name syntax.
 
+*** Gnome: GTK builds with XInput2 freeze when making a frame fullscreen.
+
+This problem exists with GTK 3.24.30 in GNOME 41.1 and possibly other
+versions.  The solution is to upgrade GNOME Shell to the version that
+comes with GNOME 41.2.
+
 *** KDE: When running on KDE, colors or fonts are not as specified for Emacs,
 or messed up.
 
@@ -1675,6 +1690,18 @@ This happens on the proprietary X server ASTEC-X when 
the number of
 monitors is changed after the server has started.  A workaround is to
 restart the X server after the monitor configuration has been changed.
 
+*** Touchpad gestures don't work and emit warning messages.
+
+When pinching or swiping on your touchpad, you might see a warning
+message that looks like:
+
+  XInputWireToCookie: Unknown generic event. type 28
+
+This happens when your XInput headers support XInput 2.4, but the
+actual version of libXi installed does not.  The solution is to
+upgrade your libXi binaries to libXi 1.8.0 or later, to correspond
+with your XInput headers.
+
 * Runtime problems on character terminals
 
 *** With X forwarding, mouse highlighting can make Emacs slow.
@@ -2792,6 +2819,17 @@ file; for example:
       "/usr/local/opt/libgccjit/lib/gcc/11"
       "/usr/local/opt/gcc/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0") ":"))
 
+* Runtime problems specific to PGTK
+
+** Some modifier keys doesn't work if Emacs is started in a systemd unit file.
+
+Environment variables may be different if there is a difference in the
+behavior of keys between when started in the systemd unit file and
+when started from the command line.
+
+Especially, PGTK Emacs needs environment variables LANG and
+GTK_IM_MODULE.
+
 * Build-time problems
 
 ** Configuration
diff --git a/etc/README b/etc/README
index 6d7a15a6f2..d343160b50 100644
--- a/etc/README
+++ b/etc/README
@@ -7,5 +7,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: emacs.icon
   Author: Sun Microsystems, Inc
-  Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
   License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/TERMS b/etc/TERMS
index 80b39c80e9..ed7d0d09de 100644
--- a/etc/TERMS
+++ b/etc/TERMS
@@ -1,4 +1,4 @@
-Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 See the end of the file for copying permissions.
 
 This file describes what you must or might want to do to termcap entries
diff --git a/etc/TODO b/etc/TODO
index 22f5c09960..80e77bba60 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -1,6 +1,6 @@
 Emacs TODO List                                                   -*-outline-*-
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/charsets/README b/etc/charsets/README
index 96cba7c613..e513fcb815 100644
--- a/etc/charsets/README
+++ b/etc/charsets/README
@@ -1,6 +1,6 @@
 # README file for charset mapping files in this directory.
 
-# Copyright (C) 2003-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003-2022 Free Software Foundation, Inc.
 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
 #   Registration Number H13PRO009
diff --git a/etc/compilation.txt b/etc/compilation.txt
index 34d8c53c9a..5601ce272a 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -679,7 +679,7 @@ Compilation segmentation fault at Thu Jul 13 10:55:49
 Compilation finished at Thu Jul 21 15:02:15
 
 
-Copyright (C) 2004-2021 Free Software Foundation, Inc.
+Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/edt-user.el b/etc/edt-user.el
index 8e1a599f0d..fbeadc8789 100644
--- a/etc/edt-user.el
+++ b/etc/edt-user.el
@@ -1,6 +1,6 @@
 ;;; edt-user.el --- Sample user customizations for Emacs EDT emulation -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1992-1993, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1986, 1992-1993, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher <kevin.gal@verizon.net>
diff --git a/etc/emacs-buffer.gdb b/etc/emacs-buffer.gdb
index 41af836599..96320b157a 100644
--- a/etc/emacs-buffer.gdb
+++ b/etc/emacs-buffer.gdb
@@ -1,6 +1,6 @@
 # emacs-buffer.gdb --- gdb macros for recovering buffers from emacs coredumps
 
-# Copyright (C) 2005-2021 Free Software Foundation, Inc.
+# Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 # Author: Noah Friedman <friedman@splode.com>
 # Created: 2005-04-28
diff --git a/etc/emacs.metainfo.xml b/etc/emacs.metainfo.xml
index 7467b88e73..11df8a7159 100644
--- a/etc/emacs.metainfo.xml
+++ b/etc/emacs.metainfo.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2014-2021 Free Software Foundation, Inc. -->
+<!-- Copyright (C) 2014-2022 Free Software Foundation, Inc. -->
 <component type="desktop-application">
  <id>org.gnu.emacs</id>
  <metadata_license>GFDL-1.3+</metadata_license>
diff --git a/etc/enriched.txt b/etc/enriched.txt
index dd269e313c..5c74c610ae 100644
--- a/etc/enriched.txt
+++ b/etc/enriched.txt
@@ -253,7 +253,7 @@ it.</indent>
 
 
 
-Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/forms/forms-d2.el b/etc/forms/forms-d2.el
index cd4231cf2d..a333441f34 100644
--- a/etc/forms/forms-d2.el
+++ b/etc/forms/forms-d2.el
@@ -1,6 +1,6 @@
 ;;; forms-d2.el --- demo forms-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1991, 1994-1997, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1991, 1994-1997, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Johan Vromans <jvromans@squirrel.nl>
diff --git a/etc/gnus-tut.txt b/etc/gnus-tut.txt
index 27e868b79c..8ab718f5d2 100644
--- a/etc/gnus-tut.txt
+++ b/etc/gnus-tut.txt
@@ -24,7 +24,7 @@ was done by moi, yours truly, your humble servant, Lars Magne
 Ingebrigtsen.  If you have a WWW browser, you can investigate to your
 heart's delight at <URL:http://www.ifi.uio.no/~larsi/larsi.html>.
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
 ;; Keywords: news
diff --git a/etc/grep.txt b/etc/grep.txt
index 0370ae4e2c..ff90553d88 100644
--- a/etc/grep.txt
+++ b/etc/grep.txt
@@ -104,7 +104,7 @@ grep -nH -e "xyzxyz" ../info/*
 
 * Miscellaneous
 
-Copyright (C) 2005-2021 Free Software Foundation, Inc.
+Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/images/README b/etc/images/README
index 561cfff765..72da92427b 100644
--- a/etc/images/README
+++ b/etc/images/README
@@ -27,19 +27,19 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: mh-logo.xpm
   Author: Satyaki Das
-  Copyright (C) 2003-2021 Free Software Foundation, Inc.
+  Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 Files: gnus.pbm
   Author: Luis Fernandes <elf@ee.ryerson.ca>
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 Files: splash.png, splash.svg, splash.pbm, splash.xpm
   Author: Francesc Rocher <francesc.rocher@gmail.com>
-  Copyright (C) 2008-2021 Free Software Foundation, Inc.
+  Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 Files: checked.xpm, unchecked.xpm
   Author: Chong Yidong <cyd@stupidchicken.com>
-  Copyright (C) 2010-2021 Free Software Foundation, Inc.
+  Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 
 * The following icons are from GTK+ 2.x. They are not part of Emacs, but
diff --git a/etc/images/checked.xpm b/etc/images/checked.xpm
index 3e7e76f254..aefa9dd5da 100644
--- a/etc/images/checked.xpm
+++ b/etc/images/checked.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-/* Copyright (C) 2010-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2022 Free Software Foundation, Inc.
  *
  * Author: Chong Yidong <cyd@stupidchicken.com>
  *
diff --git a/etc/images/custom/README b/etc/images/custom/README
index fc9cd8d7f1..4238d3d133 100644
--- a/etc/images/custom/README
+++ b/etc/images/custom/README
@@ -6,5 +6,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: down.xpm down-pushed.xpm right.xpm right-pushed.xpm
 Author: Juri Linkov
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/ezimage/README b/etc/images/ezimage/README
index 865ce5b4c0..80f128ae99 100644
--- a/etc/images/ezimage/README
+++ b/etc/images/ezimage/README
@@ -7,5 +7,5 @@ Files: bits.xpm bitsbang.xpm box-minus.xpm box-plus.xpm
        tag-gt.xpm tag-minus.xpm tag-plus.xpm tag-type.xpm tag-v.xpm
        tag.xpm unlock.xpm
 Author: Eric M. Ludlam
-Copyright (C) 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1999-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/gnus/README b/etc/images/gnus/README
index 4acfc0c7db..db039d792d 100644
--- a/etc/images/gnus/README
+++ b/etc/images/gnus/README
@@ -7,7 +7,7 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: important.xpm, unimportant.xpm
 Author: Simon Josefsson <simon@josefsson.org>
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 Files: catchup.pbm catchup.xpm cu-exit.pbm cu-exit.xpm
   describe-group.pbm describe-group.xpm exit-gnus.pbm exit-gnus.xpm
@@ -21,11 +21,11 @@ Files: catchup.pbm catchup.xpm cu-exit.pbm cu-exit.xpm
   unsubscribe.pbm unsubscribe.xpm uu-decode.pbm uu-decode.xpm
   uu-post.pbm uu-post.xpm
 Author: Luis Fernandes <elf@ee.ryerson.ca>
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 Files: gnus.png, gnus.svg
   Author: Francesc Rocher <rocher@member.fsf.org>
-  Copyright (C) 2008-2021 Free Software Foundation, Inc.
+  Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 
 * The following icons are from GNOME 2.x. They are not part of Emacs,
diff --git a/etc/images/gnus/gnus.svg b/etc/images/gnus/gnus.svg
index 362dc16cb6..1733af900b 100644
--- a/etc/images/gnus/gnus.svg
+++ b/etc/images/gnus/gnus.svg
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!-- Gnu Emacs Logo
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    Author: Francesc Rocher <f.rocher@member.fsf.org>
 
diff --git a/etc/images/gud/README b/etc/images/gud/README
index 0ef5258b9a..5edd99e2bf 100644
--- a/etc/images/gud/README
+++ b/etc/images/gud/README
@@ -1,7 +1,7 @@
 COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 The following icons were created by Nick Roberts <nickrob@snap.net.nz>.
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
   break.pbm, nexti.pbm, go.pbm, pp.pbm, print.pbm, pstar.pbm, remove.pbm
diff --git a/etc/images/icons/README b/etc/images/icons/README
index a0a2e9303d..ca2d3733ed 100644
--- a/etc/images/icons/README
+++ b/etc/images/icons/README
@@ -6,7 +6,7 @@ Files: hicolor/16x16/apps/emacs.png hicolor/24x24/apps/emacs.png
        hicolor/scalable/mimetypes/emacs-document.svg
 
 Author: Nicolas Petton <nicolas@petton.fr>
-Copyright (C) 2015-2021 Free Software Foundation, Inc.
+Copyright (C) 2015-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 Files: hicolor/16x16/apps/emacs23.png hicolor/24x24/apps/emacs23.png
@@ -14,7 +14,7 @@ Files: hicolor/16x16/apps/emacs23.png 
hicolor/24x24/apps/emacs23.png
        hicolor/128x128/apps/emacs23.png hicolor/scalable/apps/emacs23.svg
 
 Author: Kentaro Ohkouchi <nanasess@fsm.ne.jp>
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 
@@ -22,7 +22,7 @@ Files: hicolor/16x16/apps/emacs22.png 
hicolor/24x24/apps/emacs22.png
        hicolor/32x32/apps/emacs22.png hicolor/48x48/apps/emacs22.png
 
 Author: Andrew Zhilin <andrew_zhilin@yahoo.com>
-Copyright (C) 2005-2021 Free Software Foundation, Inc.
+Copyright (C) 2005-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 Files: allout-widgets-dark-bg/closed.png
@@ -71,5 +71,5 @@ Files: allout-widgets-dark-bg/closed.png
        allout-widgets-light-bg/through-descender.xpm
 
 Author: Ken Manheimer <ken.manheimer@gmail.com>
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/icons/hicolor/scalable/apps/emacs.svg 
b/etc/images/icons/hicolor/scalable/apps/emacs.svg
index a2bc441247..6a2c77ed6a 100644
--- a/etc/images/icons/hicolor/scalable/apps/emacs.svg
+++ b/etc/images/icons/hicolor/scalable/apps/emacs.svg
@@ -15,7 +15,7 @@
      id="metadata70"><rdf:RDF><cc:Work
          rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage"; 
/><dc:title></dc:title></cc:Work></rdf:RDF></metadata><!-- Gnu Emacs Icon
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    Author: Nicolas Petton <nicolas@petton.fr>
 
diff --git a/etc/images/icons/hicolor/scalable/apps/emacs23.svg 
b/etc/images/icons/hicolor/scalable/apps/emacs23.svg
index 31db7b9cef..95f732a66e 100644
--- a/etc/images/icons/hicolor/scalable/apps/emacs23.svg
+++ b/etc/images/icons/hicolor/scalable/apps/emacs23.svg
@@ -10,7 +10,7 @@
    id="svg4768"
    xml:space="preserve">
 <!-- Gnu Emacs Icon
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
diff --git a/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg 
b/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg
index b11c5bd052..04e4c084df 100644
--- a/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg
+++ b/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!-- Gnu Emacs Document Icon
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
diff --git a/etc/images/mh-logo.xpm b/etc/images/mh-logo.xpm
index fd7598d5a6..846859e058 100644
--- a/etc/images/mh-logo.xpm
+++ b/etc/images/mh-logo.xpm
@@ -1,7 +1,7 @@
 /* XPM */
 /* MH-E Logo
  *
- * Copyright (C) 2003-2021 Free Software Foundation, Inc.
+ * Copyright (C) 2003-2022 Free Software Foundation, Inc.
  *
  * Author: Satyaki Das
  *
diff --git a/etc/images/mpc/README b/etc/images/mpc/README
index 30e9ac0cf2..bf84c76909 100644
--- a/etc/images/mpc/README
+++ b/etc/images/mpc/README
@@ -2,5 +2,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: add.xpm ffwd.xpm next.xpm pause.xpm play.xpm prev.xpm rewind.xpm 
stop.xpm
 Author: Stefan Monnier <monnier@iro.umontreal.ca>
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+Copyright (C) 2009-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/newsticker/README b/etc/images/newsticker/README
index 30ecabb639..19e042db63 100644
--- a/etc/images/newsticker/README
+++ b/etc/images/newsticker/README
@@ -4,5 +4,5 @@ Files: browse-url.xpm get-all.xpm mark-immortal.xpm 
mark-read.xpm
        narrow.xpm next-feed.xpm next-item.xpm prev-feed.xpm
        prev-item.xpm rss-feed.png rss-feed.svg update.xpm
 Author: Ulf Jasper
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/smilies/README b/etc/images/smilies/README
index 9fddcfb9e7..a454f27313 100644
--- a/etc/images/smilies/README
+++ b/etc/images/smilies/README
@@ -3,5 +3,5 @@ Files: blink.pbm blink.xpm braindamaged.xpm cry.xpm dead.xpm 
evil.xpm
        sad.xpm smile.pbm smile.xpm wry.pbm wry.xpm
 Authors: Reiner Steib, Simon Josefsson, Kai Grossjohann, Alex
          Schroeder, Oliver Scholz, Per Abrahamsen, Kim F. Storm.
-Copyright (C) 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1999-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/smilies/grayscale/README 
b/etc/images/smilies/grayscale/README
index 5d15f3cfbf..f4ead742ca 100644
--- a/etc/images/smilies/grayscale/README
+++ b/etc/images/smilies/grayscale/README
@@ -3,5 +3,5 @@ Files: blink.xpm braindamaged.xpm cry.xpm dead.xpm evil.xpm 
forced.xpm
        frown.xpm grin.xpm indifferent.xpm reverse-smile.xpm sad.xpm
        smile.xpm wry.xpm
 Author: Adam Sjøgren
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/smilies/medium/README b/etc/images/smilies/medium/README
index 5d15f3cfbf..f4ead742ca 100644
--- a/etc/images/smilies/medium/README
+++ b/etc/images/smilies/medium/README
@@ -3,5 +3,5 @@ Files: blink.xpm braindamaged.xpm cry.xpm dead.xpm evil.xpm 
forced.xpm
        frown.xpm grin.xpm indifferent.xpm reverse-smile.xpm sad.xpm
        smile.xpm wry.xpm
 Author: Adam Sjøgren
-Copyright (C) 2007-2021 Free Software Foundation, Inc.
+Copyright (C) 2007-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/splash.svg b/etc/images/splash.svg
index 387ffad7c7..4c583aa102 100644
--- a/etc/images/splash.svg
+++ b/etc/images/splash.svg
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!-- Gnu Emacs Logo
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    Author: Francesc Rocher <francesc.rocher@gmail.com>
    Based on the original work by Luis Fernandes <elf@ee.ryerson.ca>
diff --git a/etc/images/tabs/README b/etc/images/tabs/README
index f1429ef16f..4d9083fca5 100644
--- a/etc/images/tabs/README
+++ b/etc/images/tabs/README
@@ -4,5 +4,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: close.xpm new.xpm left-arrow.xpm right-arrow.xpm
 Author: Juri Linkov <juri@linkov.net>
-Copyright (C) 2019-2021 Free Software Foundation, Inc.
+Copyright (C) 2019-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/tree-widget/default/README 
b/etc/images/tree-widget/default/README
index a0c9c8e48d..561cde9d56 100644
--- a/etc/images/tree-widget/default/README
+++ b/etc/images/tree-widget/default/README
@@ -5,5 +5,5 @@ Files: close.png close.xpm empty.png empty.xpm end-guide.png 
end-guide.xpm
        no-guide.png no-guide.xpm no-handle.png no-handle.xpm open.png
        open.xpm
 Author: David Ponce <david.ponce@wanadoo.fr>
-Copyright (C) 2004-2021 Free Software Foundation, Inc.
+Copyright (C) 2004-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/tree-widget/folder/README 
b/etc/images/tree-widget/folder/README
index 2a9c8a211b..41983108d9 100644
--- a/etc/images/tree-widget/folder/README
+++ b/etc/images/tree-widget/folder/README
@@ -5,5 +5,5 @@ Files:  close.png close.xpm empty.png empty.xpm end-guide.png
         leaf.png leaf.xpm no-guide.png no-guide.xpm no-handle.png
         no-handle.xpm open.png open.xpm
 Author: David Ponce <david.ponce@wanadoo.fr>
-Copyright (C) 2004-2021 Free Software Foundation, Inc.
+Copyright (C) 2004-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/unchecked.xpm b/etc/images/unchecked.xpm
index 5e18534e77..b758346b96 100644
--- a/etc/images/unchecked.xpm
+++ b/etc/images/unchecked.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-/* Copyright (C) 2010-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2022 Free Software Foundation, Inc.
  *
  * Author: Chong Yidong <cyd@stupidchicken.com>
  *
diff --git a/etc/org.gnu.emacs.defaults.gschema.xml 
b/etc/org.gnu.emacs.defaults.gschema.xml
new file mode 100644
index 0000000000..d4299c25c9
--- /dev/null
+++ b/etc/org.gnu.emacs.defaults.gschema.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019-2020, 2022 Free Software Foundation, Inc. -->
+<schemalist>
+
+  <schema id="org.gnu.emacs.defaults">
+
+    <key name='alpha'                    type='s'><default>''</default></key>
+    <key name='auto-raise-lower'         type='s'><default>''</default></key>
+    <key name='auto-lower'               type='s'><default>''</default></key>
+    <key name='auto-raise'               type='s'><default>''</default></key>
+    <key name='background'               type='s'><default>''</default></key>
+    <key name='background-mode'          type='s'><default>''</default></key>
+    <key name='bitmap-icon'              type='s'><default>''</default></key>
+    <key name='border-color'             type='s'><default>''</default></key>
+    <key name='border-width'             type='s'><default>''</default></key>
+    <key name='buffer-predicate'         type='s'><default>''</default></key>
+    <key name='cursor-blink'             type='s'><default>''</default></key>
+    <key name='cursor-type'              type='s'><default>''</default></key>
+    <key name='cursor-color'             type='s'><default>''</default></key>
+    <key name='font'                     type='s'><default>''</default></key>
+    <key name='font-backend'             type='s'><default>''</default></key>
+    <key name='foreground'               type='s'><default>''</default></key>
+    <key name='fullscreen'               type='s'><default>''</default></key>
+    <key name='horizontal-scroll-bars'   type='s'><default>''</default></key>
+    <key name='icon-name'                type='s'><default>''</default></key>
+    <key name='inhibit-double-buffering' type='s'><default>''</default></key>
+    <key name='internal-border'          type='s'><default>''</default></key>
+    <key name='internal-border-width'    type='s'><default>''</default></key>
+    <key name='left-fringe'              type='s'><default>''</default></key>
+    <key name='line-spacing'             type='s'><default>''</default></key>
+    <key name='menu-bar'                 type='s'><default>''</default></key>
+    <key name='minibuffer'               type='s'><default>''</default></key>
+    <key name='name'                     type='s'><default>''</default></key>
+    <key name='pointer-color'            type='s'><default>''</default></key>
+    <key name='reverse-video'            type='s'><default>''</default></key>
+    <key name='right-fringe'             type='s'><default>''</default></key>
+    <key name='screen-gamma'             type='s'><default>''</default></key>
+    <key name='scroll-bar'               type='s'><default>''</default></key>
+    <key name='scroll-bar-background'    type='s'><default>''</default></key>
+    <key name='scroll-bar-foreground'    type='s'><default>''</default></key>
+    <key name='scroll-bar-height'        type='s'><default>''</default></key>
+    <key name='scroll-bar-width'         type='s'><default>''</default></key>
+    <key name='scroll-bars'              type='s'><default>''</default></key>
+    <key name='title'                    type='s'><default>''</default></key>
+    <key name='tool-bar'                 type='s'><default>''</default></key>
+    <key name='vertical-scroll-bars'     type='s'><default>''</default></key>
+    <key name='wait-for-w-m'             type='s'><default>''</default></key>
+
+  </schema>
+
+</schemalist>
diff --git a/etc/org/README b/etc/org/README
index 07126fc31b..aac788d3c6 100644
--- a/etc/org/README
+++ b/etc/org/README
@@ -1,7 +1,7 @@
 The files OrgOdtContentTemplate.xml and OrgOdtStyles.xml have the
 following copyright information:
 
-Copyright (C) 2010-2021 Free Software Foundation, Inc.
+Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 These files are part of GNU Emacs.
 
diff --git a/etc/ps-prin0.ps b/etc/ps-prin0.ps
index 7204666646..53f4cac355 100644
--- a/etc/ps-prin0.ps
+++ b/etc/ps-prin0.ps
@@ -1,7 +1,7 @@
 % === BEGIN ps-print prologue 0
 % version: 6.0
 
-% Copyright (C) 2000-2021 Free Software Foundation, Inc.
+% Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
diff --git a/etc/ps-prin1.ps b/etc/ps-prin1.ps
index d565e33d3b..a9e6615dac 100644
--- a/etc/ps-prin1.ps
+++ b/etc/ps-prin1.ps
@@ -1,7 +1,7 @@
 % === BEGIN ps-print prologue 1
 % version: 6.1
 
-% Copyright (C) 2000-2021 Free Software Foundation, Inc.
+% Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
diff --git a/etc/publicsuffix.txt b/etc/publicsuffix.txt
index 5529554d82..fb018d626a 100644
--- a/etc/publicsuffix.txt
+++ b/etc/publicsuffix.txt
@@ -7132,7 +7132,7 @@ org.zw
 
 // newGTLDs
 
-// List of new gTLDs imported from 
https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 
2021-11-13T15:12:42Z
+// List of new gTLDs imported from 
https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 
2021-12-30T15:13:57Z
 // This list is auto-generated, don't edit it manually.
 // aaa : 2015-02-26 American Automobile Association, Inc.
 aaa
@@ -7197,9 +7197,6 @@ aeg
 // aetna : 2015-05-21 Aetna Life Insurance Company
 aetna
 
-// afamilycompany : 2015-07-23 Johnson Shareholdings, Inc.
-afamilycompany
-
 // afl : 2014-10-02 Australian Football League
 afl
 
@@ -7530,7 +7527,7 @@ bosch
 // bostik : 2015-05-28 Bostik SA
 bostik
 
-// boston : 2015-12-10 Boston TLD Management, LLC
+// boston : 2015-12-10 Registry Services, LLC
 boston
 
 // bot : 2014-12-18 Amazon Registry Services, Inc.
@@ -8016,9 +8013,6 @@ dtv
 // dubai : 2015-01-01 Dubai Smart Government Department
 dubai
 
-// duck : 2015-07-23 Johnson Shareholdings, Inc.
-duck
-
 // dunlop : 2015-07-02 The Goodyear Tire & Rubber Company
 dunlop
 
@@ -8346,9 +8340,6 @@ gives
 // giving : 2014-11-13 Giving Limited
 giving
 
-// glade : 2015-07-23 Johnson Shareholdings, Inc.
-glade
-
 // glass : 2013-11-07 Binky Moon, LLC
 glass
 
@@ -8880,9 +8871,6 @@ live
 // living : 2015-07-30 Lifestyle Domain Holdings, Inc.
 living
 
-// lixil : 2015-03-19 LIXIL Group Corporation
-lixil
-
 // llc : 2017-12-14 Afilias Limited
 llc
 
@@ -9021,7 +9009,7 @@ menu
 // merckmsd : 2016-07-14 MSD Registry Holdings, Inc.
 merckmsd
 
-// miami : 2013-12-19 Minds + Machines Group Limited
+// miami : 2013-12-19 Registry Services, LLC
 miami
 
 // microsoft : 2014-12-18 Microsoft Corporation
@@ -9216,9 +9204,6 @@ obi
 // observer : 2015-04-30 Dog Beach, LLC
 observer
 
-// off : 2015-07-23 Johnson Shareholdings, Inc.
-off
-
 // office : 2015-03-12 Microsoft Corporation
 office
 
@@ -9462,9 +9447,6 @@ racing
 // radio : 2016-07-21 European Broadcasting Union (EBU)
 radio
 
-// raid : 2015-07-23 Johnson Shareholdings, Inc.
-raid
-
 // read : 2014-12-18 Amazon Registry Services, Inc.
 read
 
@@ -9669,9 +9651,6 @@ schwarz
 // science : 2014-09-11 dot Science Limited
 science
 
-// scjohnson : 2015-07-23 Johnson Shareholdings, Inc.
-scjohnson
-
 // scot : 2014-01-23 Dot Scot Registry Limited
 scot
 
@@ -10873,6 +10852,18 @@ rs.ba
 app.banzaicloud.io
 *.backyards.banzaicloud.io
 
+// BASE, Inc. : https://binc.jp
+// Submitted by Yuya NAGASAWA <public-suffix-list@binc.jp>
+base.ec
+official.ec
+buyshop.jp
+fashionstore.jp
+handcrafted.jp
+kawaiishop.jp
+supersale.jp
+theshop.jp
+shopselect.net
+base.shop
 
 // BetaInABox
 // Submitted by Adrian <adrian@betainabox.com>
@@ -11658,6 +11649,10 @@ tuleap-partners.com
 onred.one
 staging.onred.one
 
+// encoway GmbH : https://www.encoway.de
+// Submitted by Marcel Daus <cloudops@encoway.de>
+eu.encoway.cloud
+
 // EU.org https://eu.org/
 // Submitted by Pierre Beyssac <hostmaster@eu.org>
 eu.org
@@ -12187,6 +12182,7 @@ herokussl.com
 
 // Hibernating Rhinos
 // Submitted by Oren Eini <oren@ravendb.net>
+ravendb.cloud
 myravendb.com
 ravendb.community
 ravendb.me
@@ -12201,6 +12197,11 @@ homesklep.pl
 // Submitted by SECaaS Team <summchan@hkpc.org>
 secaas.hk
 
+// Hoplix : https://www.hoplix.com
+// Submitted by Danilo De Franco<info@hoplix.shop>
+hoplix.shop
+
+
 // HOSTBIP REGISTRY : https://www.hostbip.com/
 // Submitted by Atanunu Igbunuroghene <publicsuffixlist@hostbip.com>
 orx.biz
@@ -12446,6 +12447,10 @@ uni5.net
 // Submitted by Roy Keene <rkeene@knightpoint.com>
 knightpoint.systems
 
+// KoobinEvent, SL: https://www.koobin.com
+// Submitted by Iván Oliva <ivan.oliva@koobin.com>
+koobin.events
+
 // KUROKU LTD : https://kuroku.ltd/
 // Submitted by DisposaBoy <security@oya.to>
 oya.to
@@ -12714,6 +12719,10 @@ that.win
 from.work
 to.work
 
+// Net at Work Gmbh : https://www.netatwork.de
+// Submitted by Jan Jaeschke <jan.jaeschke@netatwork.de>
+cloud.nospamproxy.com
+
 // Netlify : https://www.netlify.com
 // Submitted by Jessica Parsons <jessica@netlify.com>
 netlify.app
@@ -12873,11 +12882,6 @@ zapto.org
 // Submitted by Konstantin Nosov <Nosov@nodeart.io>
 stage.nodeart.io
 
-// Nodum B.V. : https://nodum.io/
-// Submitted by Wietse Wind <hello+publicsuffixlist@nodum.io>
-nodum.co
-nodum.io
-
 // Nucleos Inc. : https://nucleos.com
 // Submitted by Piotr Zduniak <piotr@nucleos.com>
 pcloud.host
@@ -13478,7 +13482,8 @@ sopot.pl
 
 // Teckids e.V. : https://www.teckids.org
 // Submitted by Dominik George <dominik.george@teckids.org>
-edugit.org
+edugit.io
+s3.teckids.org
 
 // Telebit : https://telebit.cloud
 // Submitted by AJ ONeal <aj@telebit.cloud>
@@ -13576,6 +13581,10 @@ syno-ds.de
 synology-diskstation.de
 synology-ds.de
 
+// Typeform : https://www.typeform.com
+// Submitted by Sergi Ferriz <sergi.ferriz@typeform.com>
+pro.typeform.com
+
 // Uberspace : https://uberspace.de
 // Submitted by Moritz Werner <mwerner@jonaspasche.com>
 uber.space
diff --git a/etc/refcards/Makefile b/etc/refcards/Makefile
index ce2c534a93..6f8913c5f0 100644
--- a/etc/refcards/Makefile
+++ b/etc/refcards/Makefile
@@ -1,6 +1,6 @@
 ### Makefile for Emacs refcards
 
-## Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+## Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 #
diff --git a/etc/refcards/README b/etc/refcards/README
index 4102c85ba1..8e5eb5c89c 100644
--- a/etc/refcards/README
+++ b/etc/refcards/README
@@ -1,4 +1,4 @@
-Copyright (C) 2013-2021 Free Software Foundation, Inc.
+Copyright (C) 2013-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -77,7 +77,7 @@ it is reproduced here for convenience.
 
 File: gnus-logo.eps, gnus-logo.pdf
   Author: Luis Fernandes <elf@ee.ryerson.ca>
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
   License: GNU General Public License version 3 or later (see COPYING)
 
 
diff --git a/etc/refcards/calccard.tex b/etc/refcards/calccard.tex
index 02607621cd..987ab39411 100644
--- a/etc/refcards/calccard.tex
+++ b/etc/refcards/calccard.tex
@@ -20,7 +20,7 @@
 % Typical command to format:  tex calccard.tex
 % Typical command to print (3 cols):  dvips -t landscape calccard.dvi
 
-% Copyright (C) 1987, 1992, 2001--2021 Free Software Foundation, Inc.
+% Copyright (C) 1987, 1992, 2001--2022 Free Software Foundation, Inc.
 
 % This document is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
diff --git a/etc/refcards/cs-dired-ref.tex b/etc/refcards/cs-dired-ref.tex
index 294d11d1ca..689ceff366 100644
--- a/etc/refcards/cs-dired-ref.tex
+++ b/etc/refcards/cs-dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired -*- coding: utf-8 -*-
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <eroubinc@u.washington.edu>
 % Czech translation: Pavel Janík <Pavel@Janik.cz>, March 2001
diff --git a/etc/refcards/cs-refcard.tex b/etc/refcards/cs-refcard.tex
index 4d9a8b34ae..e598caeec4 100644
--- a/etc/refcards/cs-refcard.tex
+++ b/etc/refcards/cs-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs -*- coding: utf-8 -*-
 
-% Copyright (C) 1987, 1993, 1996--1997, 2001--2021 Free Software
+% Copyright (C) 1987, 1993, 1996--1997, 2001--2022 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
diff --git a/etc/refcards/cs-survival.tex b/etc/refcards/cs-survival.tex
index 75a07eebd1..542195c7fb 100644
--- a/etc/refcards/cs-survival.tex
+++ b/etc/refcards/cs-survival.tex
@@ -1,6 +1,6 @@
 % Title:  GNU Emacs Survival Card -*- coding: utf-8 -*-
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Włodek Bzyl <matwb@univ.gda.pl>
 % Czech translation: Pavel Janík <Pavel@Janik.cz>, March 2001
diff --git a/etc/refcards/de-refcard.tex b/etc/refcards/de-refcard.tex
index 9cd0df7a5e..7eaf1fcf2b 100644
--- a/etc/refcards/de-refcard.tex
+++ b/etc/refcards/de-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996, 2000--2021 Free Software Foundation,
+% Copyright (C) 1987, 1993, 1996, 2000--2022 Free Software Foundation,
 % Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
diff --git a/etc/refcards/dired-ref.tex b/etc/refcards/dired-ref.tex
index 8d5af71b6c..7841daabff 100644
--- a/etc/refcards/dired-ref.tex
+++ b/etc/refcards/dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <eroubinc@u.washington.edu>
 
diff --git a/etc/refcards/emacsver.tex.in b/etc/refcards/emacsver.tex.in
index ac80804bf1..e8bd43e354 100644
--- a/etc/refcards/emacsver.tex.in
+++ b/etc/refcards/emacsver.tex.in
@@ -2,4 +2,4 @@
 \def\versionemacs{@majorversion@}           % major version of emacs
 %% This one should not be automatically updated;
 %% M-x set-copyright in admin.el handles it.
-\def\year{2021}                             % latest copyright year
+\def\year{2022}                             % latest copyright year
diff --git a/etc/refcards/fr-dired-ref.tex b/etc/refcards/fr-dired-ref.tex
index fb8462f276..e0eebe05e6 100644
--- a/etc/refcards/fr-dired-ref.tex
+++ b/etc/refcards/fr-dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired -*- coding: utf-8 -*-
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <eroubinc@u.washington.edu>
 % French translation: Eric Jacoboni
diff --git a/etc/refcards/fr-refcard.tex b/etc/refcards/fr-refcard.tex
index ad6db6340d..039e42c905 100644
--- a/etc/refcards/fr-refcard.tex
+++ b/etc/refcards/fr-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996--1997, 2001--2021 Free Software
+% Copyright (C) 1987, 1993, 1996--1997, 2001--2022 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
diff --git a/etc/refcards/fr-survival.tex b/etc/refcards/fr-survival.tex
index e11fe175f8..1468622611 100644
--- a/etc/refcards/fr-survival.tex
+++ b/etc/refcards/fr-survival.tex
@@ -1,7 +1,7 @@
 %&tex
 % Title:  GNU Emacs Survival Card
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Włodek Bzyl <matwb@univ.gda.pl>
 % French translation:  \'Eric Jacoboni <jaco@teaser.fr>, November 2001
diff --git a/etc/refcards/gnus-logo.eps b/etc/refcards/gnus-logo.eps
index eb77461821..cd38c2ba22 100644
--- a/etc/refcards/gnus-logo.eps
+++ b/etc/refcards/gnus-logo.eps
@@ -1,5 +1,5 @@
 %!PS-Adobe-2.0 EPSF-2.0
-% Copyright (C) 2000-2021 Free Software Foundation, Inc.
+% Copyright (C) 2000-2022 Free Software Foundation, Inc.
 %
 % Author: Luis Fernandes <elf@ee.ryerson.ca>
 %
diff --git a/etc/refcards/gnus-refcard.tex b/etc/refcards/gnus-refcard.tex
index 4a1760c1b2..93191f23af 100644
--- a/etc/refcards/gnus-refcard.tex
+++ b/etc/refcards/gnus-refcard.tex
@@ -120,7 +120,7 @@
 %% Gnus logo by Luis Fernandes.
 \newcommand{\Copyright}{%
   \begin{center}
-    Copyright \copyright\ 1995, 2000, 2002--2021 Free Software Foundation, 
Inc.\\*
+    Copyright \copyright\ 1995, 2000, 2002--2022 Free Software Foundation, 
Inc.\\*
   \end{center}
 
   Released under the terms of the GNU General Public License version 3 or 
later.
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 181516172d..dec4d174c4 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{9.5.1}
+\def\orgversionnumber{9.5.2}
 \def\versionyear{2021}          % latest update
 \input emacsver.tex
 
@@ -17,7 +17,7 @@
 \pdflayout=(0l)
 
 % Nothing else needs to be changed below this line.
-% Copyright (C) 1987, 1993, 1996--1997, 2001--2021 Free Software
+% Copyright (C) 1987, 1993, 1996--1997, 2001--2022 Free Software
 % Foundation, Inc.
 
 % This document is free software: you can redistribute it and/or modify
diff --git a/etc/refcards/pdflayout.sty b/etc/refcards/pdflayout.sty
index 91e67b109d..1bc7fbdb55 100644
--- a/etc/refcards/pdflayout.sty
+++ b/etc/refcards/pdflayout.sty
@@ -1,4 +1,4 @@
-% Copyright (C) 2007-2021 Free Software Foundation, Inc.
+% Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
diff --git a/etc/refcards/pl-refcard.tex b/etc/refcards/pl-refcard.tex
index 5c12dbfbf5..a9978c4cc3 100644
--- a/etc/refcards/pl-refcard.tex
+++ b/etc/refcards/pl-refcard.tex
@@ -1,7 +1,7 @@
 %&mex
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1999, 2001--2021 Free Software Foundation, Inc.
+% Copyright (C) 1999, 2001--2022 Free Software Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
 % Polish translation: Włodek Bzyl <matwb@univ.gda.pl>
diff --git a/etc/refcards/pt-br-refcard.tex b/etc/refcards/pt-br-refcard.tex
index 9226a6d8fb..2a3316a5be 100644
--- a/etc/refcards/pt-br-refcard.tex
+++ b/etc/refcards/pt-br-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996--1997, 2002--2004, 2006--2021 Free
+% Copyright (C) 1987, 1993, 1996--1997, 2002--2004, 2006--2022 Free
 % Software Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
diff --git a/etc/refcards/refcard.tex b/etc/refcards/refcard.tex
index bc057569a7..3da3e4902e 100644
--- a/etc/refcards/refcard.tex
+++ b/etc/refcards/refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996--1997, 2001--2021 Free Software
+% Copyright (C) 1987, 1993, 1996--1997, 2001--2022 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
diff --git a/etc/refcards/ru-refcard.tex b/etc/refcards/ru-refcard.tex
index 018be36eb4..40af641468 100644
--- a/etc/refcards/ru-refcard.tex
+++ b/etc/refcards/ru-refcard.tex
@@ -1,4 +1,4 @@
-% Copyright (C) 1997, 2002--2021 Free Software Foundation, Inc.
+% Copyright (C) 1997, 2002--2022 Free Software Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
 % Russian translation: Alex Ott <alexott@gmail.com>
@@ -41,7 +41,7 @@
 \setlength{\ColThreeWidth}{25mm}
 
 \newcommand{\versionemacs}[0]{29} % version of Emacs this is for
-\newcommand{\cyear}[0]{2021}       % copyright year
+\newcommand{\cyear}[0]{2022}       % copyright year
 
 \newcommand\shortcopyrightnotice[0]{\vskip 1ex plus 2 fill
   \centerline{\footnotesize \copyright\ \cyear\ Free Software Foundation, Inc.
diff --git a/etc/refcards/sk-dired-ref.tex b/etc/refcards/sk-dired-ref.tex
index 04db4e3fe8..ce2cc07c81 100644
--- a/etc/refcards/sk-dired-ref.tex
+++ b/etc/refcards/sk-dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired -*- coding: utf-8 -*-
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <eroubinc@u.washington.edu>
 % Czech translation: Pavel Janík <Pavel@Janik.cz>, March 2001
diff --git a/etc/refcards/sk-refcard.tex b/etc/refcards/sk-refcard.tex
index bda808f232..b3fbde8ceb 100644
--- a/etc/refcards/sk-refcard.tex
+++ b/etc/refcards/sk-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs -*- coding: utf-8 -*-
 
-% Copyright (C) 1987, 1993, 1996--1997, 2001--2021 Free Software
+% Copyright (C) 1987, 1993, 1996--1997, 2001--2022 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <stepheng+emacs@gildea.com>
diff --git a/etc/refcards/sk-survival.tex b/etc/refcards/sk-survival.tex
index 9bf591a794..04bf17650c 100644
--- a/etc/refcards/sk-survival.tex
+++ b/etc/refcards/sk-survival.tex
@@ -1,6 +1,6 @@
 % Title:  GNU Emacs Survival Card -*- coding: utf-8 -*-
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Włodek Bzyl <matwb@univ.gda.pl>
 % Czech translation: Pavel Janík <Pavel@Janik.cz>, March 2001
diff --git a/etc/refcards/survival.tex b/etc/refcards/survival.tex
index a5cd9b7e11..354ad9cb6c 100644
--- a/etc/refcards/survival.tex
+++ b/etc/refcards/survival.tex
@@ -1,7 +1,7 @@
 %&tex
 % Title:  GNU Emacs Survival Card
 
-% Copyright (C) 2000--2021 Free Software Foundation, Inc.
+% Copyright (C) 2000--2022 Free Software Foundation, Inc.
 
 % Author: Włodek Bzyl <matwb@univ.gda.pl>
 
diff --git a/etc/refcards/vipcard.tex b/etc/refcards/vipcard.tex
index c62988a050..f44ccc03c6 100644
--- a/etc/refcards/vipcard.tex
+++ b/etc/refcards/vipcard.tex
@@ -1,6 +1,6 @@
 % Quick Reference Card for VIP
 
-% Copyright (C) 1987, 2001--2021 Free Software Foundation, Inc.
+% Copyright (C) 1987, 2001--2022 Free Software Foundation, Inc.
 
 % Author: Masahiko Sato <ms@sail.stanford.edu>, 
<masahiko@sato.riec.tohoku.junet>
 
diff --git a/etc/refcards/viperCard.tex b/etc/refcards/viperCard.tex
index 24be19f14d..0794ea1d42 100644
--- a/etc/refcards/viperCard.tex
+++ b/etc/refcards/viperCard.tex
@@ -1,6 +1,6 @@
 % ViperCard -- The Reference Card for Viper under GNU Emacs
 
-% Copyright (C) 1995--1997, 2001--2021 Free Software Foundation, Inc.
+% Copyright (C) 1995--1997, 2001--2022 Free Software Foundation, Inc.
 
 % Author: Michael Kifer <kifer@cs.stonybrook.edu> (Viper)
 %      Aamod Sane <sane@cs.uiuc.edu> (VIP 4.3)
diff --git a/etc/schema/locate.rnc b/etc/schema/locate.rnc
index 697d1db11e..2889acbf3f 100644
--- a/etc/schema/locate.rnc
+++ b/etc/schema/locate.rnc
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003-2004, 2007-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/etc/schema/relaxng.rnc b/etc/schema/relaxng.rnc
index d3a9d96617..7a86d58ba9 100644
--- a/etc/schema/relaxng.rnc
+++ b/etc/schema/relaxng.rnc
@@ -1,6 +1,6 @@
 # RELAX NG XML syntax expressed in RELAX NG Compact syntax.
 
-# Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003-2004, 2007-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/etc/schema/schemas.xml b/etc/schema/schemas.xml
index f8acb0d40c..678621f7bd 100644
--- a/etc/schema/schemas.xml
+++ b/etc/schema/schemas.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
+<!-- Copyright (C) 2003-2004, 2007-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/etc/ses-example.ses b/etc/ses-example.ses
index f73fbfba70..f6f0dff27f 100644
--- a/etc/ses-example.ses
+++ b/etc/ses-example.ses
@@ -205,7 +205,7 @@ Sales summary - Acme fundraising
 ;;; ses--symbolic-formulas: (("Eastern area") ("West-district") 
("North&South") ("Other"))
 ;;; End:
 
-;;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;;; COPYING PERMISSIONS:
 ;;; 
diff --git a/etc/srecode/c.srt b/etc/srecode/c.srt
index 753d1ee01b..e36caef307 100644
--- a/etc/srecode/c.srt
+++ b/etc/srecode/c.srt
@@ -1,6 +1,6 @@
 ;;; c.srt --- SRecode templates for c-mode
 
-;; Copyright (C) 2007-2010, 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2010, 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/cpp.srt b/etc/srecode/cpp.srt
index 3d1f9cbf92..d35adaf4b7 100644
--- a/etc/srecode/cpp.srt
+++ b/etc/srecode/cpp.srt
@@ -1,6 +1,6 @@
 ;;; cpp.srt --- SRecode templates for c++-mode
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/default.srt b/etc/srecode/default.srt
index 0dff66187e..04ca2e3023 100644
--- a/etc/srecode/default.srt
+++ b/etc/srecode/default.srt
@@ -1,6 +1,6 @@
 ;;; default.srt --- SRecode templates for srecode-template-mode
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/doc-cpp.srt b/etc/srecode/doc-cpp.srt
index 0de05ff15c..e11623dc04 100644
--- a/etc/srecode/doc-cpp.srt
+++ b/etc/srecode/doc-cpp.srt
@@ -1,6 +1,6 @@
 ;; doc-c.srt --- SRecode templates for "document" applications
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/doc-default.srt b/etc/srecode/doc-default.srt
index 4fc00ddf9e..edd18c26fc 100644
--- a/etc/srecode/doc-default.srt
+++ b/etc/srecode/doc-default.srt
@@ -1,6 +1,6 @@
 ;; doc-default.srt --- SRecode templates for "document" applications
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/doc-java.srt b/etc/srecode/doc-java.srt
index b7eb0dbf2c..a94392b673 100644
--- a/etc/srecode/doc-java.srt
+++ b/etc/srecode/doc-java.srt
@@ -1,6 +1,6 @@
 ;; doc-java.srt --- SRecode templates for "document" applications
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/ede-autoconf.srt b/etc/srecode/ede-autoconf.srt
index 042c05aa63..19dc14202d 100644
--- a/etc/srecode/ede-autoconf.srt
+++ b/etc/srecode/ede-autoconf.srt
@@ -1,6 +1,6 @@
 ;;; ede/templates/autoconf.srt --- Templates for autoconf used by EDE
 
-;; Copyright (C) 2010, 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010, 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/ede-make.srt b/etc/srecode/ede-make.srt
index ba380e4090..cde1690f54 100644
--- a/etc/srecode/ede-make.srt
+++ b/etc/srecode/ede-make.srt
@@ -1,6 +1,6 @@
 ;; ede-make.srt --- SRecode templates for Makefiles used by EDE.
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/el.srt b/etc/srecode/el.srt
index a366434c3e..9078f4d334 100644
--- a/etc/srecode/el.srt
+++ b/etc/srecode/el.srt
@@ -1,6 +1,6 @@
 ;;; el.srt --- SRecode templates for Emacs Lisp mode
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/getset-cpp.srt b/etc/srecode/getset-cpp.srt
index af27cb2e8c..f53b410126 100644
--- a/etc/srecode/getset-cpp.srt
+++ b/etc/srecode/getset-cpp.srt
@@ -1,6 +1,6 @@
 ;;; getset-cpp.srt --- SRecode templates for C++ class getter/setters.
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/java.srt b/etc/srecode/java.srt
index 5d8ce88b56..5c4f7d8072 100644
--- a/etc/srecode/java.srt
+++ b/etc/srecode/java.srt
@@ -1,6 +1,6 @@
 ;; java.srt
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/make.srt b/etc/srecode/make.srt
index f83ecf9e12..436e067c50 100644
--- a/etc/srecode/make.srt
+++ b/etc/srecode/make.srt
@@ -1,6 +1,6 @@
 ;; make.srt
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/proj-test.srt b/etc/srecode/proj-test.srt
index 6825c6b837..62eb0befdf 100644
--- a/etc/srecode/proj-test.srt
+++ b/etc/srecode/proj-test.srt
@@ -1,6 +1,6 @@
 ;; proj-test.srt --- SRecode template for testing project scoping.
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/template.srt b/etc/srecode/template.srt
index 5820b1d756..b6590f5f0b 100644
--- a/etc/srecode/template.srt
+++ b/etc/srecode/template.srt
@@ -1,6 +1,6 @@
 ;;; template.srt --- Templates for Semantic Recoders
 
-;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/test.srt b/etc/srecode/test.srt
index 581c295383..186376b58a 100644
--- a/etc/srecode/test.srt
+++ b/etc/srecode/test.srt
@@ -1,6 +1,6 @@
 ;; test.srt --- SRecode templates for testing
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/texi.srt b/etc/srecode/texi.srt
index cc4c50c780..611ef65a8c 100644
--- a/etc/srecode/texi.srt
+++ b/etc/srecode/texi.srt
@@ -1,6 +1,6 @@
 ;; texi.srt --- SRecode templates for Texinfo
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/srecode/wisent.srt b/etc/srecode/wisent.srt
index 4e8f61bd09..83553c3dca 100644
--- a/etc/srecode/wisent.srt
+++ b/etc/srecode/wisent.srt
@@ -1,6 +1,6 @@
 ;; wisent.srt --- SRecode templates for Emacs/WISENT grammar files.
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/etc/themes/adwaita-theme.el b/etc/themes/adwaita-theme.el
index 7d297df526..ba83a0578c 100644
--- a/etc/themes/adwaita-theme.el
+++ b/etc/themes/adwaita-theme.el
@@ -1,6 +1,6 @@
 ;;; adwaita-theme.el --- Tango-based custom theme for faces  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: William Stevenson <yhvh2000@gmail.com>
 
diff --git a/etc/themes/deeper-blue-theme.el b/etc/themes/deeper-blue-theme.el
index 5895693386..8f19147f91 100644
--- a/etc/themes/deeper-blue-theme.el
+++ b/etc/themes/deeper-blue-theme.el
@@ -1,6 +1,6 @@
 ;;; deeper-blue-theme.el --- Custom theme for faces  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Scott Frazer <frazer.scott@gmail.com>
 
diff --git a/etc/themes/dichromacy-theme.el b/etc/themes/dichromacy-theme.el
index 148ebd434c..d53c075d92 100644
--- a/etc/themes/dichromacy-theme.el
+++ b/etc/themes/dichromacy-theme.el
@@ -1,6 +1,6 @@
 ;;; dichromacy-theme.el --- color theme suitable for color-blind users  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <cyd@stupidchicken>
 
diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el
index 514384ca2a..d9a8d5391a 100644
--- a/etc/themes/leuven-theme.el
+++ b/etc/themes/leuven-theme.el
@@ -1,6 +1,6 @@
 ;;; leuven-theme.el --- Awesome Emacs color theme on white background  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")>
 ;; URL: https://github.com/fniessen/emacs-leuven-theme
diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el
index 547d2df04c..eeca46210c 100644
--- a/etc/themes/light-blue-theme.el
+++ b/etc/themes/light-blue-theme.el
@@ -1,6 +1,6 @@
 ;;; light-blue-theme.el --- Custom theme for faces  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Drew Adams <drew.adams@oracle.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/etc/themes/manoj-dark-theme.el b/etc/themes/manoj-dark-theme.el
index e80403f5b3..b70620fe21 100644
--- a/etc/themes/manoj-dark-theme.el
+++ b/etc/themes/manoj-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; manoj-dark-theme.el --- A dark theme from Manoj  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Manoj Srivastava <srivasta@ieee.org>
 ;; Keywords: lisp, faces
diff --git a/etc/themes/misterioso-theme.el b/etc/themes/misterioso-theme.el
index 26a5946d30..55186384ad 100644
--- a/etc/themes/misterioso-theme.el
+++ b/etc/themes/misterioso-theme.el
@@ -1,6 +1,6 @@
 ;;; misterioso-theme.el --- Custom face theme for Emacs  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Hermida
 
diff --git a/etc/themes/modus-operandi-theme.el 
b/etc/themes/modus-operandi-theme.el
index 5a73e655f3..a5e8fc701c 100644
--- a/etc/themes/modus-operandi-theme.el
+++ b/etc/themes/modus-operandi-theme.el
@@ -1,27 +1,27 @@
 ;;; modus-operandi-theme.el --- Accessible light theme (WCAG AAA) -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Protesilaos Stavrou <info@protesilaos.com>
 ;; URL: https://gitlab.com/protesilaos/modus-themes
-;; Version: 1.7.0
+;; Version: 2.0.0
 ;; Package-Requires: ((emacs "27.1"))
 ;; Keywords: faces, theme, accessibility
 
 ;; This file is part of GNU Emacs.
 
-;; This program is free software; you can redistribute it and/or modify
+;; 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.
+;; 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.
+;; 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el
index f7d38ac2de..8afa961ba3 100644
--- a/etc/themes/modus-themes.el
+++ b/etc/themes/modus-themes.el
@@ -1,28 +1,28 @@
 ;;; modus-themes.el --- Highly accessible themes (WCAG AAA) -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Protesilaos Stavrou <info@protesilaos.com>
 ;; URL: https://gitlab.com/protesilaos/modus-themes
-;; Version: 1.7.0
-;; Last-Modified: <2021-11-18 12:28:22 +0200>
+;; Version: 2.0.0
+;; Last-Modified: <2021-12-24 12:35:25 +0200>
 ;; Package-Requires: ((emacs "27.1"))
 ;; Keywords: faces, theme, accessibility
 
 ;; This file is part of GNU Emacs.
 
-;; This program is free software; you can redistribute it and/or modify
+;; 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.
+;; 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.
+;; 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
@@ -38,14 +38,12 @@
 ;;     modus-themes-headings                       (alist)
 ;;     modus-themes-org-agenda                     (alist)
 ;;     modus-themes-bold-constructs                (boolean)
+;;     modus-themes-deuteranopia                   (boolean)
 ;;     modus-themes-inhibit-reload                 (boolean)
 ;;     modus-themes-intense-markup                 (boolean)
 ;;     modus-themes-italic-constructs              (boolean)
 ;;     modus-themes-mixed-fonts                    (boolean)
-;;     modus-themes-scale-headings                 (boolean)
 ;;     modus-themes-subtle-line-numbers            (boolean)
-;;     modus-themes-success-deuteranopia           (boolean)
-;;     modus-themes-variable-pitch-headings        (boolean)
 ;;     modus-themes-variable-pitch-ui              (boolean)
 ;;     modus-themes-completions                    (choice)
 ;;     modus-themes-diffs                          (choice)
@@ -60,21 +58,6 @@
 ;;     modus-themes-prompts                        (choice)
 ;;     modus-themes-region                         (choice)
 ;;     modus-themes-syntax                         (choice)
-;;     modus-themes-mode-line-padding              (natnum)
-;;
-;; The default scale for headings is as follows (it can be customized as
-;; well---remember, no scaling takes place by default):
-;;
-;;     modus-themes-scale-1                        1.05
-;;     modus-themes-scale-2                        1.1
-;;     modus-themes-scale-3                        1.15
-;;     modus-themes-scale-4                        1.2
-;;     modus-themes-scale-title                    1.3
-;;
-;; There is another scaling-related option, which however is reserved
-;; for special cases and is not used for headings:
-;;
-;;     modus-themes-scale-small                    0.9
 ;;
 ;; There also exist two unique customization variables for overriding
 ;; color palette values.  The specifics are documented in the manual.
@@ -89,14 +72,12 @@
 ;; missing package or change you would like to see.
 ;;
 ;;     ace-window
-;;     ag
 ;;     alert
 ;;     all-the-icons
 ;;     annotate
 ;;     ansi-color
 ;;     anzu
 ;;     apropos
-;;     apt-sources-list
 ;;     artbollocks-mode
 ;;     auctex and TeX
 ;;     auto-dim-other-buffers
@@ -109,7 +90,6 @@
 ;;     boon
 ;;     bookmark
 ;;     breakpoint (provided by built-in gdb-mi.el)
-;;     buffer-expose
 ;;     calendar and diary
 ;;     calfw
 ;;     centaur-tabs
@@ -127,7 +107,6 @@
 ;;     corfu
 ;;     counsel
 ;;     counsel-css
-;;     counsel-org-capture-string
 ;;     cov
 ;;     cperl-mode
 ;;     css-mode
@@ -139,28 +118,24 @@
 ;;     dashboard (emacs-dashboard)
 ;;     deadgrep
 ;;     debbugs
-;;     define-word
 ;;     deft
 ;;     dictionary
 ;;     diff-hl
 ;;     diff-mode
 ;;     dim-autoload
 ;;     dir-treeview
-;;     dired
+;;     Dired
 ;;     dired-async
 ;;     dired-git
 ;;     dired-git-info
 ;;     dired-narrow
 ;;     dired-subtree
-;;     diredc
 ;;     diredfl
 ;;     diredp (dired+)
-;;     disk-usage
 ;;     display-fill-column-indicator-mode
 ;;     doom-modeline
 ;;     dynamic-ruler
 ;;     easy-jekyll
-;;     easy-kill
 ;;     ebdb
 ;;     ediff
 ;;     eglot
@@ -197,7 +172,6 @@
 ;;     flycheck-posframe
 ;;     flymake
 ;;     flyspell
-;;     flyspell-correct
 ;;     flx
 ;;     freeze-it
 ;;     frog-menu
@@ -209,10 +183,8 @@
 ;;     geiser
 ;;     git-commit
 ;;     git-gutter (and variants)
-;;     git-lens
 ;;     git-rebase
 ;;     git-timemachine
-;;     git-walktree
 ;;     gnus
 ;;     gotest
 ;;     golden-ratio-scroll-screen
@@ -221,20 +193,14 @@
 ;;     helm-switch-shell
 ;;     helm-xref
 ;;     helpful
-;;     highlight-blocks
-;;     highlight-defined
-;;     highlight-escape-sequences (`hes-mode')
 ;;     highlight-indentation
 ;;     highlight-numbers
-;;     highlight-symbol
-;;     highlight-tail
 ;;     highlight-thing
 ;;     hl-defined
 ;;     hl-fill-column
 ;;     hl-line-mode
 ;;     hl-todo
 ;;     hydra
-;;     hyperlist
 ;;     ibuffer
 ;;     icomplete
 ;;     ido-mode
@@ -248,7 +214,6 @@
 ;;     interaction-log
 ;;     ioccur
 ;;     isearch, occur, etc.
-;;     isl (isearch-light)
 ;;     ivy
 ;;     ivy-posframe
 ;;     jira (org-jira)
@@ -272,22 +237,18 @@
 ;;     markup-faces (`adoc-mode')
 ;;     mentor
 ;;     messages
-;;     minibuffer-line
 ;;     minimap
 ;;     mmm-mode
 ;;     mode-line
 ;;     mood-line
 ;;     mpdel
 ;;     mu4e
-;;     mu4e-conversation
 ;;     multiple-cursors
 ;;     nano-modeline
 ;;     neotree
-;;     no-emoji
 ;;     notmuch
 ;;     num3-mode
 ;;     nxml-mode
-;;     objed
 ;;     orderless
 ;;     org
 ;;     org-journal
@@ -307,14 +268,11 @@
 ;;     pandoc-mode
 ;;     paradox
 ;;     paren-face
-;;     parrot
 ;;     pass
 ;;     pdf-tools
 ;;     persp-mode
 ;;     perspective
 ;;     phi-grep
-;;     phi-search
-;;     pkgbuild-mode
 ;;     pomidor
 ;;     popup
 ;;     powerline
@@ -326,7 +284,6 @@
 ;;     quick-peek
 ;;     racket-mode
 ;;     rainbow-blocks
-;;     rainbow-identifiers
 ;;     rainbow-delimiters
 ;;     rcirc
 ;;     recursion-indicator
@@ -335,7 +292,6 @@
 ;;     ripgrep
 ;;     rmail
 ;;     ruler-mode
-;;     sallet
 ;;     selectrum
 ;;     selectrum-prescient
 ;;     semantic
@@ -352,13 +308,10 @@
 ;;     smerge
 ;;     spaceline
 ;;     speedbar
-;;     spell-fu
-;;     spray
 ;;     stripes
 ;;     suggest
 ;;     switch-window
 ;;     swiper
-;;     swoop
 ;;     sx
 ;;     symbol-overlay
 ;;     syslog-mode
@@ -380,13 +333,11 @@
 ;;     undo-tree
 ;;     vc (vc-dir.el, vc-hooks.el)
 ;;     vc-annotate (C-x v g)
-;;     vdiff
 ;;     vertico
 ;;     vertico-quick
 ;;     vimish-fold
 ;;     visible-mark
 ;;     visual-regexp
-;;     volatile-highlights
 ;;     vterm
 ;;     wcheck-mode
 ;;     web-mode
@@ -594,9 +545,6 @@ cover the blue-cyan-magenta side of the spectrum."
     ;; while bg-tab-inactive should be combined with fg-dim, whereas
     ;; bg-tab-inactive-alt goes together with fg-main
     ;;
-    ;; bg-tab-bar is only intended for the bar that holds the tabs and
-    ;; can only be combined with fg-main
-    ;;
     ;; fg-escape-char-construct and fg-escape-char-backslash can
     ;; be combined bg-main, bg-dim, bg-alt
     ;;
@@ -626,7 +574,6 @@ cover the blue-cyan-magenta side of the spectrum."
     (bg-region-accent . "#afafef")
     (bg-region-accent-subtle . "#efdfff")
 
-    (bg-tab-bar . "#d5d5d5")
     (bg-tab-active . "#f6f6f6")
     (bg-tab-inactive . "#b7b7b7")
     (bg-tab-inactive-accent . "#a9b4f6")
@@ -839,9 +786,6 @@ symbol and the latter as a string.")
     ;; while bg-tab-inactive should be combined with fg-dim, whereas
     ;; bg-tab-inactive-alt goes together with fg-main
     ;;
-    ;; bg-tab-bar is only intended for the bar that holds the tabs and
-    ;; can only be combined with fg-main
-    ;;
     ;; fg-escape-char-construct and fg-escape-char-backslash can
     ;; be combined bg-main, bg-dim, bg-alt
     ;;
@@ -871,7 +815,6 @@ symbol and the latter as a string.")
     (bg-region-accent . "#4f3d88")
     (bg-region-accent-subtle . "#240f55")
 
-    (bg-tab-bar . "#2c2c2c")
     (bg-tab-active . "#0e0e0e")
     (bg-tab-inactive . "#424242")
     (bg-tab-inactive-accent . "#35398f")
@@ -920,10 +863,10 @@ symbol and the latter as a string.")
     (bg-diff-refine-changed . "#585800") (fg-diff-refine-changed . "#ffffcc")
     (bg-diff-refine-removed . "#852828") (fg-diff-refine-removed . "#ffd9eb")
 
-    (bg-diff-focus-added . "#203d20") (fg-diff-focus-added . "#b4ddb4")
-    (bg-diff-focus-added-deuteran . "#00405f") (fg-diff-focus-added-deuteran . 
"#bfe4ff")
-    (bg-diff-focus-changed . "#4a3a10") (fg-diff-focus-changed . "#d0daaf")
-    (bg-diff-focus-removed . "#5e2526") (fg-diff-focus-removed . "#eebdba")
+    (bg-diff-focus-added . "#1d3c25") (fg-diff-focus-added . "#b4ddb4")
+    (bg-diff-focus-added-deuteran . "#003959") (fg-diff-focus-added-deuteran . 
"#bfe4ff")
+    (bg-diff-focus-changed . "#424200") (fg-diff-focus-changed . "#d0daaf")
+    (bg-diff-focus-removed . "#500f29") (fg-diff-focus-removed . "#eebdba")
 
     (bg-mark-sel . "#002f2f") (fg-mark-sel . "#60cfa2")
     (bg-mark-del . "#5a0000") (fg-mark-del . "#ff99aa")
@@ -1494,6 +1437,11 @@ This behaves in accordance with 
`modus-themes-mixed-fonts'.
 The actual styling of the face is done by `modus-themes-faces'."
   :group 'modus-theme-faces)
 
+(defface modus-themes-ui-variable-pitch nil
+  "Face for `modus-themes-variable-pitch-ui'.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-theme-faces)
+
 (defface modus-themes-graph-red-0 nil
   "Special subdued red face for use in graphs.
 This is intended to be applied in contexts such as the Org agenda
@@ -1673,6 +1621,72 @@ The actual styling of the face is done by 
`modus-themes-faces'."
 The actual styling of the face is done by `modus-themes-faces'."
   :group 'modus-theme-faces)
 
+;; "Grue" is "green" and "blue".
+(defface modus-themes-grue nil
+  "Generic face for `modus-themes-deuteranopia' foreground.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-grue-active nil
+  "Face for `modus-themes-deuteranopia' active foreground.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-grue-nuanced nil
+  "Face for `modus-themes-deuteranopia' nuanced foreground.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-grue-background-active nil
+  "Face for `modus-themes-deuteranopia' active background.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-grue-background-intense nil
+  "Face for `modus-themes-deuteranopia' intense background.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-grue-background-subtle nil
+  "Face for `modus-themes-deuteranopia' subtle background.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-grue-background-refine nil
+  "Face for `modus-themes-deuteranopia' refined background.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-link-symlink nil
+  "Face for `modus-themes-links' symbolic link.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-link-broken nil
+  "Face for `modus-themes-links' broken link.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-tab-backdrop nil
+  "Face of backdrop in tabbed interfaces.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-tab-active nil
+  "Face of active tab.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-tab-inactive nil
+  "Face of inactive tab.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
+(defface modus-themes-markup-verbatim nil
+  "Face of verbatim markup.
+The actual styling of the face is done by `modus-themes-faces'."
+  :group 'modus-themes-faces)
+
 
 
 ;;; Customization variables
@@ -1767,7 +1781,7 @@ For form, see `modus-themes-vivendi-colors'."
   :link '(info-link "(modus-themes) Bold constructs"))
 
 (defcustom modus-themes-variable-pitch-headings nil
-  "Use proportional fonts (variable-pitch) in headings."
+  "DEPRECATED: specify `variable-pitch' in `modus-themes-headings'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.0.0")
   :version "28.1"
@@ -1776,6 +1790,8 @@ For form, see `modus-themes-vivendi-colors'."
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Headings' typeface"))
 
+(make-obsolete 'modus-themes-variable-pitch-headings 'modus-themes-headings 
"2.0.0")
+
 (defcustom modus-themes-variable-pitch-ui nil
   "Use proportional fonts (variable-pitch) in UI elements.
 This includes the mode line, header line, tab bar, and tab line."
@@ -1824,6 +1840,7 @@ Users may need to explicitly configure the font family of
                 (const :tag "Semi-bold" semibold)
                 (const :tag "Extra-bold" extrabold)
                 (const :tag "Ultra-bold" ultrabold))
+        (float :tag "Number (float) to adjust height by" :value 1.1)
         (choice :tag "Colors"
                 (const :tag "Subtle colors" nil)
                 (const :tag "Rainbow colors" rainbow)
@@ -1842,26 +1859,34 @@ described below.  Here is a sample, followed by a 
presentation of
 all available properties:
 
     (setq modus-themes-headings
-          '((1 . (background overline))
-            (2 . (overline rainbow))
-            (t . (monochrome))))
+          (quote ((1 . (background overline variable-pitch 1.5))
+                  (2 . (overline rainbow 1.3))
+                  (3 . (overline 1.1))
+                  (t . (monochrome)))))
 
 By default (a nil value for this variable), all headings have a
-bold typographic weight and use a desaturated text color.
+bold typographic weight, use a desaturated text color, have a
+font family that is the same as the `default' face (typically
+monospaced), and a height that is equal to the `default' face's
+height.
 
 A `rainbow' property makes the text color more saturated.
 
 An `overline' property draws a line above the area of the
 heading.
 
-A `background' property adds a subtle tinted color to the
+A `background' property applies a subtle tinted color to the
 background of the heading.
 
-A `monochrome' property makes all headings the same base color,
-which is that of the default for the active theme (black/white).
-When `background' is also set, `monochrome' changes its color to
-gray.  If both `monochrome' and `rainbow' are set, the former
-takes precedence.
+A `monochrome' property makes the heading the same as the base
+color, which is that of the `default' face's foreground.  When
+`background' is also set, `monochrome' changes its color to gray.
+If both `monochrome' and `rainbow' are set, the former takes
+precedence.
+
+A `variable-pitch' property changes the font family of the
+heading to that of the `variable-pitch' face (normally a
+proportionately spaced typeface).
 
 The symbol of a weight attribute adjusts the font of the heading
 accordingly, such as `light', `semibold', etc.  Valid symbols are
@@ -1872,46 +1897,47 @@ and italic faces).  For backward compatibility, the 
`no-bold'
 value is accepted, though users are encouraged to specify a
 `regular' weight instead.
 
+A number, expressed as a floating point (e.g. 1.5), adjusts the
+height of the heading to that many times the base font size.  The
+default height is the same as 1.0, though it need not be
+explicitly stated.
+
 Combinations of any of those properties are expressed as a list,
 like in these examples:
 
     (semibold)
     (rainbow background)
-    (overline monochrome semibold)
+    (overline monochrome semibold 1.3)
 
 The order in which the properties are set is not significant.
 
 In user configuration files the form may look like this:
 
     (setq modus-themes-headings
-          '((1 . (background overline rainbow))
-            (2 . (background overline))
-            (t . (overline semibold))))
+          (quote ((1 . (background overline rainbow 1.5))
+                  (2 . (background overline 1.3))
+                  (t . (overline semibold)))))
 
 When defining the styles per heading level, it is possible to
 pass a non-nil value (t) instead of a list of properties.  This
 will retain the original aesthetic for that level.  For example:
 
     (setq modus-themes-headings
-          '((1 . t)           ; keep the default style
-            (2 . (background overline))
-            (t . (rainbow)))) ; style for all other headings
+          (quote ((1 . t)           ; keep the default style
+                  (2 . (background overline))
+                  (t . (rainbow))))) ; style for all other headings
 
     (setq modus-themes-headings
-          '((1 . (background overline))
-            (2 . (rainbow semibold))
-            (t . t))) ; default style for all other levels
+          (quote ((1 . (background overline))
+                  (2 . (rainbow semibold))
+                  (t . t)))) ; default style for all other levels
 
 For Org users, the extent of the heading depends on the variable
 `org-fontify-whole-heading-line'.  This affects the `overline'
 and `background' properties.  Depending on the version of Org,
-there may be others, such as `org-fontify-done-headline'.
-
-Also read `modus-themes-scale-headings' to change the height of
-headings and `modus-themes-variable-pitch-headings' to make them
-use a proportionately spaced font."
+there may be others, such as `org-fontify-done-headline'."
   :group 'modus-themes
-  :package-version '(modus-themes . "1.7.0")
+  :package-version '(modus-themes . "2.0.0")
   :version "29.1"
   :type `(alist
           :options ,(mapcar (lambda (el)
@@ -1931,11 +1957,11 @@ is a sample, followed by a description of all possible
 combinations:
 
     (setq modus-themes-org-agenda
-          '((header-block . (variable-pitch scale-title))
-            (header-date . (grayscale workaholic bold-today))
-            (event . (accented italic varied))
-            (scheduled . uniform)
-            (habit . traffic-light)))
+          (quote ((header-block . (variable-pitch 1.5 semibold))
+                  (header-date . (grayscale workaholic bold-today 1.2))
+                  (event . (accented italic varied))
+                  (scheduled . uniform)
+                  (habit . traffic-light))))
 
 A `header-block' key applies to elements that concern the
 headings which demarcate blocks in the structure of the agenda.
@@ -1945,19 +1971,30 @@ font size.  Acceptable values come in the form of a 
list that can
 include either or both of those properties:
 
 - `variable-pitch' to use a proportionately spaced typeface;
-- `scale-title' to increase height to `modus-themes-scale-title'
-  OR `no-scale' to set the font to the same height as the rest of
-  the buffer.
-
-In case both `scale-title' and `no-scale' are in the list, the
-latter takes precedence.
+- A number as a floating point (e.g. 1.5) to set the height of
+  the text to that many times the default font height.  A float
+  of 1.0 or the symbol `no-scale' have the same effect of making
+  the font to the same height as the rest of the buffer.  When
+  neither a number nor `no-scale' are present, the default is a
+  small increase in height (a value of 1.15).
+- The symbol of a weight attribute adjusts the font of the
+  heading accordingly, such as `light', `semibold', etc.  Valid
+  symbols are defined in the internal variable
+  `modus-themes--heading-weights'.  The absence of a weight means
+  that bold will be used by virtue of inheriting the `bold'
+  face (check the manual for tweaking bold and italic faces).
+
+In case both a number and `no-scale' are in the list, the latter
+takes precedence.  If two numbers are specified, the first one is
+applied.
 
 Example usage:
 
     (header-block . nil)
-    (header-block . (scale-title))
+    (header-block . (1.5))
     (header-block . (no-scale))
-    (header-block . (variable-pitch scale-title))
+    (header-block . (variable-pitch 1.5))
+    (header-block . (variable-pitch 1.5 semibold))
 
 A `header-date' key covers date headings.  Dates use only a
 foreground color by default (a nil value), with weekdays and
@@ -1971,12 +2008,13 @@ that can include any of the following properties:
   terms of color;
 - `bold-today' to apply a bold typographic weight to the current
   date;
-- `bold-all' to render all date headings in a bold weight.
-- `scale-heading' increases the height of the date headings to
-  the value of `modus-themes-scale-1' (which is the first step in
-  the scale for regular headings).
+- `bold-all' to render all date headings in a bold weight;
 - `underline-today' applies an underline to the current date
-  while removing the background it has by default.
+  while removing the background it has by default;
+- A number as a floating point (e.g. 1.2) to set the height of
+  the text to that many times the default font height.  The
+  default is the same as the base font height (the equivalent of
+  1.0).
 
 For example:
 
@@ -1985,7 +2023,7 @@ For example:
     (header-date . (grayscale bold-all))
     (header-date . (grayscale workaholic))
     (header-date . (grayscale workaholic bold-today))
-    (header-date . (grayscale workaholic bold-today scale-heading))
+    (header-date . (grayscale workaholic bold-today 1.2))
 
 An `event' key covers (i) headings with a plain time stamp that
 are shown on the agenda, also known as events, (ii) entries
@@ -1995,12 +2033,6 @@ By default all those look the same and have a subtle 
foreground
 color (the default is a nil value or an empty list).  This key
 accepts a list of properties.  Those are:
 
-- `scale-small' reduces the height of the entries to the value of
-  the user option `modus-themes-scale-small' (0.9 the height of
-  the main font size by default).  This work best when the
-  relevant entries have no tags associated with them and when the
-  user is interested in reducing their presence in the agenda
-  view.
 - `accented' applies an accent value to the event's foreground,
   replacing the original gray.  It makes all entries stand out more.
 - `italic' adds a slant to the font's forms (italic or oblique
@@ -2068,9 +2100,11 @@ value are passed as a symbol.  Those are:
   The difference between ready and clear states is attenuated by
   painting both of them using shades of green.  This option thus
   highlights the alert and overdue states.
-- `traffic-light-deuteranopia' is like the `traffic-light' except
-  its three colors are red, yellow, and blue to be suitable for
-  users with red-green color deficiency (deuteranopia).
+- When `modus-themes-deuteranopia' is non-nil the habit graph
+  uses a three-color style like the aforementioned
+  `traffic-light' variant, except that shades of blue are applied
+  instead of green.  This is suitable for users with red-green
+  color deficiency (deuteranopia).
 
 For example:
 
@@ -2078,7 +2112,7 @@ For example:
     (habit . simplified)
     (habit . traffic-light)"
   :group 'modus-themes
-  :package-version '(modus-themes . "1.7.0")
+  :package-version '(modus-themes . "2.0.0")
   :version "29.1"
   :type '(set
           (cons :tag "Block header"
@@ -2087,10 +2121,22 @@ For example:
                      (choice :tag "Font style"
                              (const :tag "Use the original typeface (default)" 
nil)
                              (const :tag "Use `variable-pitch' font" 
variable-pitch))
+                     (choice :tag "Font weight (must be supported by the 
typeface)"
+                             (const :tag "Bold (default)" nil)
+                             (const :tag "Thin" thin)
+                             (const :tag "Ultra-light" ultralight)
+                             (const :tag "Extra-light" extralight)
+                             (const :tag "Light" light)
+                             (const :tag "Semi-light" semilight)
+                             (const :tag "Regular" regular)
+                             (const :tag "Medium" medium)
+                             (const :tag "Semi-bold" semibold)
+                             (const :tag "Extra-bold" extrabold)
+                             (const :tag "Ultra-bold" ultrabold))
                      (choice :tag "Scaling"
                              (const :tag "Slight increase in height (default)" 
nil)
                              (const :tag "Do not scale" no-scale)
-                             (const :tag "Scale to match 
`modus-themes-scale-title'" scale-title))))
+                             (float :tag "Number (float) to adjust height by" 
:value 1.3))))
           (cons :tag "Date header" :greedy t
                 (const header-date)
                 (set :tag "Header presentation" :greedy t
@@ -2098,12 +2144,11 @@ For example:
                      (const :tag "Do not differentiate weekdays from weekends" 
workaholic)
                      (const :tag "Make today bold" bold-today)
                      (const :tag "Make all dates bold" bold-all)
-                     (const :tag "Increase font size (`modus-themes-scale-1')" 
scale-heading)
+                     (float :tag "Number (float) to adjust height by" :value 
1.05)
                      (const :tag "Make today underlined; remove the 
background" underline-today)))
           (cons :tag "Event entry" :greedy t
                 (const event)
                 (set :tag "Text presentation" :greedy t
-                     (const :tag "Use smaller font size 
(`modus-themes-scale-small')" scale-small)
                      (const :tag "Apply an accent color" accented)
                      (const :tag "Italic font slant (oblique forms)" italic)
                      (const :tag "Differentiate events from diary/sexp 
entries" varied)))
@@ -2116,183 +2161,88 @@ For example:
                 (const habit)
                 (choice (const :tag "Follow the original design of `org-habit' 
(default)" nil)
                         (const :tag "Do not distinguish between present and 
future variants" simplified)
-                        (const :tag "Use only red, yellow, green" 
traffic-light)
-                        (const :tag "Use only red, yellow, blue" 
traffic-light-deuteranopia))))
+                        (const :tag "Use only red, yellow, green" 
traffic-light))))
   :set #'modus-themes--set-option
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Org agenda"))
 
 (defcustom modus-themes-scale-headings nil
-  "Use font scaling for headings.
-
-For regular headings the scale is controlled by the variables
-`modus-themes-scale-1' (smallest increase) and its variants all
-the way up to `modus-themes-scale-4' (largest increase).
-
-While `modus-themes-scale-title' is reserved for special headings
-that nominally are the largest on the scale (though that is not a
-requirement).
-
-A special heading is, in this context, one that does not fit into
-the syntax for heading levels that apply to the given mode.  For
-example, Org's #+title keyword lies outside the normal eight
-levels of headings.  Whereas, say, Markdown does not have such a
-special heading."
+  "DEPRECATED: specify height in `modus-themes-headings'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.2.0")
   :version "28.1"
   :type 'boolean
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled headings"))
+  :initialize #'custom-initialize-default)
 
-(defcustom modus-themes-scale-1 1.05
-  "Font size that is slightly larger than the base value.
-
-This size is used for level 4 headings, such as in Org and
-Markdown files.
+(make-obsolete 'modus-themes-scale-headings 'modus-themes-headings "2.0.0")
 
-The default value is a floating point that is interpreted as a
-multiple of the base font size.  It is recommended to use such a
-value.
-
-However, the variable also accepts an integer, understood as an
-absolute height that is 1/10 of the typeface's point size (e.g. a
-value of 140 is the same as setting the font at 14 point size).
-This will ignore the base font size and, thus, will not scale in
-accordance with it in cases where it changes, such as while using
-`text-scale-adjust'."
+(defcustom modus-themes-scale-1 1.05
+  "DEPRECATED: specify height in `modus-themes-headings'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.2.0")
   :version "28.1"
   :type 'number
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled heading sizes"))
-
-(defcustom modus-themes-scale-2 1.1
-  "Font size slightly larger than `modus-themes-scale-1'.
+  :initialize #'custom-initialize-default)
 
-This size is used for level 3 headings, such as in Org and
-Markdown files.
+(make-obsolete 'modus-themes-scale-1 'modus-themes-headings "2.0.0")
 
-The default value is a floating point that is interpreted as a
-multiple of the base font size.  It is recommended to use such a
-value.
-
-However, the variable also accepts an integer, understood as an
-absolute height that is 1/10 of the typeface's point size (e.g. a
-value of 140 is the same as setting the font at 14 point size).
-This will ignore the base font size and, thus, will not scale in
-accordance with it in cases where it changes, such as while using
-`text-scale-adjust'."
+(defcustom modus-themes-scale-2 1.1
+  "DEPRECATED: specify height in `modus-themes-headings'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.2.0")
   :version "28.1"
   :type 'number
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled heading sizes"))
-
-(defcustom modus-themes-scale-3 1.15
-  "Font size slightly larger than `modus-themes-scale-2'.
+  :initialize #'custom-initialize-default)
 
-This size is used for level 2 headings, such as in Org and
-Markdown files.
+(make-obsolete 'modus-themes-scale-2 'modus-themes-headings "2.0.0")
 
-The default value is a floating point that is interpreted as a
-multiple of the base font size.  It is recommended to use such a
-value.
-
-However, the variable also accepts an integer, understood as an
-absolute height that is 1/10 of the typeface's point size (e.g. a
-value of 140 is the same as setting the font at 14 point size).
-This will ignore the base font size and, thus, will not scale in
-accordance with it in cases where it changes, such as while using
-`text-scale-adjust'."
+(defcustom modus-themes-scale-3 1.15
+  "DEPRECATED: specify height in `modus-themes-headings'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.2.0")
   :version "28.1"
   :type 'number
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled heading sizes"))
+  :initialize #'custom-initialize-default)
 
-(defcustom modus-themes-scale-4 1.2
-  "Font size slightly larger than `modus-themes-scale-3'.
-
-This size is used for level 1 headings, such as in Org and
-Markdown files.
+(make-obsolete 'modus-themes-scale-3 'modus-themes-headings "2.0.0")
 
-The default value is a floating point that is interpreted as a
-multiple of the base font size.  It is recommended to use such a
-value.
-
-However, the variable also accepts an integer, understood as an
-absolute height that is 1/10 of the typeface's point size (e.g. a
-value of 140 is the same as setting the font at 14 point size).
-This will ignore the base font size and, thus, will not scale in
-accordance with it in cases where it changes, such as while using
-`text-scale-adjust'."
+(defcustom modus-themes-scale-4 1.2
+  "DEPRECATED: specify height in `modus-themes-headings'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.2.0")
   :version "28.1"
   :type 'number
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled heading sizes"))
+  :initialize #'custom-initialize-default)
 
-(define-obsolete-variable-alias 'modus-themes-scale-5 
'modus-themes-scale-title "1.5.0")
+(make-obsolete 'modus-themes-scale-4 'modus-themes-headings "2.0.0")
 
 (defcustom modus-themes-scale-title 1.3
-  "Font size slightly larger than `modus-themes-scale-4'.
-
-This size is only used for 'special' top level headings, such as
-Org's file title heading, denoted by the #+title key word, and
-the Org agenda structure headers (see `modus-themes-org-agenda').
-
-The default value is a floating point that is interpreted as a
-multiple of the base font size.  It is recommended to use such a
-value.
-
-However, the variable also accepts an integer, understood as an
-absolute height that is 1/10 of the typeface's point size (e.g. a
-value of 140 is the same as setting the font at 14 point size).
-This will ignore the base font size and, thus, will not scale in
-accordance with it in cases where it changes, such as while using
-`text-scale-adjust'."
+  "DEPRECATED: specify height in `modus-themes-headings'.
+Same principle for `modus-themes-org-agenda'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.5.0")
   :version "28.1"
   :type 'number
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled heading sizes"))
-
-(defcustom modus-themes-scale-small 0.9
-  "Font size smaller than the default value.
-
-This size is only used in special contexts where users are
-presented with the option to have smaller text on display (see
-`modus-themes-org-agenda').
+  :initialize #'custom-initialize-default)
 
-The default value is a floating point that is interpreted as a
-multiple of the base font size.  It is recommended to use such a
-value.
+(make-obsolete 'modus-themes-scale-title 'modus-themes-headings "2.0.0")
 
-However, the variable also accepts an integer, understood as an
-absolute height that is 1/10 of the typeface's point size (e.g. a
-value of 140 is the same as setting the font at 14 point size).
-This will ignore the base font size and, thus, will not scale in
-accordance with it in cases where it changes, such as while using
-`text-scale-adjust'."
+(defcustom modus-themes-scale-small 0.9
+  "DEPRECATED."
   :group 'modus-themes
   :package-version '(modus-themes . "1.6.0")
   :version "28.1"
   :type 'number
   :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Scaled heading sizes"))
+  :initialize #'custom-initialize-default)
+
+(make-obsolete 'modus-themes-scale-small nil "2.0.0")
 
 (defcustom modus-themes-fringes nil
   "Define the visibility of fringes.
@@ -2348,7 +2298,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-lang-checkers '(text-also background))
+    (setq modus-themes-lang-checkers (quote (text-also background)))
 
 NOTE: The placement of the straight underline, though not the
 wave style, is controlled by the built-in variables
@@ -2416,50 +2366,6 @@ respectively."
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Org mode blocks"))
 
-(defcustom modus-themes-org-habit nil
-  "Deprecated in version 1.5.0 favor of `modus-themes-org-agenda'.
-
-Control the presentation of the `org-habit' graph.
-
-The default is meant to conform with the original aesthetic of
-`org-habit'.  It employs all four color codes that correspond to
-the org-habit states---clear, ready, alert, and overdue---while
-distinguishing between their present and future variants.  This
-results in a total of eight colors in use: red, yellow, green,
-blue, in tinted and shaded versions.  They cover the full set of
-information provided by the `org-habit' consistency graph.
-
-Option `simplified' is like the default except that it removes
-the dichotomy between current and future variants by applying
-uniform color-coded values.  It applies a total of four colors:
-red, yellow, green, blue.  They produce a simplified consistency
-graph that is more legible (or less \"busy\") than the default.
-The intent is to shift focus towards the distinction between the
-four states of a habit task, rather than each state's
-present/future outlook.
-
-Option `traffic-light' further reduces the available colors to
-red, yellow, and green.  As in `simplified', present and future
-variants appear uniformly, but differently from it, the 'clear'
-state is rendered in a green hue, instead of the original blue.
-This is meant to capture the use-case where a habit task being
-\"too early\" is less important than it being \"too late\".  The
-difference between ready and clear states is attenuated by
-painting both of them using shades of green.  This option thus
-highlights the alert and overdue states."
-  :group 'modus-themes
-  :package-version '(modus-themes . "1.1.0")
-  :version "28.1"
-  :type '(choice
-          (const :format "[%v] %t\n" :tag "Respect the original design of 
org-habit (default)" nil)
-          (const :format "[%v] %t\n" :tag "Like the default, but do not 
distinguish between present and future variants" simplified)
-          (const :format "[%v] %t\n" :tag "Like `simplified', but only use 
red, yellow, green" traffic-light))
-  :set #'modus-themes--set-option
-  :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Org agenda habits"))
-
-(make-obsolete 'modus-themes-org-habit 'modus-themes-org-agenda "1.5.0")
-
 (defcustom modus-themes-mode-line nil
   "Control the overall style of the mode line.
 
@@ -2489,13 +2395,16 @@ the same as the background, effectively creating some 
padding.
 The `accented' property ensures that the active mode line uses a
 colored background instead of the standard shade of gray.
 
-The `padded' property increases the apparent height of the mode
-line.  This is done by applying box effects and combining them
-with an underline and overline.  To ensure that the underline is
-placed at the bottom, set `x-underline-at-descent-line' to
-non-nil.  The `padded' property has no effect when the `moody'
-property is also used, because Moody already applies its own
-padding.
+A positive integer (natural number or natnum) applies a padding
+effect of NATNUM pixels at the boundaries of the mode lines.  The
+default value is 1 and does not need to be specified explicitly.
+The padding has no effect when the `moody' property is also used,
+because Moody already applies its own tweaks.  To ensure that the
+underline is placed at the bottom of the mode line, set
+`x-underline-at-descent-line' to non-nil (this is not needed when
+the `borderless' property is also set).  For users on Emacs 29,
+the `x-use-underline-position-properties' variable must also be
+set to nil.
 
 Combinations of any of those properties are expressed as a list,
 like in these examples:
@@ -2508,7 +2417,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-mode-line '(borderless accented))
+    (setq modus-themes-mode-line (quote (borderless accented)))
 
 Note that Moody does not expose any faces that the themes could
 style directly.  Instead it re-purposes existing ones to render
@@ -2532,7 +2441,7 @@ default colors (which have been carefully designed to be 
highly
 accessible).
 
 Furthermore, because Moody expects an underline and overline
-instead of a box style, it is advised to set
+instead of a box style, it is strongly advised to set
 `x-underline-at-descent-line' to a non-nil value."
   :group 'modus-themes
   :package-version '(modus-themes . "1.6.0")
@@ -2544,14 +2453,13 @@ instead of a box style, it is advised to set
                       (const :tag "No box effects (Moody-compatible)" moody))
               (const :tag "Colored background" accented)
               (const :tag "Without border color" borderless)
-              (const :tag "With extra padding" padded))
+              (natnum :tag "With extra padding" :value 6))
   :set #'modus-themes--set-option
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Mode line"))
 
 (defcustom modus-themes-mode-line-padding 6
-  "Padding for `modus-themes-mode-line'.
-The value is expressed as a positive integer."
+  "DEPRECATED: Set natural number in `modus-themes-mode-line'."
   :group 'modus-themes
   :package-version '(modus-themes . "1.7.0")
   :version "29.1"
@@ -2560,12 +2468,14 @@ The value is expressed as a positive integer."
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Mode line"))
 
+(make-obsolete 'modus-themes-mode-line-padding 'modus-themes-mode-line "2.0.0")
+
 (defcustom modus-themes-diffs nil
   "Adjust the overall style of diffs.
 
 The default (nil) uses fairly intense color combinations for
 diffs, by applying prominently colored backgrounds, with
-appropriate foregrounds.
+appropriately tinted foregrounds.
 
 Option `desaturated' follows the same principles as with the
 default (nil), though it tones down all relevant colors.
@@ -2573,36 +2483,19 @@ default (nil), though it tones down all relevant colors.
 Option `bg-only' applies a background but does not override the
 text's foreground.  This makes it suitable for a non-nil value
 passed to `diff-font-lock-syntax' (note: Magit does not support
-syntax highlighting in diffs---last checked on 2021-04-21).
-
-Option `deuteranopia' is like the default (nil) in terms of using
-prominently colored backgrounds, except that it also accounts for
-red-green color defficiency by replacing all instances of green
-with colors on the blue side of the spectrum.  Other stylistic
-changes are made in the interest of optimizing for such a
-use-case.
-
-Option `fg-only-deuteranopia' removes all colored backgrounds,
-except from word-wise or refined changes.  Instead, it only uses
-color-coded foreground values to differentiate between added,
-removed, and changed lines.  If a background is necessary to
-denote context, a subtle grayscale value is applied.  The color
-used for added lines is a variant of blue to account for
-red-green color defficiency but also because green text alone is
-hard to discern in the diff's context (hard for our accessibility
-purposes).  The `fg-only' option that existed in older versions
-of the themes is now an alias of `fg-only-deuteranopia', in the
-interest of backward compatibility."
+syntax highlighting in diffs---last checked on 2021-12-02).
+
+When the user option `modus-themes-deuteranopia' is non-nil, all
+diffs will use a red/blue color-coding system instead of the
+standard red/green.  Other stylistic changes are made in the
+interest of optimizing for such a use-case."
   :group 'modus-themes
-  :package-version '(modus-themes . "1.4.0")
-  :version "28.1"
+  :package-version '(modus-themes . "2.0.0")
+  :version "29.1"
   :type '(choice
           (const :format "[%v] %t\n" :tag "Intensely colored backgrounds 
(default)" nil)
           (const :format "[%v] %t\n" :tag "Slightly accented backgrounds with 
tinted text" desaturated)
-          (const :format "[%v] %t\n" :tag "Apply color-coded backgrounds; keep 
syntax colors intact" bg-only)
-          (const :format "[%v] %t\n" :tag "Like the default (nil), though 
optimized for red-green color defficiency" deuteranopia)
-          (const :format "[%v] %t\n" :tag "No backgrounds, except for refined 
diffs" fg-only-deuteranopia)
-          (const :format "[%v] %t\n" :tag "Alias of `fg-only-deuteranopia' for 
backward compatibility" fg-only))
+          (const :format "[%v] %t\n" :tag "Apply color-coded backgrounds; keep 
syntax colors intact" bg-only))
   :set #'modus-themes--set-option
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Diffs"))
@@ -2617,8 +2510,7 @@ only or mostly use foreground colors for their 
interaction model,
 and (ii) those that combine background and foreground values for
 some of their metaphors.  The former category encompasses
 Icomplete, Ido, Selectrum, Vertico, as well as pattern matching
-styles like Orderless and Flx.  The latter covers Helm, Ivy, and
-Sallet.
+styles like Orderless and Flx.  The latter covers Helm and Ivy.
 
 A value of nil (the default) will simply respect the metaphors of
 each completion framework.
@@ -2687,7 +2579,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-prompts '(background gray))"
+    (setq modus-themes-prompts (quote (background gray)))"
   :group 'modus-themes
   :package-version '(modus-themes . "1.5.0")
   :version "28.1"
@@ -2701,8 +2593,6 @@ In user configuration files the form may look like this:
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Command prompts"))
 
-(make-obsolete 'modus-themes-intense-hl-line 'modus-themes-hl-line "1.3.0")
-
 (defcustom modus-themes-hl-line nil
   "Control the current line highlight of HL-line mode.
 
@@ -2731,7 +2621,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-hl-line '(underline accented))
+    (setq modus-themes-hl-line (quote (underline accented)))
 
 Set `x-underline-at-descent-line' to a non-nil value for better
 results with underlines."
@@ -2799,7 +2689,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-paren-match '(bold intense))"
+    (setq modus-themes-paren-match (quote (bold intense)))"
   :group 'modus-themes
   :package-version '(modus-themes . "1.5.0")
   :version "28.1"
@@ -2847,7 +2737,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-syntax '(faint alt-syntax))
+    (setq modus-themes-syntax (quote (faint alt-syntax)))
 
 Independent of this variable, users may also control the use of a
 bold weight or italic text: `modus-themes-bold-constructs' and
@@ -2906,7 +2796,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-links '(neutral-underline background))
+    (setq modus-themes-links (quote (neutral-underline background)))
 
 The placement of the underline, meaning its proximity to the
 text, is controlled by `x-use-underline-position-properties',
@@ -2960,7 +2850,7 @@ The order in which the properties are set is not 
significant.
 
 In user configuration files the form may look like this:
 
-    (setq modus-themes-region '(bg-only no-extend))"
+    (setq modus-themes-region (quote (bg-only no-extend)))"
   :group 'modus-themes
   :package-version '(modus-themes . "1.5.0")
   :version "28.1"
@@ -2972,26 +2862,37 @@ In user configuration files the form may look like this:
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Active region"))
 
-(defcustom modus-themes-success-deuteranopia nil
-  "Color-code 'success' or 'done' as blue instead of green.
-
-This is to account for red-green color deficiency.
-
-The present customization option applies to all contexts where
-there can be a color-coded distinction between success or
-failure, to-do or done, mark for selection or deletion (e.g. in
-Dired), current and lazily highlighted search matches, and so on.
-
-Diffs, which rely on a red/green dichotomy by default, can also
-be configured to meet the needs of users with deuteranopia via
-the option `modus-themes-diffs'."
+(define-obsolete-variable-alias
+  'modus-themes-success-deuteranopia
+  'modus-themes-deuteranopia
+  "2.0.0")
+
+(defcustom modus-themes-deuteranopia nil
+  "When non-nil use red/blue color-coding instead of red/green.
+
+This is to account for red-green color deficiency, also know as
+deuteranopia and variants.  It applies to all contexts where
+there can be a color-coded distinction between failure or
+success, a to-do or done state, a mark for deletion versus a mark
+for selection (e.g. in Dired), current and lazily highlighted
+search matches, removed lines in diffs as opposed to added ones,
+and so on.
+
+Note that this does not change all colors throughout the active
+theme, but only applies to cases that have color-coding
+significance.  For example, regular code syntax highlighting is
+not affected.  There is no such need because of the themes'
+overarching commitment to the highest legibility standard, which
+ensures that text is readable regardless of hue, as well as the
+predominance of colors on the blue-cyan-magenta-purple side of
+the spectrum."
   :group 'modus-themes
-  :package-version '(modus-themes . "1.4.0")
-  :version "28.1"
+  :package-version '(modus-themes . "2.0.0")
+  :version "29.1"
   :type 'boolean
   :set #'modus-themes--set-option
   :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) Success' color-code"))
+  :link '(info-link "(modus-themes) Deuteranopia style"))
 
 (defcustom modus-themes-mail-citations nil
   "Control the color of citations in messages or email clients.
@@ -3093,11 +2994,6 @@ Those are stored in `modus-themes-faces' and
   (when modus-themes-mixed-fonts
     (list :inherit 'fixed-pitch)))
 
-(defun modus-themes--variable-pitch ()
-  "Conditional use of `variable-pitch' in headings."
-  (when modus-themes-variable-pitch-headings
-    (list :inherit 'variable-pitch)))
-
 (defun modus-themes--variable-pitch-ui ()
   "Conditional use of `variable-pitch' in UI elements."
   (when modus-themes-variable-pitch-ui
@@ -3163,7 +3059,8 @@ differ in overall intensity.  FAINTFG is a nuanced color."
                  (memq 'intense modus-themes-lang-checkers))
             intensebg)
            ((memq 'background modus-themes-lang-checkers)
-            subtlebg))
+            subtlebg)
+           ('unspecified))
           :foreground
           (cond
            ((and (memq 'faint modus-themes-lang-checkers)
@@ -3175,10 +3072,11 @@ differ in overall intensity.  FAINTFG is a nuanced 
color."
            ((memq 'intense modus-themes-lang-checkers)
             intensefg)
            ((memq 'text-also modus-themes-lang-checkers)
-            subtlefg)))))
+            subtlefg)
+           ('unspecified)))))
 
 (defun modus-themes--prompt (mainfg intensefg grayfg subtlebg intensebg 
intensebg-fg subtlebggray intensebggray)
-  "Conditional use of colors for prompts.
+  "Conditional use of colors for text prompt faces.
 MAINFG is the prompt's standard foreground.  INTENSEFG is a more
 prominent alternative to the main foreground, while GRAYFG is a
 less luminant shade of gray.
@@ -3192,7 +3090,7 @@ should be combinable with INTENSEBG-FG.
 SUBTLEBGGRAY and INTENSEBGGRAY are background values.  The former
 can be combined with GRAYFG, while the latter only works with the
 theme's fallback text color."
-  (let ((modus-themes-prompts
+  (let ((properties
          (if (listp modus-themes-prompts)
              modus-themes-prompts
            ;; translation layer for legacy values
@@ -3207,40 +3105,40 @@ theme's fallback text color."
              ('intense-gray '(background intense gray))))))
     (list :foreground
           (cond
-           ((and (memq 'gray modus-themes-prompts)
-                 (memq 'intense modus-themes-prompts))
+           ((and (memq 'gray properties)
+                 (memq 'intense properties))
             'unspecified)
-           ((memq 'gray modus-themes-prompts)
+           ((memq 'gray properties)
             grayfg)
-           ((and (memq 'background modus-themes-prompts)
-                 (memq 'intense modus-themes-prompts))
+           ((and (memq 'background properties)
+                 (memq 'intense properties))
             intensebg-fg)
-           ((memq 'intense modus-themes-prompts)
+           ((memq 'intense properties)
             intensefg)
            (mainfg))
           :background
           (cond
-           ((and (memq 'gray modus-themes-prompts)
-                 (memq 'background modus-themes-prompts)
-                 (memq 'intense modus-themes-prompts))
+           ((and (memq 'gray properties)
+                 (memq 'background properties)
+                 (memq 'intense properties))
             intensebggray)
-           ((and (memq 'gray modus-themes-prompts)
-                 (memq 'background modus-themes-prompts))
+           ((and (memq 'gray properties)
+                 (memq 'background properties))
             subtlebggray)
-           ((and (memq 'background modus-themes-prompts)
-                 (memq 'intense modus-themes-prompts))
+           ((and (memq 'background properties)
+                 (memq 'intense properties))
             intensebg)
-           ((memq 'background modus-themes-prompts)
+           ((memq 'background properties)
             subtlebg)
            ('unspecified))
           :inherit
           (cond
-           ((and (memq 'bold modus-themes-prompts)
-                 (memq 'italic modus-themes-prompts))
+           ((and (memq 'bold properties)
+                 (memq 'italic properties))
             'bold-italic)
-           ((memq 'italic modus-themes-prompts)
+           ((memq 'italic properties)
             'italic)
-           ((memq 'bold modus-themes-prompts)
+           ((memq 'bold properties)
             'bold)
            ('unspecified)))))
 
@@ -3250,7 +3148,7 @@ NORMALBG should be the special palette color 
'bg-paren-match' or
 something similar.  INTENSEBG must be easier to discern next to
 other backgrounds, such as the special palette color
 'bg-paren-match-intense'."
-  (let ((modus-themes-paren-match
+  (let ((properties
          (if (listp modus-themes-paren-match)
              modus-themes-paren-match
            ;; translation layer for legacy values
@@ -3261,15 +3159,15 @@ other backgrounds, such as the special palette color
              ('subtle-bold '(bold))
              ('intense '(intense))))))
     (list :inherit
-          (if (memq 'bold modus-themes-paren-match)
+          (if (memq 'bold properties)
               'bold
             'unspecified)
           :background
-          (if (memq 'intense modus-themes-paren-match)
+          (if (memq 'intense properties)
               intensebg
             normalbg)
           :underline
-          (if (memq 'underline modus-themes-paren-match)
+          (if (memq 'underline properties)
               t
             nil))))
 
@@ -3277,7 +3175,7 @@ other backgrounds, such as the special palette color
   "Apply foreground value to code syntax.
 FG is the default.  FAINT is typically the same color in its
 desaturated version."
-  (let ((modus-themes-syntax
+  (let ((properties
          (if (listp modus-themes-syntax)
              modus-themes-syntax
            ;; translation layer for legacy values
@@ -3291,7 +3189,7 @@ desaturated version."
              ('alt-syntax-yellow-comments '(alt-syntax yellow-comments))))))
     (list :foreground
           (cond
-           ((memq 'faint modus-themes-syntax)
+           ((memq 'faint properties)
             faint)
            (fg)))))
 
@@ -3300,7 +3198,7 @@ desaturated version."
 FG is the default.  FAINT is typically the same color in its
 desaturated version.  ALT is another hue while optional FAINT-ALT
 is its subtle alternative."
-  (let ((modus-themes-syntax
+  (let ((properties
          (if (listp modus-themes-syntax)
              modus-themes-syntax
            ;; translation layer for legacy values
@@ -3314,12 +3212,12 @@ is its subtle alternative."
              ('alt-syntax-yellow-comments '(alt-syntax yellow-comments))))))
     (list :foreground
           (cond
-           ((and (memq 'alt-syntax modus-themes-syntax)
-                 (memq 'faint modus-themes-syntax))
+           ((and (memq 'alt-syntax properties)
+                 (memq 'faint properties))
             (or faint-alt alt))
-           ((memq 'faint modus-themes-syntax)
+           ((memq 'faint properties)
             faint)
-           ((memq 'alt-syntax modus-themes-syntax)
+           ((memq 'alt-syntax properties)
             alt)
            (fg)))))
 
@@ -3330,7 +3228,7 @@ desaturated version.  GREEN is a color variant in that 
side of
 the spectrum.  ALT is another hue.  Optional FAINT-GREEN is a
 subtle alternative to GREEN.  Optional FAINT-ALT is a subtle
 alternative to ALT."
-  (let ((modus-themes-syntax
+  (let ((properties
          (if (listp modus-themes-syntax)
              modus-themes-syntax
            ;; translation layer for legacy values
@@ -3344,17 +3242,17 @@ alternative to ALT."
              ('alt-syntax-yellow-comments '(alt-syntax yellow-comments))))))
     (list :foreground
           (cond
-           ((and (memq 'faint modus-themes-syntax)
-                 (memq 'green-strings modus-themes-syntax))
+           ((and (memq 'faint properties)
+                 (memq 'green-strings properties))
             (or faint-green green))
-           ((and (memq 'alt-syntax modus-themes-syntax)
-                 (memq 'faint modus-themes-syntax))
+           ((and (memq 'alt-syntax properties)
+                 (memq 'faint properties))
             (or faint-alt faint))
-           ((memq 'faint modus-themes-syntax)
+           ((memq 'faint properties)
             faint)
-           ((memq 'green-strings modus-themes-syntax)
+           ((memq 'green-strings properties)
             green)
-           ((memq 'alt-syntax modus-themes-syntax)
+           ((memq 'alt-syntax properties)
             alt)
            (fg)))))
 
@@ -3363,7 +3261,7 @@ alternative to ALT."
 FG is the default.  YELLOW is a color variant of that name while
 optional FAINT-YELLOW is its subtle variant.  Optional FAINT is
 an alternative to the default value."
-  (let ((modus-themes-syntax
+  (let ((properties
          (if (listp modus-themes-syntax)
              modus-themes-syntax
            ;; translation layer for legacy values
@@ -3377,16 +3275,16 @@ an alternative to the default value."
              ('alt-syntax-yellow-comments '(alt-syntax yellow-comments))))))
     (list :foreground
           (cond
-           ((and (memq 'faint modus-themes-syntax)
-                 (memq 'yellow-comments modus-themes-syntax))
+           ((and (memq 'faint properties)
+                 (memq 'yellow-comments properties))
             (or faint-yellow yellow))
-           ((and (memq 'alt-syntax modus-themes-syntax)
-                 (memq 'yellow-comments modus-themes-syntax)
-                 (not (memq 'green-strings modus-themes-syntax)))
+           ((and (memq 'alt-syntax properties)
+                 (memq 'yellow-comments properties)
+                 (not (memq 'green-strings properties)))
             (or faint-yellow yellow))
-           ((memq 'yellow-comments modus-themes-syntax)
+           ((memq 'yellow-comments properties)
             yellow)
-           ((memq 'faint modus-themes-syntax)
+           ((memq 'faint properties)
             (or faint fg))
            (fg)))))
 
@@ -3418,7 +3316,7 @@ that combines well with the background and foreground."
   (let* ((key (modus-themes--key-cdr level modus-themes-headings))
          (style (or key (modus-themes--key-cdr t modus-themes-headings)))
          (style-listp (listp style))
-         (modus-themes-headings
+         (properties
           (if style-listp
               style
             ;; translation layer for legacy values
@@ -3440,7 +3338,7 @@ that combines well with the background and foreground."
               ('rainbow-section-no-bold '(no-bold rainbow background overline))
               ('section '(background overline))
               ('section-no-bold '(background overline no-bold)))))
-         (var (when modus-themes-variable-pitch-headings 'variable-pitch))
+         (var (when (memq 'variable-pitch properties) 'variable-pitch))
          (varbold (if var
                       (append (list 'bold) (list var))
                     'bold))
@@ -3449,28 +3347,30 @@ that combines well with the background and foreground."
           (cond
            ;; `no-bold' is for backward compatibility because we cannot
            ;; deprecate a variable's value.
-           ((or weight (memq 'no-bold modus-themes-headings))
+           ((or weight (memq 'no-bold properties))
             var)
            (varbold))
           :background
           (cond
-           ((and (memq 'monochrome modus-themes-headings)
-                 (memq 'background modus-themes-headings))
+           ((and (memq 'monochrome properties)
+                 (memq 'background properties))
             bg-gray)
-           ((memq 'background modus-themes-headings)
+           ((memq 'background properties)
             bg)
            ('unspecified))
           :foreground
           (cond
-           ((memq 'monochrome modus-themes-headings)
+           ((memq 'monochrome properties)
             'unspecified)
-           ((memq 'rainbow modus-themes-headings)
+           ((memq 'rainbow properties)
             fg-alt)
            (fg))
+          :height
+          (seq-find #'floatp properties 'unspecified)
           :weight
           (or weight 'unspecified)
           :overline
-          (if (memq 'overline modus-themes-headings)
+          (if (memq 'overline properties)
               border
             'unspecified))))
 
@@ -3478,16 +3378,20 @@ that combines well with the background and foreground."
   "Control the style of the Org agenda structure.
 FG is the foreground color to use."
   (let* ((properties (modus-themes--key-cdr 'header-block 
modus-themes-org-agenda))
-         (inherit (cond ((memq 'variable-pitch properties)
-                         (list 'bold 'variable-pitch))
-                        ('bold)))
-         (height (cond ((memq 'no-scale properties)
-                        1.0)
-                       ((memq 'scale-title properties)
-                        modus-themes-scale-title)
-                       (1.15))))
-    (list :inherit inherit
-          :height height
+         (weight (modus-themes--heading-weight properties)))
+    (list :inherit
+          (cond
+           ((and weight (memq 'variable-pitch properties))
+            'variable-pitch)
+           (weight 'unspecified)
+           ((memq 'variable-pitch properties)
+            (list 'bold 'variable-pitch))
+           ('bold))
+          :weight
+          (or weight 'unspecified)
+          :height
+          (cond ((memq 'no-scale properties) 'unspecified)
+                ((seq-find #'floatp properties 1.15)))
           :foreground fg)))
 
 (defun modus-themes--agenda-date (defaultfg grayscalefg &optional workaholicfg 
grayscaleworkaholicfg bg bold ul)
@@ -3506,8 +3410,10 @@ weight.  Optional UL applies an underline."
            (t
             'unspecified))
           :background
-          (unless (memq 'underline-today properties)
-            bg)
+          (cond
+           ((memq 'underline-today properties)
+            'unspecified)
+           ((or bg 'unspecified)))
           :foreground
           (cond
            ((and (memq 'grayscale properties)
@@ -3520,9 +3426,7 @@ weight.  Optional UL applies an underline."
            (t
             defaultfg))
           :height
-          (if (memq 'scale-heading properties)
-              modus-themes-scale-1
-            'unspecified)
+          (seq-find #'floatp properties 'unspecified)
           :underline
           (if (and ul (memq 'underline-today properties))
               t
@@ -3535,11 +3439,7 @@ toggle to behave in accordance with the semantics of the 
`varied'
 property that the `event' key accepts in
 `modus-themes-org-agenda'."
   (let ((properties (modus-themes--key-cdr 'event modus-themes-org-agenda)))
-    (list :height
-          (if (memq 'scale-small properties)
-              modus-themes-scale-small
-            'unspecified)
-          :foreground
+    (list :foreground
           (cond
            ((or (and (memq 'varied properties) varied)
                 (and (memq 'accented properties)
@@ -3585,11 +3485,12 @@ DEFAULT is the original foregrounc color.  TRAFFIC is 
to be used
 when the 'traffic-light' style is applied, while SIMPLE
 corresponds to the 'simplified style'.  Optional TRAFFIC-DEUTERAN
 is an alternative to TRAFFIC, meant for deuteranopia."
-  (pcase (modus-themes--key-cdr 'habit modus-themes-org-agenda)
-    ('traffic-light (list :background traffic))
-    ('traffic-light-deuteranopia (list :background (or traffic-deuteran 
traffic)))
-    ('simplified (list :background simple))
-    (_ (list :background default))))
+  (if modus-themes-deuteranopia
+      (list :background (or traffic-deuteran traffic))
+    (pcase (modus-themes--key-cdr 'habit modus-themes-org-agenda)
+      ('traffic-light (list :background traffic))
+      ('simplified (list :background simple))
+      (_ (list :background default)))))
 
 (defun modus-themes--org-block (bgblk fgdefault &optional fgblk)
   "Conditionally set the background of Org blocks.
@@ -3625,15 +3526,8 @@ set to `rainbow'."
     ('gray-background (list :background bg :foreground fg :extend t))
     ('grayscale (list :background bg :foreground fg :extend t))
     ('greyscale (list :background bg :foreground fg :extend t))
-    ('rainbow (list :background bgaccent :foreground fgaccent))
-    (_ (list :background bg :foreground fg))))
-
-(defun modus-themes--mode-line-padding ()
-  "Determine mode line padding value.
-See `modus-themes--mode-line-attrs'."
-  (if (natnump modus-themes-mode-line-padding)
-      modus-themes-mode-line-padding
-    6))                                 ; the default value
+    ('rainbow (list :background bgaccent :foreground fgaccent :extend nil))
+    (_ (list :background bg :foreground fg :extend nil))))
 
 (defun modus-themes--mode-line-attrs
     (fg bg fg-alt bg-alt fg-accent bg-accent border border-3d &optional 
alt-style fg-distant)
@@ -3651,91 +3545,85 @@ line's box property.
 Optional FG-DISTANT should be close to the main background
 values.  It is intended to be used as a distant-foreground
 property."
-  (let ((padding (modus-themes--mode-line-padding))
-        (modus-themes-mode-line
-         (if (listp modus-themes-mode-line)
-             modus-themes-mode-line
-           ;; translation layer for legacy values
-           (alist-get modus-themes-mode-line
-                      '((3d . (3d))
-                        (moody . (moody))
-                        (borderless . (borderless))
-                        (borderless-3d . (borderless 3d))
-                        (borderless-moody . (borderless moody))
-                        (accented . (accented))
-                        (accented-3d . (accented 3d))
-                        (accented-moody . (accented moody))
-                        (borderless-accented . (borderless accented))
-                        (borderless-accented-3d . (borderless accented 3d))
-                        (borderless-accented-moody . (borderless accented 
moody)))))))
-    (let ((base (cond ((memq 'accented modus-themes-mode-line)
-                       (cons fg-accent bg-accent))
-                      ((and (or (memq 'moody modus-themes-mode-line)
-                                (memq '3d modus-themes-mode-line))
-                            (not (memq 'borderless modus-themes-mode-line)))
-                       (cons fg-alt bg-alt))
-                      ((cons fg bg))))
-          (box (cond ((memq 'moody modus-themes-mode-line)
+  (let* ((properties
+          (if (listp modus-themes-mode-line)
+              modus-themes-mode-line
+            ;; translation layer for legacy values
+            (alist-get modus-themes-mode-line
+                       '((3d . (3d))
+                         (moody . (moody))
+                         (borderless . (borderless))
+                         (borderless-3d . (borderless 3d))
+                         (borderless-moody . (borderless moody))
+                         (accented . (accented))
+                         (accented-3d . (accented 3d))
+                         (accented-moody . (accented moody))
+                         (borderless-accented . (borderless accented))
+                         (borderless-accented-3d . (borderless accented 3d))
+                         (borderless-accented-moody . (borderless accented 
moody))))))
+         (padding (seq-find #'natnump properties 1))
+         (padded (> padding 1))
+         (base (cond ((memq 'accented properties)
+                      (cons fg-accent bg-accent))
+                     ((and (or (memq 'moody properties)
+                               (memq '3d properties))
+                           (not (memq 'borderless properties)))
+                      (cons fg-alt bg-alt))
+                     ((cons fg bg))))
+         (line (cond ((not (or (memq 'moody properties) padded))
+                      'unspecified)
+                     ((and (not (memq 'moody properties))
+                           padded
+                           (memq 'borderless properties))
                       'unspecified)
-                     ((and (memq '3d modus-themes-mode-line)
-                           (memq 'padded modus-themes-mode-line))
-                      (list :line-width padding
-                            :color
-                            (cond ((and (memq 'accented modus-themes-mode-line)
-                                        (memq 'borderless 
modus-themes-mode-line))
-                                   bg-accent)
-                                  ((or (memq 'accented modus-themes-mode-line)
-                                       (memq 'borderless 
modus-themes-mode-line))
-                                   bg)
-                                  (bg-alt))
-                            :style (when alt-style 'released-button)))
-                     ((and (memq 'accented modus-themes-mode-line)
-                           (memq 'padded modus-themes-mode-line))
-                      (list :line-width padding :color bg-accent))
-                     ((memq 'padded modus-themes-mode-line)
-                      (list :line-width padding :color bg))
-                     ((memq '3d modus-themes-mode-line)
-                      (list :line-width 1
-                            :color
-                            (cond ((and (memq 'accented modus-themes-mode-line)
-                                        (memq 'borderless 
modus-themes-mode-line))
-                                   bg-accent)
-                                  ((memq 'borderless modus-themes-mode-line) 
bg)
-                                  (border-3d))
-                            :style (when alt-style 'released-button)))
-                     ((and (memq 'accented modus-themes-mode-line)
-                           (memq 'borderless modus-themes-mode-line))
+                     ((and (memq 'borderless properties)
+                           (memq 'accented properties))
                       bg-accent)
-                     ((memq 'borderless modus-themes-mode-line)
+                     ((memq 'borderless properties)
                       bg)
-                     ((memq 'padded modus-themes-mode-line)
-                      (list :line-width padding :color bg))
-                     (border)))
-          (line (cond ((not (or (memq 'moody modus-themes-mode-line)
-                                (memq 'padded modus-themes-mode-line)))
-                       'unspecified)
-                      ((and (memq 'borderless modus-themes-mode-line)
-                            (memq 'accented modus-themes-mode-line))
-                       bg-accent)
-                      ((memq 'borderless modus-themes-mode-line)
-                       bg)
-                      (border))))
-      (list :foreground (car base)
-            :background (cdr base)
-            :box box
-            :overline line
-            :underline line
-            :distant-foreground
-            (when (memq 'moody modus-themes-mode-line)
-              fg-distant)))))
-
-(defun modus-themes--diff
-    (fg-only-bg fg-only-fg mainbg mainfg altbg altfg &optional deuteranbg 
deuteranfg  bg-only-fg)
-  "Color combinations for `modus-themes-diffs'.
+                     (border))))
+    (list :foreground (car base)
+          :background (cdr base)
+          :box
+          (cond ((memq 'moody properties)
+                 'unspecified)
+                ((and (memq '3d properties) padded)
+                 (list :line-width padding
+                       :color
+                       (cond ((and (memq 'accented properties)
+                                   (memq 'borderless properties))
+                              bg-accent)
+                             ((or (memq 'accented properties)
+                                  (memq 'borderless properties))
+                              bg)
+                             (bg-alt))
+                       :style (when alt-style 'released-button)))
+                ((and (memq 'accented properties) padded)
+                 (list :line-width padding :color bg-accent))
+                ((memq '3d properties)
+                 (list :line-width padding
+                       :color
+                       (cond ((and (memq 'accented properties)
+                                   (memq 'borderless properties))
+                              bg-accent)
+                             ((memq 'borderless properties) bg)
+                             (border-3d))
+                       :style (when alt-style 'released-button)))
+                ((and (memq 'accented properties)
+                      (memq 'borderless properties))
+                 (list :line-width padding :color bg-accent))
+                ((or (memq 'borderless properties) padded)
+                 (list :line-width padding :color bg))
+                (border))
+          :overline line
+          :underline line
+          :distant-foreground
+          (if (memq 'moody properties)
+              fg-distant
+            'unspecified))))
 
-FG-ONLY-BG should be similar or the same as the main background.
-FG-ONLY-FG should be a saturated accent value that can be
-combined with the former.
+(defun modus-themes--diff (mainbg mainfg altbg altfg &optional deuteranbg 
deuteranfg  bg-only-fg)
+  "Color combinations for `modus-themes-diffs'.
 
 MAINBG must be one of the dedicated backgrounds for diffs while
 MAINFG must be the same for the foreground.
@@ -3749,27 +3637,16 @@ for red-green color defficiency (deuteranopia).
 
 Optional BG-ONLY-FG applies ALTFG else leaves the foreground
 unspecified."
-  (pcase modus-themes-diffs
-    ('fg-only (list :background fg-only-bg :foreground fg-only-fg))
-    ('fg-only-deuteranopia (list :background fg-only-bg :foreground 
fg-only-fg))
-    ('desaturated (list :background altbg :foreground altfg))
-    ('deuteranopia (list :background (or deuteranbg mainbg) :foreground (or 
deuteranfg mainfg)))
-    ('bg-only (list :background altbg :foreground (if bg-only-fg altfg 
'unspecified)))
-    (_ (list :background mainbg :foreground mainfg))))
-
-(defun modus-themes--diff-deuteran (deuteran main)
-  "Determine whether the DEUTERAN or MAIN color should be used.
-This is based on whether `modus-themes-diffs' has the value
-`deuteranopia'."
-  (if (or (eq modus-themes-diffs 'deuteranopia)
-          (eq modus-themes-diffs 'fg-only-deuteranopia)
-          (eq modus-themes-diffs 'fg-only))
-      (list deuteran)
-    (list main)))
-
-(defun modus-themes--success-deuteran (deuteran main)
+  (if modus-themes-deuteranopia
+      (list :background (or deuteranbg mainbg) :foreground (or deuteranfg 
mainfg))
+    (pcase modus-themes-diffs
+      ('desaturated (list :background altbg :foreground altfg))
+      ('bg-only (list :background altbg :foreground (if bg-only-fg altfg 
'unspecified)))
+      (_ (list :background mainbg :foreground mainfg)))))
+
+(defun modus-themes--deuteran (deuteran main)
   "Determine whether to color-code success as DEUTERAN or MAIN."
-  (if modus-themes-success-deuteranopia
+  (if modus-themes-deuteranopia
       (list deuteran)
     (list main)))
 
@@ -3813,7 +3690,7 @@ FG is the link's default color for its text and underline
 property.  FGFAINT is a desaturated color for the text and
 underline.  UNDERLINE is a gray color only for the undeline.  BG
 is a background color and BGNEUTRAL is its fallback value."
-  (let ((modus-themes-links
+  (let ((properties
          (if (listp modus-themes-links)
              modus-themes-links
            ;; translation layer for legacy values
@@ -3826,42 +3703,42 @@ is a background color and BGNEUTRAL is its fallback 
value."
              ('neutral-underline-only '(no-color neutral-underline))))))
     (list :inherit
           (cond
-           ((and (memq 'bold modus-themes-links)
-                 (memq 'italic modus-themes-links))
+           ((and (memq 'bold properties)
+                 (memq 'italic properties))
             'bold-italic)
-           ((memq 'italic modus-themes-links)
+           ((memq 'italic properties)
             'italic)
-           ((memq 'bold modus-themes-links)
+           ((memq 'bold properties)
             'bold)
            ('unspecified))
           :background
           (cond
-           ((and (memq 'no-color modus-themes-links)
-                 (memq 'no-underline modus-themes-links))
+           ((and (memq 'no-color properties)
+                 (memq 'no-underline properties))
             bgneutral)
-           ((memq 'background modus-themes-links)
+           ((memq 'background properties)
             bg)
            ('unspecified))
           :foreground
           (cond
-           ((memq 'no-color modus-themes-links)
+           ((memq 'no-color properties)
             'unspecified)
-           ((memq 'faint modus-themes-links)
+           ((memq 'faint properties)
             fgfaint)
            (fg))
           :underline
           (cond
-           ((memq 'no-underline modus-themes-links)
+           ((memq 'no-underline properties)
             'unspecified)
-           ((memq 'neutral-underline modus-themes-links)
+           ((memq 'neutral-underline properties)
             underline)
            (t)))))
 
 (defun modus-themes--link-color (fg fgfaint &optional neutralfg)
-  "Extends `modus-themes--link'.
+  "Extend `modus-themes--link'.
 FG is the main accented foreground.  FGFAINT is also accented,
 yet desaturated.  Optional NEUTRALFG is a gray value."
-  (let ((modus-themes-links
+  (let ((properties
          (if (listp modus-themes-links)
              modus-themes-links
            ;; translation layer for legacy values
@@ -3874,25 +3751,19 @@ yet desaturated.  Optional NEUTRALFG is a gray value."
              ('neutral-underline-only '(no-color neutral-underline))))))
     (list :foreground
           (cond
-           ((memq 'no-color modus-themes-links)
+           ((memq 'no-color properties)
             (or neutralfg 'unspecified))
-           ((memq 'faint modus-themes-links)
+           ((memq 'faint properties)
             fgfaint)
            (fg))
           :underline
           (cond
-           ((memq 'no-underline modus-themes-links)
+           ((memq 'no-underline properties)
             'unspecified)
-           ((memq 'neutral-underline modus-themes-links)
+           ((memq 'neutral-underline properties)
             (or neutralfg 'unspecified))
            (t)))))
 
-(defun modus-themes--scale (amount)
-  "Scale heading by AMOUNT.
-AMOUNT is a customization option."
-  (when modus-themes-scale-headings
-    (list :height amount)))
-
 (defun modus-themes--region (bg fg bgsubtle bgaccent bgaccentsubtle)
   "Apply `modus-themes-region' styles.
 
@@ -3901,7 +3772,7 @@ is a subtle background value that can be combined with 
all colors
 used to fontify text and code syntax.  BGACCENT is a colored
 background that combines well with FG.  BGACCENTSUBTLE can be
 combined with all colors used to fontify text."
-  (let ((modus-themes-region
+  (let ((properties
          (if (listp modus-themes-region)
              modus-themes-region
            ;; translation layer for legacy values
@@ -3913,25 +3784,25 @@ combined with all colors used to fontify text."
              ('no-extend '(no-extend))))))
     (list :background
           (cond
-           ((and (memq 'accented modus-themes-region)
-                 (memq 'bg-only modus-themes-region))
+           ((and (memq 'accented properties)
+                 (memq 'bg-only properties))
             bgaccentsubtle)
-           ((memq 'accented modus-themes-region)
+           ((memq 'accented properties)
             bgaccent)
-           ((memq 'bg-only modus-themes-region)
+           ((memq 'bg-only properties)
             bgsubtle)
            (bg))
           :foreground
           (cond
-           ((and (memq 'accented modus-themes-region)
-                 (memq 'bg-only modus-themes-region))
+           ((and (memq 'accented properties)
+                 (memq 'bg-only properties))
             'unspecified)
-           ((memq 'bg-only modus-themes-region)
+           ((memq 'bg-only properties)
             'unspecified)
            (fg))
           :extend
           (cond
-           ((memq 'no-extend modus-themes-region)
+           ((memq 'no-extend properties)
             nil)
            (t)))))
 
@@ -3946,7 +3817,7 @@ LINEACCENT are color values that can remain distinct 
against the
 buffer's possible backgrounds: the former is neutral, the latter
 is accented.  LINENEUTRALINTENSE and LINEACCENTINTENSE are their
 more prominent alternatives."
-  (let ((modus-themes-hl-line
+  (let ((properties
          (if (listp modus-themes-hl-line)
              modus-themes-hl-line
            ;; translation layer for legacy values
@@ -3959,28 +3830,28 @@ more prominent alternatives."
              ('underline-only-accented '(underline accented))))))
     (list :background
           (cond
-           ((and (memq 'intense modus-themes-hl-line)
-                 (memq 'accented modus-themes-hl-line))
+           ((and (memq 'intense properties)
+                 (memq 'accented properties))
             bgaccent)
-           ((memq 'accented modus-themes-hl-line)
+           ((memq 'accented properties)
             bgaccentsubtle)
-           ((memq 'intense modus-themes-hl-line)
+           ((memq 'intense properties)
             bgintense)
            (bgdefault))
           :underline
           (cond
-           ((and (memq 'intense modus-themes-hl-line)
-                 (memq 'accented modus-themes-hl-line)
-                 (memq 'underline modus-themes-hl-line))
+           ((and (memq 'intense properties)
+                 (memq 'accented properties)
+                 (memq 'underline properties))
             lineaccentintense)
-           ((and (memq 'accented modus-themes-hl-line)
-                 (memq 'underline modus-themes-hl-line))
+           ((and (memq 'accented properties)
+                 (memq 'underline properties))
             lineaccent)
-           ((and (memq 'intense modus-themes-hl-line)
-                 (memq 'underline modus-themes-hl-line))
+           ((and (memq 'intense properties)
+                 (memq 'underline properties))
             lineneutralintense)
-           ((or (memq 'no-background modus-themes-hl-line)
-                (memq 'underline modus-themes-hl-line))
+           ((or (memq 'no-background properties)
+                (memq 'underline properties))
             lineneutral)
            ('unspecified)))))
 
@@ -4240,66 +4111,72 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     ;; intended for `diff-mode' or equivalent
     `(modus-themes-diff-added
       ((,class ,@(modus-themes--diff
-                  bg-main blue-alt-other
                   bg-diff-focus-added fg-diff-focus-added
                   green-nuanced-bg fg-diff-added
                   bg-diff-focus-added-deuteran fg-diff-focus-added-deuteran))))
     `(modus-themes-diff-changed
       ((,class ,@(modus-themes--diff
-                  bg-main yellow
                   bg-diff-focus-changed fg-diff-focus-changed
                   yellow-nuanced-bg fg-diff-changed))))
     `(modus-themes-diff-removed
       ((,class ,@(modus-themes--diff
-                  bg-main red
                   bg-diff-focus-removed fg-diff-focus-removed
                   red-nuanced-bg fg-diff-removed))))
     `(modus-themes-diff-refine-added
       ((,class ,@(modus-themes--diff
-                  bg-diff-added-deuteran fg-diff-added-deuteran
                   bg-diff-refine-added fg-diff-refine-added
                   bg-diff-focus-added fg-diff-focus-added
                   bg-diff-refine-added-deuteran 
fg-diff-refine-added-deuteran))))
     `(modus-themes-diff-refine-changed
       ((,class ,@(modus-themes--diff
-                  bg-diff-changed fg-diff-changed
                   bg-diff-refine-changed fg-diff-refine-changed
                   bg-diff-focus-changed fg-diff-focus-changed))))
     `(modus-themes-diff-refine-removed
       ((,class ,@(modus-themes--diff
-                  bg-diff-removed fg-diff-removed
                   bg-diff-refine-removed fg-diff-refine-removed
                   bg-diff-focus-removed fg-diff-focus-removed))))
     `(modus-themes-diff-focus-added
       ((,class ,@(modus-themes--diff
-                  bg-dim blue-alt-other
                   bg-diff-focus-added fg-diff-focus-added
                   bg-diff-added fg-diff-added
                   bg-diff-focus-added-deuteran fg-diff-focus-added-deuteran))))
     `(modus-themes-diff-focus-changed
       ((,class ,@(modus-themes--diff
-                  bg-dim yellow
                   bg-diff-focus-changed fg-diff-focus-changed
                   bg-diff-changed fg-diff-changed))))
     `(modus-themes-diff-focus-removed
       ((,class ,@(modus-themes--diff
-                  bg-dim red
                   bg-diff-focus-removed fg-diff-focus-removed
                   bg-diff-removed fg-diff-removed))))
     `(modus-themes-diff-heading
       ((,class ,@(modus-themes--diff
-                  bg-alt fg-main
                   bg-diff-heading fg-diff-heading
                   cyan-nuanced-bg cyan-nuanced-fg
                   bg-header fg-main
                   t))))
+;;;;; deuteranopia-specific
+    `(modus-themes-grue ((,class :foreground ,@(modus-themes--deuteran blue 
green))))
+    `(modus-themes-grue-active ((,class :foreground ,@(modus-themes--deuteran 
blue-active green-active))))
+    `(modus-themes-grue-nuanced ((,class :foreground ,@(modus-themes--deuteran 
blue-nuanced-fg green-nuanced-fg))))
+    `(modus-themes-grue-background-active ((,class :inherit 
,@(modus-themes--deuteran
+                                                               
'modus-themes-fringe-blue
+                                                               
'modus-themes-fringe-green))))
+    `(modus-themes-grue-background-intense ((,class :inherit 
,@(modus-themes--deuteran
+                                                                
'modus-themes-intense-blue
+                                                                
'modus-themes-intense-green))))
+    `(modus-themes-grue-background-subtle ((,class :inherit 
,@(modus-themes--deuteran
+                                                               
'modus-themes-subtle-blue
+                                                               
'modus-themes-subtle-green))))
+    `(modus-themes-grue-background-subtle ((,class :inherit 
,@(modus-themes--deuteran
+                                                               
'modus-themes-refine-blue
+                                                               
'modus-themes-refine-green))))
 ;;;;; mark indicators
     ;; color combinations intended for Dired, Ibuffer, or equivalent
     `(modus-themes-pseudo-header ((,class :inherit bold :foreground ,fg-main)))
     `(modus-themes-mark-alt ((,class :inherit bold :background ,bg-mark-alt 
:foreground ,fg-mark-alt)))
     `(modus-themes-mark-del ((,class :inherit bold :background ,bg-mark-del 
:foreground ,fg-mark-del)))
     `(modus-themes-mark-sel ((,class :inherit bold
-                                     :background 
,@(modus-themes--success-deuteran
+                                     :background ,@(modus-themes--deuteran
                                                     cyan-refine-bg
                                                     bg-mark-sel)
                                      :foreground ,fg-mark-sel)))
@@ -4309,23 +4186,19 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(modus-themes-heading-1
       ((,class ,@(modus-themes--heading
                   1 fg-main magenta-alt-other
-                  magenta-nuanced-bg bg-alt bg-region)
-               ,@(modus-themes--scale modus-themes-scale-4))))
+                  magenta-nuanced-bg bg-alt bg-region))))
     `(modus-themes-heading-2
       ((,class ,@(modus-themes--heading
                   2 fg-special-warm magenta-alt
-                  red-nuanced-bg bg-alt bg-region)
-               ,@(modus-themes--scale modus-themes-scale-3))))
+                  red-nuanced-bg bg-alt bg-region))))
     `(modus-themes-heading-3
       ((,class ,@(modus-themes--heading
                   3 fg-special-cold blue
-                  blue-nuanced-bg bg-alt bg-region)
-               ,@(modus-themes--scale modus-themes-scale-2))))
+                  blue-nuanced-bg bg-alt bg-region))))
     `(modus-themes-heading-4
       ((,class ,@(modus-themes--heading
                   4 fg-special-mild cyan
-                  cyan-nuanced-bg bg-alt bg-region)
-               ,@(modus-themes--scale modus-themes-scale-1))))
+                  cyan-nuanced-bg bg-alt bg-region))))
     `(modus-themes-heading-5
       ((,class ,@(modus-themes--heading
                   5 fg-special-calm green-alt-other
@@ -4365,6 +4238,13 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(modus-themes-lang-warning ((,class ,@(modus-themes--lang-check
                                             fg-lang-underline-warning 
fg-lang-warning
                                             yellow yellow-refine-fg 
yellow-nuanced-bg yellow-refine-bg yellow-faint))))
+;;;;; links
+    `(modus-themes-link-broken ((,class :inherit button 
,@(modus-themes--link-color red red-faint))))
+    `(modus-themes-link-symlink ((,class :inherit button 
,@(modus-themes--link-color cyan cyan-faint))))
+;;;;; tabs
+    `(modus-themes-tab-active ((,class ,@(modus-themes--tab bg-tab-active nil 
nil nil t t))))
+    `(modus-themes-tab-backdrop ((,class ,@(modus-themes--tab bg-active 
bg-active-accent nil nil nil nil t))))
+    `(modus-themes-tab-inactive ((,class ,@(modus-themes--tab bg-tab-inactive 
bg-tab-inactive-accent fg-dim nil t))))
 ;;;;; other custom faces
     `(modus-themes-bold ((,class ,@(modus-themes--bold-weight))))
     `(modus-themes-hl-line ((,class ,@(modus-themes--hl-line
@@ -4384,18 +4264,21 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(modus-themes-reset-soft ((,class :background ,bg-main :foreground 
,fg-main
                                        :weight normal :slant normal 
:strike-through nil
                                        :box nil :underline nil :overline nil 
:extend nil)))
-    `(modus-themes-search-success ((,class :inherit 
,@(modus-themes--success-deuteran
+    `(modus-themes-search-success ((,class :inherit ,@(modus-themes--deuteran
                                                        
'modus-themes-intense-blue
                                                        
'modus-themes-intense-green))))
-    `(modus-themes-search-success-lazy ((,class :inherit 
,@(modus-themes--success-deuteran
+    `(modus-themes-search-success-lazy ((,class :inherit 
,@(modus-themes--deuteran
                                                             
'modus-themes-special-mild
                                                             
'modus-themes-refine-cyan))))
-    `(modus-themes-search-success-modeline ((,class :foreground 
,@(modus-themes--success-deuteran
+    `(modus-themes-search-success-modeline ((,class :foreground 
,@(modus-themes--deuteran
                                                                    blue-active
                                                                    
green-active))))
     `(modus-themes-slant ((,class :inherit italic :slant 
,@(modus-themes--slant))))
-    `(modus-themes-variable-pitch ((,class ,@(modus-themes--variable-pitch))))
+    `(modus-themes-ui-variable-pitch ((,class 
,@(modus-themes--variable-pitch-ui))))
     `(modus-themes-fixed-pitch ((,class ,@(modus-themes--fixed-pitch))))
+    `(modus-themes-markup-verbatim ((,class :inherit modus-themes-fixed-pitch
+                                            ,@(modus-themes--markup 
fg-special-calm magenta-alt
+                                                                    bg-alt 
magenta-nuanced-bg))))
 ;;;; standard faces
 ;;;;; absolute essentials
     `(default ((,class :background ,bg-main :foreground ,fg-main)))
@@ -4413,7 +4296,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(error ((,class :inherit bold :foreground ,red)))
     `(escape-glyph ((,class :foreground ,fg-escape-char-construct)))
     `(file-name-shadow ((,class :inherit (shadow italic))))
-    `(header-line ((,class ,@(modus-themes--variable-pitch-ui)
+    `(header-line ((,class :inherit modus-themes-ui-variable-pitch
                            :background ,bg-header :foreground ,fg-header)))
     `(header-line-highlight ((,class :inherit modus-themes-active-blue)))
     `(help-argument-name ((,class :inherit modus-themes-slant :foreground 
,cyan)))
@@ -4434,7 +4317,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                               bg-region-accent-subtle))))
     `(secondary-selection ((,class :inherit modus-themes-special-cold)))
     `(shadow ((,class :foreground ,fg-alt)))
-    `(success ((,class :inherit bold :foreground 
,@(modus-themes--success-deuteran blue green))))
+    `(success ((,class :inherit (bold modus-themes-grue))))
     `(trailing-whitespace ((,class :background ,red-intense-bg)))
     `(warning ((,class :inherit bold :foreground ,yellow)))
 ;;;;; buttons, links, widgets
@@ -4452,9 +4335,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(widget-field ((,class :background ,bg-alt :foreground ,fg-dim)))
     `(widget-inactive ((,class :inherit shadow :background ,bg-dim)))
     `(widget-single-line-field ((,class :inherit widget-field)))
-;;;;; ag
-    `(ag-hit-face ((,class :foreground ,fg-special-cold)))
-    `(ag-match-face ((,class :inherit modus-themes-special-calm)))
 ;;;;; alert
     `(alert-high-face ((,class :inherit bold :foreground ,red-alt)))
     `(alert-low-face ((,class :foreground ,fg-special-mild)))
@@ -4530,62 +4410,45 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(anzu-replace-highlight ((,class :inherit modus-themes-refine-yellow 
:underline t)))
     `(anzu-replace-to ((,class :inherit (modus-themes-search-success bold))))
 ;;;;; apropos
-    `(apropos-button ((,class :inherit button
-                              ,@(modus-themes--link-color
-                                 magenta-alt-other magenta-alt-other-faint))))
-    `(apropos-function-button ((,class :inherit button
-                                       ,@(modus-themes--link-color
-                                          magenta magenta-faint))))
+    `(apropos-button ((,class :foreground ,magenta-alt-other)))
+    `(apropos-function-button ((,class :foreground ,magenta)))
     `(apropos-keybinding ((,class :inherit modus-themes-key-binding)))
-    `(apropos-misc-button ((,class :inherit button
-                                   ,@(modus-themes--link-color
-                                      green-alt-other green-alt-other-faint))))
+    `(apropos-misc-button ((,class :foreground ,green-alt-other)))
     `(apropos-property ((,class :inherit modus-themes-bold :foreground 
,magenta-alt)))
     `(apropos-symbol ((,class :inherit modus-themes-pseudo-header)))
-    `(apropos-user-option-button ((,class :inherit button
-                                          ,@(modus-themes--link-color
-                                             cyan cyan-faint))))
-    `(apropos-variable-button ((,class :inherit button
-                                       ,@(modus-themes--link-color
-                                          blue-alt blue-alt-faint))))
-;;;;; apt-sources-list
-    `(apt-sources-list-components ((,class :foreground ,cyan)))
-    `(apt-sources-list-options ((,class :foreground ,yellow)))
-    `(apt-sources-list-suite ((,class :foreground ,green)))
-    `(apt-sources-list-type ((,class :foreground ,magenta)))
-    `(apt-sources-list-uri ((,class :foreground ,blue)))
+    `(apropos-user-option-button ((,class :foreground ,cyan)))
+    `(apropos-variable-button ((,class :foreground ,blue-alt)))
 ;;;;; artbollocks-mode
     `(artbollocks-face ((,class :inherit modus-themes-lang-note)))
     `(artbollocks-lexical-illusions-face ((,class :background ,bg-alt 
:foreground ,red-alt :underline t)))
     `(artbollocks-passive-voice-face ((,class :inherit 
modus-themes-lang-warning)))
     `(artbollocks-weasel-words-face ((,class :inherit 
modus-themes-lang-error)))
 ;;;;; auctex and Tex
-    `(font-latex-bold-face ((,class :inherit bold :foreground 
,fg-special-calm)))
-    `(font-latex-doctex-documentation-face ((,class :inherit 
modus-themes-slant :foreground ,fg-special-cold)))
-    `(font-latex-doctex-preprocessor-face ((,class :inherit modus-themes-bold 
:foreground ,red-alt-other)))
+    `(font-latex-bold-face ((,class :inherit bold)))
+    `(font-latex-doctex-documentation-face ((,class :inherit 
font-lock-doc-face)))
+    `(font-latex-doctex-preprocessor-face ((,class :inherit 
font-lock-preprocessor-face)))
     `(font-latex-italic-face ((,class :inherit italic)))
-    `(font-latex-math-face ((,class :foreground ,cyan-alt-other)))
-    `(font-latex-script-char-face ((,class :foreground ,cyan-alt-other)))
-    `(font-latex-sectioning-0-face ((,class :inherit 
modus-themes-variable-pitch :foreground ,blue-nuanced-fg)))
-    `(font-latex-sectioning-1-face ((,class :inherit (bold 
modus-themes-variable-pitch) :foreground ,blue-nuanced-fg)))
-    `(font-latex-sectioning-2-face ((,class :inherit (bold 
modus-themes-variable-pitch) :foreground ,blue-nuanced-fg)))
-    `(font-latex-sectioning-3-face ((,class :inherit (bold 
modus-themes-variable-pitch) :foreground ,blue-nuanced-fg)))
-    `(font-latex-sectioning-4-face ((,class :inherit (bold 
modus-themes-variable-pitch) :foreground ,blue-nuanced-fg)))
-    `(font-latex-sectioning-5-face ((,class :inherit 
modus-themes-variable-pitch :foreground ,blue-nuanced-fg)))
-    `(font-latex-sedate-face ((,class :inherit modus-themes-bold :foreground 
,magenta-alt-other)))
-    `(font-latex-slide-title-face ((,class :inherit (bold 
modus-themes-variable-pitch) :foreground ,cyan-nuanced-fg
-                                           ,@(modus-themes--scale 
modus-themes-scale-4))))
+    `(font-latex-math-face ((,class :inherit font-lock-constant-face)))
+    `(font-latex-script-char-face ((,class :inherit font-lock-builtin-face)))
+    `(font-latex-sectioning-0-face ((,class :inherit modus-themes-heading-1)))
+    `(font-latex-sectioning-1-face ((,class :inherit modus-themes-heading-2)))
+    `(font-latex-sectioning-2-face ((,class :inherit modus-themes-heading-3)))
+    `(font-latex-sectioning-3-face ((,class :inherit modus-themes-heading-4)))
+    `(font-latex-sectioning-4-face ((,class :inherit modus-themes-heading-5)))
+    `(font-latex-sectioning-5-face ((,class :inherit modus-themes-heading-6)))
+    `(font-latex-sedate-face ((,class :inherit font-lock-keyword-face)))
+    `(font-latex-slide-title-face ((,class :inherit modus-themes-heading-1)))
     `(font-latex-string-face ((,class :inherit font-lock-string-face)))
     `(font-latex-subscript-face ((,class :height 0.95)))
     `(font-latex-superscript-face ((,class :height 0.95)))
     `(font-latex-verbatim-face ((,class :background ,bg-dim :foreground 
,fg-special-mild)))
     `(font-latex-warning-face ((,class :inherit font-lock-warning-face)))
     `(tex-match ((,class :foreground ,blue-alt-other)))
-    `(tex-verbatim ((,class :background ,bg-dim :foreground ,fg-special-mild)))
+    `(tex-verbatim ((,class :inherit modus-themes-markup-verbatim)))
     `(texinfo-heading ((,class :foreground ,magenta)))
     `(TeX-error-description-error ((,class :inherit error)))
-    `(TeX-error-description-help ((,class :foreground ,blue)))
-    `(TeX-error-description-tex-said ((,class :foreground ,blue)))
+    `(TeX-error-description-help ((,class :inherit success)))
+    `(TeX-error-description-tex-said ((,class :inherit success)))
     `(TeX-error-description-warning ((,class :inherit warning)))
 ;;;;; auto-dim-other-buffers
     `(auto-dim-other-buffers-face ((,class :background ,bg-alt)))
@@ -4653,10 +4516,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
 ;;;;; breakpoint (built-in gdb-mi.el)
     `(breakpoint-disabled ((,class :inherit shadow)))
     `(breakpoint-enabled ((,class :inherit bold :foreground ,red)))
-;;;;; buffer-expose
-    `(buffer-expose-ace-char-face ((,class :inherit bold :foreground 
,red-active)))
-    `(buffer-expose-mode-line-face ((,class :foreground ,cyan-active)))
-    `(buffer-expose-selected-face ((,class :inherit 
modus-themes-special-mild)))
 ;;;;; calendar and diary
     `(calendar-month-header ((,class :inherit modus-themes-pseudo-header)))
     `(calendar-today ((,class :inherit bold :underline t)))
@@ -4679,9 +4538,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(cfw:face-saturday ((,class :inherit bold :foreground ,cyan-alt-other)))
     `(cfw:face-select ((,class :inherit modus-themes-intense-blue)))
     `(cfw:face-sunday ((,class :inherit bold :foreground ,cyan-alt-other)))
-    `(cfw:face-title ((,class :inherit modus-themes-variable-pitch
-                              :foreground ,fg-special-cold
-                              ,@(modus-themes--scale 
modus-themes-scale-title))))
+    `(cfw:face-title ((,class :inherit modus-themes-heading-1 :background 
,bg-main :overline nil :foreground ,fg-special-cold)))
     `(cfw:face-today ((,class :background ,bg-inactive)))
     `(cfw:face-today-title ((,class :background ,bg-active)))
     `(cfw:face-toolbar ((,class :background ,bg-alt :foreground ,bg-alt)))
@@ -4696,9 +4553,9 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(centaur-tabs-modified-marker-selected ((,class :inherit 
centaur-tabs-selected)))
     `(centaur-tabs-modified-marker-unselected ((,class :inherit 
centaur-tabs-unselected)))
     `(centaur-tabs-default (( )))
-    `(centaur-tabs-selected ((,class ,@(modus-themes--tab bg-tab-active nil 
nil nil t t))))
+    `(centaur-tabs-selected ((,class :inherit modus-themes-tab-active)))
     `(centaur-tabs-selected-modified ((,class :inherit (italic 
centaur-tabs-selected))))
-    `(centaur-tabs-unselected ((,class ,@(modus-themes--tab bg-tab-inactive 
bg-tab-inactive-accent fg-dim nil t))))
+    `(centaur-tabs-unselected ((,class :inherit modus-themes-tab-inactive)))
     `(centaur-tabs-unselected-modified ((,class :inherit (italic 
centaur-tabs-unselected))))
 ;;;;; cfrs
     `(cfrs-border-color ((,class :background ,fg-window-divider-inner)))
@@ -4749,9 +4606,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                                        :background ,bg-alt 
:foreground ,fg-alt)))
     `(cider-test-error-face ((,class :inherit modus-themes-subtle-red)))
     `(cider-test-failure-face ((,class :inherit (modus-themes-intense-red 
bold))))
-    `(cider-test-success-face ((,class :inherit 
,@(modus-themes--success-deuteran
-                                                   'modus-themes-intense-blue
-                                                   
'modus-themes-intense-green))))
+    `(cider-test-success-face ((,class :inherit 
modus-themes-grue-background-intense)))
     `(cider-traced-face ((,class :box (:line-width -1 :color ,cyan :style nil) 
:background ,bg-dim)))
     `(cider-warning-highlight-face ((,class :foreground ,yellow :underline t)))
 ;;;;; circe (and lui)
@@ -4784,8 +4639,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(company-preview ((,class :background ,bg-dim :foreground ,fg-dim)))
     `(company-preview-common ((,class :foreground ,blue-alt)))
     `(company-preview-search ((,class :inherit modus-themes-special-calm)))
-    `(company-scrollbar-bg ((,class :background ,bg-active)))
-    `(company-scrollbar-fg ((,class :background ,fg-active)))
     `(company-template-field ((,class :inherit modus-themes-intense-magenta)))
     `(company-tooltip ((,class :background ,bg-alt :foreground ,fg-alt)))
     `(company-tooltip-annotation ((,class :inherit modus-themes-slant 
:foreground ,fg-special-cold)))
@@ -4794,6 +4647,8 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(company-tooltip-common-selection ((,class :foreground ,fg-main)))
     `(company-tooltip-deprecated ((,class :inherit company-tooltip 
:strike-through t)))
     `(company-tooltip-mouse ((,class :inherit modus-themes-intense-blue)))
+    `(company-tooltip-scrollbar-thumb ((,class :background ,fg-active)))
+    `(company-tooltip-scrollbar-track ((,class :background ,bg-active)))
     `(company-tooltip-search ((,class :inherit 
(modus-themes-search-success-lazy bold))))
     `(company-tooltip-search-selection ((,class :inherit 
(modus-themes-search-success bold) :underline t)))
     `(company-tooltip-selection ((,class :inherit (modus-themes-subtle-cyan 
bold))))
@@ -4858,8 +4713,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(counsel-css-selector-depth-face-4 ((,class :foreground ,yellow)))
     `(counsel-css-selector-depth-face-5 ((,class :foreground ,magenta)))
     `(counsel-css-selector-depth-face-6 ((,class :foreground ,red)))
-;;;;; counsel-org-capture-string
-    `(counsel-org-capture-string-template-body-face ((,class :foreground 
,fg-special-cold)))
 ;;;;; cov
     `(cov-coverage-not-run-face ((,class :foreground ,red-intense)))
     `(cov-coverage-run-face ((,class :foreground ,green-intense)))
@@ -4941,9 +4794,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(debbugs-gnu-stale-4 ((,class :foreground ,yellow-alt-other)))
     `(debbugs-gnu-stale-5 ((,class :foreground ,red-alt)))
     `(debbugs-gnu-tagged ((,class :foreground ,magenta-alt)))
-;;;;; define-word
-    `(define-word-face-1 ((,class :foreground ,yellow)))
-    `(define-word-face-2 ((,class :foreground ,fg-main)))
 ;;;;; deft
     `(deft-filter-string-error-face ((,class :inherit 
modus-themes-refine-red)))
     `(deft-filter-string-face ((,class :foreground ,green-intense)))
@@ -4965,9 +4815,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(diff-hl-dired-ignored ((,class :inherit dired-ignored)))
     `(diff-hl-dired-insert ((,class :inherit diff-hl-insert)))
     `(diff-hl-dired-unknown ((,class :inherit dired-ignored)))
-    `(diff-hl-insert ((,class :inherit ,@(modus-themes--diff-deuteran
-                                          'modus-themes-fringe-blue
-                                          'modus-themes-fringe-green))))
+    `(diff-hl-insert ((,class :inherit modus-themes-grue-background-active)))
     `(diff-hl-reverted-hunk-highlight ((,class :background ,fg-main 
:foreground ,bg-main)))
 ;;;;; diff-mode
     `(diff-added ((,class :inherit modus-themes-diff-added)))
@@ -4979,8 +4827,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(diff-header ((,class :foreground ,fg-main)))
     `(diff-hunk-header ((,class :inherit (bold modus-themes-diff-heading))))
     `(diff-index ((,class :inherit bold :foreground ,blue-alt)))
-    `(diff-indicator-added ((,class :inherit (diff-added bold)
-                                    :foreground ,@(modus-themes--diff-deuteran 
blue green))))
+    `(diff-indicator-added ((,class :inherit (modus-themes-grue diff-added 
bold))))
     `(diff-indicator-changed ((,class :inherit (diff-changed bold) :foreground 
,yellow)))
     `(diff-indicator-removed ((,class :inherit (diff-removed bold) :foreground 
,red)))
     `(diff-nonexistent ((,class :inherit (modus-themes-neutral bold))))
@@ -5008,13 +4855,11 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(dir-treeview-indent-face ((,class :inherit shadow)))
     `(dir-treeview-label-mouse-face ((,class :inherit highlight)))
     `(dir-treeview-start-dir-face ((,class :inherit 
modus-themes-pseudo-header)))
-    `(dir-treeview-symlink-face ((,class :inherit button
-                                         ,@(modus-themes--link-color
-                                            cyan cyan-faint))))
+    `(dir-treeview-symlink-face ((,class :inherit modus-themes-link-symlink)))
     `(dir-treeview-video-face ((,class :foreground ,magenta-alt-other)))
     `(dir-treeview-video-icon-face ((,class :inherit 
dir-treeview-default-icon-face :foreground ,magenta-alt-other)))
 ;;;;; dired
-    `(dired-broken-symlink ((,class :inherit button :foreground ,red)))
+    `(dired-broken-symlink ((,class :inherit modus-themes-link-broken)))
     `(dired-directory ((,class :foreground ,blue)))
     `(dired-flagged ((,class :inherit modus-themes-mark-del)))
     `(dired-header ((,class :inherit modus-themes-pseudo-header)))
@@ -5022,9 +4867,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(dired-mark ((,class :inherit modus-themes-mark-symbol)))
     `(dired-marked ((,class :inherit modus-themes-mark-sel)))
     `(dired-perm-write ((,class :foreground ,fg-special-warm)))
-    `(dired-symlink ((,class :inherit button
-                             ,@(modus-themes--link-color
-                                cyan-alt cyan-alt-faint))))
+    `(dired-symlink ((,class :inherit modus-themes-link-symlink)))
     `(dired-warning ((,class :inherit bold :foreground ,yellow)))
 ;;;;; dired-async
     `(dired-async-failures ((,class :inherit bold :foreground ,red-active)))
@@ -5048,11 +4891,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(dired-subtree-depth-4-face (()))
     `(dired-subtree-depth-5-face (()))
     `(dired-subtree-depth-6-face (()))
-;;;;; diredc
-    `(diredc-face-chmod-font-lock-dir ((,class :foreground ,blue-alt)))
-    `(diredc-face-chmod-font-lock-exec ((,class :foreground ,magenta)))
-    `(diredc-face-chmod-font-lock-read ((,class :foreground ,fg-main)))
-    `(diredc-face-chmod-font-lock-write ((,class :foreground ,cyan)))
 ;;;;; diredfl
     `(diredfl-autofile-name ((,class :inherit modus-themes-special-cold)))
     `(diredfl-compressed-file-name ((,class :foreground ,fg-special-warm)))
@@ -5108,13 +4946,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(diredp-symlink ((,class :inherit dired-symlink)))
     `(diredp-tagged-autofile-name ((,class :inherit 
modus-themes-refine-magenta)))
     `(diredp-write-priv ((,class :foreground ,cyan)))
-;;;;; disk-usage
-    `(disk-usage-children ((,class :foreground ,yellow)))
-    `(disk-usage-inaccessible ((,class :inherit bold :foreground ,red)))
-    `(disk-usage-percent ((,class :foreground ,green)))
-    `(disk-usage-size ((,class :foreground ,cyan)))
-    `(disk-usage-symlink ((,class :inherit button)))
-    `(disk-usage-symlink-directory ((,class :inherit bold :foreground 
,blue-alt)))
 ;;;;; display-fill-column-indicator-mode
     `(fill-column-indicator ((,class :foreground ,bg-active)))
 ;;;;; doom-modeline
@@ -5145,9 +4976,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(doom-modeline-host ((,class :inherit italic)))
     `(doom-modeline-info ((,class :foreground ,green-active)))
     `(doom-modeline-lsp-error ((,class :inherit bold :foreground ,red-active)))
-    `(doom-modeline-lsp-success ((,class :inherit bold :foreground 
,@(modus-themes--success-deuteran
-                                                                      
blue-active
-                                                                      
green-active))))
+    `(doom-modeline-lsp-success ((,class :inherit (bold 
modus-themes-grue-active))))
     `(doom-modeline-lsp-warning ((,class :inherit bold :foreground 
,yellow-active)))
     `(doom-modeline-panel ((,class :inherit modus-themes-active-blue)))
     `(doom-modeline-persp-buffer-not-in-persp ((,class :inherit italic 
:foreground ,yellow-active)))
@@ -5163,9 +4992,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(dynamic-ruler-positive-face ((,class :inherit 
modus-themes-intense-yellow)))
 ;;;;; easy-jekyll
     `(easy-jekyll-help-face ((,class :background ,bg-dim :foreground 
,cyan-alt-other)))
-;;;;; easy-kill
-    `(easy-kill-origin ((,class :inherit modus-themes-subtle-red)))
-    `(easy-kill-selection ((,class :inherit modus-themes-subtle-yellow)))
 ;;;;; ebdb
     `(ebdb-address-default ((,class :foreground ,fg-special-calm)))
     `(ebdb-defunct ((,class :inherit shadow)))
@@ -5181,7 +5007,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
 ;;;;; ediff
     `(ediff-current-diff-A ((,class :inherit modus-themes-diff-removed)))
     `(ediff-current-diff-Ancestor ((,class ,@(modus-themes--diff
-                                              bg-alt fg-special-cold
                                               bg-special-cold fg-special-cold
                                               blue-nuanced-bg blue))))
     `(ediff-current-diff-B ((,class :inherit modus-themes-diff-added)))
@@ -5238,12 +5063,12 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
 ;;;;; embark
     `(embark-keybinding ((,class :inherit modus-themes-key-binding)))
 ;;;;; emms
-    `(emms-browser-album-face ((,class :foreground ,magenta-alt-other 
,@(modus-themes--scale modus-themes-scale-2))))
-    `(emms-browser-artist-face ((,class :foreground ,cyan 
,@(modus-themes--scale modus-themes-scale-3))))
-    `(emms-browser-composer-face ((,class :foreground ,magenta-alt 
,@(modus-themes--scale modus-themes-scale-3))))
+    `(emms-browser-album-face ((,class :foreground ,magenta-alt-other)))
+    `(emms-browser-artist-face ((,class :foreground ,cyan)))
+    `(emms-browser-composer-face ((,class :foreground ,magenta-alt)))
     `(emms-browser-performer-face ((,class :inherit emms-browser-artist-face)))
     `(emms-browser-track-face ((,class :inherit emms-playlist-track-face)))
-    `(emms-browser-year/genre-face ((,class :foreground ,cyan-alt-other 
,@(modus-themes--scale modus-themes-scale-4))))
+    `(emms-browser-year/genre-face ((,class :foreground ,cyan-alt-other)))
     `(emms-playlist-track-face ((,class :foreground ,blue-alt)))
     `(emms-playlist-selected-face ((,class :inherit bold :foreground 
,blue-alt-other)))
     `(emms-metaplaylist-mode-current-face ((,class :inherit 
emms-playlist-selected-face)))
@@ -5275,28 +5100,28 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(equake-tab-active ((,class :background ,fg-alt :foreground ,bg-alt)))
     `(equake-tab-inactive ((,class :foreground ,fg-inactive)))
 ;;;;; erc
-    `(erc-action-face ((,class :inherit bold :foreground ,cyan)))
+    `(erc-action-face ((,class :foreground ,cyan-alt-other)))
     `(erc-bold-face ((,class :inherit bold)))
     `(erc-button ((,class :inherit button)))
     `(erc-command-indicator-face ((,class :inherit bold :foreground 
,cyan-alt)))
-    `(erc-current-nick-face ((,class :foreground ,magenta-alt-other)))
+    `(erc-current-nick-face ((,class :inherit bold :foreground ,red-alt)))
     `(erc-dangerous-host-face ((,class :inherit modus-themes-intense-red)))
-    `(erc-direct-msg-face ((,class :foreground ,magenta)))
+    `(erc-direct-msg-face ((,class :foreground ,fg-special-warm)))
     `(erc-error-face ((,class :inherit bold :foreground ,red)))
-    `(erc-fool-face ((,class :foreground ,fg-inactive)))
+    `(erc-fool-face ((,class :inherit shadow)))
     `(erc-header-line ((,class :background ,bg-header :foreground ,fg-header)))
-    `(erc-input-face ((,class :foreground ,fg-special-calm)))
+    `(erc-input-face ((,class :foreground ,magenta)))
     `(erc-inverse-face ((,class :inherit erc-default-face :inverse-video t)))
-    `(erc-keyword-face ((,class :inherit bold :foreground ,magenta-alt)))
+    `(erc-keyword-face ((,class :inherit bold :foreground ,magenta-alt-other)))
     `(erc-my-nick-face ((,class :inherit bold :foreground ,magenta)))
     `(erc-my-nick-prefix-face ((,class :inherit erc-my-nick-face)))
     `(erc-nick-default-face ((,class :inherit bold :foreground ,blue)))
-    `(erc-nick-msg-face ((,class :inherit bold :foreground ,green)))
+    `(erc-nick-msg-face ((,class :inherit warning)))
     `(erc-nick-prefix-face ((,class :inherit erc-nick-default-face)))
-    `(erc-notice-face ((,class :foreground ,fg-unfocused)))
-    `(erc-pal-face ((,class :inherit bold :foreground ,red-alt)))
+    `(erc-notice-face ((,class :inherit font-lock-comment-face)))
+    `(erc-pal-face ((,class :inherit bold :foreground ,magenta-alt)))
     `(erc-prompt-face ((,class :inherit modus-themes-prompt)))
-    `(erc-timestamp-face ((,class :foreground ,blue-nuanced-fg)))
+    `(erc-timestamp-face ((,class :foreground ,cyan)))
     `(erc-underline-face ((,class :underline t)))
     `(bg:erc-color-face0 ((,class :background "white")))
     `(bg:erc-color-face1 ((,class :background "black")))
@@ -5346,7 +5171,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(eshell-ls-product ((,class :inherit shadow)))
     `(eshell-ls-readonly ((,class :foreground ,yellow-faint)))
     `(eshell-ls-special ((,class :foreground ,magenta)))
-    `(eshell-ls-symlink ((,class :foreground ,cyan)))
+    `(eshell-ls-symlink ((,class :inherit modus-themes-link-symlink)))
     `(eshell-ls-unreadable ((,class :background ,bg-inactive :foreground 
,fg-inactive)))
     `(eshell-prompt ((,class :inherit modus-themes-prompt)))
 ;;;;; eshell-fringe-status
@@ -5452,10 +5277,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(flycheck-indicator-error ((,class :inherit modus-themes-bold :foreground 
,red-active)))
     `(flycheck-indicator-info ((,class :inherit modus-themes-bold :foreground 
,blue-active)))
     `(flycheck-indicator-running ((,class :inherit modus-themes-bold 
:foreground ,magenta-active)))
-    `(flycheck-indicator-success ((,class :inherit modus-themes-bold
-                                          :foreground 
,@(modus-themes--success-deuteran
-                                                         blue-active
-                                                         green-active))))
+    `(flycheck-indicator-success ((,class :inherit (modus-themes-bold 
modus-themes-grue-active))))
     `(flycheck-indicator-warning ((,class :inherit modus-themes-bold 
:foreground ,yellow-active)))
 ;;;;; flycheck-posframe
     `(flycheck-posframe-background-face ((,class :background ,bg-alt)))
@@ -5471,8 +5293,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
 ;;;;; flyspell
     `(flyspell-duplicate ((,class :inherit modus-themes-lang-warning)))
     `(flyspell-incorrect ((,class :inherit modus-themes-lang-error)))
-;;;;; flyspell-correct
-    `(flyspell-correct-highlight-face ((,class :inherit 
modus-themes-refine-green)))
 ;;;;; flx
     `(flx-highlight-face ((,class ,@(modus-themes--extra-completions
                                      'modus-themes-subtle-magenta
@@ -5591,66 +5411,33 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(git-commit-comment-branch-local ((,class :inherit modus-themes-slant 
:foreground ,blue-alt)))
     `(git-commit-comment-branch-remote ((,class :inherit modus-themes-slant 
:foreground ,magenta-alt)))
     `(git-commit-comment-detached ((,class :inherit modus-themes-slant 
:foreground ,cyan-alt)))
-    `(git-commit-comment-file ((,class :inherit modus-themes-slant
-                                       ,@(modus-themes--syntax-comment
-                                          fg-special-cold red-nuanced-fg))))
-    `(git-commit-comment-heading ((,class :inherit (bold modus-themes-slant)
-                                          ,@(modus-themes--syntax-comment
-                                             fg-dim fg-special-warm))))
+    `(git-commit-comment-file ((,class :inherit modus-themes-slant :foreground 
,cyan)))
+    `(git-commit-comment-heading ((,class :inherit (bold modus-themes-slant))))
     `(git-commit-keyword ((,class :foreground ,magenta)))
     `(git-commit-known-pseudo-header ((,class :foreground ,cyan-alt-other)))
-    `(git-commit-nonempty-second-line ((,class :inherit 
modus-themes-refine-yellow)))
-    `(git-commit-overlong-summary ((,class :inherit 
modus-themes-refine-yellow)))
+    `(git-commit-nonempty-second-line ((,class :inherit error)))
+    `(git-commit-overlong-summary ((,class :inherit warning)))
     `(git-commit-pseudo-header ((,class :foreground ,blue)))
-    `(git-commit-summary ((,class :inherit bold :foreground ,cyan)))
+    `(git-commit-summary ((,class :inherit bold :foreground ,blue)))
 ;;;;; git-gutter
-    `(git-gutter:added ((,class :inherit ,@(modus-themes--diff-deuteran
-                                            'modus-themes-fringe-blue
-                                            'modus-themes-fringe-green))))
+    `(git-gutter:added ((,class :inherit modus-themes-grue-background-active)))
     `(git-gutter:deleted ((,class :inherit modus-themes-fringe-red)))
     `(git-gutter:modified ((,class :inherit modus-themes-fringe-yellow)))
     `(git-gutter:separator ((,class :inherit modus-themes-fringe-cyan)))
     `(git-gutter:unchanged ((,class :inherit modus-themes-fringe-magenta)))
 ;;;;; git-gutter-fr
-    `(git-gutter-fr:added ((,class :inherit ,@(modus-themes--diff-deuteran
-                                               'modus-themes-fringe-blue
-                                               'modus-themes-fringe-green))))
+    `(git-gutter-fr:added ((,class :inherit 
modus-themes-grue-background-active)))
     `(git-gutter-fr:deleted ((,class :inherit modus-themes-fringe-red)))
     `(git-gutter-fr:modified ((,class :inherit modus-themes-fringe-yellow)))
-;;;;; git-{gutter,fringe}+
-    `(git-gutter+-added ((,class :inherit ,@(modus-themes--diff-deuteran
-                                             'modus-themes-fringe-blue
-                                             'modus-themes-fringe-green))))
-    `(git-gutter+-deleted ((,class :inherit modus-themes-fringe-red)))
-    `(git-gutter+-modified ((,class :inherit modus-themes-fringe-yellow)))
-    `(git-gutter+-separator ((,class :inherit modus-themes-fringe-cyan)))
-    `(git-gutter+-unchanged ((,class :inherit modus-themes-fringe-magenta)))
-    `(git-gutter-fr+-added ((,class :inherit modus-themes-fringe-green)))
-    `(git-gutter-fr+-deleted ((,class :inherit modus-themes-fringe-red)))
-    `(git-gutter-fr+-modified ((,class :inherit modus-themes-fringe-yellow)))
-;;;;; git-lens
-    `(git-lens-added ((,class :inherit bold :foreground 
,@(modus-themes--diff-deuteran blue green))))
-    `(git-lens-deleted ((,class :inherit bold :foreground ,red)))
-    `(git-lens-header ((,class :inherit bold :height 1.1 :foreground ,cyan)))
-    `(git-lens-modified ((,class :inherit bold :foreground ,yellow)))
-    `(git-lens-renamed ((,class :inherit bold :foreground ,magenta)))
 ;;;;; git-rebase
-    `(git-rebase-comment-hash ((,class :inherit modus-themes-slant
-                                       ,@(modus-themes--syntax-comment
-                                          fg-special-cold red-nuanced-fg))))
-    `(git-rebase-comment-heading  ((,class :inherit (bold modus-themes-slant)
-                                           ,@(modus-themes--syntax-comment
-                                              fg-dim fg-special-warm))))
+    `(git-rebase-comment-hash ((,class :inherit modus-themes-slant :foreground 
,cyan)))
+    `(git-rebase-comment-heading  ((,class :inherit (bold 
modus-themes-slant))))
     `(git-rebase-description ((,class :foreground ,fg-main)))
     `(git-rebase-hash ((,class :foreground ,cyan-alt-other)))
 ;;;;; git-timemachine
     `(git-timemachine-commit ((,class :inherit bold :foreground 
,yellow-active)))
     `(git-timemachine-minibuffer-author-face ((,class :foreground 
,fg-special-warm)))
     `(git-timemachine-minibuffer-detail-face ((,class :foreground ,red-alt)))
-;;;;; git-walktree
-    `(git-walktree-commit-face ((,class :foreground ,yellow)))
-    `(git-walktree-symlink-face ((,class :inherit button)))
-    `(git-walktree-tree-face ((,class :foreground ,magenta)))
 ;;;;; gnus
     `(gnus-button ((,class :inherit button)))
     `(gnus-cite-1 ((,class :inherit message-cited-text-1)))
@@ -5774,9 +5561,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(helm-ff-executable ((,class :foreground ,magenta-alt)))
     `(helm-ff-file ((,class :foreground ,fg-main)))
     `(helm-ff-file-extension ((,class :foreground ,fg-special-warm)))
-    `(helm-ff-invalid-symlink ((,class :inherit button
-                                       ,@(modus-themes--link-color
-                                          red red-faint))))
+    `(helm-ff-invalid-symlink ((,class :inherit modus-themes-link-broken)))
     `(helm-ff-pipe ((,class ,@(modus-themes--extra-completions
                                'modus-themes-refine-magenta
                                'modus-themes-subtle-magenta
@@ -5793,9 +5578,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                'modus-themes-refine-red
                                'modus-themes-nuanced-yellow
                                red-alt))))
-    `(helm-ff-symlink ((,class :inherit button
-                               ,@(modus-themes--link-color
-                                  cyan cyan-faint))))
+    `(helm-ff-symlink ((,class :inherit modus-themes-link-symlink)))
     `(helm-ff-truename ((,class :foreground ,blue-alt-other)))
     `(helm-fd-finish ((,class :foreground ,green-active)))
     `(helm-grep-cmd-line ((,class :foreground ,yellow-alt-other)))
@@ -5832,9 +5615,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                   'modus-themes-nuanced-cyan
                                   cyan-alt-other))))
     `(helm-minibuffer-prompt ((,class :inherit modus-themes-prompt)))
-    `(helm-moccur-buffer ((,class :inherit button
-                                  ,@(modus-themes--link-color
-                                     cyan-alt-other cyan-alt-other-faint))))
+    `(helm-moccur-buffer ((,class :inherit button :foreground 
,cyan-alt-other)))
     `(helm-mode-prefix ((,class ,@(modus-themes--extra-completions
                                    'modus-themes-subtle-magenta
                                    'modus-themes-intense-magenta
@@ -5858,8 +5639,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(helm-separator ((,class :foreground ,fg-special-mild)))
     `(helm-time-zone-current ((,class :foreground ,green)))
     `(helm-time-zone-home ((,class :foreground ,magenta)))
-    `(helm-source-header ((,class :inherit bold :foreground ,red-alt
-                                  ,@(modus-themes--scale 
modus-themes-scale-4))))
+    `(helm-source-header ((,class :inherit modus-themes-pseudo-header 
:foreground ,fg-special-cold)))
     `(helm-top-columns ((,class :inherit helm-header)))
     `(helm-ucs-char ((,class :foreground ,yellow-alt-other)))
     `(helm-visible-mark ((,class :inherit modus-themes-subtle-cyan)))
@@ -5903,33 +5683,11 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(highlight-changes-delete ((,class :background ,red-nuanced-bg
                                         :foreground ,red :underline t)))
     `(hl-line ((,class :inherit modus-themes-hl-line)))
-;;;;; highlight-blocks
-    `(highlight-blocks-depth-1-face ((,class :background ,bg-dim :foreground 
,fg-main)))
-    `(highlight-blocks-depth-2-face ((,class :background ,bg-alt :foreground 
,fg-main)))
-    `(highlight-blocks-depth-3-face ((,class :background ,bg-special-cold 
:foreground ,fg-main)))
-    `(highlight-blocks-depth-4-face ((,class :background ,bg-special-calm 
:foreground ,fg-main)))
-    `(highlight-blocks-depth-5-face ((,class :background ,bg-special-warm 
:foreground ,fg-main)))
-    `(highlight-blocks-depth-6-face ((,class :background ,bg-special-mild 
:foreground ,fg-main)))
-    `(highlight-blocks-depth-7-face ((,class :background ,bg-inactive 
:foreground ,fg-main)))
-    `(highlight-blocks-depth-8-face ((,class :background ,bg-active 
:foreground ,fg-main)))
-    `(highlight-blocks-depth-9-face ((,class :background ,cyan-subtle-bg 
:foreground ,fg-main)))
-;;;;; highlight-defined
-    `(highlight-defined-builtin-function-name-face ((,class :foreground 
,magenta)))
-    `(highlight-defined-face-name-face ((,class :foreground ,fg-main)))
-    `(highlight-defined-function-name-face ((,class :foreground ,magenta)))
-    `(highlight-defined-macro-name-face ((,class :foreground ,magenta-alt)))
-    `(highlight-defined-special-form-name-face ((,class :foreground 
,magenta-alt-other)))
-    `(highlight-defined-variable-name-face ((,class :foreground ,cyan)))
-;;;;; highlight-escape-sequences (`hes-mode')
-    `(hes-escape-backslash-face ((,class :inherit 
font-lock-regexp-grouping-construct)))
-    `(hes-escape-sequence-face ((,class :inherit 
font-lock-regexp-grouping-backslash)))
 ;;;;; highlight-indentation
     `(highlight-indentation-face ((,class :inherit modus-themes-hl-line)))
     `(highlight-indentation-current-column-face ((,class :background 
,bg-active)))
 ;;;;; highlight-numbers
     `(highlight-numbers-number ((,class :foreground ,blue-alt-other)))
-;;;;; highlight-symbol
-    `(highlight-symbol-face ((,class :inherit modus-themes-special-mild)))
 ;;;;; highlight-thing
     `(highlight-thing ((,class :background ,bg-alt :foreground ,cyan)))
 ;;;;; hl-defined
@@ -5946,16 +5704,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(hydra-face-pink ((,class :inherit bold :foreground ,magenta-alt-faint)))
     `(hydra-face-red ((,class :inherit bold :foreground ,red-faint)))
     `(hydra-face-teal ((,class :inherit bold :foreground ,cyan-alt-other)))
-;;;;; hyperlist
-    `(hyperlist-condition ((,class :foreground ,green)))
-    `(hyperlist-hashtag ((,class :foreground ,yellow)))
-    `(hyperlist-operator ((,class :foreground ,blue-alt)))
-    `(hyperlist-paren ((,class :foreground ,cyan-alt-other)))
-    `(hyperlist-quote ((,class :foreground ,cyan-alt)))
-    `(hyperlist-ref ((,class :foreground ,magenta-alt-other)))
-    `(hyperlist-stars ((,class :inherit shadow)))
-    `(hyperlist-tag ((,class :foreground ,red)))
-    `(hyperlist-toplevel ((,class :inherit bold :foreground ,fg-main)))
 ;;;;; icomplete
     `(icomplete-first-match ((,class :inherit bold
                                      ,@(modus-themes--standard-completions
@@ -5988,9 +5736,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(iflipb-other-buffer-face ((,class :inherit shadow)))
 ;;;;; image-dired
     `(image-dired-thumb-flagged ((,class :background ,red-intense-bg)))
-    `(image-dired-thumb-mark ((,class :background 
,@(modus-themes--success-deuteran
-                                                     cyan-intense-bg
-                                                     green-intense-bg))))
+    `(image-dired-thumb-mark ((,class :inherit 
modus-themes-grue-background-intense)))
 ;;;;; imenu-list
     `(imenu-list-entry-face-0 ((,class :foreground ,cyan)))
     `(imenu-list-entry-face-1 ((,class :foreground ,blue)))
@@ -6009,9 +5755,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(indium-repl-prompt-face ((,class :inherit modus-themes-prompt)))
     `(indium-repl-stdout-face ((,class :foreground ,fg-main)))
 ;;;;; info
-    `(Info-quoted ((,class :inherit modus-themes-fixed-pitch ; the 
capitalization is canonical
-                           ,@(modus-themes--markup fg-special-calm magenta-alt
-                                                   bg-alt 
magenta-nuanced-bg))))
+    `(Info-quoted ((,class :inherit modus-themes-markup-verbatim))) ; the 
capitalization is canonical
     `(info-header-node ((,class :inherit (shadow bold))))
     `(info-header-xref ((,class :foreground ,blue-active)))
     `(info-index-match ((,class :inherit match)))
@@ -6049,8 +5793,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(ioccur-num-line-face ((,class :foreground ,fg-special-warm)))
     `(ioccur-overlay-face ((,class :inherit modus-themes-refine-blue :extend 
t)))
     `(ioccur-regexp-face ((,class :inherit (modus-themes-intense-magenta 
bold))))
-    `(ioccur-title-face ((,class :inherit bold :foreground ,red-alt
-                                 ,@(modus-themes--scale 
modus-themes-scale-4))))
+    `(ioccur-title-face ((,class :inherit modus-themes-pseudo-header 
:foreground ,fg-special-cold)))
 ;;;;; isearch, occur, and the like
     `(isearch ((,class :inherit (modus-themes-search-success bold))))
     `(isearch-fail ((,class :inherit modus-themes-refine-red)))
@@ -6059,14 +5802,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(lazy-highlight ((,class :inherit modus-themes-search-success-lazy)))
     `(match ((,class :inherit modus-themes-special-calm)))
     `(query-replace ((,class :inherit (modus-themes-intense-yellow bold))))
-;;;;; isl (isearch-light)
-    `(isl-line ((,class :inherit ,@(modus-themes--success-deuteran
-                                    'modus-themes-subtle-blue
-                                    'modus-themes-subtle-green))))
-    `(isl-match ((,class :inherit modus-themes-search-success-lazy)))
-    `(isl-number ((,class :inherit (modus-themes-bold 
modus-themes-search-success-modeline))))
-    `(isl-on ((,class :inherit (bold modus-themes-search-success))))
-    `(isl-string ((,class :inherit modus-themes-bold :foreground 
,cyan-active)))
 ;;;;; ivy
     `(ivy-action ((,class :inherit bold :foreground ,red-alt)))
     `(ivy-completions-annotations ((,class :inherit completions-annotations)))
@@ -6268,11 +6003,17 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(magit-blame-margin ((,class :inherit (magit-blame-highlight 
modus-themes-reset-hard))))
     `(magit-blame-name ((,class :foreground ,magenta-alt-other)))
     `(magit-blame-summary ((,class :foreground ,cyan-alt-other)))
-    `(magit-branch-current ((,class :foreground ,blue-alt-other :box t)))
+    ;; ;; NOTE 2021-11-23: we do not set the `magit-branch-current'
+    ;; ;; because its definition checks if the :box attribute can be set
+    ;; ;; and if not, it uses :inverse-video.  Useful for terminal
+    ;; ;; emulators.
+    ;;
+    ;; `(magit-branch-current ((,class :foreground ,blue-alt-other :box t)))
     `(magit-branch-local ((,class :foreground ,blue-alt)))
     `(magit-branch-remote ((,class :foreground ,magenta-alt)))
     `(magit-branch-remote-head ((,class :foreground ,magenta-alt-other :box 
t)))
     `(magit-branch-upstream ((,class :inherit italic)))
+    `(magit-branch-warning ((,class :inherit warning)))
     `(magit-cherry-equivalent ((,class :background ,bg-main :foreground 
,magenta-intense)))
     `(magit-cherry-unmatched ((,class :background ,bg-main :foreground 
,cyan-intense)))
     ;; NOTE: here we break from the pattern of inheriting from the
@@ -6280,19 +6021,16 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     ;; not the highlighted ones.  This is because Magit's interaction
     ;; model relies on highlighting the current diff hunk.
     `(magit-diff-added ((,class ,@(modus-themes--diff
-                                   bg-main blue-alt-other
                                    bg-diff-added fg-diff-added
                                    green-nuanced-bg fg-diff-added
                                    bg-diff-added-deuteran 
fg-diff-added-deuteran))))
     `(magit-diff-added-highlight ((,class :inherit 
modus-themes-diff-focus-added)))
     `(magit-diff-base ((,class ,@(modus-themes--diff
-                                  bg-main yellow
                                   bg-diff-changed fg-diff-changed
                                   yellow-nuanced-bg fg-diff-changed))))
     `(magit-diff-base-highlight ((,class :inherit 
modus-themes-diff-focus-changed)))
     `(magit-diff-context ((,class ,@(unless (eq modus-themes-diffs 'bg-only) 
(list :foreground fg-unfocused)))))
     `(magit-diff-context-highlight ((,class ,@(modus-themes--diff
-                                               bg-dim fg-dim
                                                bg-inactive fg-inactive
                                                bg-dim fg-alt
                                                bg-dim fg-alt))))
@@ -6303,25 +6041,25 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     ;; modus-themes-diff-* faces.
     `(magit-diff-hunk-heading ((,class :inherit bold
                                        ,@(modus-themes--diff
-                                          bg-alt fg-alt
                                           bg-active fg-inactive
                                           bg-inactive fg-inactive
                                           bg-inactive fg-inactive
                                           t))))
+    ;; NOTE: we do not follow the pattern of inheriting from
+    ;; modus-themes-grue-* faces, as this is a special case.
     `(magit-diff-hunk-heading-highlight
       ((,class :inherit bold
-               :background ,@(modus-themes--diff-deuteran bg-active 
bg-diff-heading)
-               :foreground ,@(modus-themes--diff-deuteran fg-main 
fg-diff-heading))))
+               :background ,@(modus-themes--deuteran bg-active bg-diff-heading)
+               :foreground ,@(modus-themes--deuteran fg-main 
fg-diff-heading))))
     `(magit-diff-hunk-heading-selection ((,class :inherit 
modus-themes-refine-blue)))
     `(magit-diff-hunk-region ((,class :inherit bold)))
     `(magit-diff-lines-boundary ((,class :background ,fg-main)))
     `(magit-diff-lines-heading ((,class :inherit modus-themes-refine-magenta)))
     `(magit-diff-removed ((,class ,@(modus-themes--diff
-                                     bg-main red
                                      bg-diff-removed fg-diff-removed
                                      red-nuanced-bg fg-diff-removed))))
     `(magit-diff-removed-highlight ((,class :inherit 
modus-themes-diff-focus-removed)))
-    `(magit-diffstat-added ((,class :foreground ,@(modus-themes--diff-deuteran 
blue green))))
+    `(magit-diffstat-added ((,class :inherit modus-themes-grue)))
     `(magit-diffstat-removed ((,class :foreground ,red)))
     `(magit-dimmed ((,class :foreground ,fg-unfocused)))
     `(magit-filename ((,class :foreground ,fg-special-cold)))
@@ -6356,9 +6094,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(magit-section-heading ((,class :inherit bold :foreground ,cyan)))
     `(magit-section-heading-selection ((,class :inherit 
(modus-themes-refine-cyan bold))))
     `(magit-section-highlight ((,class :background ,bg-alt)))
-    `(magit-sequence-done ((,class :foreground 
,@(modus-themes--success-deuteran
-                                                  blue
-                                                  green))))
+    `(magit-sequence-done ((,class :inherit modus-themes-grue)))
     `(magit-sequence-drop ((,class :foreground ,red-alt)))
     `(magit-sequence-exec ((,class :foreground ,magenta-alt)))
     `(magit-sequence-head ((,class :foreground ,cyan-alt)))
@@ -6370,9 +6106,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(magit-signature-error ((,class :foreground ,red-alt)))
     `(magit-signature-expired ((,class :foreground ,yellow)))
     `(magit-signature-expired-key ((,class :foreground ,yellow)))
-    `(magit-signature-good ((,class :foreground 
,@(modus-themes--success-deuteran
-                                                   blue
-                                                   green))))
+    `(magit-signature-good ((,class :inherit modus-themes-grue)))
     `(magit-signature-revoked ((,class :foreground ,magenta)))
     `(magit-signature-untrusted ((,class :foreground ,cyan)))
     `(magit-tag ((,class :foreground ,yellow-alt-other)))
@@ -6449,15 +6183,13 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                                 :foreground ,fg-special-mild)))
     `(markdown-html-tag-name-face ((,class :inherit modus-themes-fixed-pitch
                                            :foreground ,magenta-alt)))
-    `(markdown-inline-code-face ((,class :inherit modus-themes-fixed-pitch
-                                         ,@(modus-themes--markup 
fg-special-calm magenta-alt
-                                                                 bg-alt 
magenta-nuanced-bg))))
+    `(markdown-inline-code-face ((,class :inherit 
modus-themes-markup-verbatim)))
     `(markdown-italic-face ((,class :inherit italic)))
     `(markdown-language-info-face ((,class :inherit modus-themes-fixed-pitch
                                            :foreground ,fg-special-cold)))
     `(markdown-language-keyword-face ((,class :inherit modus-themes-fixed-pitch
-                                              ,@(modus-themes--markup fg-alt 
red-alt
-                                                                      bg-alt 
red-nuanced-bg))))
+                                              :background ,bg-alt
+                                              :foreground ,fg-alt)))
     `(markdown-line-break-face ((,class :inherit modus-themes-refine-cyan 
:underline t)))
     `(markdown-link-face ((,class :inherit button)))
     `(markdown-link-title-face ((,class :inherit modus-themes-slant 
:foreground ,fg-special-cold)))
@@ -6479,18 +6211,16 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(markup-bold-face ((,class :inherit bold :foreground ,red-nuanced-fg)))
     `(markup-code-face ((,class :foreground ,magenta)))
     `(markup-comment-face ((,class :inherit font-lock-comment-face)))
-    `(markup-complex-replacement-face ((,class :background ,magenta-nuanced-bg
-                                               :foreground ,magenta-alt-other
-                                               :underline ,magenta-alt-other)))
+    `(markup-complex-replacement-face ((,class :background ,magenta-nuanced-bg 
:foreground ,magenta-alt-other)))
     `(markup-emphasis-face ((,class :inherit markup-italic-face)))
     `(markup-error-face ((,class :inherit error)))
     `(markup-gen-face ((,class :foreground ,magenta-alt)))
-    `(markup-internal-reference-face ((,class :foreground ,fg-alt :underline 
,bg-region)))
+    `(markup-internal-reference-face ((,class :inherit modus-themes-slant 
:foreground ,fg-alt)))
     `(markup-italic-face ((,class :inherit italic)))
     `(markup-list-face ((,class :inherit modus-themes-special-cold)))
-    `(markup-meta-face ((,class :inherit shadow)))
+    `(markup-meta-face ((,class :inherit (modus-themes-fixed-pitch shadow))))
     `(markup-meta-hide-face ((,class :foreground "gray50")))
-    `(markup-reference-face ((,class :foreground ,blue-alt :underline 
,bg-region)))
+    `(markup-reference-face ((,class :inherit modus-themes-slant :foreground 
,blue-alt)))
     `(markup-replacement-face ((,class :inherit modus-themes-fixed-pitch 
:foreground ,red-alt)))
     `(markup-secondary-text-face ((,class :height 0.9 :foreground 
,cyan-alt-other)))
     `(markup-small-face ((,class :inherit markup-gen-face :height 0.9)))
@@ -6500,24 +6230,13 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(markup-table-cell-face ((,class :inherit modus-themes-subtle-neutral)))
     `(markup-table-face ((,class :inherit modus-themes-subtle-neutral)))
     `(markup-table-row-face ((,class :inherit modus-themes-special-cold)))
-    `(markup-title-0-face ((,class :inherit (bold modus-themes-variable-pitch)
-                                   :foreground ,blue-nuanced-fg
-                                   ,@(modus-themes--scale 
modus-themes-scale-title))))
-    `(markup-title-1-face ((,class :inherit (bold modus-themes-variable-pitch)
-                                   :foreground ,blue-nuanced-fg
-                                   ,@(modus-themes--scale 
modus-themes-scale-1))))
-    `(markup-title-2-face ((,class :inherit (bold modus-themes-variable-pitch)
-                                   :foreground ,blue-nuanced-fg
-                                   ,@(modus-themes--scale 
modus-themes-scale-2))))
-    `(markup-title-3-face ((,class :inherit (bold modus-themes-variable-pitch)
-                                   :foreground ,blue-nuanced-fg
-                                   ,@(modus-themes--scale 
modus-themes-scale-3))))
-    `(markup-title-4-face ((,class :inherit (bold modus-themes-variable-pitch)
-                                   :foreground ,blue-nuanced-fg
-                                   ,@(modus-themes--scale 
modus-themes-scale-4))))
-    `(markup-title-5-face ((,class :inherit (bold modus-themes-variable-pitch)
-                                   :foreground ,blue-nuanced-fg)))
-    `(markup-verbatim-face ((,class :background ,bg-alt)))
+    `(markup-title-0-face ((,class :inherit modus-themes-heading-1)))
+    `(markup-title-1-face ((,class :inherit modus-themes-heading-2)))
+    `(markup-title-2-face ((,class :inherit modus-themes-heading-3)))
+    `(markup-title-3-face ((,class :inherit modus-themes-heading-4)))
+    `(markup-title-4-face ((,class :inherit modus-themes-heading-5)))
+    `(markup-title-5-face ((,class :inherit modus-themes-heading-6)))
+    `(markup-verbatim-face ((,class :inherit modus-themes-fixed-pitch 
:background ,bg-alt)))
 ;;;;; mentor
     `(mentor-download-message ((,class :foreground ,fg-special-warm)))
     `(mentor-download-name ((,class :foreground ,fg-special-cold)))
@@ -6542,8 +6261,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(message-header-xheader ((,class :foreground ,blue-alt)))
     `(message-mml ((,class :foreground ,cyan-alt-other)))
     `(message-separator ((,class :inherit modus-themes-intense-neutral)))
-;;;;; minibuffer-line
-    `(minibuffer-line ((,class :foreground ,fg-main)))
 ;;;;; minimap
     `(minimap-active-region-background ((,class :background ,bg-active)))
     `(minimap-current-line-face ((,class :background ,cyan-intense-bg 
:foreground ,fg-main)))
@@ -6557,17 +6274,18 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(mmm-output-submode-face ((,class :background ,red-nuanced-bg)))
     `(mmm-special-submode-face ((,class :background ,green-nuanced-bg)))
 ;;;;; mode-line
-    `(mode-line ((,class ,@(modus-themes--variable-pitch-ui)
+    `(mode-line ((,class :inherit modus-themes-ui-variable-pitch
                          ,@(modus-themes--mode-line-attrs
                             fg-active bg-active
                             fg-dim bg-active
                             fg-main bg-active-accent
                             fg-alt bg-active
                             'alt-style bg-main))))
+    `(mode-line-active ((,class :inherit mode-line)))
     `(mode-line-buffer-id ((,class :inherit bold)))
     `(mode-line-emphasis ((,class :inherit bold :foreground ,blue-active)))
     `(mode-line-highlight ((,class :inherit modus-themes-active-blue :box 
(:line-width -1 :style pressed-button))))
-    `(mode-line-inactive ((,class ,@(modus-themes--variable-pitch-ui)
+    `(mode-line-inactive ((,class :inherit modus-themes-ui-variable-pitch
                                   ,@(modus-themes--mode-line-attrs
                                      fg-inactive bg-inactive
                                      fg-alt bg-dim
@@ -6578,9 +6296,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(mood-line-status-error ((,class :inherit bold :foreground ,red-active)))
     `(mood-line-status-info ((,class :foreground ,cyan-active)))
     `(mood-line-status-neutral ((,class :foreground ,blue-active)))
-    `(mood-line-status-success ((,class :foreground 
,@(modus-themes--success-deuteran
-                                                       blue-active
-                                                       green-active))))
+    `(mood-line-status-success ((,class :inherit modus-themes-grue-active)))
     `(mood-line-status-warning ((,class :inherit bold :foreground 
,yellow-active)))
     `(mood-line-unimportant ((,class :foreground ,fg-inactive)))
 ;;;;; mpdel
@@ -6624,18 +6340,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(mu4e-url-number-face ((,class :inherit shadow)))
     `(mu4e-view-body-face ((,class :foreground ,fg-main)))
     `(mu4e-warning-face ((,class :inherit warning)))
-;;;;; mu4e-conversation
-    `(mu4e-conversation-header ((,class :inherit modus-themes-special-cold)))
-    `(mu4e-conversation-sender-1 ((,class :foreground ,fg-special-warm)))
-    `(mu4e-conversation-sender-2 ((,class :foreground ,fg-special-cold)))
-    `(mu4e-conversation-sender-3 ((,class :foreground ,fg-special-mild)))
-    `(mu4e-conversation-sender-4 ((,class :inherit shadow)))
-    `(mu4e-conversation-sender-5 ((,class :foreground ,yellow-refine-fg)))
-    `(mu4e-conversation-sender-6 ((,class :foreground ,cyan-refine-fg)))
-    `(mu4e-conversation-sender-7 ((,class :foreground ,green-refine-fg)))
-    `(mu4e-conversation-sender-8 ((,class :foreground ,blue-refine-fg)))
-    `(mu4e-conversation-sender-me ((,class :foreground ,fg-main)))
-    `(mu4e-conversation-unread ((,class :inherit bold)))
 ;;;;; multiple-cursors
     `(mc/cursor-bar-face ((,class :height 1 :background ,fg-main)))
     `(mc/cursor-face ((,class :inverse-video t)))
@@ -6659,7 +6363,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(neo-file-link-face ((,class :foreground ,fg-main)))
     `(neo-header-face ((,class :inherit bold :foreground ,fg-main)))
     `(neo-root-dir-face ((,class :inherit bold :foreground ,cyan-alt)))
-    `(neo-vc-added-face ((,class :foreground ,@(modus-themes--diff-deuteran 
blue green))))
+    `(neo-vc-added-face ((,class :inherit modus-themes-grue)))
     `(neo-vc-conflict-face ((,class :inherit error)))
     `(neo-vc-default-face ((,class :foreground ,fg-main)))
     `(neo-vc-edited-face ((,class :foreground ,yellow)))
@@ -6671,8 +6375,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(neo-vc-unlocked-changes-face ((,class :inherit 
modus-themes-refine-blue)))
     `(neo-vc-up-to-date-face ((,class :inherit shadow)))
     `(neo-vc-user-face ((,class :foreground ,magenta)))
-;;;;; no-emoji
-    `(no-emoji ((,class :foreground ,cyan)))
 ;;;;; notmuch
     `(notmuch-crypto-decryption ((,class :inherit (shadow bold))))
     `(notmuch-crypto-part-header ((,class :foreground ,magenta-alt-other)))
@@ -6731,10 +6433,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(nxml-prolog-keyword ((,class :inherit font-lock-keyword-face)))
     `(nxml-ref ((,class :inherit modus-themes-bold :foreground 
,fg-special-mild)))
     `(rng-error ((,class :inherit error)))
-;;;;; objed
-    `(objed-hl ((,class :background ,(if modus-themes-hl-line 
bg-hl-alt-intense bg-hl-alt))))
-    `(objed-mark ((,class :background ,bg-active)))
-    `(objed-mode-line ((,class :foreground ,cyan-active)))
 ;;;;; orderless
     `(orderless-match-face-0 ((,class :inherit bold
                                       ,@(modus-themes--standard-completions
@@ -6769,9 +6467,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                                                           
bg-inactive t t))))
     `(org-agenda-diary ((,class :inherit org-agenda-calendar-sexp)))
     `(org-agenda-dimmed-todo-face ((,class :inherit shadow)))
-    `(org-agenda-done ((,class :foreground ,@(modus-themes--success-deuteran
-                                              blue-nuanced-fg
-                                              green-nuanced-fg))))
+    `(org-agenda-done ((,class :inherit modus-themes-grue-nuanced)))
     `(org-agenda-filter-category ((,class :inherit bold :foreground 
,cyan-active)))
     `(org-agenda-filter-effort ((,class :inherit bold :foreground 
,cyan-active)))
     `(org-agenda-filter-regexp ((,class :inherit bold :foreground 
,cyan-active)))
@@ -6797,20 +6493,19 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                         ,@(modus-themes--markup fg-special-mild green-alt-other
                                                 bg-alt green-nuanced-bg)
                         :extend t)))
-    `(org-column ((,class :background ,bg-alt)))
-    `(org-column-title ((,class :inherit bold :underline t :background 
,bg-alt)))
+    `(org-column ((,class :inherit (modus-themes-fixed-pitch default)
+                          :background ,bg-alt)))
+    `(org-column-title ((,class :inherit (bold modus-themes-fixed-pitch 
default)
+                                :underline t :background ,bg-alt)))
     `(org-date ((,class :inherit ,(if modus-themes-mixed-fonts
-                                      '(button fixed-pitch)
-                                    'button)
-                        ,@(modus-themes--link-color
-                           cyan cyan-faint))))
-    `(org-date-selected ((,class :inherit bold :foreground ,blue-alt 
:inverse-video t)))
+                                      '(fixed-pitch modus-themes-link-symlink)
+                                    'modus-themes-link-symlink))))
+    `(org-date-selected ((,class :foreground ,blue-alt :inverse-video t)))
     `(org-dispatcher-highlight ((,class :inherit (bold 
modus-themes-mark-alt))))
     `(org-document-info ((,class :foreground ,fg-special-cold)))
     `(org-document-info-keyword ((,class :inherit (shadow 
modus-themes-fixed-pitch))))
-    `(org-document-title ((,class :inherit (bold modus-themes-variable-pitch) 
:foreground ,fg-special-cold
-                                  ,@(modus-themes--scale 
modus-themes-scale-title))))
-    `(org-done ((,class :foreground ,@(modus-themes--success-deuteran blue 
green))))
+    `(org-document-title ((,class :inherit modus-themes-heading-1 :background 
,bg-main :overline nil :foreground ,fg-special-cold)))
+    `(org-done ((,class :inherit modus-themes-grue)))
     `(org-drawer ((,class :inherit (shadow modus-themes-fixed-pitch))))
     `(org-ellipsis (())) ; inherits from the heading's color
     `(org-footnote ((,class :inherit button
@@ -6853,10 +6548,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
                                               green-graph-0-bg
                                               green-graph-1-bg
                                               blue-graph-0-bg))))
-    `(org-headline-done ((,class :inherit modus-themes-variable-pitch
-                                 :foreground ,@(modus-themes--success-deuteran
-                                                blue-nuanced-fg
-                                                green-nuanced-fg))))
+    `(org-headline-done ((,class :inherit (modus-themes-variable-pitch 
modus-themes-grue-nuanced))))
     `(org-headline-todo ((,class :inherit modus-themes-variable-pitch 
:foreground ,red-nuanced-fg)))
     `(org-hide ((,class :foreground ,bg-main)))
     `(org-indent ((,class :inherit (fixed-pitch org-hide))))
@@ -6884,10 +6576,10 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(org-scheduled ((,class ,@(modus-themes--agenda-scheduled yellow-faint 
fg-special-warm magenta-alt))))
     `(org-scheduled-previously ((,class ,@(modus-themes--agenda-scheduled 
yellow fg-special-warm yellow-alt-other))))
     `(org-scheduled-today ((,class ,@(modus-themes--agenda-scheduled yellow 
fg-special-warm magenta-alt-other))))
-    `(org-sexp-date ((,class :inherit org-date)))
+    `(org-sexp-date ((,class :foreground ,cyan-alt-other)))
     `(org-special-keyword ((,class :inherit (shadow 
modus-themes-fixed-pitch))))
     `(org-table ((,class :inherit modus-themes-fixed-pitch :foreground 
,fg-special-cold)))
-    `(org-table-header ((,class :inherit (fixed-pitch 
modus-themes-intense-neutral))))
+    `(org-table-header ((,class :inherit (fixed-pitch 
modus-themes-special-cold))))
     `(org-tag ((,class :foreground ,magenta-nuanced-fg)))
     `(org-tag-group ((,class :inherit bold :foreground ,cyan-nuanced-fg)))
     `(org-target ((,class :underline t)))
@@ -6895,9 +6587,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(org-todo ((,class :foreground ,red)))
     `(org-upcoming-deadline ((,class :foreground ,red-alt-other)))
     `(org-upcoming-distant-deadline ((,class :foreground ,red-faint)))
-    `(org-verbatim ((,class :inherit modus-themes-fixed-pitch
-                            ,@(modus-themes--markup fg-special-calm magenta-alt
-                                                    bg-alt 
magenta-nuanced-bg))))
+    `(org-verbatim ((,class :inherit modus-themes-markup-verbatim)))
     `(org-verse ((,class :inherit org-quote)))
     `(org-warning ((,class :inherit bold :foreground ,red-alt-other)))
 ;;;;; org-journal
@@ -6914,29 +6604,21 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
 ;;;;; org-recur
     `(org-recur ((,class :foreground ,magenta-active)))
 ;;;;; org-roam
-    `(org-roam-link ((,class :inherit button
-                             ,@(modus-themes--link-color
-                                green green-faint))))
-    `(org-roam-link-current ((,class :inherit button
-                                     ,@(modus-themes--link-color
-                                        green-alt green-alt-faint))))
-    `(org-roam-link-invalid ((,class :inherit button
-                                     ,@(modus-themes--link-color
-                                        red red-faint))))
-    `(org-roam-link-shielded ((,class :inherit button
-                                      ,@(modus-themes--link-color
-                                         yellow yellow-faint))))
-    `(org-roam-tag ((,class :inherit (shadow italic))))
+    `(org-roam-dim ((,class :foreground "gray50")))
+    `(org-roam-header-line ((,class :inherit bold :foreground 
,magenta-active)))
+    `(org-roam-olp ((,class :inherit shadow)))
+    `(org-roam-preview-heading ((,class :inherit modus-themes-subtle-neutral)))
+    `(org-roam-preview-heading-highlight ((,class :inherit 
modus-themes-intense-neutral)))
+    `(org-roam-preview-heading-selection ((,class :inherit 
modus-themes-special-cold)))
+    `(org-roam-preview-region ((,class :inherit bold)))
+    `(org-roam-title ((,class :inherit modus-themes-pseudo-header)))
 ;;;;; org-superstar
     `(org-superstar-item ((,class :foreground ,fg-main)))
     `(org-superstar-leading ((,class :foreground ,fg-whitespace)))
 ;;;;; org-table-sticky-header
-    `(org-table-sticky-header-face ((,class :inherit 
modus-themes-intense-neutral)))
+    `(org-table-sticky-header-face ((,class :inherit 
modus-themes-special-cold)))
 ;;;;; org-tree-slide
-    `(org-tree-slide-header-overlay-face
-      ((,class :inherit (bold modus-themes-variable-pitch) :background ,bg-main
-               :foreground ,fg-special-cold :overline nil
-               ,@(modus-themes--scale modus-themes-scale-title))))
+    `(org-tree-slide-header-overlay-face ((,class :inherit 
org-document-title)))
 ;;;;; org-treescope
     `(org-treescope-faces--markerinternal-midday ((,class :inherit 
modus-themes-intense-blue)))
     `(org-treescope-faces--markerinternal-range ((,class :inherit 
modus-themes-special-mild)))
@@ -6992,8 +6674,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(paradox-starred-face ((,class :foreground ,magenta-alt)))
 ;;;;; paren-face
     `(parenthesis ((,class :foreground ,fg-unfocused)))
-;;;;; parrot
-    `(parrot-rotate-rotation-highlight-face ((,class :inherit 
modus-themes-refine-magenta)))
 ;;;;; pass
     `(pass-mode-directory-face ((,class :inherit bold :foreground 
,fg-special-cold)))
     `(pass-mode-entry-face ((,class :background ,bg-main :foreground 
,fg-main)))
@@ -7009,26 +6689,16 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
 ;;;;; perspective
     `(persp-selected-face ((,class :inherit bold :foreground ,blue-active)))
 ;;;;; phi-grep
-    `(phi-grep-heading-face  ((,class :inherit bold :foreground ,red-alt
-                                      ,@(modus-themes--scale 
modus-themes-scale-4))))
+    `(phi-grep-heading-face ((,class :inherit modus-themes-pseudo-header 
:foreground ,fg-special-cold)))
     `(phi-grep-line-number-face ((,class :foreground ,fg-special-warm)))
     `(phi-grep-match-face ((,class :inherit modus-themes-special-calm)))
     `(phi-grep-modified-face ((,class :inherit modus-themes-refine-yellow)))
     `(phi-grep-overlay-face ((,class :inherit modus-themes-refine-blue)))
-;;;;; phi-search
-    `(phi-replace-preview-face ((,class :inherit 
modus-themes-intense-magenta)))
-    `(phi-search-failpart-face ((,class :inherit modus-themes-refine-red)))
-    `(phi-search-match-face ((,class :inherit 
modus-themes-search-success-lazy)))
-    `(phi-search-selection-face ((,class :inherit (modus-themes-search-success 
bold))))
-;;;;; pkgbuild-mode
-    `(pkgbuild-error-face ((,class :inherit modus-themes-lang-error)))
 ;;;;; pomidor
     `(pomidor-break-face ((,class :foreground ,blue-alt-other)))
     `(pomidor-overwork-face ((,class :foreground ,red-alt-other)))
     `(pomidor-skip-face ((,class :inherit (shadow modus-themes-slant))))
-    `(pomidor-work-face ((,class :foreground ,@(modus-themes--success-deuteran
-                                                blue-alt
-                                                green-alt-other))))
+    `(pomidor-work-face ((,class :inherit modus-themes-grue)))
 ;;;;; popup
     `(popup-face ((,class :background ,bg-alt :foreground ,fg-main)))
     `(popup-isearch-match ((,class :inherit (modus-themes-refine-cyan bold))))
@@ -7093,22 +6763,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(rainbow-blocks-depth-8-face ((,class :foreground ,cyan-alt)))
     `(rainbow-blocks-depth-9-face ((,class :foreground ,red-alt)))
     `(rainbow-blocks-unmatched-face ((,class :foreground ,red)))
-;;;;; rainbow-identifiers
-    `(rainbow-identifiers-identifier-1 ((,class :foreground ,green-alt-other)))
-    `(rainbow-identifiers-identifier-2 ((,class :foreground 
,magenta-alt-other)))
-    `(rainbow-identifiers-identifier-3 ((,class :foreground ,cyan-alt-other)))
-    `(rainbow-identifiers-identifier-4 ((,class :foreground 
,yellow-alt-other)))
-    `(rainbow-identifiers-identifier-5 ((,class :foreground ,blue-alt-other)))
-    `(rainbow-identifiers-identifier-6 ((,class :foreground ,green-alt)))
-    `(rainbow-identifiers-identifier-7 ((,class :foreground ,magenta-alt)))
-    `(rainbow-identifiers-identifier-8 ((,class :foreground ,cyan-alt)))
-    `(rainbow-identifiers-identifier-9 ((,class :foreground ,yellow-alt)))
-    `(rainbow-identifiers-identifier-10 ((,class :foreground ,green)))
-    `(rainbow-identifiers-identifier-11 ((,class :foreground ,magenta)))
-    `(rainbow-identifiers-identifier-12 ((,class :foreground ,cyan)))
-    `(rainbow-identifiers-identifier-13 ((,class :foreground ,yellow)))
-    `(rainbow-identifiers-identifier-14 ((,class :foreground ,blue-alt)))
-    `(rainbow-identifiers-identifier-15 ((,class :foreground ,red-alt)))
 ;;;;; rainbow-delimiters
     `(rainbow-delimiters-base-error-face ((,class :background ,red-subtle-bg 
:foreground ,fg-main)))
     `(rainbow-delimiters-base-face ((,class :foreground ,fg-main)))
@@ -7124,16 +6778,19 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(rainbow-delimiters-mismatched-face ((,class :inherit (bold 
modus-themes-refine-yellow))))
     `(rainbow-delimiters-unmatched-face ((,class :inherit (bold 
modus-themes-refine-red))))
 ;;;;; rcirc
-    `(rcirc-bright-nick ((,class :inherit bold :foreground ,magenta-alt)))
+    `(rcirc-bright-nick ((,class :inherit bold :foreground ,magenta-intense)))
     `(rcirc-dim-nick ((,class :inherit shadow)))
+    `(rcirc-monospace-text ((,class :inherit fixed-pitch)))
     `(rcirc-my-nick ((,class :inherit bold :foreground ,magenta)))
-    `(rcirc-nick-in-message ((,class :foreground ,magenta-alt-other)))
-    `(rcirc-nick-in-message-full-line ((,class :inherit bold :foreground 
,fg-special-mild)))
-    `(rcirc-other-nick ((,class :inherit bold :foreground ,fg-special-cold)))
+    `(rcirc-nick-in-message ((,class :inherit bold :foreground ,red-alt)))
+    `(rcirc-nick-in-message-full-line ((,class :inherit bold :foreground 
,cyan-alt-other)))
+    `(rcirc-other-nick ((,class :inherit bold :foreground ,blue)))
     `(rcirc-prompt ((,class :inherit modus-themes-prompt)))
-    `(rcirc-server ((,class :foreground ,fg-unfocused)))
-    `(rcirc-timestamp ((,class :foreground ,blue-nuanced-fg)))
-    `(rcirc-url ((,class :foreground ,blue :underline t)))
+    `(rcirc-server ((,class :inherit shadow)))
+    `(rcirc-timestamp ((,class :foreground ,cyan)))
+    `(rcirc-track-keyword ((,class :inherit bold)))
+    `(rcirc-track-nick ((,class :inherit bold :foreground ,red-active)))
+    `(rcirc-url ((,class :inherit link)))
 ;;;;; recursion-indicator
     `(recursion-indicator-general ((,class :foreground ,blue-active)))
     `(recursion-indicator-minibuffer ((,class :foreground ,red-active)))
@@ -7176,57 +6833,13 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(ruler-mode-margins ((,class :inherit ruler-mode-default :foreground 
,bg-main)))
     `(ruler-mode-pad ((,class :inherit ruler-mode-default :background 
,bg-active :foreground ,fg-inactive)))
     `(ruler-mode-tab-stop ((,class :inherit ruler-mode-default :foreground 
,fg-special-warm)))
-;;;;; sallet
-    `(sallet-buffer-compressed ((,class :inherit italic :foreground 
,yellow-nuanced-fg)))
-    `(sallet-buffer-default-directory ((,class :foreground ,cyan-nuanced-fg)))
-    `(sallet-buffer-directory ((,class :foreground ,blue-nuanced-fg)))
-    `(sallet-buffer-help ((,class :foreground ,fg-special-cold)))
-    `(sallet-buffer-modified ((,class :inherit italic :foreground 
,yellow-alt-other)))
-    `(sallet-buffer-ordinary ((,class :foreground ,fg-main)))
-    `(sallet-buffer-read-only ((,class :foreground ,yellow-alt)))
-    `(sallet-buffer-size ((,class :foreground ,fg-special-calm)))
-    `(sallet-buffer-special ((,class :foreground ,magenta-alt-other)))
-    `(sallet-flx-match ((,class ,@(modus-themes--extra-completions
-                                   'modus-themes-subtle-cyan
-                                   'modus-themes-refine-cyan
-                                   'modus-themes-nuanced-cyan
-                                   cyan-alt-other))))
-    `(sallet-recentf-buffer-name ((,class :foreground ,blue-nuanced-fg)))
-    `(sallet-recentf-file-path ((,class :foreground ,fg-special-mild)))
-    `(sallet-regexp-match ((,class ,@(modus-themes--extra-completions
-                                      'modus-themes-subtle-magenta
-                                      'modus-themes-refine-magenta
-                                      'modus-themes-nuanced-magenta
-                                      magenta-alt-other))))
-    `(sallet-source-header ((,class :inherit bold :foreground ,red-alt
-                                    ,@(modus-themes--scale 
modus-themes-scale-4))))
-    `(sallet-substring-match ((,class ,@(modus-themes--extra-completions
-                                         'modus-themes-subtle-blue
-                                         'modus-themes-refine-blue
-                                         'modus-themes-nuanced-blue
-                                         blue-alt-other))))
 ;;;;; selectrum
-    ;; NOTE 2021-02-22: The `selectrum-primary-highlight' and
-    ;; `selectrum-secondary-highlight' are deprecated upstream in favour
-    ;; of their selectrum-prescient counterparts.  We shall remove those
-    ;; faces from the themes once we are certain that they are no longer
-    ;; relevant.
     `(selectrum-current-candidate
       ((,class :inherit bold :foreground ,fg-main
                :background ,@(pcase modus-themes-completions
                                ('opinionated (list bg-active))
                                (_ (list bg-inactive))))))
     `(selectrum-mouse-highlight ((,class :inherit highlight)))
-    `(selectrum-primary-highlight
-      ((,class :inherit bold
-               ,@(modus-themes--standard-completions
-                  magenta-alt magenta-nuanced-bg
-                  magenta-refine-bg magenta-refine-fg))))
-    `(selectrum-secondary-highlight
-      ((,class :inherit bold
-               ,@(modus-themes--standard-completions
-                  cyan-alt-other cyan-nuanced-bg
-                  cyan-refine-bg cyan-refine-fg))))
     `(selectrum-quick-keys-highlight
       ((,class :inherit modus-themes-refine-red)))
     `(selectrum-quick-keys-match
@@ -7363,11 +6976,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(speedbar-selected-face ((,class :inherit bold :foreground ,cyan)))
     `(speedbar-separator-face ((,class :inherit modus-themes-intense-neutral)))
     `(speedbar-tag-face ((,class :foreground ,yellow-alt-other)))
-;;;;; spell-fu
-    `(spell-fu-incorrect-face ((,class :inherit modus-themes-lang-error)))
-;;;;; spray
-    `(spray-accent-face ((,class :foreground ,red-intense)))
-    `(spray-base-face ((,class :inherit default :foreground ,fg-special-cold)))
 ;;;;; stripes
     `(stripes ((,class :background ,bg-alt)))
 ;;;;; suggest
@@ -7385,14 +6993,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(swiper-match-face-2 ((,class :inherit (bold 
modus-themes-intense-green))))
     `(swiper-match-face-3 ((,class :inherit (bold modus-themes-intense-blue))))
     `(swiper-match-face-4 ((,class :inherit (bold modus-themes-intense-red))))
-;;;;; swoop
-    `(swoop-face-header-format-line ((,class :inherit bold :foreground ,red-alt
-                                             ,@(modus-themes--scale 
modus-themes-scale-3))))
-    `(swoop-face-line-buffer-name ((,class :inherit bold :foreground ,blue-alt
-                                           ,@(modus-themes--scale 
modus-themes-scale-4))))
-    `(swoop-face-line-number ((,class :foreground ,fg-special-warm)))
-    `(swoop-face-target-line ((,class :inherit modus-themes-intense-blue 
:extend t)))
-    `(swoop-face-target-words ((,class :inherit modus-themes-refine-cyan)))
 ;;;;; sx
     `(sx-inbox-item-type ((,class :foreground ,magenta-alt-other)))
     `(sx-inbox-item-type-unread ((,class :inherit (sx-inbox-item-type bold))))
@@ -7442,30 +7042,29 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(syslog-su ((,class :inherit bold :foreground ,red-alt)))
     `(syslog-warn ((,class :inherit bold :foreground ,yellow)))
 ;;;;; tab-bar-groups
-    `(tab-bar-groups-tab-1 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,blue-tab)))
-    `(tab-bar-groups-tab-2 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,red-tab)))
-    `(tab-bar-groups-tab-3 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,green-tab)))
-    `(tab-bar-groups-tab-4 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,orange-tab)))
-    `(tab-bar-groups-tab-5 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,purple-tab)))
-    `(tab-bar-groups-tab-6 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,cyan-tab)))
-    `(tab-bar-groups-tab-7 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,yellow-tab)))
-    `(tab-bar-groups-tab-8 ((,class ,@(modus-themes--variable-pitch-ui) 
:foreground ,magenta-tab)))
+    `(tab-bar-groups-tab-1 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,blue-tab)))
+    `(tab-bar-groups-tab-2 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,red-tab)))
+    `(tab-bar-groups-tab-3 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,green-tab)))
+    `(tab-bar-groups-tab-4 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,orange-tab)))
+    `(tab-bar-groups-tab-5 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,purple-tab)))
+    `(tab-bar-groups-tab-6 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,cyan-tab)))
+    `(tab-bar-groups-tab-7 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,yellow-tab)))
+    `(tab-bar-groups-tab-8 ((,class :inherit modus-themes-ui-variable-pitch 
:foreground ,magenta-tab)))
 ;;;;; tab-bar-mode
-    `(tab-bar ((,class ,@(modus-themes--tab bg-active bg-active-accent nil nil 
nil nil t))))
+    `(tab-bar ((,class :inherit modus-themes-tab-backdrop)))
     `(tab-bar-tab-group-current ((,class ,@(modus-themes--tab bg-tab-active)
                                          :box (:line-width (2 . -2) :color 
"gray50"))))
     `(tab-bar-tab-group-inactive ((,class ,@(modus-themes--tab bg-tab-inactive 
bg-tab-inactive-accent fg-dim)
                                           :box (:line-width (2 . -2) :color 
"gray50"))))
-    `(tab-bar-tab ((,class ,@(modus-themes--tab bg-tab-active nil nil nil t 
t))))
-    `(tab-bar-tab-inactive ((,class ,@(modus-themes--tab bg-tab-inactive 
bg-tab-inactive-accent fg-dim nil t))))
+    `(tab-bar-tab ((,class :inherit modus-themes-tab-active)))
+    `(tab-bar-tab-inactive ((,class :inherit modus-themes-tab-inactive)))
 ;;;;; tab-line-mode
-    `(tab-line ((,class ,@(modus-themes--tab bg-active bg-active-accent nil 
nil nil nil t)
-                        :height 0.95)))
+    `(tab-line ((,class :inherit modus-themes-tab-backdrop :height 0.95)))
     `(tab-line-close-highlight ((,class :foreground ,red)))
     `(tab-line-highlight ((,class :inherit modus-themes-active-blue)))
-    `(tab-line-tab ((,class ,@(modus-themes--tab bg-tab-active nil nil nil t 
t))))
+    `(tab-line-tab ((,class :inherit modus-themes-tab-active)))
     `(tab-line-tab-current ((,class :inherit tab-line-tab)))
-    `(tab-line-tab-inactive ((,class ,@(modus-themes--tab bg-tab-inactive 
bg-tab-inactive-accent fg-dim nil t))))
+    `(tab-line-tab-inactive ((,class :inherit modus-themes-tab-inactive)))
     `(tab-line-tab-inactive-alternate ((,class ,@(modus-themes--tab 
bg-tab-inactive-alt
                                                                     
bg-tab-inactive-alt-accent fg-main nil t))))
     `(tab-line-tab-modified ((,class :foreground ,red-alt-other-faint)))
@@ -7539,9 +7138,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(transient-argument ((,class :inherit bold :foreground ,green)))
     `(transient-blue ((,class :inherit bold :foreground ,blue)))
     `(transient-disabled-suffix ((,class :inherit modus-themes-intense-red)))
-    `(transient-enabled-suffix ((,class :inherit 
,@(modus-themes--success-deuteran
-                                                    'modus-themes-subtle-blue
-                                                    
'modus-themes-subtle-green))))
+    `(transient-enabled-suffix ((,class :inherit 
modus-themes-grue-background-subtle)))
     `(transient-heading ((,class :inherit bold :foreground ,fg-main)))
     `(transient-inactive-argument ((,class :inherit shadow)))
     `(transient-inactive-value ((,class :inherit shadow)))
@@ -7560,34 +7157,29 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(trashed-mark ((,class :inherit modus-themes-mark-symbol)))
     `(trashed-marked ((,class :inherit modus-themes-mark-alt)))
     `(trashed-restored ((,class :inherit modus-themes-mark-sel)))
-    `(trashed-symlink ((,class :inherit button
-                               ,@(modus-themes--link-color
-                                  cyan-alt cyan-alt-faint))))
+    `(trashed-symlink ((,class :inherit modus-themes-link-symlink)))
 ;;;;; treemacs
     `(treemacs-directory-collapsed-face ((,class :foreground ,magenta-alt)))
     `(treemacs-directory-face ((,class :inherit dired-directory)))
     `(treemacs-file-face ((,class :foreground ,fg-main)))
     `(treemacs-fringe-indicator-face ((,class :foreground ,fg-main)))
-    `(treemacs-git-added-face ((,class :foreground ,green-intense)))
-    `(treemacs-git-conflict-face ((,class :inherit (modus-themes-intense-red 
bold))))
+    `(treemacs-git-added-face ((,class :inherit success)))
+    `(treemacs-git-conflict-face ((,class :inherit error)))
     `(treemacs-git-ignored-face ((,class :inherit shadow)))
-    `(treemacs-git-modified-face ((,class :foreground ,yellow-alt-other)))
-    `(treemacs-git-renamed-face ((,class :foreground ,cyan-alt-other)))
+    `(treemacs-git-modified-face ((,class :inherit warning)))
+    `(treemacs-git-renamed-face ((,class :inherit italic)))
     `(treemacs-git-unmodified-face ((,class :foreground ,fg-main)))
-    `(treemacs-git-untracked-face ((,class :foreground ,red-alt-other)))
+    `(treemacs-git-untracked-face ((,class :inherit shadow)))
     `(treemacs-help-column-face ((,class :inherit modus-themes-bold 
:foreground ,magenta-alt-other :underline t)))
     `(treemacs-help-title-face ((,class :foreground ,blue-alt-other)))
     `(treemacs-on-failure-pulse-face ((,class :inherit 
modus-themes-intense-red)))
-    `(treemacs-on-success-pulse-face ((,class :inherit 
,@(modus-themes--success-deuteran
-                                                          
'modus-themes-intense-blue
-                                                          
'modus-themes-intense-green))))
+    `(treemacs-on-success-pulse-face ((,class :inherit 
modus-themes-grue-background-intense)))
     `(treemacs-root-face ((,class :inherit bold :foreground ,blue-alt-other 
:height 1.2 :underline t)))
     `(treemacs-root-remote-disconnected-face ((,class :inherit 
treemacs-root-remote-face :foreground ,yellow)))
     `(treemacs-root-remote-face ((,class :inherit treemacs-root-face 
:foreground ,magenta)))
     `(treemacs-root-remote-unreadable-face ((,class :inherit 
treemacs-root-unreadable-face)))
     `(treemacs-root-unreadable-face ((,class :inherit treemacs-root-face 
:strike-through t)))
     `(treemacs-tags-face ((,class :foreground ,blue-alt)))
-    `(treemacs-tags-face ((,class :foreground ,magenta-alt)))
 ;;;;; tty-menu
     `(tty-menu-disabled-face ((,class :background ,bg-alt :foreground 
,fg-alt)))
     `(tty-menu-enabled-face ((,class :inherit bold :background ,bg-alt 
:foreground ,fg-main)))
@@ -7644,14 +7236,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(vc-removed-state ((,class :foreground ,red-active)))
     `(vc-state-base ((,class :foreground ,fg-active)))
     `(vc-up-to-date-state ((,class :foreground ,fg-special-cold)))
-;;;;; vdiff
-    `(vdiff-addition-face ((,class :inherit modus-themes-diff-added)))
-    `(vdiff-change-face ((,class :inherit modus-themes-diff-changed)))
-    `(vdiff-closed-fold-face ((,class :inherit modus-themes-diff-heading)))
-    `(vdiff-refine-added ((,class :inherit modus-themes-diff-refine-added)))
-    `(vdiff-refine-changed ((,class :inherit 
modus-themes-diff-refine-changed)))
-    `(vdiff-subtraction-face ((,class :inherit modus-themes-diff-removed)))
-    `(vdiff-target-face ((,class :inherit modus-themes-intense-blue)))
 ;;;;; vertico
     `(vertico-current ((,class :inherit bold :foreground ,fg-main
                                :background ,@(pcase modus-themes-completions
@@ -7677,8 +7261,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(vr/match-0 ((,class :inherit modus-themes-refine-yellow)))
     `(vr/match-1 ((,class :inherit modus-themes-refine-yellow)))
     `(vr/match-separator-face ((,class :inherit (modus-themes-intense-neutral 
bold))))
-;;;;; volatile-highlights
-    `(vhl/default-face ((,class :background ,bg-alt :foreground 
,blue-nuanced-fg :extend t)))
 ;;;;; vterm
     `(vterm-color-black ((,class :background "gray35" :foreground "gray35")))
     `(vterm-color-blue ((,class :background ,blue :foreground ,blue)))
@@ -7768,11 +7350,11 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(web-mode-warning-face ((,class :inherit font-lock-warning-face)))
     `(web-mode-whitespace-face ((,class :background ,bg-whitespace :foreground 
,fg-whitespace)))
 ;;;;; wgrep
-    `(wgrep-delete-face ((,class :inherit modus-themes-refine-yellow)))
-    `(wgrep-done-face ((,class :inherit modus-themes-refine-blue)))
-    `(wgrep-face ((,class :inherit modus-themes-refine-green)))
+    `(wgrep-delete-face ((,class :inherit warning)))
+    `(wgrep-done-face ((,class :inherit success)))
+    `(wgrep-face ((,class :inherit bold)))
     `(wgrep-file-face ((,class :foreground ,fg-special-warm)))
-    `(wgrep-reject-face ((,class :inherit (modus-themes-intense-red bold))))
+    `(wgrep-reject-face ((,class :inherit error)))
 ;;;;; which-function-mode
     `(which-func ((,class :foreground ,magenta-active)))
 ;;;;; which-key
@@ -7828,7 +7410,7 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(ztreep-arrow-face ((,class :foreground ,fg-inactive)))
     `(ztreep-diff-header-face ((,class :inherit bold :height 1.2 :foreground 
,fg-special-cold)))
     `(ztreep-diff-header-small-face ((,class :foreground ,fg-main)))
-    `(ztreep-diff-model-add-face ((,class :foreground 
,@(modus-themes--diff-deuteran blue green))))
+    `(ztreep-diff-model-add-face ((,class :inherit modus-themes-grue)))
     `(ztreep-diff-model-diff-face ((,class :foreground ,red)))
     `(ztreep-diff-model-ignored-face ((,class :inherit shadow :strike-through 
t)))
     `(ztreep-diff-model-normal-face ((,class :inherit shadow)))
@@ -7858,10 +7440,6 @@ by virtue of calling either of 
`modus-themes-load-operandi' and
     `(ibuffer-filter-group-name-face 'modus-themes-pseudo-header)
     `(ibuffer-marked-face 'modus-themes-mark-sel)
     `(ibuffer-title-face 'default)
-;;;; highlight-tail
-    `(highlight-tail-colors
-      '((,green-subtle-bg . 0)
-        (,cyan-subtle-bg . 20)))
 ;;;; hl-todo
     `(hl-todo-keyword-faces
       '(("HOLD" . ,yellow-alt)
diff --git a/etc/themes/modus-vivendi-theme.el 
b/etc/themes/modus-vivendi-theme.el
index 6dffbf07e9..738753741c 100644
--- a/etc/themes/modus-vivendi-theme.el
+++ b/etc/themes/modus-vivendi-theme.el
@@ -1,27 +1,27 @@
 ;;; modus-vivendi-theme.el --- Accessible dark theme (WCAG AAA) -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Protesilaos Stavrou <info@protesilaos.com>
 ;; URL: https://gitlab.com/protesilaos/modus-themes
-;; Version: 1.7.0
+;; Version: 2.0.0
 ;; Package-Requires: ((emacs "27.1"))
 ;; Keywords: faces, theme, accessibility
 
 ;; This file is part of GNU Emacs.
 
-;; This program is free software; you can redistribute it and/or modify
+;; 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.
+;; 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.
+;; 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index fe4a24746e..ef00d2ac49 100644
--- a/etc/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; tango-dark-theme.el --- Tango-based custom theme for faces  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Authors: Chong Yidong <cyd@stupidchicken>
 ;;          Jan Moringen <jan.moringen@uni-bielefeld.de>
diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el
index 5c429b0b70..ecbbf03753 100644
--- a/etc/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
@@ -1,6 +1,6 @@
 ;;; tango-theme.el --- Tango-based custom theme for faces  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Authors: Chong Yidong <cyd@stupidchicken>
 ;;          Jan Moringen <jan.moringen@uni-bielefeld.de>
diff --git a/etc/themes/tsdh-dark-theme.el b/etc/themes/tsdh-dark-theme.el
index 62ed7c81dc..a88ad75520 100644
--- a/etc/themes/tsdh-dark-theme.el
+++ b/etc/themes/tsdh-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; tsdh-dark-theme.el --- Tassilo's dark custom theme  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/etc/themes/tsdh-light-theme.el b/etc/themes/tsdh-light-theme.el
index 481a8f3733..d9d09b702b 100644
--- a/etc/themes/tsdh-light-theme.el
+++ b/etc/themes/tsdh-light-theme.el
@@ -1,6 +1,6 @@
 ;;; tsdh-light-theme.el --- Tassilo's light custom theme  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/etc/themes/wheatgrass-theme.el b/etc/themes/wheatgrass-theme.el
index 162f797515..c56c8a2d8a 100644
--- a/etc/themes/wheatgrass-theme.el
+++ b/etc/themes/wheatgrass-theme.el
@@ -1,6 +1,6 @@
 ;;; wheatgrass-theme.el --- custom theme for faces  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/etc/themes/whiteboard-theme.el b/etc/themes/whiteboard-theme.el
index 9cf8e7dfc9..f21b18b421 100644
--- a/etc/themes/whiteboard-theme.el
+++ b/etc/themes/whiteboard-theme.el
@@ -1,6 +1,6 @@
 ;;; whiteboard-theme.el --- Custom theme for faces  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Scott Frazer <frazer.scott@gmail.com>
 
diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el
index d769c33721..d9fab8ac78 100644
--- a/etc/themes/wombat-theme.el
+++ b/etc/themes/wombat-theme.el
@@ -1,6 +1,6 @@
 ;;; wombat-theme.el --- Custom face theme for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Kristoffer Grönlund <krig@koru.se>
 
diff --git a/etc/tutorials/TUTORIAL b/etc/tutorials/TUTORIAL
index c5f2e684c4..c4e08adb0c 100644
--- a/etc/tutorials/TUTORIAL
+++ b/etc/tutorials/TUTORIAL
@@ -1131,7 +1131,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial is a part of GNU Emacs.  It is copyrighted
 and comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
diff --git a/etc/tutorials/TUTORIAL.bg b/etc/tutorials/TUTORIAL.bg
index 3391e9b32e..63cae5d62b 100644
--- a/etc/tutorials/TUTORIAL.bg
+++ b/etc/tutorials/TUTORIAL.bg
@@ -1162,7 +1162,7 @@ Dired ви позволява да гледате списъка от файло
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
diff --git a/etc/tutorials/TUTORIAL.cn b/etc/tutorials/TUTORIAL.cn
index 742de090da..5d03014e41 100644
--- a/etc/tutorials/TUTORIAL.cn
+++ b/etc/tutorials/TUTORIAL.cn
@@ -997,7 +997,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial is a part of GNU Emacs.  It is copyrighted
 and comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
@@ -1026,7 +1026,7 @@ using, writing, and sharing free software!
 
 本篇指南是 GNU Emacs 的一部分,并允许在下列条件的约束下发行其拷贝:
 
-   Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation,
+   Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation,
    Inc.
 
    本文件为 GNU Emacs 的一部分。
diff --git a/etc/tutorials/TUTORIAL.cs b/etc/tutorials/TUTORIAL.cs
index 12c0d1e5ca..737b872c50 100644
--- a/etc/tutorials/TUTORIAL.cs
+++ b/etc/tutorials/TUTORIAL.cs
@@ -1015,7 +1015,7 @@ tutoriálem napsaným Stuartem Cracraftem pro původní Emacs.
 Tato verze tutoriálu je, podobně jako GNU Emacs, chráněna copyrightem a
 je šířena se svolením distribuovat kopie za jistých podmínek:
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
    Každému je zaručeno právo vytvářet a distribuovat přesné kopie tohoto
    dokumentu tak, jak jej obdržel, na jakémkoliv médiu, s tím, že bude
diff --git a/etc/tutorials/TUTORIAL.de b/etc/tutorials/TUTORIAL.de
index 7793094dc0..4ae421f40e 100644
--- a/etc/tutorials/TUTORIAL.de
+++ b/etc/tutorials/TUTORIAL.de
@@ -1488,7 +1488,7 @@ Beachten Sie bitte, dass im Zweifelsfalle das englische 
Original
 dieser Urheberrechtsnotiz gültig ist (zu finden in der Datei
 TUTORIAL).
 
-   Copyright (C) 1985, 1996-1997, 2001-2021 Free Software Foundation,
+   Copyright (C) 1985, 1996-1997, 2001-2022 Free Software Foundation,
    Inc.
 
    Diese Datei ist ein Bestandteil von GNU Emacs.
diff --git a/etc/tutorials/TUTORIAL.eo b/etc/tutorials/TUTORIAL.eo
index a1490cb99b..762510a6fb 100644
--- a/etc/tutorials/TUTORIAL.eo
+++ b/etc/tutorials/TUTORIAL.eo
@@ -1081,7 +1081,7 @@ la dosiero verkita de Stuart Cracraft por la originala 
Emakso.
 kopirajton, kaj venas kun permeso por disdoni kopiojn se certaj
 kondiĉoj estas observataj:
 
-   Copyright (C) 1985, 1999, 2001-2002, 2005, 2007-2021 Free Software
+   Copyright (C) 1985, 1999, 2001-2002, 2005, 2007-2022 Free Software
    Foundation, Inc.
 
    Ĉi tiu dosiero estas parto de "GNU Emacs".
diff --git a/etc/tutorials/TUTORIAL.es b/etc/tutorials/TUTORIAL.es
index a92604ccb9..454f2ce68f 100644
--- a/etc/tutorials/TUTORIAL.es
+++ b/etc/tutorials/TUTORIAL.es
@@ -1204,7 +1204,7 @@ Por favor, en caso de duda, solo es válido el original en 
inglés de la
 siguiente nota de derechos de reproducción (que puede encontrar en el
 archivo TUTORIAL).
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
    Se permite a cualquiera hacer o distribuir copias literales de este
    documento como se recibe, en cualquier medio, siempre que la nota
diff --git a/etc/tutorials/TUTORIAL.fr b/etc/tutorials/TUTORIAL.fr
index 3c1d87cda0..5b080645e4 100644
--- a/etc/tutorials/TUTORIAL.fr
+++ b/etc/tutorials/TUTORIAL.fr
@@ -1202,7 +1202,7 @@ Cette version du didacticiel, comme GNU Emacs, est placée 
sous
 droit d'auteur, et vous pouvez en distribuer des copies sous certaines
 conditions :
 
-Copyright (C) 1985, 1996, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 2001-2022 Free Software Foundation, Inc.
 
    Chacun peut créer ou distribuer des copies de ce document tel qu'il
    l'a reçu, sur n'importe quel support, pourvu que la note de
diff --git a/etc/tutorials/TUTORIAL.he b/etc/tutorials/TUTORIAL.he
index fc4b769599..26a9d06e45 100644
--- a/etc/tutorials/TUTORIAL.he
+++ b/etc/tutorials/TUTORIAL.he
@@ -1015,7 +1015,7 @@ find-file.
 גירסה זו של השיעור הינה חלק מחבילת GNU Emacs. היא מוגנת בזכויות יוצרים
 וניתנת להעתקה והפצת עותקים בתנאים מסויימים כדלקמן:
 
-                       Copyright (C) 2010-2021 Free Software Foundation, Inc.
+                       Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ‏GNU Emacs הינו תכנה חפשית; זכותכם להפיצו ו\או לשנותו בכפוף לתנאי
 הרשיון GNU General Public License, כפי שהוא יוצא לאור ע״י Free
diff --git a/etc/tutorials/TUTORIAL.it b/etc/tutorials/TUTORIAL.it
index aa2fb4560a..dba941cfd5 100644
--- a/etc/tutorials/TUTORIAL.it
+++ b/etc/tutorials/TUTORIAL.it
@@ -1219,7 +1219,7 @@ distribuito con il permesso di farne copie a determinate 
condizioni:
    indicativo, restando comunque inteso il fatto che è quella
    originale a fare fede.
 
-Copyright (C) 2003-2021 Free Software Foundation, Inc.
+Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
    È permesso a chiunque copiare e distribuire attraverso ogni mezzo
    copie fedeli di questo documento così come viene ricevuto, a
diff --git a/etc/tutorials/TUTORIAL.ja b/etc/tutorials/TUTORIAL.ja
index db1e19b692..43f4d09da7 100644
--- a/etc/tutorials/TUTORIAL.ja
+++ b/etc/tutorials/TUTORIAL.ja
@@ -1062,7 +1062,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.ko b/etc/tutorials/TUTORIAL.ko
index d3ec8c240c..84cc4f1d84 100644
--- a/etc/tutorials/TUTORIAL.ko
+++ b/etc/tutorials/TUTORIAL.ko
@@ -981,7 +981,7 @@ C-x C-s와 (META쇠나 EDIT쇠 혹은 교체쇠가 있으면) <ESC>v와 같은 
 GNU 이맥스와 같이 이 지침서 판은 저작권이 있으며 특정한 조건을 만족할
 때에 복사본을 배포할 수 있는 허가를 갖고 나온 것이다:
 
-Copyright (C) 1985, 1996, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 2001-2022 Free Software Foundation, Inc.
 
    이 문서는 이 저작권 공고와 허용 공고가 그대로 유지되고, 배포자가
    수취자에게 이 공고에 따라 허용되는 것처럼 또 재분배하는 것을
diff --git a/etc/tutorials/TUTORIAL.nl b/etc/tutorials/TUTORIAL.nl
index 0853e5ffbb..2ec3fac11b 100644
--- a/etc/tutorials/TUTORIAL.nl
+++ b/etc/tutorials/TUTORIAL.nl
@@ -1209,7 +1209,7 @@ Deze versie van de inleiding is onderdeel van GNU Emacs.  
Het valt
 onder copyright.  Je mag deze inleiding verspreiden onder bepaalde
 voorwaarden:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation,
   Inc.
 
   Dit bestand is onderdeel van GNU Emacs.
@@ -1239,7 +1239,7 @@ Engels origineel van de copyrightmelding en condities:
 This version of the tutorial is a part of GNU Emacs.  It is copyrighted
 and comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/etc/tutorials/TUTORIAL.pl b/etc/tutorials/TUTORIAL.pl
index b5ccccfad4..2d87eb4710 100644
--- a/etc/tutorials/TUTORIAL.pl
+++ b/etc/tutorials/TUTORIAL.pl
@@ -1209,7 +1209,7 @@ z pomocą Ryszarda Kubiaka i Janusza S. Bienia 
<jsbien@mail.uw.edu.pl>.
 Ta wersja samouczka, podobnie jak GNU Emacs, jest chroniona prawem
 autorskim, ale wolno ją kopiować pod następującymi warunkami:
 
-Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1994, 2001-2022 Free Software Foundation, Inc.
 
 Zezwala się na wykonywanie lub rozpowszechnianie
 wiernych kopii tego dokumentu w otrzymanej formie, na dowolnym
diff --git a/etc/tutorials/TUTORIAL.pt_BR b/etc/tutorials/TUTORIAL.pt_BR
index 65ab3b5651..0a3b376e4d 100644
--- a/etc/tutorials/TUTORIAL.pt_BR
+++ b/etc/tutorials/TUTORIAL.pt_BR
@@ -1056,7 +1056,7 @@ Essa versão do tutorial foi originalmente traduzida por 
Marcelo Toledo
 <marcelo@gnu.org> e como o GNU Emacs, tem um copyright, e vem
 com uma permissão de distribuição de cópias nas seguintes condições:
 
-Copyright (C) 2004-2021 Free Software Foundation, Inc.
+Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
    Permissão é garantida a qualquer um para fazer ou distribuir cópias
    integrais deste documento como recebido, em qualquer meio, deixando
diff --git a/etc/tutorials/TUTORIAL.ro b/etc/tutorials/TUTORIAL.ro
index f9e67caa1e..1f1dc32560 100644
--- a/etc/tutorials/TUTORIAL.ro
+++ b/etc/tutorials/TUTORIAL.ro
@@ -4,7 +4,7 @@ Mulţumiri Aidei Hulubei <aida@chang.pub.ro> pentru corecturi şi 
sugestii.
 
 Această versiune a fost produsă plecând de la versiunea în limba
 engleză, care este
-Copyright (c) 1985, 2013-2021 Free Software Foundation, Inc.
+Copyright (c) 1985, 2013-2022 Free Software Foundation, Inc.
 
 Citiţi acum versiunea românească a tutorialului de Emacs.
 
@@ -1082,7 +1082,7 @@ continuare noţita de copyright originală în limba engleză.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.ru b/etc/tutorials/TUTORIAL.ru
index 45bee48bd4..d32b7163e6 100644
--- a/etc/tutorials/TUTORIAL.ru
+++ b/etc/tutorials/TUTORIAL.ru
@@ -1105,7 +1105,7 @@ Dired позволяет вам отображать список файлов 
 (copyrighted) и приходит с ограничениями распространения копий со
 следующими соглашениями:
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.sk b/etc/tutorials/TUTORIAL.sk
index 525db24800..7e523f0f93 100644
--- a/etc/tutorials/TUTORIAL.sk
+++ b/etc/tutorials/TUTORIAL.sk
@@ -1074,7 +1074,7 @@ tútorialom napísaným Stuartom Cracraftom pre pôvodný 
Emacs.
 Táto verzia tútorialu je, podobne ako GNU Emacs, chránená copyrightom
 a je šírená s povolením distribuovať kópie za istých podmienok:
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
    Každému je zaručené právo vytvárať a distribuovať presné kópie tohto
    dokumentu tak, ako ho dostal, na akomkoľvek médiu, s tým, že bude
diff --git a/etc/tutorials/TUTORIAL.sl b/etc/tutorials/TUTORIAL.sl
index be87588b26..20ff1b6055 100644
--- a/etc/tutorials/TUTORIAL.sl
+++ b/etc/tutorials/TUTORIAL.sl
@@ -1119,7 +1119,7 @@ Emacs. V slovenščino ga je prevedel Primož Peterlin.
 To besedilo, kot sam GNU Emacs, je avtorsko delo, in njegovo
 razmnoževanje in razširjanje je dovoljeno pod naslednjimi pogoji:
 
-Copyright © 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright © 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
   Ta datoteka je del paketa GNU Emacs.
 
diff --git a/etc/tutorials/TUTORIAL.sv b/etc/tutorials/TUTORIAL.sv
index 5c9703f806..b1111af929 100644
--- a/etc/tutorials/TUTORIAL.sv
+++ b/etc/tutorials/TUTORIAL.sv
@@ -1153,7 +1153,7 @@ Lidell översatte den till svenska.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/etc/tutorials/TUTORIAL.th b/etc/tutorials/TUTORIAL.th
index 8bd4f07260..fb5a031362 100644
--- a/etc/tutorials/TUTORIAL.th
+++ b/etc/tutorials/TUTORIAL.th
@@ -964,7 +964,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1985, 1996, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 2001-2022 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.zh b/etc/tutorials/TUTORIAL.zh
index a808cf8359..959d51b7aa 100644
--- a/etc/tutorials/TUTORIAL.zh
+++ b/etc/tutorials/TUTORIAL.zh
@@ -1049,7 +1049,7 @@ issue here>」。
 這個版本的快速指南和 GNU Emacs 一樣都是版權化的,並且允許在某些條件下
 散佈其拷貝:
 
-Copyright (C) 1985, 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/w32-feature.el b/etc/w32-feature.el
index 364e9341ae..dadd8d1faa 100644
--- a/etc/w32-feature.el
+++ b/etc/w32-feature.el
@@ -1,6 +1,6 @@
 ;;; w32-feature.el --- Check Availability of Emacs Features  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Phillip Lord <phillip.lord@russet.org.uk>
 
diff --git a/leim/ChangeLog.1 b/leim/ChangeLog.1
index e2c0120445..af5a16c385 100644
--- a/leim/ChangeLog.1
+++ b/leim/ChangeLog.1
@@ -2578,7 +2578,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1997-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1997-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/leim/Makefile.in b/leim/Makefile.in
index ce1029abcf..a574a10845 100644
--- a/leim/Makefile.in
+++ b/leim/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1997-2021 Free Software Foundation, Inc.
+# Copyright (C) 1997-2022 Free Software Foundation, Inc.
 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 #   2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/leim/README b/leim/README
index baaf661055..6a4ec77619 100644
--- a/leim/README
+++ b/leim/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/leim/leim-ext.el b/leim/leim-ext.el
index 904675c0c5..58dd166763 100644
--- a/leim/leim-ext.el
+++ b/leim/leim-ext.el
@@ -1,6 +1,6 @@
 ;;; leim-ext.el --- extra leim configuration   -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
diff --git a/lib-src/ChangeLog.1 b/lib-src/ChangeLog.1
index 3c2698005d..0829f50a56 100644
--- a/lib-src/ChangeLog.1
+++ b/lib-src/ChangeLog.1
@@ -8609,7 +8609,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1988-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1988-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index c07b678839..c25ba5c974 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2021 Free Software
+# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2022 Free Software
 # Foundation, Inc.
 
 # This file is part of GNU Emacs.
@@ -297,8 +297,8 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
 ## up if chown or chgrp fails, as the package responsible for
 ## installing Emacs can fix this problem later.
 $(DESTDIR)${archlibdir}: all
-       @echo
-       @echo "Installing utilities run internally by Emacs."
+       $(info $ )
+       $(info Installing utilities run internally by Emacs.)
        umask 022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}"
        exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
        if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
@@ -339,8 +339,8 @@ $(DESTDIR)${archlibdir}: all
 .PHONY: bootstrap-clean check tags
 
 install: $(DESTDIR)${archlibdir}
-       @echo
-       @echo "Installing utilities for users to run."
+       $(info $ )
+       $(info Installing utilities for users to run.)
        umask 022 && ${MKDIR_P} "$(DESTDIR)${bindir}"
        for file in ${INSTALLABLES} ; do \
          $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} \
@@ -375,7 +375,7 @@ bootstrap-clean maintainer-clean: distclean
 
 ## Test the contents of the directory.
 check:
-       @echo "We don't have any tests for the lib-src/ directory yet."
+       $(info We don't have any tests for the lib-src/ directory yet.)
 
 tagsfiles = $(wildcard ${srcdir}/*.[ch])
 
diff --git a/lib-src/be_resources.cc b/lib-src/be_resources.cc
index e6a14f037b..d18fe30dd7 100644
--- a/lib-src/be_resources.cc
+++ b/lib-src/be_resources.cc
@@ -1,5 +1,5 @@
 /* Haiku window system support
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 436b13a32c..04ae018464 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1,6 +1,6 @@
 /* ebrowse.c --- parsing files for the ebrowse C++ browser
 
-Copyright (C) 1992-2021 Free Software Foundation, Inc.
+Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index ea9f72dfae..365e803e1c 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1,6 +1,6 @@
 /* Client process that communicates with GNU Emacs acting as server.
 
-Copyright (C) 1986-1987, 1994, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1986-1987, 1994, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -607,7 +607,12 @@ decode_options (int argc, char **argv)
       alt_display = "be";
 #endif
 
+#ifdef HAVE_PGTK
+      display = egetenv ("WAYLAND_DISPLAY");
+      alt_display = egetenv ("DISPLAY");
+#else
       display = egetenv ("DISPLAY");
+#endif
     }
 
   if (!display)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 71f3464661..aa5bc8839d 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2021 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2022 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index 64866068f4..c074a957a6 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -1,5 +1,5 @@
 /* Convert files for Emacs Hexl mode.
-   Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989, 2001-2022 Free Software Foundation, Inc.
 
 Author: Keith Gabryelski (according to authors.el)
 
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index d17c28be90..f42b1988a2 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1,6 +1,6 @@
 /* Generate doc-string file for GNU Emacs from source files.
 
-Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2021 Free Software
+Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public 
License
 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
 
-/* The arguments given to this program are all the C and Lisp source files
- of GNU Emacs.  .elc and .el and .c files are allowed.
+/* The arguments given to this program are all the C and some Lisp source files
+ of GNU Emacs.  .el and .c files are allowed.
  A .o file can also be specified; the .c file it was made from is used.
  This helps the makefile pass the correct list of files.
  Option -d DIR means change to DIR before looking for files.
@@ -62,9 +62,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    Similarly, msdos defines this as sys_chdir, but we're not linking with the
    file where that function is defined.  */
 #undef chdir
-#define IS_SLASH(c)  ((c) == '/' || (c) == '\\' || (c) == ':')
-#else  /* not DOS_NT */
-#define IS_SLASH(c)  ((c) == '/')
 #endif /* not DOS_NT */
 
 static void scan_file (char *filename);
@@ -242,9 +239,7 @@ scan_file (char *filename)
 
   if (!generate_globals)
     put_filename (filename);
-  if (len > 4 && !strcmp (filename + len - 4, ".elc"))
-    scan_lisp_file (filename, "rb");
-  else if (len > 3 && !strcmp (filename + len - 3, ".el"))
+  if (len > 3 && !strcmp (filename + len - 3, ".el"))
     scan_lisp_file (filename, "r");
   else
     scan_c_file (filename, "r");
@@ -1225,7 +1220,7 @@ scan_c_stream (FILE *infile)
     fatal ("read error");
 }
 
-/* Read a file of Lisp code, compiled or interpreted.
+/* Read a file of Lisp source code.
  Looks for
   (defun NAME ARGS DOCSTRING ...)
   (defmacro NAME ARGS DOCSTRING ...)
@@ -1252,10 +1247,8 @@ scan_c_stream (FILE *infile)
  For defun, defmacro, and autoload, we know how to skip over the
  arglist, but the doc string must still have a backslash and newline
  immediately after the double quote.
- The only source files that must follow this convention are preloaded
- uncompiled ones like loaddefs.el; aside from that, it is always the .elc
- file that we should look at, and they are no problem because byte-compiler
- output follows this convention.
+ The only source files that follow this convention are autoload-generated
+ files like loaddefs.el;
  The NAME and DOCSTRING are output.
  NAME is preceded by `F' for a function or `V' for a variable.
  An entry is output only if DOCSTRING has \ newline just after the opening ".
@@ -1331,50 +1324,14 @@ search_lisp_doc_at_eol (FILE *infile)
   return true;
 }
 
-#define DEF_ELISP_FILE(fn)  { #fn, sizeof(#fn) - 1 }
-
 static void
 scan_lisp_file (const char *filename, const char *mode)
 {
   FILE *infile;
   int c;
-  char *saved_string = 0;
-  /* These are the only files that are loaded uncompiled, and must
-     follow the conventions of the doc strings expected by this
-     function.  These conventions are automatically followed by the
-     byte compiler when it produces the .elc files.  */
-  static struct {
-    const char *fn;
-    int fl;
-  } const uncompiled[] = {
-    DEF_ELISP_FILE (loaddefs.el),
-    DEF_ELISP_FILE (loadup.el),
-    DEF_ELISP_FILE (charprop.el),
-    DEF_ELISP_FILE (cp51932.el),
-    DEF_ELISP_FILE (eucjp-ms.el)
-  };
-  int i;
-  int flen = strlen (filename);
 
   if (generate_globals)
     fatal ("scanning lisp file when -g specified");
-  if (flen > 3 && !strcmp (filename + flen - 3, ".el"))
-    {
-      bool match = false;
-      for (i = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]); i++)
-       {
-         if (uncompiled[i].fl <= flen
-             && !strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn)
-             && (flen == uncompiled[i].fl
-                 || IS_SLASH (filename[flen - uncompiled[i].fl - 1])))
-           {
-             match = true;
-             break;
-           }
-       }
-      if (!match)
-       fatal ("uncompiled lisp file %s is not supported", filename);
-    }
 
   infile = fopen (filename, mode);
   if (infile == NULL)
@@ -1398,54 +1355,6 @@ scan_lisp_file (const char *filename, const char *mode)
       /* Skip the line break.  */
       while (c == '\n' || c == '\r')
        c = getc (infile);
-      /* Detect a dynamic doc string and save it for the next expression.  */
-      if (c == '#')
-       {
-         c = getc (infile);
-         if (c == '@')
-           {
-             ptrdiff_t length = 0;
-             ptrdiff_t i;
-
-             /* Read the length.  */
-             while ((c = getc (infile),
-                     c_isdigit (c)))
-               {
-                 if (INT_MULTIPLY_WRAPV (length, 10, &length)
-                     || INT_ADD_WRAPV (length, c - '0', &length)
-                     || SIZE_MAX < length)
-                   memory_exhausted ();
-               }
-
-             if (length <= 1)
-               fatal ("invalid dynamic doc string length");
-
-             if (c != ' ')
-               fatal ("space not found after dynamic doc string length");
-
-             /* The next character is a space that is counted in the length
-                but not part of the doc string.
-                We already read it, so just ignore it.  */
-             length--;
-
-             /* Read in the contents.  */
-             free (saved_string);
-             saved_string = xmalloc (length);
-             for (i = 0; i < length; i++)
-               saved_string[i] = getc (infile);
-             /* The last character is a ^_.
-                That is needed in the .elc file
-                but it is redundant in DOC.  So get rid of it here.  */
-             saved_string[length - 1] = 0;
-             /* Skip the line break.  */
-             while (c == '\n' || c == '\r')
-               c = getc (infile);
-             /* Skip the following line.  */
-             while (! (c == '\n' || c == '\r' || c < 0))
-               c = getc (infile);
-           }
-         continue;
-       }
 
       if (c != '(')
        continue;
@@ -1498,7 +1407,6 @@ scan_lisp_file (const char *filename, const char *mode)
            }
        }
 
-      /* defcustom can only occur in uncompiled Lisp files.  */
       else if (! strcmp (buffer, "defvar")
               || ! strcmp (buffer, "defconst")
               || ! strcmp (buffer, "defcustom"))
@@ -1506,9 +1414,8 @@ scan_lisp_file (const char *filename, const char *mode)
          type = 'V';
          read_lisp_symbol (infile, buffer);
 
-         if (saved_string == 0)
-           if (!search_lisp_doc_at_eol (infile))
-             continue;
+         if (!search_lisp_doc_at_eol (infile))
+           continue;
        }
 
       else if (! strcmp (buffer, "custom-declare-variable")
@@ -1548,9 +1455,8 @@ scan_lisp_file (const char *filename, const char *mode)
                }
            }
 
-         if (saved_string == 0)
-           if (!search_lisp_doc_at_eol (infile))
-             continue;
+         if (!search_lisp_doc_at_eol (infile))
+           continue;
        }
 
       else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias"))
@@ -1586,9 +1492,8 @@ scan_lisp_file (const char *filename, const char *mode)
                }
            }
 
-         if (saved_string == 0)
-           if (!search_lisp_doc_at_eol (infile))
-             continue;
+         if (!search_lisp_doc_at_eol (infile))
+           continue;
        }
 
       else if (! strcmp (buffer, "autoload"))
@@ -1632,9 +1537,8 @@ scan_lisp_file (const char *filename, const char *mode)
            }
          read_c_string_or_comment (infile, 0, false, 0);
 
-         if (saved_string == 0)
-           if (!search_lisp_doc_at_eol (infile))
-             continue;
+         if (!search_lisp_doc_at_eol (infile))
+           continue;
        }
 
 #ifdef DEBUG
@@ -1652,23 +1556,13 @@ scan_lisp_file (const char *filename, const char *mode)
          continue;
        }
 
-      /* At this point, we should either use the previous dynamic doc string in
-        saved_string or gobble a doc string from the input file.
-        In the latter case, the opening quote (and leading backslash-newline)
+      /* At this point, we should gobble a doc string from the input file.
+        The opening quote (and leading backslash-newline)
         have already been read.  */
 
       printf ("\037%c%s\n", type, buffer);
-      if (saved_string)
-       {
-         fputs (saved_string, stdout);
-         /* Don't use one dynamic doc string twice.  */
-         free (saved_string);
-         saved_string = 0;
-       }
-      else
-       read_c_string_or_comment (infile, 1, false, 0);
+      read_c_string_or_comment (infile, 1, false, 0);
     }
-  free (saved_string);
   if (ferror (infile) || fclose (infile) != 0)
     fatal ("%s: read error", filename);
 }
diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c
index 485dd4b919..ea9fe941e4 100644
--- a/lib-src/make-fingerprint.c
+++ b/lib-src/make-fingerprint.c
@@ -1,6 +1,6 @@
 /* Hash inputs and generate C file with the digest.
 
-Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2016, 2018-2021 Free
+Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2016, 2018-2022 Free
 Software Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index e683da179d..888688f90b 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -1,7 +1,7 @@
 /* movemail foo bar -- move file foo to file bar,
    locking file foo the way /bin/mail respects.
 
-Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2021 Free Software
+Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index c8bcf742fe..ee21abc723 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -1,6 +1,6 @@
 /* Utility and Unix shadow routines for GNU Emacs support programs on NT.
 
-Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 Author: Geoff Voelker (voelker@cs.washington.edu)
 Created: 10-8-94
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index d62c19f16a..2cd2b1d107 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -1,5 +1,5 @@
 /* Utility and Unix shadow routines for GNU Emacs support programs on NT.
-   Copyright (C) 1994, 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2002-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 27ed89b836..cfe2ece660 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1,6 +1,6 @@
 /* pop.c: client routines for talking to a POP3-protocol post-office server
 
-Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2021 Free Software
+Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2022 Free Software
 Foundation, Inc.
 
 Author: Jonathan Kamens <jik@security.ov.com>
diff --git a/lib-src/pop.h b/lib-src/pop.h
index 229714b68e..2c9b3e0bec 100644
--- a/lib-src/pop.h
+++ b/lib-src/pop.h
@@ -1,5 +1,5 @@
 /* pop.h: Header file for the "pop.c" client POP3 protocol.
-   Copyright (C) 1991, 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 2001-2022 Free Software Foundation, Inc.
 
 Author: Jonathan Kamens <jik@security.ov.com>
 
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index 7a033672f6..bc7875cfdd 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -2,7 +2,7 @@
 
 # RCS to ChangeLog generator
 
-# Copyright (C) 1992-1998, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2001-2022 Free Software Foundation, Inc.
 
 # Author: Paul Eggert <eggert@cs.ucla.edu>
 
@@ -20,7 +20,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 
-Copyright='Copyright (C) 2021 Free Software Foundation, Inc.
+Copyright='Copyright (C) 2022 Free Software Foundation, Inc.
 This program comes with NO WARRANTY, to the extent permitted by law.
 You may redistribute copies of this program
 under the terms of the GNU General Public License.
diff --git a/lib-src/seccomp-filter.c b/lib-src/seccomp-filter.c
index e7496053a8..552a986239 100644
--- a/lib-src/seccomp-filter.c
+++ b/lib-src/seccomp-filter.c
@@ -1,6 +1,6 @@
 /* Generate a Secure Computing filter definition file.
 
-Copyright (C) 2020-2021 Free Software Foundation, Inc.
+Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index f1242dfbe6..8d6cca79c9 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -1,6 +1,6 @@
 /* update-game-score.c --- Update a score file
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 Author: Colin Walters <walters@debian.org>
 
diff --git a/lib/Makefile.in b/lib/Makefile.in
index ccb90c3d1b..8b95013624 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright 2017-2021 Free Software Foundation, Inc.
+# Copyright 2017-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -88,13 +88,13 @@ e-%.o: %.c
 all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a)
 
 libgnu.a: $(libgnu_a_OBJECTS)
-       $(AM_V_at)rm -f $@
-       $(AM_V_AR)$(AR) $(ARFLAGS) $@ $(libgnu_a_OBJECTS)
+       $(AM_V_AR)rm -f $@
+       $(AM_V_at)$(AR) $(ARFLAGS) $@ $(libgnu_a_OBJECTS)
        $(AM_V_at)$(RANLIB) $@
 
 libegnu.a: $(libegnu_a_OBJECTS)
-       $(AM_V_at)rm -f $@
-       $(AM_V_AR)$(AR) $(ARFLAGS) $@ $(libegnu_a_OBJECTS)
+       $(AM_V_AR)rm -f $@
+       $(AM_V_at)$(AR) $(ARFLAGS) $@ $(libegnu_a_OBJECTS)
        $(AM_V_at)$(RANLIB) $@
 
 ETAGS = ../lib-src/etags$(EXEEXT)
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index 6fed3c7971..e914627a88 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -1,5 +1,5 @@
 /* A C macro for declaring that a function does not return.
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/acl-errno-valid.c b/lib/acl-errno-valid.c
index af1af82c9f..39717c3517 100644
--- a/lib/acl-errno-valid.c
+++ b/lib/acl-errno-valid.c
@@ -1,6 +1,6 @@
 /* Test whether ACLs are well supported on this system.
 
-   Copyright 2013-2021 Free Software Foundation, Inc.
+   Copyright 2013-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
index 2b212e8fc4..75a80bf0df 100644
--- a/lib/acl-internal.c
+++ b/lib/acl-internal.c
@@ -1,6 +1,6 @@
 /* Test whether a file has a nontrivial ACL.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index ca302bf8cd..582f9e1c1a 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -1,6 +1,6 @@
 /* Internal implementation of access control lists.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl.h b/lib/acl.h
index 7014b82f73..8b933c20b9 100644
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -1,6 +1,6 @@
 /* acl.c - access control lists
 
-   Copyright (C) 2002, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2008-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl_entries.c b/lib/acl_entries.c
index 6f70caf175..e4c014ce71 100644
--- a/lib/acl_entries.c
+++ b/lib/acl_entries.c
@@ -1,6 +1,6 @@
 /* Return the number of entries in an ACL.
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/af_alg.h b/lib/af_alg.h
index f0fe7fc055..ddd6568b8e 100644
--- a/lib/af_alg.h
+++ b/lib/af_alg.h
@@ -1,5 +1,5 @@
 /* af_alg.h - Compute message digests from file streams and buffers.
-   Copyright (C) 2018-2021 Free Software Foundation, Inc.
+   Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 65c2d4d939..e2b146138d 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation,
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2022 Free Software Foundation,
    Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/allocator.c b/lib/allocator.c
index 2262de9ff3..42c891805d 100644
--- a/lib/allocator.c
+++ b/lib/allocator.c
@@ -1,6 +1,6 @@
 /* Memory allocators such as malloc+free.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/allocator.h b/lib/allocator.h
index f0e8f34896..3e698ced83 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -1,6 +1,6 @@
 /* Memory allocators such as malloc+free.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h
index b4de241e90..e4513efe95 100644
--- a/lib/arg-nonnull.h
+++ b/lib/arg-nonnull.h
@@ -1,5 +1,5 @@
 /* A C macro for declaring that specific arguments must not be NULL.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/at-func.c b/lib/at-func.c
index b6d9de754d..92d65f6341 100644
--- a/lib/at-func.c
+++ b/lib/at-func.c
@@ -1,5 +1,5 @@
 /* Define at-style functions like fstatat, unlinkat, fchownat, etc.
-   Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/attribute.h b/lib/attribute.h
index eb36188d48..378d4f0a80 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -1,6 +1,6 @@
 /* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
 
-   Copyright 2020-2021 Free Software Foundation, Inc.
+   Copyright 2020-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/binary-io.c b/lib/binary-io.c
index adc0ae2b0c..ea407fd74f 100644
--- a/lib/binary-io.c
+++ b/lib/binary-io.c
@@ -1,5 +1,5 @@
 /* Binary mode I/O.
-   Copyright 2017-2021 Free Software Foundation, Inc.
+   Copyright 2017-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/binary-io.h b/lib/binary-io.h
index 642f08b1ba..5b7661e233 100644
--- a/lib/binary-io.h
+++ b/lib/binary-io.h
@@ -1,5 +1,5 @@
 /* Binary mode I/O.
-   Copyright (C) 2001, 2003, 2005, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index 113f878027..f4746d3995 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -1,5 +1,5 @@
 /* byteswap.h - Byte swapping
-   Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2022 Free Software Foundation, Inc.
    Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/c++defs.h b/lib/c++defs.h
index a47b61a009..ad181558fb 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -1,5 +1,5 @@
 /* C++ compatible function declaration macros.
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index 300f97c292..a247514cd6 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -1,6 +1,6 @@
 /* Character handling in C locale.
 
-   Copyright (C) 2003-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index 3a652ac1f2..1a4f603898 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 82f99bb06b..3e874b5ea3 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -1,5 +1,5 @@
 /* Case-insensitive string comparison functions in C locale.
-   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software
+   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index 3c22455082..87b993cb2f 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,5 +1,5 @@
 /* c-strcasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index f3ca786cb3..5a5d30b6e5 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,5 +1,5 @@
 /* c-strncasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 92e9639720..a7fa7feb62 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2021 Free Software Foundation, Inc.
+   Copyright (C) 1996-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index 9d0c125ecb..6ddc35f798 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -1,6 +1,6 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2001, 2003-2004, 2007, 2009-2021 Free Software Foundation,
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2022 Free Software Foundation,
    Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index a3517b827a..2b559b2cd4 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -1,6 +1,6 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 4dac9d264d..abf13a9086 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
+   Copyright The GNU Toolchain Authors.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -150,6 +151,53 @@
 # define __glibc_objsize(__o) __bos (__o)
 #endif
 
+/* Compile time conditions to choose between the regular, _chk and _chk_warn
+   variants.  These conditions should get evaluated to constant and optimized
+   away.  */
+
+#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s))
+#define __glibc_unsigned_or_positive(__l) \
+  ((__typeof (__l)) 0 < (__typeof (__l)) -1                                  \
+   || (__builtin_constant_p (__l) && (__l) > 0))
+
+/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ
+   condition can be folded to a constant and if it is true.  The -1 check is
+   redundant because since it implies that __glibc_safe_len_cond is true.  */
+#define __glibc_safe_or_unknown_len(__l, __s, __osz) \
+  (__glibc_unsigned_or_positive (__l)                                        \
+   && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l),     \
+                                                  __s, __osz))               \
+   && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
+
+/* Conversely, we know at compile time that the length is unsafe if the
+   __L * __S <= __OBJSZ condition can be folded to a constant and if it is
+   false.  */
+#define __glibc_unsafe_len(__l, __s, __osz) \
+  (__glibc_unsigned_or_positive (__l)                                        \
+   && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l),     \
+                                                  __s, __osz))               \
+   && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
+
+/* Fortify function f.  __f_alias, __f_chk and __f_chk_warn must be
+   declared.  */
+
+#define __glibc_fortify(f, __l, __s, __osz, ...) \
+  (__glibc_safe_or_unknown_len (__l, __s, __osz)                             \
+   ? __ ## f ## _alias (__VA_ARGS__)                                         \
+   : (__glibc_unsafe_len (__l, __s, __osz)                                   \
+      ? __ ## f ## _chk_warn (__VA_ARGS__, __osz)                            \
+      : __ ## f ## _chk (__VA_ARGS__, __osz)))                       \
+
+/* Fortify function f, where object size argument passed to f is the number of
+   elements and not total size.  */
+
+#define __glibc_fortify_n(f, __l, __s, __osz, ...) \
+  (__glibc_safe_or_unknown_len (__l, __s, __osz)                             \
+   ? __ ## f ## _alias (__VA_ARGS__)                                         \
+   : (__glibc_unsafe_len (__l, __s, __osz)                                   \
+      ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s))                  \
+      : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))                     \
+
 #if __GNUC_PREREQ (4,3)
 # define __warnattr(msg) __attribute__((__warning__ (msg)))
 # define __errordecl(name, msg) \
@@ -243,6 +291,15 @@
 # define __attribute_alloc_size__(params) /* Ignore.  */
 #endif
 
+/* Tell the compiler which argument to an allocation function
+   indicates the alignment of the allocation.  */
+#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__)
+# define __attribute_alloc_align__(param) \
+  __attribute__ ((__alloc_align__ param))
+#else
+# define __attribute_alloc_align__(param) /* Ignore.  */
+#endif
+
 /* At some point during the gcc 2.96 development the `pure' attribute
    for functions was introduced.  We don't want to use it unconditionally
    (although this would be possible) since it generates warnings.  */
@@ -605,12 +662,22 @@ _Static_assert (0, "IEEE 128-bits long double requires 
redirection on this platf
    size-index is not provided:
      access (access-mode, <ref-index> [, <size-index>])  */
 #  define __attr_access(x) __attribute__ ((__access__ x))
+/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
+   use the access attribute to get object sizes from function definition
+   arguments, so we can't use them on functions we fortify.  Drop the object
+   size hints for such functions.  */
+#  if __USE_FORTIFY_LEVEL == 3
+#    define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, 
o)))
+#  else
+#    define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
+#  endif
 #  if __GNUC_PREREQ (11, 0)
 #    define __attr_access_none(argno) __attribute__ ((__access__ (__none__, 
argno)))
 #  else
 #    define __attr_access_none(argno)
 #  endif
 #else
+#  define __fortified_attr_access(a, o, s)
 #  define __attr_access(x)
 #  define __attr_access_none(argno)
 #endif
diff --git a/lib/cloexec.c b/lib/cloexec.c
index 7defa93446..812be01a06 100644
--- a/lib/cloexec.c
+++ b/lib/cloexec.c
@@ -1,6 +1,6 @@
 /* cloexec.c - set or clear the close-on-exec descriptor flag
 
-   Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 1991, 2004-2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/cloexec.h b/lib/cloexec.h
index 97a3659efb..7a22d77532 100644
--- a/lib/cloexec.h
+++ b/lib/cloexec.h
@@ -1,6 +1,6 @@
 /* cloexec.c - set or clear the close-on-exec descriptor flag
 
-   Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/close-stream.c b/lib/close-stream.c
index 86f6d6e1de..54f3e3c3d0 100644
--- a/lib/close-stream.c
+++ b/lib/close-stream.c
@@ -1,6 +1,6 @@
 /* Close a stream, with nicer error checking than fclose's.
 
-   Copyright (C) 1998-2002, 2004, 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2004, 2006-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/close-stream.h b/lib/close-stream.h
index 8a58a48e61..537506c489 100644
--- a/lib/close-stream.h
+++ b/lib/close-stream.h
@@ -1,6 +1,6 @@
 /* Close a stream, with nicer error checking than fclose's.
 
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
diff --git a/lib/copy-file-range.c b/lib/copy-file-range.c
index 17df577055..96f1ec7c5e 100644
--- a/lib/copy-file-range.c
+++ b/lib/copy-file-range.c
@@ -1,5 +1,5 @@
 /* Stub for copy_file_range
-   Copyright 2019-2021 Free Software Foundation, Inc.
+   Copyright 2019-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/count-leading-zeros.c b/lib/count-leading-zeros.c
index 7cf1ac2ff0..8eb1d2c100 100644
--- a/lib/count-leading-zeros.c
+++ b/lib/count-leading-zeros.c
@@ -1,6 +1,6 @@
 /* Count the number of leading 0 bits in a word.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h
index cef529ac13..354641af0a 100644
--- a/lib/count-leading-zeros.h
+++ b/lib/count-leading-zeros.h
@@ -1,5 +1,5 @@
 /* count-leading-zeros.h -- counts the number of leading 0 bits in a word.
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/count-one-bits.c b/lib/count-one-bits.c
index d9b4f5e848..67a61dad61 100644
--- a/lib/count-one-bits.c
+++ b/lib/count-one-bits.c
@@ -1,6 +1,6 @@
 /* Count the number of 1-bits in a word.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h
index 5e87a572b0..7d24c45a0d 100644
--- a/lib/count-one-bits.h
+++ b/lib/count-one-bits.h
@@ -1,5 +1,5 @@
 /* count-one-bits.h -- counts the number of 1-bits in a word.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/count-trailing-zeros.c b/lib/count-trailing-zeros.c
index 538b01dc02..143dcda55d 100644
--- a/lib/count-trailing-zeros.c
+++ b/lib/count-trailing-zeros.c
@@ -1,6 +1,6 @@
 /* Count the number of trailing 0 bits in a word.
 
-   Copyright 2013-2021 Free Software Foundation, Inc.
+   Copyright 2013-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h
index f81674c571..9a989a4324 100644
--- a/lib/count-trailing-zeros.h
+++ b/lib/count-trailing-zeros.h
@@ -1,5 +1,5 @@
 /* count-trailing-zeros.h -- counts the number of trailing 0 bits in a word.
-   Copyright 2013-2021 Free Software Foundation, Inc.
+   Copyright 2013-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/diffseq.h b/lib/diffseq.h
index 1cac430edd..0c901a6ecf 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -1,6 +1,6 @@
 /* Analyze differences between two vectors.
 
-   Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2021 Free Software
+   Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2022 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index 4deb0cb466..f28288d1ac 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -1,5 +1,5 @@
 /* A GNU-like <dirent.h>.
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/dirfd.c b/lib/dirfd.c
index 640cb4ff13..4104683fbf 100644
--- a/lib/dirfd.c
+++ b/lib/dirfd.c
@@ -1,6 +1,6 @@
 /* dirfd.c -- return the file descriptor associated with an open DIR*
 
-   Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/dtoastr.c b/lib/dtoastr.c
index 5baba92922..eaade8fa01 100644
--- a/lib/dtoastr.c
+++ b/lib/dtoastr.c
@@ -1,6 +1,6 @@
 /* Convert 'double' to accurate string.
 
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c
index 73061a3309..225a2be67c 100644
--- a/lib/dtotimespec.c
+++ b/lib/dtotimespec.c
@@ -1,6 +1,6 @@
 /* Convert double to timespec.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/dup2.c b/lib/dup2.c
index 53e5552132..1c766ab38e 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -1,6 +1,6 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004-2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/dynarray.h b/lib/dynarray.h
index ec64273b3a..ca6439d3ad 100644
--- a/lib/dynarray.h
+++ b/lib/dynarray.h
@@ -1,5 +1,5 @@
 /* Type-safe arrays which grow dynamically.
-   Copyright 2021 Free Software Foundation, Inc.
+   Copyright 2021-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/eloop-threshold.h b/lib/eloop-threshold.h
index fcd30ab1e6..8b31457119 100644
--- a/lib/eloop-threshold.h
+++ b/lib/eloop-threshold.h
@@ -1,5 +1,5 @@
 /* Threshold at which to diagnose ELOOP.  Generic version.
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 3cad9e2d62..3ec1845694 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index a86cebd179..97388c73bb 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -1,6 +1,6 @@
 /* euidaccess -- check if effective user id can access file
 
-   Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2021 Free
+   Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2022 Free
    Software Foundation, Inc.
 
    This file is part of the GNU C Library.
diff --git a/lib/execinfo.c b/lib/execinfo.c
index 18a1051b25..4320b16c63 100644
--- a/lib/execinfo.c
+++ b/lib/execinfo.c
@@ -1,6 +1,6 @@
 /* Information about executables.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h
index 98bb8039b7..03c551a87b 100644
--- a/lib/execinfo.in.h
+++ b/lib/execinfo.in.h
@@ -1,6 +1,6 @@
 /* Information about executables.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index 2906c04d0f..ad0bfd170c 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -1,5 +1,5 @@
 /* Erasure of sensitive data, generic implementation.
-   Copyright (C) 2016-2021 Free Software Foundation, Inc.
+   Copyright (C) 2016-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/faccessat.c b/lib/faccessat.c
index 3a776466cf..2c0c07aac1 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -1,5 +1,5 @@
 /* Check the access rights of a file relative to an open directory.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index eb6e2242fd..506e6badd7 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -1,5 +1,5 @@
 /* Change the protections of file relative to an open directory.
-   Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/fcntl.c b/lib/fcntl.c
index c744eb91e6..f9753c4035 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -1,6 +1,6 @@
 /* Provide file descriptor control.
 
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 26dedc3041..3e0c302af3 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/fdopendir.c b/lib/fdopendir.c
index 451b4e1321..a61bad66e2 100644
--- a/lib/fdopendir.c
+++ b/lib/fdopendir.c
@@ -1,5 +1,5 @@
 /* provide a replacement fdopendir function
-   Copyright (C) 2004-2021 Free Software Foundation, Inc.
+   Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 800af227cc..2b6f91ff20 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -1,6 +1,6 @@
 /* Test whether a file has a nontrivial ACL.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/filemode.c b/lib/filemode.c
index 357567281d..cb508ad12d 100644
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -1,6 +1,6 @@
 /* filemode.c -- make a string describing file modes
 
-   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2021 Free
+   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2022 Free
    Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/filemode.h b/lib/filemode.h
index a02facb757..7c645c16b5 100644
--- a/lib/filemode.h
+++ b/lib/filemode.h
@@ -1,6 +1,6 @@
 /* Make a string describing file modes.
 
-   Copyright (C) 1998-1999, 2003, 2006, 2009-2021 Free Software Foundation,
+   Copyright (C) 1998-1999, 2003, 2006, 2009-2022 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/filename.h b/lib/filename.h
index dafe3dfddb..ab77ca2df9 100644
--- a/lib/filename.h
+++ b/lib/filename.h
@@ -1,5 +1,5 @@
 /* Basic filename support macros.
-   Copyright (C) 2001-2004, 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index fca23ec4fc..b3e6e2f3cb 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
    Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index c210452938..98020e6667 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
    Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/fingerprint.c b/lib/fingerprint.c
index 7266da9710..e450d317d7 100644
--- a/lib/fingerprint.c
+++ b/lib/fingerprint.c
@@ -1,6 +1,6 @@
 /* Placeholder fingerprint for Emacs
 
-Copyright 2019-2021 Free Software Foundation, Inc.
+Copyright 2019-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib/fingerprint.h b/lib/fingerprint.h
index 6ec0c80052..d683d0a37a 100644
--- a/lib/fingerprint.h
+++ b/lib/fingerprint.h
@@ -1,6 +1,6 @@
 /* Header file for the Emacs build fingerprint.
 
-Copyright (C) 2016, 2018-2021 Free Software Foundation, Inc.
+Copyright (C) 2016, 2018-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib/flexmember.h b/lib/flexmember.h
index 1b19a2bfd9..1545639f75 100644
--- a/lib/flexmember.h
+++ b/lib/flexmember.h
@@ -1,6 +1,6 @@
 /* Sizes of structs with flexible array members.
 
-   Copyright 2016-2021 Free Software Foundation, Inc.
+   Copyright 2016-2022 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
diff --git a/lib/fpending.c b/lib/fpending.c
index 7c61f7eea7..617f3977f8 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -1,5 +1,5 @@
 /* fpending.c -- return the number of pending output bytes on a stream
-   Copyright (C) 2000, 2004, 2006-2007, 2009-2021 Free Software Foundation,
+   Copyright (C) 2000, 2004, 2006-2007, 2009-2022 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/fpending.h b/lib/fpending.h
index 016341bab5..2b45e9031b 100644
--- a/lib/fpending.h
+++ b/lib/fpending.h
@@ -1,6 +1,6 @@
 /* Declare __fpending.
 
-   Copyright (C) 2000, 2003, 2005-2006, 2009-2021 Free Software Foundation,
+   Copyright (C) 2000, 2003, 2005-2006, 2009-2022 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/free.c b/lib/free.c
index 780f03dd11..86ebe6c630 100644
--- a/lib/free.c
+++ b/lib/free.c
@@ -1,6 +1,6 @@
 /* Make free() preserve errno.
 
-   Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 640a375430..56de0cab4b 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -1,6 +1,6 @@
 /* Work around an fstatat bug on Solaris 9.
 
-   Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/fsusage.c b/lib/fsusage.c
index 740cdc219a..734f0fc746 100644
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -1,6 +1,6 @@
 /* fsusage.c -- return space usage of mounted file systems
 
-   Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2021 Free Software
+   Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/fsusage.h b/lib/fsusage.h
index b3f58d9994..f4f50aba29 100644
--- a/lib/fsusage.h
+++ b/lib/fsusage.h
@@ -1,6 +1,6 @@
 /* fsusage.h -- declarations for file system space usage info
 
-   Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2021 Free Software
+   Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/fsync.c b/lib/fsync.c
index 99a932d770..9b561ab96e 100644
--- a/lib/fsync.c
+++ b/lib/fsync.c
@@ -7,7 +7,7 @@
 
    Written by Richard W.M. Jones <rjones.at.redhat.com>
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/ftoastr.c b/lib/ftoastr.c
index 0ee0407ec2..4349c8c561 100644
--- a/lib/ftoastr.c
+++ b/lib/ftoastr.c
@@ -1,6 +1,6 @@
 /* floating point to accurate string
 
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/ftoastr.h b/lib/ftoastr.h
index d7ff9e0548..065574a9ff 100644
--- a/lib/ftoastr.h
+++ b/lib/ftoastr.h
@@ -1,6 +1,6 @@
 /* floating point to accurate string
 
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/futimens.c b/lib/futimens.c
index 273cc87187..97228242b1 100644
--- a/lib/futimens.c
+++ b/lib/futimens.c
@@ -1,5 +1,5 @@
 /* Set the access and modification time of an open fd.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
index fe376e5bb0..a17b791c8d 100644
--- a/lib/get-permissions.c
+++ b/lib/get-permissions.c
@@ -1,6 +1,6 @@
 /* Get permissions of a file.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 5006c2d5c5..793e0f8894 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -1,5 +1,5 @@
 /* getdtablesize() function: Return maximum possible file descriptor value + 1.
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/getgroups.c b/lib/getgroups.c
index 96665257f2..f7abd72667 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -1,6 +1,6 @@
 /* provide consistent interface to getgroups for systems that don't allow N==0
 
-   Copyright (C) 1996, 1999, 2003, 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2003, 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index d42d0cd279..53d1b81a3b 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -1,6 +1,6 @@
 /* Get the system load averages.
 
-   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2021 Free Software
+   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2022 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with gnulib.
diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h
index 33e3d4b3d8..b6dd913caf 100644
--- a/lib/getopt-cdefs.in.h
+++ b/lib/getopt-cdefs.in.h
@@ -1,5 +1,5 @@
 /* getopt-on-non-glibc compatibility macros.
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library.
diff --git a/lib/getopt-core.h b/lib/getopt-core.h
index ceb14d0597..1c40ecc833 100644
--- a/lib/getopt-core.h
+++ b/lib/getopt-core.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt (basic, portable features only).
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h
index f82a8c6129..d661fcc554 100644
--- a/lib/getopt-ext.h
+++ b/lib/getopt-ext.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt (GNU extensions).
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
index b1733a3497..3eead0e04e 100644
--- a/lib/getopt-pfx-core.h
+++ b/lib/getopt-pfx-core.h
@@ -1,5 +1,5 @@
 /* getopt (basic, portable features) gnulib wrapper header.
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library.
diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
index b9a14ba05a..85a6cb5db3 100644
--- a/lib/getopt-pfx-ext.h
+++ b/lib/getopt-pfx-ext.h
@@ -1,5 +1,5 @@
 /* getopt (GNU extensions) gnulib wrapper header.
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library.
diff --git a/lib/getopt.c b/lib/getopt.c
index 7f3aa5aa3d..128dc7fcf5 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -1,5 +1,5 @@
 /* Getopt for GNU.
-   Copyright (C) 1987-2021 Free Software Foundation, Inc.
+   Copyright (C) 1987-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index bf884f0322..9bc50ee2be 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library, which supplies a different version of
diff --git a/lib/getopt1.c b/lib/getopt1.c
index 5a928062fd..990eee1b64 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,5 +1,5 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-2021 Free Software Foundation, Inc.
+   Copyright (C) 1987-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index 91254e487d..ccdbb973a5 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getrandom.c b/lib/getrandom.c
index a186c4d3bd..e146873093 100644
--- a/lib/getrandom.c
+++ b/lib/getrandom.c
@@ -1,6 +1,6 @@
 /* Obtain a series of random bytes.
 
-   Copyright 2020-2021 Free Software Foundation, Inc.
+   Copyright 2020-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/gettext.h b/lib/gettext.h
index f1c7a24075..b3577a043f 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
@@ -138,7 +138,7 @@
 #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
   npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
MsgidPlural, N, Category)
 
-#ifdef __GNUC__
+#if defined __GNUC__ || defined __clang__
 __inline
 #else
 #ifdef __cplusplus
@@ -157,7 +157,7 @@ pgettext_aux (const char *domain,
     return translation;
 }
 
-#ifdef __GNUC__
+#if defined __GNUC__ || defined __clang__
 __inline
 #else
 #ifdef __cplusplus
@@ -191,9 +191,8 @@ npgettext_aux (const char *domain,
    or may have security implications due to non-deterministic stack usage.  */
 
 #if (!defined GNULIB_NO_VLA \
-     && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
-     /*  || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
-         || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
+     && defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
+     && !defined __STDC_NO_VLA__)
 # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
 #else
 # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
@@ -208,7 +207,7 @@ npgettext_aux (const char *domain,
 #define dpgettext_expr(Domainname, Msgctxt, Msgid) \
   dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
 
-#ifdef __GNUC__
+#if defined __GNUC__ || defined __clang__
 __inline
 #else
 #ifdef __cplusplus
@@ -255,7 +254,7 @@ dcpgettext_expr (const char *domain,
 #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
   dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
 
-#ifdef __GNUC__
+#if defined __GNUC__ || defined __clang__
 __inline
 #else
 #ifdef __cplusplus
diff --git a/lib/gettime.c b/lib/gettime.c
index 8f28a32df1..a44a69dfc4 100644
--- a/lib/gettime.c
+++ b/lib/gettime.c
@@ -1,6 +1,6 @@
 /* gettime -- get the system clock
 
-   Copyright (C) 2002, 2004-2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004-2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -30,6 +30,8 @@ gettime (struct timespec *ts)
 {
 #if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME
   clock_gettime (CLOCK_REALTIME, ts);
+#elif defined HAVE_TIMESPEC_GET
+  timespec_get (ts, TIME_UTC);
 #else
   struct timeval tv;
   gettimeofday (&tv, NULL);
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index 2a222fc5b7..36c7920afe 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -1,6 +1,6 @@
 /* Provide gettimeofday for systems that don't have it or for which it's 
broken.
 
-   Copyright (C) 2001-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index c7c7eb455b..a8a6cd782d 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -1,5 +1,5 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2021 Free Software Foundation, Inc.
+# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -202,6 +202,9 @@ COM_ERRLIB = @COM_ERRLIB@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CRYPTOLIB = @CRYPTOLIB@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
 CYGWIN_OBJ = @CYGWIN_OBJ@
 C_SWITCH_MACHINE = @C_SWITCH_MACHINE@
 C_SWITCH_SYSTEM = @C_SWITCH_SYSTEM@
@@ -244,22 +247,26 @@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@
 GETOPT_H = @GETOPT_H@
 GFILENOTIFY_CFLAGS = @GFILENOTIFY_CFLAGS@
 GFILENOTIFY_LIBS = @GFILENOTIFY_LIBS@
-GL_COND_LIBTOOL = @GL_COND_LIBTOOL@
-GL_GENERATE_ALLOCA_H = @GL_GENERATE_ALLOCA_H@
-GL_GENERATE_BYTESWAP_H = @GL_GENERATE_BYTESWAP_H@
-GL_GENERATE_ERRNO_H = @GL_GENERATE_ERRNO_H@
-GL_GENERATE_EXECINFO_H = @GL_GENERATE_EXECINFO_H@
-GL_GENERATE_GMP_GMP_H = @GL_GENERATE_GMP_GMP_H@
-GL_GENERATE_IEEE754_H = @GL_GENERATE_IEEE754_H@
-GL_GENERATE_LIMITS_H = @GL_GENERATE_LIMITS_H@
-GL_GENERATE_MINI_GMP_H = @GL_GENERATE_MINI_GMP_H@
-GL_GENERATE_STDALIGN_H = @GL_GENERATE_STDALIGN_H@
-GL_GENERATE_STDDEF_H = @GL_GENERATE_STDDEF_H@
-GL_GENERATE_STDINT_H = @GL_GENERATE_STDINT_H@
+GL_COND_LIBTOOL_CONDITION = @GL_COND_LIBTOOL_CONDITION@
+GL_GENERATE_ALLOCA_H_CONDITION = @GL_GENERATE_ALLOCA_H_CONDITION@
+GL_GENERATE_BYTESWAP_H_CONDITION = @GL_GENERATE_BYTESWAP_H_CONDITION@
+GL_GENERATE_ERRNO_H_CONDITION = @GL_GENERATE_ERRNO_H_CONDITION@
+GL_GENERATE_EXECINFO_H_CONDITION = @GL_GENERATE_EXECINFO_H_CONDITION@
+GL_GENERATE_GETOPT_CDEFS_H_CONDITION = @GL_GENERATE_GETOPT_CDEFS_H_CONDITION@
+GL_GENERATE_GETOPT_H_CONDITION = @GL_GENERATE_GETOPT_H_CONDITION@
+GL_GENERATE_GMP_GMP_H_CONDITION = @GL_GENERATE_GMP_GMP_H_CONDITION@
+GL_GENERATE_GMP_H_CONDITION = @GL_GENERATE_GMP_H_CONDITION@
+GL_GENERATE_IEEE754_H_CONDITION = @GL_GENERATE_IEEE754_H_CONDITION@
+GL_GENERATE_LIMITS_H_CONDITION = @GL_GENERATE_LIMITS_H_CONDITION@
+GL_GENERATE_MINI_GMP_H_CONDITION = @GL_GENERATE_MINI_GMP_H_CONDITION@
+GL_GENERATE_STDALIGN_H_CONDITION = @GL_GENERATE_STDALIGN_H_CONDITION@
+GL_GENERATE_STDDEF_H_CONDITION = @GL_GENERATE_STDDEF_H_CONDITION@
+GL_GENERATE_STDINT_H_CONDITION = @GL_GENERATE_STDINT_H_CONDITION@
 GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@
 GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@
 GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@
 GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@
+GL_GNULIB_CALLOC_GNU = @GL_GNULIB_CALLOC_GNU@
 GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@
 GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@
 GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@
@@ -299,6 +306,7 @@ GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@
 GL_GNULIB_FGETC = @GL_GNULIB_FGETC@
 GL_GNULIB_FGETS = @GL_GNULIB_FGETS@
 GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@
+GL_GNULIB_FOPEN_GNU = @GL_GNULIB_FOPEN_GNU@
 GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@
 GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@
 GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@
@@ -334,6 +342,7 @@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@
 GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@
 GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@
 GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@
+GL_GNULIB_GETPASS_GNU = @GL_GNULIB_GETPASS_GNU@
 GL_GNULIB_GETRANDOM = @GL_GNULIB_GETRANDOM@
 GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@
 GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@
@@ -351,6 +360,7 @@ GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@
 GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@
 GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@
 GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@
+GL_GNULIB_MALLOC_GNU = @GL_GNULIB_MALLOC_GNU@
 GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@
 GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@
 GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@
@@ -460,6 +470,7 @@ GL_GNULIB_READDIR = @GL_GNULIB_READDIR@
 GL_GNULIB_READLINK = @GL_GNULIB_READLINK@
 GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@
 GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@
+GL_GNULIB_REALLOC_GNU = @GL_GNULIB_REALLOC_GNU@
 GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@
 GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@
 GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@
@@ -517,6 +528,7 @@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@
 GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@
 GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@
 GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@
+GL_GNULIB_TIMESPEC_GETRES = @GL_GNULIB_TIMESPEC_GETRES@
 GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@
 GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@
 GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@
@@ -561,12 +573,17 @@ GTK_CFLAGS = @GTK_CFLAGS@
 GTK_LIBS = @GTK_LIBS@
 GTK_OBJ = @GTK_OBJ@
 GZIP_PROG = @GZIP_PROG@
+HAIKU_CFLAGS = @HAIKU_CFLAGS@
+HAIKU_CXX_OBJ = @HAIKU_CXX_OBJ@
+HAIKU_LIBS = @HAIKU_LIBS@
+HAIKU_OBJ = @HAIKU_OBJ@
 HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@
 HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
 HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@
 HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
 HAVE_ALPHASORT = @HAVE_ALPHASORT@
 HAVE_ATOLL = @HAVE_ATOLL@
+HAVE_BE_APP = @HAVE_BE_APP@
 HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@
 HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
 HAVE_CHOWN = @HAVE_CHOWN@
@@ -600,6 +617,7 @@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
 HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
 HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
+HAVE_DECL_POSIX_SPAWN_SETSID = @HAVE_DECL_POSIX_SPAWN_SETSID@
 HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
 HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@
 HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@
@@ -651,6 +669,7 @@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
 HAVE_GETUMASK = @HAVE_GETUMASK@
 HAVE_GRANTPT = @HAVE_GRANTPT@
 HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
+HAVE_GSETTINGS = @HAVE_GSETTINGS@
 HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
 HAVE_INITSTATE = @HAVE_INITSTATE@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
@@ -684,12 +703,17 @@ HAVE_OPENDIR = @HAVE_OPENDIR@
 HAVE_OS_H = @HAVE_OS_H@
 HAVE_PCLOSE = @HAVE_PCLOSE@
 HAVE_PDUMPER = @HAVE_PDUMPER@
+HAVE_PGTK = @HAVE_PGTK@
 HAVE_PIPE = @HAVE_PIPE@
 HAVE_PIPE2 = @HAVE_PIPE2@
 HAVE_POPEN = @HAVE_POPEN@
 HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@
 HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
 HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@
+HAVE_POSIX_SPAWN = @HAVE_POSIX_SPAWN@
+HAVE_POSIX_SPAWNATTR_SETFLAGS = @HAVE_POSIX_SPAWNATTR_SETFLAGS@
+HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR = 
@HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR@
+HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP = 
@HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP@
 HAVE_PREAD = @HAVE_PREAD@
 HAVE_PSELECT = @HAVE_PSELECT@
 HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@
@@ -726,6 +750,7 @@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
 HAVE_SIGSET_T = @HAVE_SIGSET_T@
 HAVE_SLEEP = @HAVE_SLEEP@
+HAVE_SPAWN_H = @HAVE_SPAWN_H@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
@@ -758,6 +783,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_TIMEGM = @HAVE_TIMEGM@
 HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@
+HAVE_TIMESPEC_GETRES = @HAVE_TIMESPEC_GETRES@
 HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
 HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
@@ -923,6 +949,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PAXCTL = @PAXCTL@
 PAXCTL_dumped = @PAXCTL_dumped@
 PAXCTL_notdumped = @PAXCTL_notdumped@
+PGTK_LIBS = @PGTK_LIBS@
+PGTK_OBJ = @PGTK_OBJ@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
@@ -940,7 +968,8 @@ RALLOC_OBJ = @RALLOC_OBJ@
 RANLIB = @RANLIB@
 REPLACE_ACCESS = @REPLACE_ACCESS@
 REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@
-REPLACE_CALLOC = @REPLACE_CALLOC@
+REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@
+REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@
 REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_CLOSE = @REPLACE_CLOSE@
@@ -968,6 +997,7 @@ REPLACE_FDOPENDIR = @REPLACE_FDOPENDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
 REPLACE_FFSLL = @REPLACE_FFSLL@
 REPLACE_FOPEN = @REPLACE_FOPEN@
+REPLACE_FOPEN_FOR_FOPEN_GNU = @REPLACE_FOPEN_FOR_FOPEN_GNU@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
 REPLACE_FPURGE = @REPLACE_FPURGE@
 REPLACE_FREE = @REPLACE_FREE@
@@ -989,6 +1019,7 @@ REPLACE_GETLINE = @REPLACE_GETLINE@
 REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
 REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETPASS = @REPLACE_GETPASS@
+REPLACE_GETPASS_FOR_GETPASS_GNU = @REPLACE_GETPASS_FOR_GETPASS_GNU@
 REPLACE_GETRANDOM = @REPLACE_GETRANDOM@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_GMTIME = @REPLACE_GMTIME@
@@ -1001,7 +1032,8 @@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@
 REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
 REPLACE_LSEEK = @REPLACE_LSEEK@
 REPLACE_LSTAT = @REPLACE_LSTAT@
-REPLACE_MALLOC = @REPLACE_MALLOC@
+REPLACE_MALLOC_FOR_MALLOC_GNU = @REPLACE_MALLOC_FOR_MALLOC_GNU@
+REPLACE_MALLOC_FOR_MALLOC_POSIX = @REPLACE_MALLOC_FOR_MALLOC_POSIX@
 REPLACE_MBTOWC = @REPLACE_MBTOWC@
 REPLACE_MEMCHR = @REPLACE_MEMCHR@
 REPLACE_MEMMEM = @REPLACE_MEMMEM@
@@ -1036,8 +1068,9 @@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
 REPLACE_READ = @REPLACE_READ@
 REPLACE_READLINK = @REPLACE_READLINK@
 REPLACE_READLINKAT = @REPLACE_READLINKAT@
-REPLACE_REALLOC = @REPLACE_REALLOC@
 REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@
+REPLACE_REALLOC_FOR_REALLOC_GNU = @REPLACE_REALLOC_FOR_REALLOC_GNU@
+REPLACE_REALLOC_FOR_REALLOC_POSIX = @REPLACE_REALLOC_FOR_REALLOC_POSIX@
 REPLACE_REALPATH = @REPLACE_REALPATH@
 REPLACE_REMOVE = @REPLACE_REMOVE@
 REPLACE_RENAME = @REPLACE_RENAME@
@@ -1104,6 +1137,7 @@ SETTINGS_LIBS = @SETTINGS_LIBS@
 SHELL = @SHELL@
 SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
 SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+SQLITE3_LIBS = @SQLITE3_LIBS@
 STDALIGN_H = @STDALIGN_H@
 STDDEF_H = @STDDEF_H@
 STDINT_H = @STDINT_H@
@@ -1132,6 +1166,8 @@ WARN_CFLAGS = @WARN_CFLAGS@
 WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
 WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
 WEBKIT_LIBS = @WEBKIT_LIBS@
+WEBP_CFLAGS = @WEBP_CFLAGS@
+WEBP_LIBS = @WEBP_LIBS@
 WERROR_CFLAGS = @WERROR_CFLAGS@
 WIDGET_OBJ = @WIDGET_OBJ@
 WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
@@ -1153,6 +1189,8 @@ XFT_LIBS = @XFT_LIBS@
 XGSELOBJ = @XGSELOBJ@
 XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
 XINERAMA_LIBS = @XINERAMA_LIBS@
+XINPUT_CFLAGS = @XINPUT_CFLAGS@
+XINPUT_LIBS = @XINPUT_LIBS@
 XMENU_OBJ = @XMENU_OBJ@
 XMKMF = @XMKMF@
 XOBJ = @XOBJ@
@@ -1162,6 +1200,7 @@ XRENDER_LIBS = @XRENDER_LIBS@
 XWIDGETS_OBJ = @XWIDGETS_OBJ@
 X_TOOLKIT_TYPE = @X_TOOLKIT_TYPE@
 ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
 ac_ct_OBJC = @ac_ct_OBJC@
 archlibdir = @archlibdir@
 bindir = @bindir@
@@ -1188,34 +1227,36 @@ exec_prefix = @exec_prefix@
 gamedir = @gamedir@
 gamegroup = @gamegroup@
 gameuser = @gameuser@
-gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7 = 
@gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7@
-gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b = 
@gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b@
-gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31 = 
@gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31@
-gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c = 
@gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c@
-gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4 = 
@gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4@
-gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec = 
@gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec@
-gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c = 
@gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c@
-gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1 = 
@gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1@
-gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36 = 
@gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36@
-gl_GNULIB_ENABLED_cloexec = @gl_GNULIB_ENABLED_cloexec@
-gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b = 
@gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b@
-gl_GNULIB_ENABLED_dirfd = @gl_GNULIB_ENABLED_dirfd@
-gl_GNULIB_ENABLED_dynarray = @gl_GNULIB_ENABLED_dynarray@
-gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866 = 
@gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866@
-gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@
-gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@
-gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@
-gl_GNULIB_ENABLED_lchmod = @gl_GNULIB_ENABLED_lchmod@
-gl_GNULIB_ENABLED_open = @gl_GNULIB_ENABLED_open@
-gl_GNULIB_ENABLED_rawmemchr = @gl_GNULIB_ENABLED_rawmemchr@
-gl_GNULIB_ENABLED_scratch_buffer = @gl_GNULIB_ENABLED_scratch_buffer@
-gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@
-gl_GNULIB_ENABLED_utimens = @gl_GNULIB_ENABLED_utimens@
+gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_CONDITION = 
@gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_CONDITION@
+gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_CONDITION = 
@gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_CONDITION@
+gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31_CONDITION = 
@gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31_CONDITION@
+gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c_CONDITION = 
@gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c_CONDITION@
+gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4_CONDITION = 
@gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4_CONDITION@
+gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec_CONDITION = 
@gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec_CONDITION@
+gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c_CONDITION = 
@gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c_CONDITION@
+gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1_CONDITION = 
@gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1_CONDITION@
+gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_CONDITION = 
@gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_CONDITION@
+gl_GNULIB_ENABLED_cloexec_CONDITION = @gl_GNULIB_ENABLED_cloexec_CONDITION@
+gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b_CONDITION = 
@gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b_CONDITION@
+gl_GNULIB_ENABLED_dirfd_CONDITION = @gl_GNULIB_ENABLED_dirfd_CONDITION@
+gl_GNULIB_ENABLED_dynarray_CONDITION = @gl_GNULIB_ENABLED_dynarray_CONDITION@
+gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b_CONDITION = 
@gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b_CONDITION@
+gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866_CONDITION = 
@gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866_CONDITION@
+gl_GNULIB_ENABLED_euidaccess_CONDITION = 
@gl_GNULIB_ENABLED_euidaccess_CONDITION@
+gl_GNULIB_ENABLED_getdtablesize_CONDITION = 
@gl_GNULIB_ENABLED_getdtablesize_CONDITION@
+gl_GNULIB_ENABLED_getgroups_CONDITION = @gl_GNULIB_ENABLED_getgroups_CONDITION@
+gl_GNULIB_ENABLED_lchmod_CONDITION = @gl_GNULIB_ENABLED_lchmod_CONDITION@
+gl_GNULIB_ENABLED_open_CONDITION = @gl_GNULIB_ENABLED_open_CONDITION@
+gl_GNULIB_ENABLED_rawmemchr_CONDITION = @gl_GNULIB_ENABLED_rawmemchr_CONDITION@
+gl_GNULIB_ENABLED_scratch_buffer_CONDITION = 
@gl_GNULIB_ENABLED_scratch_buffer_CONDITION@
+gl_GNULIB_ENABLED_strtoll_CONDITION = @gl_GNULIB_ENABLED_strtoll_CONDITION@
+gl_GNULIB_ENABLED_utimens_CONDITION = @gl_GNULIB_ENABLED_utimens_CONDITION@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
 gltests_LIBOBJS = @gltests_LIBOBJS@
 gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 gltests_WITNESS = @gltests_WITNESS@
+gsettingsschemadir = @gsettingsschemadir@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -1296,13 +1337,12 @@ BUILT_SOURCES += $(ALLOCA_H)
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
-ifneq (,$(GL_GENERATE_ALLOCA_H))
+ifneq (,$(GL_GENERATE_ALLOCA_H_CONDITION))
 alloca.h: alloca.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < 
$(srcdir)/alloca.in.h; \
-       } > $@-t && \
-       mv -f $@-t $@
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+         -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' \
+         $(srcdir)/alloca.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 else
 alloca.h: $(top_builddir)/config.status
        rm -f $@
@@ -1327,7 +1367,7 @@ endif
 ## begin gnulib module at-internal
 ifeq (,$(OMIT_GNULIB_MODULE_at-internal))
 
-ifneq (,$(gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b))
+ifneq (,$(gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b_CONDITION))
 libgnu_a_SOURCES += openat-priv.h openat-proc.c
 
 endif
@@ -1358,13 +1398,10 @@ BUILT_SOURCES += $(BYTESWAP_H)
 
 # We need the following in order to create <byteswap.h> when the system
 # doesn't have one.
-ifneq (,$(GL_GENERATE_BYTESWAP_H))
+ifneq (,$(GL_GENERATE_BYTESWAP_H_CONDITION))
 byteswap.h: byteswap.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/byteswap.in.h; \
-       } > $@-t && \
-       mv -f $@-t $@
+       $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/byteswap.in.h
+       $(AM_V_at)mv $@-t $@
 else
 byteswap.h: $(top_builddir)/config.status
        rm -f $@
@@ -1416,7 +1453,7 @@ endif
 ## begin gnulib module cloexec
 ifeq (,$(OMIT_GNULIB_MODULE_cloexec))
 
-ifneq (,$(gl_GNULIB_ENABLED_cloexec))
+ifneq (,$(gl_GNULIB_ENABLED_cloexec_CONDITION))
 libgnu_a_SOURCES += cloexec.c
 
 endif
@@ -1540,9 +1577,8 @@ BUILT_SOURCES += dirent.h
 # We need the following in order to create <dirent.h> when the system
 # doesn't have one that works with the given compiler.
 dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''HAVE_DIRENT_H''@|$(HAVE_DIRENT_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -1572,9 +1608,8 @@ dirent.h: dirent.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/dirent.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/dirent.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += dirent.h dirent.h-t
 
 EXTRA_DIST += dirent.in.h
@@ -1585,7 +1620,7 @@ endif
 ## begin gnulib module dirfd
 ifeq (,$(OMIT_GNULIB_MODULE_dirfd))
 
-ifneq (,$(gl_GNULIB_ENABLED_dirfd))
+ifneq (,$(gl_GNULIB_ENABLED_dirfd_CONDITION))
 
 endif
 EXTRA_DIST += dirfd.c
@@ -1629,31 +1664,28 @@ endif
 ## begin gnulib module dynarray
 ifeq (,$(OMIT_GNULIB_MODULE_dynarray))
 
-ifneq (,$(gl_GNULIB_ENABLED_dynarray))
+ifneq (,$(gl_GNULIB_ENABLED_dynarray_CONDITION))
 BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h
 
 malloc/dynarray.gl.h: malloc/dynarray.h
-       $(AM_V_at)$(MKDIR_P) malloc
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e '/libc_hidden_proto/d' < $(srcdir)/malloc/dynarray.h; \
-       } > $@-t && \
-       mv $@-t $@
+       $(AM_V_GEN)$(MKDIR_P) 'malloc'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+         -e '/libc_hidden_proto/d' \
+         $(srcdir)/malloc/dynarray.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t
 
 malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c
-       $(AM_V_at)$(MKDIR_P) malloc
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|<malloc/dynarray\.h>|<malloc/dynarray.gl.h>|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'malloc'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|<malloc/dynarray\.h>|<malloc/dynarray.gl.h>|g' \
              -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \
              -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \
              -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' 
\
              -e 's|__glibc_likely|_GL_LIKELY|g' \
              -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \
-             < $(srcdir)/malloc/dynarray-skeleton.c; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/malloc/dynarray-skeleton.c > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h 
malloc/dynarray-skeleton.gl.h-t
 
 libgnu_a_SOURCES += malloc/dynarray_at_failure.c                 
malloc/dynarray_emplace_enlarge.c                 malloc/dynarray_finalize.c    
             malloc/dynarray_resize.c                 
malloc/dynarray_resize_clear.c
@@ -1669,7 +1701,7 @@ endif
 ## begin gnulib module eloop-threshold
 ifeq (,$(OMIT_GNULIB_MODULE_eloop-threshold))
 
-ifneq (,$(gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c))
+ifneq (,$(gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c_CONDITION))
 
 endif
 EXTRA_DIST += eloop-threshold.h
@@ -1684,11 +1716,10 @@ BUILT_SOURCES += $(ERRNO_H)
 
 # We need the following in order to create <errno.h> when the system
 # doesn't have one that is POSIX compliant.
-ifneq (,$(GL_GENERATE_ERRNO_H))
+ifneq (,$(GL_GENERATE_ERRNO_H_CONDITION))
 errno.h: errno.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -1699,9 +1730,8 @@ errno.h: errno.in.h $(top_builddir)/config.status
              -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
              -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
              -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
-             < $(srcdir)/errno.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/errno.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 else
 errno.h: $(top_builddir)/config.status
        rm -f $@
@@ -1716,7 +1746,7 @@ endif
 ## begin gnulib module euidaccess
 ifeq (,$(OMIT_GNULIB_MODULE_euidaccess))
 
-ifneq (,$(gl_GNULIB_ENABLED_euidaccess))
+ifneq (,$(gl_GNULIB_ENABLED_euidaccess_CONDITION))
 
 endif
 EXTRA_DIST += euidaccess.c
@@ -1733,13 +1763,10 @@ BUILT_SOURCES += $(EXECINFO_H)
 
 # We need the following in order to create <execinfo.h> when the system
 # doesn't have one that works.
-ifneq (,$(GL_GENERATE_EXECINFO_H))
+ifneq (,$(GL_GENERATE_EXECINFO_H_CONDITION))
 execinfo.h: execinfo.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/execinfo.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+       $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/execinfo.in.h
+       $(AM_V_at)mv $@-t $@
 else
 execinfo.h: $(top_builddir)/config.status
        rm -f $@
@@ -1805,9 +1832,8 @@ BUILT_SOURCES += fcntl.h
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
 fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -1828,9 +1854,8 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H)
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/fcntl.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/fcntl.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += fcntl.h fcntl.h-t
 
 EXTRA_DIST += fcntl.in.h
@@ -1963,10 +1988,31 @@ EXTRA_libgnu_a_SOURCES += futimens.c
 endif
 ## end   gnulib module futimens
 
+## begin gnulib module gen-header
+ifeq (,$(OMIT_GNULIB_MODULE_gen-header))
+
+# In 'sed', replace the pattern space with a "DO NOT EDIT" comment.
+SED_HEADER_NOEDIT = s,.*,/* DO NOT EDIT! GENERATED AUTOMATICALLY! */,
+
+# '$(SED_HEADER_STDOUT) -e "..."' runs 'sed' but first outputs "DO NOT EDIT".
+SED_HEADER_STDOUT = sed -e 1h -e '1$(SED_HEADER_NOEDIT)' -e 1G
+
+# '$(SED_HEADER_TO_AT_t) FILE' copies FILE to $@-t, prepending a leading
+# "DO_NOT_EDIT".  Although this could be done more simply via:
+#      SED_HEADER_TO_AT_t = $(SED_HEADER_STDOUT) > $@-t
+# the -n and 'w' avoid a fork+exec, at least when GNU Make is used.
+SED_HEADER_TO_AT_t = $(SED_HEADER_STDOUT) -n -e 'w $@-t'
+
+# Use $(gl_V_at) instead of $(AM_V_GEN) or $(AM_V_at) on a line that
+gl_V_at = $(AM_V_GEN)
+
+endif
+## end   gnulib module gen-header
+
 ## begin gnulib module getdtablesize
 ifeq (,$(OMIT_GNULIB_MODULE_getdtablesize))
 
-ifneq (,$(gl_GNULIB_ENABLED_getdtablesize))
+ifneq (,$(gl_GNULIB_ENABLED_getdtablesize_CONDITION))
 
 endif
 EXTRA_DIST += getdtablesize.c
@@ -1979,7 +2025,7 @@ endif
 ## begin gnulib module getgroups
 ifeq (,$(OMIT_GNULIB_MODULE_getgroups))
 
-ifneq (,$(gl_GNULIB_ENABLED_getgroups))
+ifneq (,$(gl_GNULIB_ENABLED_getgroups_CONDITION))
 
 endif
 EXTRA_DIST += getgroups.c
@@ -2007,27 +2053,33 @@ BUILT_SOURCES += $(GETOPT_H) $(GETOPT_CDEFS_H)
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
+ifneq (,$(GL_GENERATE_GETOPT_H_CONDITION))
 getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             < $(srcdir)/getopt.in.h; \
-       } > $@-t && \
-       mv -f $@-t $@
+             $(srcdir)/getopt.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
+else
+getopt.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 
+ifneq (,$(GL_GENERATE_GETOPT_CDEFS_H_CONDITION))
 getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-          sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
-             < $(srcdir)/getopt-cdefs.in.h; \
-       } > $@-t && \
-       mv -f $@-t $@
+       $(AM_V_GEN)$(SED_HEADER_STDOUT) \
+         -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
+         $(srcdir)/getopt-cdefs.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
+else
+getopt-cdefs.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 
 MOSTLYCLEANFILES += getopt.h getopt.h-t getopt-cdefs.h getopt-cdefs.h-t
 
@@ -2052,7 +2104,7 @@ endif
 ## begin gnulib module gettext-h
 ifeq (,$(OMIT_GNULIB_MODULE_gettext-h))
 
-ifneq (,$(gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36))
+ifneq (,$(gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_CONDITION))
 libgnu_a_SOURCES += gettext.h
 
 endif
@@ -2090,7 +2142,7 @@ endif
 ## begin gnulib module group-member
 ifeq (,$(OMIT_GNULIB_MODULE_group-member))
 
-ifneq (,$(gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1))
+ifneq (,$(gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1_CONDITION))
 
 endif
 EXTRA_DIST += group-member.c
@@ -2115,14 +2167,12 @@ BUILT_SOURCES += $(IEEE754_H)
 
 # We need the following in order to create <ieee754.h> when the system
 # doesn't have one that works with the given compiler.
-ifneq (,$(GL_GENERATE_IEEE754_H))
+ifneq (,$(GL_GENERATE_IEEE754_H_CONDITION))
 ieee754.h: ieee754.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/ifndef _GL_GNULIB_HEADER/if 0/g' \
-           $(srcdir)/ieee754.in.h; \
-       } > $@-t && \
-       mv -f $@-t $@
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+         -e 's/ifndef _GL_GNULIB_HEADER/if 0/g' \
+         $(srcdir)/ieee754.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 else
 ieee754.h: $(top_builddir)/config.status
        rm -f $@
@@ -2160,9 +2210,8 @@ BUILT_SOURCES += inttypes.h
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
 inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(WARN_ON_USE_H) $(ARG_NONNULL_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -2187,9 +2236,8 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(WARN_ON_U
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/inttypes.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/inttypes.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += inttypes.h inttypes.h-t
 
 EXTRA_DIST += inttypes.in.h
@@ -2200,7 +2248,7 @@ endif
 ## begin gnulib module lchmod
 ifeq (,$(OMIT_GNULIB_MODULE_lchmod))
 
-ifneq (,$(gl_GNULIB_ENABLED_lchmod))
+ifneq (,$(gl_GNULIB_ENABLED_lchmod_CONDITION))
 
 endif
 EXTRA_DIST += lchmod.c
@@ -2224,22 +2272,23 @@ ifeq (,$(OMIT_GNULIB_MODULE_libgmp))
 
 BUILT_SOURCES += $(GMP_H)
 
-ifneq (,$(GL_GENERATE_MINI_GMP_H))
+ifneq (,$(GL_GENERATE_GMP_H_CONDITION))
+ifneq (,$(GL_GENERATE_MINI_GMP_H_CONDITION))
 # Build gmp.h as a wrapper for mini-gmp.h when using mini-gmp.
 gmp.h: $(top_builddir)/config.status
-       echo '#include "mini-gmp.h"' >$@-t
+       echo '#include "mini-gmp.h"' > $@-t
        mv $@-t $@
-else
-ifneq (,$(GL_GENERATE_GMP_GMP_H))
+endif
+ifneq (,$(GL_GENERATE_GMP_GMP_H_CONDITION))
 # Build gmp.h as a wrapper for gmp/gmp.h.
 gmp.h: $(top_builddir)/config.status
-       echo '#include <gmp/gmp.h>' >$@-t
+       echo '#include <gmp/gmp.h>' > $@-t
        mv $@-t $@
+endif
 else
 gmp.h: $(top_builddir)/config.status
        rm -f $@
 endif
-endif
 MOSTLYCLEANFILES += gmp.h gmp.h-t
 
 EXTRA_DIST += mini-gmp-gnulib.c mini-gmp.c mini-gmp.h
@@ -2256,18 +2305,16 @@ BUILT_SOURCES += $(LIMITS_H)
 
 # We need the following in order to create <limits.h> when the system
 # doesn't have one that is compatible with GNU.
-ifneq (,$(GL_GENERATE_LIMITS_H))
+ifneq (,$(GL_GENERATE_LIMITS_H_CONDITION))
 limits.h: limits.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \
-             < $(srcdir)/limits.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/limits.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 else
 limits.h: $(top_builddir)/config.status
        rm -f $@
@@ -2290,10 +2337,23 @@ EXTRA_libgnu_a_SOURCES += lstat.c
 endif
 ## end   gnulib module lstat
 
+## begin gnulib module malloc-gnu
+ifeq (,$(OMIT_GNULIB_MODULE_malloc-gnu))
+
+ifneq (,$(gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b_CONDITION))
+
+endif
+EXTRA_DIST += malloc.c
+
+EXTRA_libgnu_a_SOURCES += malloc.c
+
+endif
+## end   gnulib module malloc-gnu
+
 ## begin gnulib module malloc-posix
 ifeq (,$(OMIT_GNULIB_MODULE_malloc-posix))
 
-ifneq (,$(gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866))
+ifneq (,$(gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866_CONDITION))
 
 endif
 EXTRA_DIST += malloc.c
@@ -2369,7 +2429,7 @@ endif
 ## begin gnulib module mktime-internal
 ifeq (,$(OMIT_GNULIB_MODULE_mktime-internal))
 
-ifneq (,$(gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31))
+ifneq (,$(gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31_CONDITION))
 
 endif
 EXTRA_DIST += mktime-internal.h mktime.c
@@ -2402,7 +2462,7 @@ endif
 ## begin gnulib module open
 ifeq (,$(OMIT_GNULIB_MODULE_open))
 
-ifneq (,$(gl_GNULIB_ENABLED_open))
+ifneq (,$(gl_GNULIB_ENABLED_open_CONDITION))
 
 endif
 EXTRA_DIST += open.c
@@ -2415,7 +2475,7 @@ endif
 ## begin gnulib module openat-h
 ifeq (,$(OMIT_GNULIB_MODULE_openat-h))
 
-ifneq (,$(gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7))
+ifneq (,$(gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7_CONDITION))
 
 endif
 EXTRA_DIST += openat.h
@@ -2473,7 +2533,7 @@ endif
 ## begin gnulib module rawmemchr
 ifeq (,$(OMIT_GNULIB_MODULE_rawmemchr))
 
-ifneq (,$(gl_GNULIB_ENABLED_rawmemchr))
+ifneq (,$(gl_GNULIB_ENABLED_rawmemchr_CONDITION))
 
 endif
 EXTRA_DIST += rawmemchr.c rawmemchr.valgrind
@@ -2508,7 +2568,7 @@ endif
 ## begin gnulib module realloc-gnu
 ifeq (,$(OMIT_GNULIB_MODULE_realloc-gnu))
 
-ifneq (,$(gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b))
+ifneq (,$(gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b_CONDITION))
 
 endif
 EXTRA_DIST += realloc.c
@@ -2521,7 +2581,7 @@ endif
 ## begin gnulib module realloc-posix
 ifeq (,$(OMIT_GNULIB_MODULE_realloc-posix))
 
-ifneq (,$(gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4))
+ifneq (,$(gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4_CONDITION))
 
 endif
 EXTRA_DIST += realloc.c
@@ -2545,7 +2605,7 @@ endif
 ## begin gnulib module root-uid
 ifeq (,$(OMIT_GNULIB_MODULE_root-uid))
 
-ifneq (,$(gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c))
+ifneq (,$(gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c_CONDITION))
 
 endif
 EXTRA_DIST += root-uid.h
@@ -2556,20 +2616,18 @@ endif
 ## begin gnulib module scratch_buffer
 ifeq (,$(OMIT_GNULIB_MODULE_scratch_buffer))
 
-ifneq (,$(gl_GNULIB_ENABLED_scratch_buffer))
+ifneq (,$(gl_GNULIB_ENABLED_scratch_buffer_CONDITION))
 BUILT_SOURCES += malloc/scratch_buffer.gl.h
 
 malloc/scratch_buffer.gl.h: malloc/scratch_buffer.h
-       $(AM_V_at)$(MKDIR_P) malloc
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|__always_inline|inline _GL_ATTRIBUTE_ALWAYS_INLINE|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'malloc'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|__always_inline|inline _GL_ATTRIBUTE_ALWAYS_INLINE|g' \
              -e 's|__glibc_likely|_GL_LIKELY|g' \
              -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \
              -e '/libc_hidden_proto/d' \
-             < $(srcdir)/malloc/scratch_buffer.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/malloc/scratch_buffer.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += malloc/scratch_buffer.gl.h malloc/scratch_buffer.gl.h-t
 
 libgnu_a_SOURCES += malloc/scratch_buffer_dupfree.c                 
malloc/scratch_buffer_grow.c                 
malloc/scratch_buffer_grow_preserve.c                 
malloc/scratch_buffer_set_array_size.c
@@ -2610,9 +2668,8 @@ BUILT_SOURCES += signal.h
 # We need the following in order to create <signal.h> when the system
 # doesn't have a complete one.
 signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -2636,9 +2693,8 @@ signal.h: signal.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/signal.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/signal.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += signal.h signal.h-t
 
 EXTRA_DIST += signal.in.h
@@ -2719,13 +2775,10 @@ BUILT_SOURCES += $(STDALIGN_H)
 
 # We need the following in order to create <stdalign.h> when the system
 # doesn't have one that works.
-ifneq (,$(GL_GENERATE_STDALIGN_H))
+ifneq (,$(GL_GENERATE_STDALIGN_H_CONDITION))
 stdalign.h: stdalign.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/stdalign.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+       $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/stdalign.in.h
+       $(AM_V_at)mv $@-t $@
 else
 stdalign.h: $(top_builddir)/config.status
        rm -f $@
@@ -2744,11 +2797,10 @@ BUILT_SOURCES += $(STDDEF_H)
 
 # We need the following in order to create <stddef.h> when the system
 # doesn't have one that works with the given compiler.
-ifneq (,$(GL_GENERATE_STDDEF_H))
+ifneq (,$(GL_GENERATE_STDDEF_H_CONDITION))
 stddef.h: stddef.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -2756,9 +2808,8 @@ stddef.h: stddef.in.h $(top_builddir)/config.status
              -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
              -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
              -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
-             < $(srcdir)/stddef.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/stddef.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 else
 stddef.h: $(top_builddir)/config.status
        rm -f $@
@@ -2777,11 +2828,10 @@ BUILT_SOURCES += $(STDINT_H)
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
-ifneq (,$(GL_GENERATE_STDINT_H))
+ifneq (,$(GL_GENERATE_STDINT_H_CONDITION))
 stdint.h: stdint.in.h $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -2808,9 +2858,8 @@ stdint.h: stdint.in.h $(top_builddir)/config.status
              -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
              -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
              -e 
's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \
-             < $(srcdir)/stdint.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/stdint.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 else
 stdint.h: $(top_builddir)/config.status
        rm -f $@
@@ -2830,9 +2879,8 @@ BUILT_SOURCES += stdio.h
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
 stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -2844,6 +2892,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \
              -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \
              -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \
+             -e 's/@''GNULIB_FOPEN_GNU''@/$(GL_GNULIB_FOPEN_GNU)/g' \
              -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \
              -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \
              -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \
@@ -2919,6 +2968,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
              -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+             -e 
's|@''REPLACE_FOPEN_FOR_FOPEN_GNU''@|$(REPLACE_FOPEN_FOR_FOPEN_GNU)|g' \
              -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
              -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
              -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
@@ -2949,9 +2999,9 @@ stdio.h: stdio.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
-       } > $@-t && \
-       mv $@-t $@
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
 
 EXTRA_DIST += stdio.in.h
@@ -2968,9 +3018,8 @@ BUILT_SOURCES += stdlib.h
 # doesn't have one that works with the given compiler.
 stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
   $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -2978,12 +3027,14 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \
              -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \
              -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \
+             -e 's/@''GNULIB_CALLOC_GNU''@/$(GL_GNULIB_CALLOC_GNU)/g' \
              -e 's/@''GNULIB_CALLOC_POSIX''@/$(GL_GNULIB_CALLOC_POSIX)/g' \
              -e 
's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \
              -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \
              -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \
              -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \
              -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \
+             -e 's/@''GNULIB_MALLOC_GNU''@/$(GL_GNULIB_MALLOC_GNU)/g' \
              -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \
              -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \
              -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \
@@ -2999,6 +3050,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \
              -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \
              -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \
+             -e 's/@''GNULIB_REALLOC_GNU''@/$(GL_GNULIB_REALLOC_GNU)/g' \
              -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \
              -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \
              -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \
@@ -3065,11 +3117,13 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
              -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
              -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \
-             -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
+             -e 
's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \
+             -e 
's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \
              -e 
's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
              -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
              -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \
-             -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
+             -e 
's|@''REPLACE_MALLOC_FOR_MALLOC_GNU''@|$(REPLACE_MALLOC_FOR_MALLOC_GNU)|g' \
+             -e 
's|@''REPLACE_MALLOC_FOR_MALLOC_POSIX''@|$(REPLACE_MALLOC_FOR_MALLOC_POSIX)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \
@@ -3079,7 +3133,8 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
              -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
              -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
-             -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
+             -e 
's|@''REPLACE_REALLOC_FOR_REALLOC_GNU''@|$(REPLACE_REALLOC_FOR_REALLOC_GNU)|g' \
+             -e 
's|@''REPLACE_REALLOC_FOR_REALLOC_POSIX''@|$(REPLACE_REALLOC_FOR_REALLOC_POSIX)|g'
 \
              -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
@@ -3095,9 +3150,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _Noreturn/r $(_NORETURN_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
-       } > $@-t && \
-       mv $@-t $@
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += stdlib.h stdlib.h-t
 
 EXTRA_DIST += stdlib.in.h
@@ -3124,9 +3179,8 @@ BUILT_SOURCES += string.h
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
 string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -3220,10 +3274,9 @@ string.h: string.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
-             < $(srcdir)/string.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += string.h string.h-t
 
 EXTRA_DIST += string.in.h
@@ -3256,7 +3309,7 @@ endif
 ## begin gnulib module strtoll
 ifeq (,$(OMIT_GNULIB_MODULE_strtoll))
 
-ifneq (,$(gl_GNULIB_ENABLED_strtoll))
+ifneq (,$(gl_GNULIB_ENABLED_strtoll_CONDITION))
 
 endif
 EXTRA_DIST += strtol.c strtoll.c
@@ -3285,10 +3338,9 @@ BUILT_SOURCES += sys/random.h
 # We need the following in order to create <sys/random.h> when the system
 # doesn't have one.
 sys/random.h: sys_random.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'sys'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -3300,9 +3352,8 @@ sys/random.h: sys_random.in.h 
$(top_builddir)/config.status $(CXXDEFS_H) $(ARG_N
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_random.in.h; \
-       } > $@-t && \
-       mv -f $@-t $@
+             $(srcdir)/sys_random.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += sys/random.h sys/random.h-t
 MOSTLYCLEANDIRS += sys
 
@@ -3319,10 +3370,9 @@ BUILT_SOURCES += sys/select.h
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
 sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'sys'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -3336,9 +3386,8 @@ sys/select.h: sys_select.in.h 
$(top_builddir)/config.status $(CXXDEFS_H) $(WARN_
              -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_select.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/sys_select.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += sys/select.h sys/select.h-t
 MOSTLYCLEANDIRS += sys
 
@@ -3355,10 +3404,9 @@ BUILT_SOURCES += sys/stat.h
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
 sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'sys'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -3411,9 +3459,8 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNU
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_stat.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/sys_stat.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
 MOSTLYCLEANDIRS += sys
 
@@ -3430,10 +3477,9 @@ BUILT_SOURCES += sys/time.h
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
 sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'sys'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -3448,9 +3494,8 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNU
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_time.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/sys_time.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += sys/time.h sys/time.h-t
 
 EXTRA_DIST += sys_time.in.h
@@ -3466,19 +3511,17 @@ BUILT_SOURCES += sys/types.h
 # We need the following in order to create <sys/types.h> when the system
 # doesn't have one that works with the given compiler.
 sys/types.h: sys_types.in.h $(top_builddir)/config.status
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(AM_V_GEN)$(MKDIR_P) 'sys'
+       $(AM_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
              -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
              -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \
-             < $(srcdir)/sys_types.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/sys_types.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += sys/types.h sys/types.h-t
 
 EXTRA_DIST += sys_types.in.h
@@ -3504,9 +3547,8 @@ BUILT_SOURCES += time.h
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
 time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) 
$(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@@ -3519,6 +3561,7 @@ time.h: time.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \
              -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \
              -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \
+             -e 
's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \
              -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \
              -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \
              -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \
@@ -3528,6 +3571,7 @@ time.h: time.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
              -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
              -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \
+             -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \
              -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
              -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
              -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
@@ -3546,9 +3590,8 @@ time.h: time.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/time.in.h; \
-       } > $@-t && \
-       mv $@-t $@
+             $(srcdir)/time.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += time.h time.h-t
 
 EXTRA_DIST += time.in.h
@@ -3634,9 +3677,8 @@ libgnu_a_SOURCES += unistd.c
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
 unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|GL|g' \
              -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -3677,6 +3719,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \
              -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \
              -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \
+             -e 's/@''GNULIB_GETPASS_GNU''@/$(GL_GNULIB_GETPASS_GNU)/g' \
              -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \
              -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \
              -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \
@@ -3797,6 +3840,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \
+             -e 
's|@''REPLACE_GETPASS_FOR_GETPASS_GNU''@|$(REPLACE_GETPASS_FOR_GETPASS_GNU)|g' \
              -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
@@ -3822,9 +3866,9 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g'
 \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
-       } > $@-t && \
-       mv $@-t $@
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             > $@-t
+       $(AM_V_at)mv $@-t $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
 
 EXTRA_DIST += unistd.in.h
@@ -3853,7 +3897,7 @@ endif
 ## begin gnulib module utimens
 ifeq (,$(OMIT_GNULIB_MODULE_utimens))
 
-ifneq (,$(gl_GNULIB_ENABLED_utimens))
+ifneq (,$(gl_GNULIB_ENABLED_utimens_CONDITION))
 libgnu_a_SOURCES += utimens.c
 
 endif
@@ -3894,7 +3938,7 @@ endif
 ## begin gnulib module xalloc-oversized
 ifeq (,$(OMIT_GNULIB_MODULE_xalloc-oversized))
 
-ifneq (,$(gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec))
+ifneq (,$(gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec_CONDITION))
 
 endif
 EXTRA_DIST += xalloc-oversized.h
diff --git a/lib/group-member.c b/lib/group-member.c
index 24aea3599c..480a12616a 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -1,6 +1,6 @@
 /* group-member.c -- determine whether group id is in calling user's group list
 
-   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2021 Free Software
+   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/idx.h b/lib/idx.h
index 54ad5d81fe..c3669ddaca 100644
--- a/lib/idx.h
+++ b/lib/idx.h
@@ -1,5 +1,5 @@
 /* A type for indices and sizes.
-   Copyright (C) 2020-2021 Free Software Foundation, Inc.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/ieee754.in.h b/lib/ieee754.in.h
index ce371cbcea..2ca9709bb9 100644
--- a/lib/ieee754.in.h
+++ b/lib/ieee754.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index 6099abad97..173b63f537 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -1,6 +1,6 @@
 /* ignore a function return without a compiler warning.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/intprops.h b/lib/intprops.h
index 3fe64e82e9..68d6daa570 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
@@ -229,18 +229,18 @@
 
 /* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow
    (A, B, P) work when P is non-null.  */
+#if defined __has_builtin
+# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
 /* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
    see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>.  */
-#if 7 <= __GNUC__ && !defined __ICC
+#elif 7 <= __GNUC__ && !defined __EDG__
 # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
-#elif defined __has_builtin
-# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
 #else
 # define _GL_HAS_BUILTIN_ADD_OVERFLOW 0
 #endif
 
 /* True if __builtin_mul_overflow (A, B, P) works when P is non-null.  */
-#ifdef __clang__
+#if defined __clang_major__ && __clang_major__ < 14
 /* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>.  */
 # define _GL_HAS_BUILTIN_MUL_OVERFLOW 0
 #else
@@ -249,9 +249,8 @@
 
 /* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
    __builtin_sub_overflow_p and __builtin_mul_overflow_p.  */
-#if defined __clang__ || defined __ICC
-/* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it
-   would presumably run afoul of Clang bug 16404.  ICC 2021.1's
+#ifdef __EDG__
+/* In EDG-based compilers like ICC 2021.3 and earlier,
    __builtin_add_overflow_p etc. are not treated as integral constant
    expressions even when all arguments are.  */
 # define _GL_HAS_BUILTIN_OVERFLOW_P 0
@@ -400,7 +399,7 @@
 #if _GL_HAS_BUILTIN_MUL_OVERFLOW
 # if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
        || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
-      && !defined __ICC)
+      && !defined __EDG__)
 #  define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
 # else
    /* Work around GCC bug 91450.  */
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index 41cb4220ce..853eca087c 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2022 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
diff --git a/lib/lchmod.c b/lib/lchmod.c
index 195304f511..479ed776cb 100644
--- a/lib/lchmod.c
+++ b/lib/lchmod.c
@@ -1,6 +1,6 @@
 /* Implement lchmod on platforms where it does not work correctly.
 
-   Copyright 2020-2021 Free Software Foundation, Inc.
+   Copyright 2020-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/libc-config.h b/lib/libc-config.h
index 886c11f37f..8fec489378 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -1,6 +1,6 @@
 /* System definitions for code taken from the GNU C Library
 
-   Copyright 2017-2021 Free Software Foundation, Inc.
+   Copyright 2017-2022 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
diff --git a/lib/limits.in.h b/lib/limits.in.h
index 2ecafebb00..b77bf75c5f 100644
--- a/lib/limits.in.h
+++ b/lib/limits.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <limits.h>.
 
-   Copyright 2016-2021 Free Software Foundation, Inc.
+   Copyright 2016-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/lstat.c b/lib/lstat.c
index 7de0bf1027..472bfbceb9 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,6 +1,6 @@
 /* Work around a bug of lstat on some systems
 
-   Copyright (C) 1997-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/malloc.c b/lib/malloc.c
index 0d8b3596ca..f334dd6e96 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -1,6 +1,6 @@
 /* malloc() function that is glibc compatible.
 
-   Copyright (C) 1997-1998, 2006-2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 1997-1998, 2006-2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/malloc/dynarray-skeleton.c b/lib/malloc/dynarray-skeleton.c
index 48210e3252..bad548a498 100644
--- a/lib/malloc/dynarray-skeleton.c
+++ b/lib/malloc/dynarray-skeleton.c
@@ -1,5 +1,5 @@
 /* Type-safe arrays which grow dynamically.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/dynarray.h b/lib/malloc/dynarray.h
index 638c33f986..f16fd950df 100644
--- a/lib/malloc/dynarray.h
+++ b/lib/malloc/dynarray.h
@@ -1,5 +1,5 @@
 /* Type-safe arrays which grow dynamically.  Shared definitions.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/dynarray_at_failure.c b/lib/malloc/dynarray_at_failure.c
index 8dd6850787..062ab7062b 100644
--- a/lib/malloc/dynarray_at_failure.c
+++ b/lib/malloc/dynarray_at_failure.c
@@ -1,5 +1,5 @@
 /* Report an dynamic array index out of bounds condition.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/dynarray_emplace_enlarge.c 
b/lib/malloc/dynarray_emplace_enlarge.c
index 0f8baf94ad..0cff2e7055 100644
--- a/lib/malloc/dynarray_emplace_enlarge.c
+++ b/lib/malloc/dynarray_emplace_enlarge.c
@@ -1,5 +1,5 @@
 /* Increase the size of a dynamic array in preparation of an emplace operation.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/dynarray_finalize.c b/lib/malloc/dynarray_finalize.c
index c33da41389..3f360c3aa8 100644
--- a/lib/malloc/dynarray_finalize.c
+++ b/lib/malloc/dynarray_finalize.c
@@ -1,5 +1,5 @@
 /* Copy the dynamically-allocated area to an explicitly-sized heap allocation.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/dynarray_resize.c b/lib/malloc/dynarray_resize.c
index 5a57166a84..8d1922e5c7 100644
--- a/lib/malloc/dynarray_resize.c
+++ b/lib/malloc/dynarray_resize.c
@@ -1,5 +1,5 @@
 /* Increase the size of a dynamic array.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/dynarray_resize_clear.c 
b/lib/malloc/dynarray_resize_clear.c
index 9c43b00c3a..8cf1b0d026 100644
--- a/lib/malloc/dynarray_resize_clear.c
+++ b/lib/malloc/dynarray_resize_clear.c
@@ -1,5 +1,5 @@
 /* Increase the size of a dynamic array and clear the new part.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h
index 36d0bef4bb..e4c5c8a85d 100644
--- a/lib/malloc/scratch_buffer.h
+++ b/lib/malloc/scratch_buffer.h
@@ -1,5 +1,5 @@
 /* Variable-sized buffer with on-stack default allocation.
-   Copyright (C) 2015-2021 Free Software Foundation, Inc.
+   Copyright (C) 2015-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/scratch_buffer_dupfree.c 
b/lib/malloc/scratch_buffer_dupfree.c
index 07363b9bc8..eb3b95c1b1 100644
--- a/lib/malloc/scratch_buffer_dupfree.c
+++ b/lib/malloc/scratch_buffer_dupfree.c
@@ -1,5 +1,5 @@
 /* Variable-sized buffer with on-stack default allocation.
-   Copyright (C) 2020-2021 Free Software Foundation, Inc.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/scratch_buffer_grow.c b/lib/malloc/scratch_buffer_grow.c
index 22c8c7781e..9a5e4dbb1e 100644
--- a/lib/malloc/scratch_buffer_grow.c
+++ b/lib/malloc/scratch_buffer_grow.c
@@ -1,5 +1,5 @@
 /* Variable-sized buffer with on-stack default allocation.
-   Copyright (C) 2015-2021 Free Software Foundation, Inc.
+   Copyright (C) 2015-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/scratch_buffer_grow_preserve.c 
b/lib/malloc/scratch_buffer_grow_preserve.c
index 2b2b819289..3fe5a0720e 100644
--- a/lib/malloc/scratch_buffer_grow_preserve.c
+++ b/lib/malloc/scratch_buffer_grow_preserve.c
@@ -1,5 +1,5 @@
 /* Variable-sized buffer with on-stack default allocation.
-   Copyright (C) 2015-2021 Free Software Foundation, Inc.
+   Copyright (C) 2015-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/malloc/scratch_buffer_set_array_size.c 
b/lib/malloc/scratch_buffer_set_array_size.c
index a47f9276a8..89c37a950e 100644
--- a/lib/malloc/scratch_buffer_set_array_size.c
+++ b/lib/malloc/scratch_buffer_set_array_size.c
@@ -1,5 +1,5 @@
 /* Variable-sized buffer with on-stack default allocation.
-   Copyright (C) 2015-2021 Free Software Foundation, Inc.
+   Copyright (C) 2015-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/md5-stream.c b/lib/md5-stream.c
index fb483b7334..07c639fd36 100644
--- a/lib/md5-stream.c
+++ b/lib/md5-stream.c
@@ -1,6 +1,6 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2021 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2022 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/md5.c b/lib/md5.c
index 7955665ccd..57489ed74c 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2021 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2022 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/md5.h b/lib/md5.h
index bae5960a8c..5b92eac5ec 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,6 +1,6 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2021 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2022 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/memmem.c b/lib/memmem.c
index 142de576d9..5701052d48 100644
--- a/lib/memmem.c
+++ b/lib/memmem.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2021 Free Software
+/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2022 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/mempcpy.c b/lib/mempcpy.c
index cacacdbc62..9aae418ef2 100644
--- a/lib/mempcpy.c
+++ b/lib/mempcpy.c
@@ -1,5 +1,5 @@
 /* Copy memory area and return pointer after last written byte.
-   Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/memrchr.c b/lib/memrchr.c
index e0d47d13d7..e853996ad0 100644
--- a/lib/memrchr.c
+++ b/lib/memrchr.c
@@ -1,6 +1,6 @@
 /* memrchr -- find the last occurrence of a byte in a memory block
 
-   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2021 Free Software
+   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2022 Free Software
    Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/mini-gmp-gnulib.c b/lib/mini-gmp-gnulib.c
index 08aa8f97c1..7620da38db 100644
--- a/lib/mini-gmp-gnulib.c
+++ b/lib/mini-gmp-gnulib.c
@@ -1,6 +1,6 @@
 /* Tailor mini-gmp.c for Gnulib-using applications.
 
-   Copyright 2018-2021 Free Software Foundation, Inc.
+   Copyright 2018-2022 Free Software Foundation, Inc.
 
    This file is free software.
    It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
diff --git a/lib/minmax.h b/lib/minmax.h
index a03361bafa..b4b1345bbc 100644
--- a/lib/minmax.h
+++ b/lib/minmax.h
@@ -1,5 +1,5 @@
 /* MIN, MAX macros.
-   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2021 Free Software
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/mkostemp.c b/lib/mkostemp.c
index 285f1badf8..eae289aff9 100644
--- a/lib/mkostemp.c
+++ b/lib/mkostemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2021 Free Software
+/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2022 Free Software
    Foundation, Inc.
    This file is derived from the one in the GNU C Library.
 
diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h
index 7386625d3d..170764eabc 100644
--- a/lib/mktime-internal.h
+++ b/lib/mktime-internal.h
@@ -1,5 +1,5 @@
 /* Internals of mktime and related functions
-   Copyright 2016-2021 Free Software Foundation, Inc.
+   Copyright 2016-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <eggert@cs.ucla.edu>.
 
diff --git a/lib/mktime.c b/lib/mktime.c
index ae721c72e6..aa12e28e16 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -1,5 +1,5 @@
 /* Convert a 'struct tm' to a time_t value.
-   Copyright (C) 1993-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <eggert@twinsun.com>.
 
diff --git a/lib/nproc.c b/lib/nproc.c
index a9e369dd3f..378d3ff3fc 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -1,6 +1,6 @@
 /* Detect the number of processors.
 
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -307,10 +307,11 @@ num_processors_ignoring_omp (enum nproc_query query)
      NPROC_CURRENT and NPROC_ALL.  */
 
 #if HAVE_SYSCTL && ! defined __GLIBC__ && defined HW_NCPU
-  { /* This works on Mac OS X, FreeBSD, NetBSD, OpenBSD.  */
+  { /* This works on macOS, FreeBSD, NetBSD, OpenBSD.
+       macOS 10.14 does not allow mib to be const.  */
     int nprocs;
     size_t len = sizeof (nprocs);
-    static int const mib[][2] = {
+    static int mib[][2] = {
 # ifdef HW_NCPUONLINE
       { CTL_HW, HW_NCPUONLINE },
 # endif
diff --git a/lib/nproc.h b/lib/nproc.h
index d7659a5cad..505351d95f 100644
--- a/lib/nproc.h
+++ b/lib/nproc.h
@@ -1,6 +1,6 @@
 /* Detect the number of processors.
 
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index 7f258e8727..190ff4d8f2 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This file is free software: you can redistribute it and/or modify
@@ -22,7 +22,7 @@
 # define HAVE_TZNAME 1
 # include "../locale/localeinfo.h"
 #else
-# include <config.h>
+# include <libc-config.h>
 # if FPRINTFTIME
 #  include "fprintftime.h"
 # else
@@ -367,10 +367,7 @@ tm_diff (const struct tm *a, const struct tm *b)
 #define ISO_WEEK1_WDAY 4 /* Thursday */
 #define YDAY_MINIMUM (-366)
 static int iso_week_days (int, int);
-#if defined __GNUC__ || defined __clang__
-__inline__
-#endif
-static int
+static __inline int
 iso_week_days (int yday, int wday)
 {
   /* Add enough to the first operand of % to make it nonnegative.  */
@@ -428,9 +425,7 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t 
maxsize)
   return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false,
                               0, -1, &tzset_called extra_args LOCALE_ARG);
 }
-#if defined _LIBC && ! FPRINTFTIME
 libc_hidden_def (my_strftime)
-#endif
 
 /* Just like my_strftime, above, but with more parameters.
    UPCASE indicates that the result should be converted to upper case.
@@ -656,6 +651,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 
 #endif /* ! DO_MULTIBYTE */
 
+      char const *percent = f;
+
       /* Check for flags that can modify a format.  */
       while (1)
         {
@@ -757,8 +754,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           while (0)
 
         case L_('%'):
-          if (modifier != 0)
-            goto bad_format;
+          if (f - 1 != percent)
+            goto bad_percent;
           add1 (*f);
           break;
 
@@ -1472,6 +1469,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           }
 
         case L_('\0'):          /* GNU extension: % at end of format.  */
+        bad_percent:
             --f;
             FALLTHROUGH;
         default:
@@ -1479,12 +1477,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
              since this is most likely the right thing to do if a
              multibyte string has been misparsed.  */
         bad_format:
-          {
-            int flen;
-            for (flen = 1; f[1 - flen] != L_('%'); flen++)
-              continue;
-            cpy (flen, &f[1 - flen]);
-          }
+          cpy (f - percent + 1, percent);
           break;
         }
     }
diff --git a/lib/open.c b/lib/open.c
index 372cda8816..170bff108e 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -1,5 +1,5 @@
 /* Open a descriptor to a file.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/openat-priv.h b/lib/openat-priv.h
index 5c42d03499..451cac10cc 100644
--- a/lib/openat-priv.h
+++ b/lib/openat-priv.h
@@ -1,6 +1,6 @@
 /* Internals for openat-like functions.
 
-   Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/openat-proc.c b/lib/openat-proc.c
index 4f8be90f14..d5f4296d47 100644
--- a/lib/openat-proc.c
+++ b/lib/openat-proc.c
@@ -1,6 +1,6 @@
 /* Create /proc/self/fd-related names for subfiles of open directories.
 
-   Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/openat.h b/lib/openat.h
index 70981241b2..dcb2864ffc 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -1,5 +1,5 @@
 /* provide a replacement openat function
-   Copyright (C) 2004-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2004-2006, 2008-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/pathmax.h b/lib/pathmax.h
index 716f4a9aae..19b93d7eab 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -1,5 +1,5 @@
 /* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2021 Free Software
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/pipe2.c b/lib/pipe2.c
index 9ba8c3b703..400aff001a 100644
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -1,5 +1,5 @@
 /* Create a pipe, with specific opening flags.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/pselect.c b/lib/pselect.c
index b5fadc6728..a1eca0c6a2 100644
--- a/lib/pselect.c
+++ b/lib/pselect.c
@@ -1,6 +1,6 @@
 /* pselect - synchronous I/O multiplexing
 
-   Copyright 2011-2021 Free Software Foundation, Inc.
+   Copyright 2011-2022 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c
index 11b7091e7f..cd4eb80732 100644
--- a/lib/pthread_sigmask.c
+++ b/lib/pthread_sigmask.c
@@ -1,5 +1,5 @@
 /* POSIX compatible signal blocking for threads.
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c
index f274ca8d56..42ae68ffc1 100644
--- a/lib/qcopy-acl.c
+++ b/lib/qcopy-acl.c
@@ -1,6 +1,6 @@
 /* Copy access control list from one file to another.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
index e7a00b8030..ea68c1bfc6 100644
--- a/lib/rawmemchr.c
+++ b/lib/rawmemchr.c
@@ -1,5 +1,5 @@
 /* Searching in a string.
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/rawmemchr.valgrind b/lib/rawmemchr.valgrind
index d489c320c3..64cf86c842 100644
--- a/lib/rawmemchr.valgrind
+++ b/lib/rawmemchr.valgrind
@@ -1,6 +1,6 @@
 # Suppress a valgrind message about use of uninitialized memory in rawmemchr().
 
-# Copyright (C) 2008-2021 Free Software Foundation, Inc.
+# Copyright (C) 2008-2022 Free Software Foundation, Inc.
 #
 # This file is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as
diff --git a/lib/readlink.c b/lib/readlink.c
index ad4d51dc64..ed03cc8ded 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
 /* Read the contents of a symbolic link.
-   Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
index 4a29f7a8bf..f3d39604d2 100644
--- a/lib/readlinkat.c
+++ b/lib/readlinkat.c
@@ -1,5 +1,5 @@
 /* Read a symlink relative to an open directory.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/realloc.c b/lib/realloc.c
index af03f0c577..c878381576 100644
--- a/lib/realloc.c
+++ b/lib/realloc.c
@@ -1,6 +1,6 @@
 /* realloc() function that is glibc compatible.
 
-   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2021 Free Software
+   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 887e5b5068..b607c85320 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
@@ -27,14 +27,10 @@ static void re_compile_fastmap_iter (regex_t *bufp,
                                     const re_dfastate_t *init_state,
                                     char *fastmap);
 static reg_errcode_t init_dfa (re_dfa_t *dfa, size_t pat_len);
-#ifdef RE_ENABLE_I18N
 static void free_charset (re_charset_t *cset);
-#endif /* RE_ENABLE_I18N */
 static void free_workarea_compile (regex_t *preg);
 static reg_errcode_t create_initial_state (re_dfa_t *dfa);
-#ifdef RE_ENABLE_I18N
 static void optimize_utf8 (re_dfa_t *dfa);
-#endif
 static reg_errcode_t analyze (regex_t *preg);
 static reg_errcode_t preorder (bin_tree_t *root,
                               reg_errcode_t (fn (void *, bin_tree_t *)),
@@ -89,7 +85,6 @@ static reg_errcode_t parse_bracket_element (bracket_elem_t 
*elem,
 static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem,
                                          re_string_t *regexp,
                                          re_token_t *token);
-#ifdef RE_ENABLE_I18N
 static reg_errcode_t build_equiv_class (bitset_t sbcset,
                                        re_charset_t *mbcset,
                                        Idx *equiv_class_alloc,
@@ -100,14 +95,6 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE 
trans,
                                      Idx *char_class_alloc,
                                      const char *class_name,
                                      reg_syntax_t syntax);
-#else  /* not RE_ENABLE_I18N */
-static reg_errcode_t build_equiv_class (bitset_t sbcset,
-                                       const unsigned char *name);
-static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
-                                     bitset_t sbcset,
-                                     const char *class_name,
-                                     reg_syntax_t syntax);
-#endif /* not RE_ENABLE_I18N */
 static bin_tree_t *build_charclass_op (re_dfa_t *dfa,
                                       RE_TRANSLATE_TYPE trans,
                                       const char *class_name,
@@ -279,8 +266,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
 }
 weak_alias (__re_compile_fastmap, re_compile_fastmap)
 
-static inline void
-__attribute__ ((always_inline))
+static __always_inline void
 re_set_fastmap (char *fastmap, bool icase, int ch)
 {
   fastmap[ch] = 1;
@@ -306,7 +292,6 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t 
*init_state,
       if (type == CHARACTER)
        {
          re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
-#ifdef RE_ENABLE_I18N
          if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
            {
              unsigned char buf[MB_LEN_MAX];
@@ -327,7 +312,6 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t 
*init_state,
                      != (size_t) -1))
                re_set_fastmap (fastmap, false, buf[0]);
            }
-#endif
        }
       else if (type == SIMPLE_BRACKET)
        {
@@ -341,13 +325,12 @@ re_compile_fastmap_iter (regex_t *bufp, const 
re_dfastate_t *init_state,
                  re_set_fastmap (fastmap, icase, ch);
            }
        }
-#ifdef RE_ENABLE_I18N
       else if (type == COMPLEX_BRACKET)
        {
          re_charset_t *cset = dfa->nodes[node].opr.mbcset;
          Idx i;
 
-# ifdef _LIBC
+#ifdef _LIBC
          /* See if we have to try all bytes which start multiple collation
             elements.
             e.g. In da_DK, we want to catch 'a' since "aa" is a valid
@@ -363,7 +346,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t 
*init_state,
                    if (table[i] < 0)
                      re_set_fastmap (fastmap, icase, i);
                }
-# endif /* _LIBC */
+#endif /* _LIBC */
 
          /* See if we have to start the match at all multibyte characters,
             i.e. where we would not find an invalid sequence.  This only
@@ -371,9 +354,9 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t 
*init_state,
             sets, the SIMPLE_BRACKET again suffices.  */
          if (dfa->mb_cur_max > 1
              && (cset->nchar_classes || cset->non_match || cset->nranges
-# ifdef _LIBC
+#ifdef _LIBC
                  || cset->nequiv_classes
-# endif /* _LIBC */
+#endif /* _LIBC */
                 ))
            {
              unsigned char c = 0;
@@ -406,12 +389,7 @@ re_compile_fastmap_iter (regex_t *bufp, const 
re_dfastate_t *init_state,
                }
            }
        }
-#endif /* RE_ENABLE_I18N */
-      else if (type == OP_PERIOD
-#ifdef RE_ENABLE_I18N
-              || type == OP_UTF8_PERIOD
-#endif /* RE_ENABLE_I18N */
-              || type == END_OF_RE)
+      else if (type == OP_PERIOD || type == OP_UTF8_PERIOD || type == 
END_OF_RE)
        {
          memset (fastmap, '\1', sizeof (char) * SBC_MAX);
          if (type == END_OF_RE)
@@ -550,7 +528,6 @@ regerror (int errcode, const regex_t *__restrict preg, char 
*__restrict errbuf,
 weak_alias (__regerror, regerror)
 
 
-#ifdef RE_ENABLE_I18N
 /* This static array is used for the map to single-byte characters when
    UTF-8 is used.  Otherwise we would allocate memory just to initialize
    it the same all the time.  UTF-8 is the preferred encoding so this is
@@ -558,25 +535,24 @@ weak_alias (__regerror, regerror)
 static const bitset_t utf8_sb_map =
 {
   /* Set the first 128 bits.  */
-# if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
+#if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
   [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
-# else
-#  if 4 * BITSET_WORD_BITS < ASCII_CHARS
-#   error "bitset_word_t is narrower than 32 bits"
-#  elif 3 * BITSET_WORD_BITS < ASCII_CHARS
+#else
+# if 4 * BITSET_WORD_BITS < ASCII_CHARS
+#  error "bitset_word_t is narrower than 32 bits"
+# elif 3 * BITSET_WORD_BITS < ASCII_CHARS
   BITSET_WORD_MAX, BITSET_WORD_MAX, BITSET_WORD_MAX,
-#  elif 2 * BITSET_WORD_BITS < ASCII_CHARS
+# elif 2 * BITSET_WORD_BITS < ASCII_CHARS
   BITSET_WORD_MAX, BITSET_WORD_MAX,
-#  elif 1 * BITSET_WORD_BITS < ASCII_CHARS
+# elif 1 * BITSET_WORD_BITS < ASCII_CHARS
   BITSET_WORD_MAX,
-#  endif
+# endif
   (BITSET_WORD_MAX
    >> (SBC_MAX % BITSET_WORD_BITS == 0
        ? 0
        : BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS))
-# endif
-};
 #endif
+};
 
 
 static void
@@ -614,10 +590,8 @@ free_dfa_content (re_dfa_t *dfa)
        re_free (entry->array);
       }
   re_free (dfa->state_table);
-#ifdef RE_ENABLE_I18N
   if (dfa->sb_char != utf8_sb_map)
     re_free (dfa->sb_char);
-#endif
   re_free (dfa->subexp_map);
 #ifdef DEBUG
   re_free (dfa->re_str);
@@ -796,11 +770,9 @@ re_compile_internal (regex_t *preg, const char * pattern, 
size_t length,
   if (__glibc_unlikely (err != REG_NOERROR))
     goto re_compile_internal_free_return;
 
-#ifdef RE_ENABLE_I18N
   /* If possible, do searching in single byte encoding to speed things up.  */
   if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL)
     optimize_utf8 (dfa);
-#endif
 
   /* Then create the initial state of the dfa.  */
   err = create_initial_state (dfa);
@@ -830,11 +802,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
 #ifndef _LIBC
   const char *codeset_name;
 #endif
-#ifdef RE_ENABLE_I18N
   size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
-#else
-  size_t max_i18n_object_size = 0;
-#endif
   size_t max_object_size =
     MAX (sizeof (struct re_state_table_entry),
         MAX (sizeof (re_token_t),
@@ -886,7 +854,6 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
   dfa->map_notascii = 0;
 #endif
 
-#ifdef RE_ENABLE_I18N
   if (dfa->mb_cur_max > 1)
     {
       if (dfa->is_utf8)
@@ -906,14 +873,13 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
                wint_t wch = __btowc (ch);
                if (wch != WEOF)
                  dfa->sb_char[i] |= (bitset_word_t) 1 << j;
-# ifndef _LIBC
+#ifndef _LIBC
                if (isascii (ch) && wch != ch)
                  dfa->map_notascii = 1;
-# endif
+#endif
              }
        }
     }
-#endif
 
   if (__glibc_unlikely (dfa->nodes == NULL || dfa->state_table == NULL))
     return REG_ESPACE;
@@ -933,8 +899,6 @@ init_word_char (re_dfa_t *dfa)
   dfa->word_ops_used = 1;
   if (__glibc_likely (dfa->map_notascii == 0))
     {
-      /* Avoid uint32_t and uint64_t as some non-GCC platforms lack
-        them, an issue when this code is used in Gnulib.  */
       bitset_word_t bits0 = 0x00000000;
       bitset_word_t bits1 = 0x03ff0000;
       bitset_word_t bits2 = 0x87fffffe;
@@ -1074,7 +1038,6 @@ create_initial_state (re_dfa_t *dfa)
   return REG_NOERROR;
 }
 
-#ifdef RE_ENABLE_I18N
 /* If it is possible to do searching in single byte encoding instead of UTF-8
    to speed things up, set dfa->mb_cur_max to 1, clear is_utf8 and change
    DFA nodes where needed.  */
@@ -1154,7 +1117,6 @@ optimize_utf8 (re_dfa_t *dfa)
   dfa->is_utf8 = 0;
   dfa->has_mb_node = dfa->nbackref > 0 || has_period;
 }
-#endif
 
 /* Analyze the structure tree, and calculate "first", "next", "edest",
    "eclosure", and "inveclosure".  */
@@ -1792,7 +1754,6 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
   token->opr.c = c;
 
   token->word_char = 0;
-#ifdef RE_ENABLE_I18N
   token->mb_partial = 0;
   if (input->mb_cur_max > 1
       && !re_string_first_byte (input, re_string_cur_idx (input)))
@@ -1801,7 +1762,6 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
       token->mb_partial = 1;
       return 1;
     }
-#endif
   if (c == '\\')
     {
       unsigned char c2;
@@ -1814,7 +1774,6 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
       c2 = re_string_peek_byte_case (input, 1);
       token->opr.c = c2;
       token->type = CHARACTER;
-#ifdef RE_ENABLE_I18N
       if (input->mb_cur_max > 1)
        {
          wint_t wc = re_string_wchar_at (input,
@@ -1822,7 +1781,6 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
          token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
        }
       else
-#endif
        token->word_char = IS_WORD_CHAR (c2) != 0;
 
       switch (c2)
@@ -1928,14 +1886,12 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
     }
 
   token->type = CHARACTER;
-#ifdef RE_ENABLE_I18N
   if (input->mb_cur_max > 1)
     {
       wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
       token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
     }
   else
-#endif
     token->word_char = IS_WORD_CHAR (token->opr.c);
 
   switch (c)
@@ -2027,14 +1983,12 @@ peek_token_bracket (re_token_t *token, re_string_t 
*input, reg_syntax_t syntax)
   c = re_string_peek_byte (input, 0);
   token->opr.c = c;
 
-#ifdef RE_ENABLE_I18N
   if (input->mb_cur_max > 1
       && !re_string_first_byte (input, re_string_cur_idx (input)))
     {
       token->type = CHARACTER;
       return 1;
     }
-#endif /* RE_ENABLE_I18N */
 
   if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS)
       && re_string_cur_idx (input) + 1 < re_string_length (input))
@@ -2256,7 +2210,6 @@ parse_expression (re_string_t *regexp, regex_t *preg, 
re_token_t *token,
          *err = REG_ESPACE;
          return NULL;
        }
-#ifdef RE_ENABLE_I18N
       if (dfa->mb_cur_max > 1)
        {
          while (!re_string_eoi (regexp)
@@ -2273,7 +2226,6 @@ parse_expression (re_string_t *regexp, regex_t *preg, 
re_token_t *token,
                }
            }
        }
-#endif
       break;
 
     case OP_OPEN_SUBEXP:
@@ -2666,40 +2618,30 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 
 #ifndef _LIBC
 
-# ifdef RE_ENABLE_I18N
 /* Convert the byte B to the corresponding wide character.  In a
    unibyte locale, treat B as itself.  In a multibyte locale, return
    WEOF if B is an encoding error.  */
 static wint_t
-parse_byte (unsigned char b, re_charset_t *mbcset)
+parse_byte (unsigned char b, re_dfa_t const *dfa)
 {
-  return mbcset == NULL ? b : __btowc (b);
+  return dfa->mb_cur_max > 1 ? __btowc (b) : b;
 }
-# endif
 
-  /* Local function for parse_bracket_exp only used in case of NOT _LIBC.
-     Build the range expression which starts from START_ELEM, and ends
-     at END_ELEM.  The result are written to MBCSET and SBCSET.
-     RANGE_ALLOC is the allocated size of mbcset->range_starts, and
-     mbcset->range_ends, is a pointer argument since we may
-     update it.  */
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Build the range expression which starts from START_ELEM, and ends
+   at END_ELEM.  The result are written to MBCSET and SBCSET.
+   RANGE_ALLOC is the allocated size of mbcset->range_starts, and
+   mbcset->range_ends, is a pointer argument since we may
+   update it.  */
 
 static reg_errcode_t
-# ifdef RE_ENABLE_I18N
-build_range_exp (const reg_syntax_t syntax,
-                 bitset_t sbcset,
-                 re_charset_t *mbcset,
-                 Idx *range_alloc,
-                 const bracket_elem_t *start_elem,
-                 const bracket_elem_t *end_elem)
-# else /* not RE_ENABLE_I18N */
-build_range_exp (const reg_syntax_t syntax,
-                 bitset_t sbcset,
-                 const bracket_elem_t *start_elem,
-                 const bracket_elem_t *end_elem)
-# endif /* not RE_ENABLE_I18N */
+build_range_exp (bitset_t sbcset, re_charset_t *mbcset, Idx *range_alloc,
+                bracket_elem_t *start_elem, bracket_elem_t *end_elem,
+                re_dfa_t *dfa, reg_syntax_t syntax, uint_fast32_t nrules,
+                const unsigned char *collseqmb, const char *collseqwc,
+                int_fast32_t table_size, const void *symb_table,
+                const unsigned char *extra)
 {
-  unsigned int start_ch, end_ch;
   /* Equivalence Classes and Character Classes can't be a range start/end.  */
   if (__glibc_unlikely (start_elem->type == EQUIV_CLASS
                        || start_elem->type == CHAR_CLASS
@@ -2715,110 +2657,88 @@ build_range_exp (const reg_syntax_t syntax,
                            && strlen ((char *) end_elem->opr.name) > 1)))
     return REG_ECOLLATE;
 
-# ifdef RE_ENABLE_I18N
-  {
-    wchar_t wc;
-    wint_t start_wc;
-    wint_t end_wc;
-
+  unsigned int
     start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch
                : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0]
-                  : 0));
+                  : 0)),
     end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch
              : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
                 : 0));
+  wint_t
     start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
-               ? parse_byte (start_ch, mbcset) : start_elem->opr.wch);
+               ? parse_byte (start_ch, dfa) : start_elem->opr.wch),
     end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
-             ? parse_byte (end_ch, mbcset) : end_elem->opr.wch);
-    if (start_wc == WEOF || end_wc == WEOF)
-      return REG_ECOLLATE;
-    else if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES)
-                              && start_wc > end_wc))
-      return REG_ERANGE;
-
-    /* Got valid collation sequence values, add them as a new entry.
-       However, for !_LIBC we have no collation elements: if the
-       character set is single byte, the single byte character set
-       that we build below suffices.  parse_bracket_exp passes
-       no MBCSET if dfa->mb_cur_max == 1.  */
-    if (mbcset)
-      {
-       /* Check the space of the arrays.  */
-       if (__glibc_unlikely (*range_alloc == mbcset->nranges))
-         {
-           /* There is not enough space, need realloc.  */
-           wchar_t *new_array_start, *new_array_end;
-           Idx new_nranges;
-
-           /* +1 in case of mbcset->nranges is 0.  */
-           new_nranges = 2 * mbcset->nranges + 1;
-           /* Use realloc since mbcset->range_starts and mbcset->range_ends
-              are NULL if *range_alloc == 0.  */
-           new_array_start = re_realloc (mbcset->range_starts, wchar_t,
-                                         new_nranges);
-           new_array_end = re_realloc (mbcset->range_ends, wchar_t,
-                                       new_nranges);
+             ? parse_byte (end_ch, dfa) : end_elem->opr.wch);
 
-           if (__glibc_unlikely (new_array_start == NULL
-                                 || new_array_end == NULL))
-             {
-               re_free (new_array_start);
-               re_free (new_array_end);
-               return REG_ESPACE;
-             }
+  if (start_wc == WEOF || end_wc == WEOF)
+    return REG_ECOLLATE;
+  else if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES)
+                             && start_wc > end_wc))
+    return REG_ERANGE;
 
-           mbcset->range_starts = new_array_start;
-           mbcset->range_ends = new_array_end;
-           *range_alloc = new_nranges;
-         }
+  /* Got valid collation sequence values, add them as a new entry.
+     However, for !_LIBC we have no collation elements: if the
+     character set is single byte, the single byte character set
+     that we build below suffices.  parse_bracket_exp passes
+     no MBCSET if dfa->mb_cur_max == 1.  */
+  if (dfa->mb_cur_max > 1)
+    {
+      /* Check the space of the arrays.  */
+      if (__glibc_unlikely (*range_alloc == mbcset->nranges))
+        {
+          /* There is not enough space, need realloc.  */
+          wchar_t *new_array_start, *new_array_end;
+          Idx new_nranges;
 
-       mbcset->range_starts[mbcset->nranges] = start_wc;
-       mbcset->range_ends[mbcset->nranges++] = end_wc;
-      }
+          /* +1 in case of mbcset->nranges is 0.  */
+          new_nranges = 2 * mbcset->nranges + 1;
+          /* Use realloc since mbcset->range_starts and mbcset->range_ends
+             are NULL if *range_alloc == 0.  */
+          new_array_start = re_realloc (mbcset->range_starts, wchar_t,
+                                        new_nranges);
+          new_array_end = re_realloc (mbcset->range_ends, wchar_t,
+                                      new_nranges);
+
+          if (__glibc_unlikely (new_array_start == NULL
+                                || new_array_end == NULL))
+            {
+              re_free (new_array_start);
+              re_free (new_array_end);
+              return REG_ESPACE;
+            }
+
+          mbcset->range_starts = new_array_start;
+          mbcset->range_ends = new_array_end;
+          *range_alloc = new_nranges;
+        }
+
+      mbcset->range_starts[mbcset->nranges] = start_wc;
+      mbcset->range_ends[mbcset->nranges++] = end_wc;
+    }
+
+  /* Build the table for single byte characters.  */
+  for (wchar_t wc = 0; wc < SBC_MAX; ++wc)
+    {
+      if (start_wc <= wc && wc <= end_wc)
+        bitset_set (sbcset, wc);
+    }
 
-    /* Build the table for single byte characters.  */
-    for (wc = 0; wc < SBC_MAX; ++wc)
-      {
-       if (start_wc <= wc && wc <= end_wc)
-         bitset_set (sbcset, wc);
-      }
-  }
-# else /* not RE_ENABLE_I18N */
-  {
-    unsigned int ch;
-    start_ch = ((start_elem->type == SB_CHAR ) ? start_elem->opr.ch
-               : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0]
-                  : 0));
-    end_ch = ((end_elem->type == SB_CHAR ) ? end_elem->opr.ch
-             : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
-                : 0));
-    if (start_ch > end_ch)
-      return REG_ERANGE;
-    /* Build the table for single byte characters.  */
-    for (ch = 0; ch < SBC_MAX; ++ch)
-      if (start_ch <= ch  && ch <= end_ch)
-       bitset_set (sbcset, ch);
-  }
-# endif /* not RE_ENABLE_I18N */
   return REG_NOERROR;
 }
 #endif /* not _LIBC */
 
 #ifndef _LIBC
-/* Helper function for parse_bracket_exp only used in case of NOT _LIBC..
+/* Helper function for parse_bracket_exp only used in case of NOT _LIBC.
    Build the collating element which is represented by NAME.
    The result are written to MBCSET and SBCSET.
    COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
    pointer argument since we may update it.  */
 
 static reg_errcode_t
-# ifdef RE_ENABLE_I18N
 build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
-                       Idx *coll_sym_alloc, const unsigned char *name)
-# else /* not RE_ENABLE_I18N */
-build_collating_symbol (bitset_t sbcset, const unsigned char *name)
-# endif /* not RE_ENABLE_I18N */
+                       Idx *coll_sym_alloc, const unsigned char *name,
+                       uint_fast32_t nrules, int_fast32_t table_size,
+                       const void *symb_table, const unsigned char *extra)
 {
   size_t name_len = strlen ((const char *) name);
   if (__glibc_unlikely (name_len != 1))
@@ -2831,271 +2751,280 @@ build_collating_symbol (bitset_t sbcset, const 
unsigned char *name)
 }
 #endif /* not _LIBC */
 
-/* This function parse bracket expression like "[abc]", "[a-c]",
-   "[[.a-a.]]" etc.  */
-
-static bin_tree_t *
-parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
-                  reg_syntax_t syntax, reg_errcode_t *err)
-{
 #ifdef _LIBC
-  const unsigned char *collseqmb;
-  const char *collseqwc;
-  uint32_t nrules;
-  int32_t table_size;
-  const int32_t *symb_table;
-  const unsigned char *extra;
-
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Seek the collating symbol entry corresponding to NAME.
-     Return the index of the symbol in the SYMB_TABLE,
-     or -1 if not found.  */
-
-  auto inline int32_t
-  __attribute__ ((always_inline))
-  seek_collating_symbol_entry (const unsigned char *name, size_t name_len)
-    {
-      int32_t elem;
-
-      for (elem = 0; elem < table_size; elem++)
-       if (symb_table[2 * elem] != 0)
-         {
-           int32_t idx = symb_table[2 * elem + 1];
-           /* Skip the name of collating element name.  */
-           idx += 1 + extra[idx];
-           if (/* Compare the length of the name.  */
-               name_len == extra[idx]
-               /* Compare the name.  */
-               && memcmp (name, &extra[idx + 1], name_len) == 0)
-             /* Yep, this is the entry.  */
-             return elem;
-         }
-      return -1;
-    }
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Seek the collating symbol entry corresponding to NAME.
+   Return the index of the symbol in the SYMB_TABLE,
+   or -1 if not found.  */
+
+static __always_inline int32_t
+seek_collating_symbol_entry (const unsigned char *name, size_t name_len,
+                            const int32_t *symb_table,
+                            int_fast32_t table_size,
+                            const unsigned char *extra)
+{
+  int_fast32_t elem;
 
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Look up the collation sequence value of BR_ELEM.
-     Return the value if succeeded, UINT_MAX otherwise.  */
+  for (elem = 0; elem < table_size; elem++)
+    if (symb_table[2 * elem] != 0)
+      {
+       int32_t idx = symb_table[2 * elem + 1];
+       /* Skip the name of collating element name.  */
+       idx += 1 + extra[idx];
+       if (/* Compare the length of the name.  */
+           name_len == extra[idx]
+           /* Compare the name.  */
+           && memcmp (name, &extra[idx + 1], name_len) == 0)
+         /* Yep, this is the entry.  */
+         return elem;
+      }
+  return -1;
+}
 
-  auto inline unsigned int
-  __attribute__ ((always_inline))
-  lookup_collation_sequence_value (bracket_elem_t *br_elem)
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Look up the collation sequence value of BR_ELEM.
+   Return the value if succeeded, UINT_MAX otherwise.  */
+
+static __always_inline unsigned int
+lookup_collation_sequence_value (bracket_elem_t *br_elem, uint32_t nrules,
+                                const unsigned char *collseqmb,
+                                const char *collseqwc,
+                                int_fast32_t table_size,
+                                const int32_t *symb_table,
+                                const unsigned char *extra)
+{
+  if (br_elem->type == SB_CHAR)
     {
-      if (br_elem->type == SB_CHAR)
-       {
-         /*
-         if (MB_CUR_MAX == 1)
-         */
-         if (nrules == 0)
-           return collseqmb[br_elem->opr.ch];
-         else
-           {
-             wint_t wc = __btowc (br_elem->opr.ch);
-             return __collseq_table_lookup (collseqwc, wc);
-           }
-       }
-      else if (br_elem->type == MB_CHAR)
+      /* if (MB_CUR_MAX == 1) */
+      if (nrules == 0)
+       return collseqmb[br_elem->opr.ch];
+      else
        {
-         if (nrules != 0)
-           return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+         wint_t wc = __btowc (br_elem->opr.ch);
+         return __collseq_table_lookup (collseqwc, wc);
        }
-      else if (br_elem->type == COLL_SYM)
+    }
+  else if (br_elem->type == MB_CHAR)
+    {
+      if (nrules != 0)
+       return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+    }
+  else if (br_elem->type == COLL_SYM)
+    {
+      size_t sym_name_len = strlen ((char *) br_elem->opr.name);
+      if (nrules != 0)
        {
-         size_t sym_name_len = strlen ((char *) br_elem->opr.name);
-         if (nrules != 0)
+         int32_t elem, idx;
+         elem = seek_collating_symbol_entry (br_elem->opr.name,
+                                             sym_name_len,
+                                             symb_table, table_size,
+                                             extra);
+         if (elem != -1)
            {
-             int32_t elem, idx;
-             elem = seek_collating_symbol_entry (br_elem->opr.name,
-                                                 sym_name_len);
-             if (elem != -1)
-               {
-                 /* We found the entry.  */
-                 idx = symb_table[2 * elem + 1];
-                 /* Skip the name of collating element name.  */
-                 idx += 1 + extra[idx];
-                 /* Skip the byte sequence of the collating element.  */
-                 idx += 1 + extra[idx];
-                 /* Adjust for the alignment.  */
-                 idx = (idx + 3) & ~3;
-                 /* Skip the multibyte collation sequence value.  */
-                 idx += sizeof (unsigned int);
-                 /* Skip the wide char sequence of the collating element.  */
-                 idx += sizeof (unsigned int) *
-                   (1 + *(unsigned int *) (extra + idx));
-                 /* Return the collation sequence value.  */
-                 return *(unsigned int *) (extra + idx);
-               }
-             else if (sym_name_len == 1)
-               {
-                 /* No valid character.  Match it as a single byte
-                    character.  */
-                 return collseqmb[br_elem->opr.name[0]];
-               }
+             /* We found the entry.  */
+             idx = symb_table[2 * elem + 1];
+             /* Skip the name of collating element name.  */
+             idx += 1 + extra[idx];
+             /* Skip the byte sequence of the collating element.  */
+             idx += 1 + extra[idx];
+             /* Adjust for the alignment.  */
+             idx = (idx + 3) & ~3;
+             /* Skip the multibyte collation sequence value.  */
+             idx += sizeof (unsigned int);
+             /* Skip the wide char sequence of the collating element.  */
+             idx += sizeof (unsigned int) *
+               (1 + *(unsigned int *) (extra + idx));
+             /* Return the collation sequence value.  */
+             return *(unsigned int *) (extra + idx);
            }
          else if (sym_name_len == 1)
-           return collseqmb[br_elem->opr.name[0]];
+           {
+             /* No valid character.  Match it as a single byte
+                character.  */
+             return collseqmb[br_elem->opr.name[0]];
+           }
        }
-      return UINT_MAX;
+      else if (sym_name_len == 1)
+       return collseqmb[br_elem->opr.name[0]];
     }
+  return UINT_MAX;
+}
 
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Build the range expression which starts from START_ELEM, and ends
-     at END_ELEM.  The result are written to MBCSET and SBCSET.
-     RANGE_ALLOC is the allocated size of mbcset->range_starts, and
-     mbcset->range_ends, is a pointer argument since we may
-     update it.  */
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Build the range expression which starts from START_ELEM, and ends
+   at END_ELEM.  The result are written to MBCSET and SBCSET.
+   RANGE_ALLOC is the allocated size of mbcset->range_starts, and
+   mbcset->range_ends, is a pointer argument since we may
+   update it.  */
+
+static __always_inline reg_errcode_t
+build_range_exp (bitset_t sbcset, re_charset_t *mbcset, Idx *range_alloc,
+                bracket_elem_t *start_elem, bracket_elem_t *end_elem,
+                re_dfa_t *dfa, reg_syntax_t syntax, uint32_t nrules,
+                const unsigned char *collseqmb, const char *collseqwc,
+                int_fast32_t table_size, const int32_t *symb_table,
+                const unsigned char *extra)
+{
+  unsigned int ch;
+  uint32_t start_collseq;
+  uint32_t end_collseq;
 
-  auto inline reg_errcode_t
-  __attribute__ ((always_inline))
-  build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
-                  bracket_elem_t *start_elem, bracket_elem_t *end_elem)
-    {
-      unsigned int ch;
-      uint32_t start_collseq;
-      uint32_t end_collseq;
-
-      /* Equivalence Classes and Character Classes can't be a range
-        start/end.  */
-      if (__glibc_unlikely (start_elem->type == EQUIV_CLASS
-                           || start_elem->type == CHAR_CLASS
-                           || end_elem->type == EQUIV_CLASS
-                           || end_elem->type == CHAR_CLASS))
-       return REG_ERANGE;
+  /* Equivalence Classes and Character Classes can't be a range
+     start/end.  */
+  if (__glibc_unlikely (start_elem->type == EQUIV_CLASS
+                        || start_elem->type == CHAR_CLASS
+                        || end_elem->type == EQUIV_CLASS
+                        || end_elem->type == CHAR_CLASS))
+    return REG_ERANGE;
 
-      /* FIXME: Implement rational ranges here, too.  */
-      start_collseq = lookup_collation_sequence_value (start_elem);
-      end_collseq = lookup_collation_sequence_value (end_elem);
-      /* Check start/end collation sequence values.  */
-      if (__glibc_unlikely (start_collseq == UINT_MAX
-                           || end_collseq == UINT_MAX))
-       return REG_ECOLLATE;
-      if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES)
-                           && start_collseq > end_collseq))
-       return REG_ERANGE;
+  /* FIXME: Implement rational ranges here, too.  */
+  start_collseq = lookup_collation_sequence_value (start_elem, nrules, 
collseqmb, collseqwc,
+                                                  table_size, symb_table, 
extra);
+  end_collseq = lookup_collation_sequence_value (end_elem, nrules, collseqmb, 
collseqwc,
+                                                table_size, symb_table, extra);
+  /* Check start/end collation sequence values.  */
+  if (__glibc_unlikely (start_collseq == UINT_MAX
+                        || end_collseq == UINT_MAX))
+    return REG_ECOLLATE;
+  if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES)
+                        && start_collseq > end_collseq))
+    return REG_ERANGE;
 
-      /* Got valid collation sequence values, add them as a new entry.
-        However, if we have no collation elements, and the character set
-        is single byte, the single byte character set that we
-        build below suffices. */
-      if (nrules > 0 || dfa->mb_cur_max > 1)
+  /* Got valid collation sequence values, add them as a new entry.
+     However, if we have no collation elements, and the character set
+     is single byte, the single byte character set that we
+     build below suffices. */
+  if (nrules > 0 || dfa->mb_cur_max > 1)
+    {
+      /* Check the space of the arrays.  */
+      if (__glibc_unlikely (*range_alloc == mbcset->nranges))
        {
-         /* Check the space of the arrays.  */
-         if (__glibc_unlikely (*range_alloc == mbcset->nranges))
-           {
-             /* There is not enough space, need realloc.  */
-             uint32_t *new_array_start;
-             uint32_t *new_array_end;
-             Idx new_nranges;
-
-             /* +1 in case of mbcset->nranges is 0.  */
-             new_nranges = 2 * mbcset->nranges + 1;
-             new_array_start = re_realloc (mbcset->range_starts, uint32_t,
-                                           new_nranges);
-             new_array_end = re_realloc (mbcset->range_ends, uint32_t,
-                                         new_nranges);
-
-             if (__glibc_unlikely (new_array_start == NULL
-                                   || new_array_end == NULL))
-               return REG_ESPACE;
+         /* There is not enough space, need realloc.  */
+         uint32_t *new_array_start;
+         uint32_t *new_array_end;
+         int new_nranges;
 
-             mbcset->range_starts = new_array_start;
-             mbcset->range_ends = new_array_end;
-             *range_alloc = new_nranges;
-           }
+         /* +1 in case of mbcset->nranges is 0.  */
+         new_nranges = 2 * mbcset->nranges + 1;
+         new_array_start = re_realloc (mbcset->range_starts, uint32_t,
+                                       new_nranges);
+         new_array_end = re_realloc (mbcset->range_ends, uint32_t,
+                                     new_nranges);
 
-         mbcset->range_starts[mbcset->nranges] = start_collseq;
-         mbcset->range_ends[mbcset->nranges++] = end_collseq;
-       }
+          if (__glibc_unlikely (new_array_start == NULL
+                                || new_array_end == NULL))
+           return REG_ESPACE;
 
-      /* Build the table for single byte characters.  */
-      for (ch = 0; ch < SBC_MAX; ch++)
-       {
-         uint32_t ch_collseq;
-         /*
-         if (MB_CUR_MAX == 1)
-         */
-         if (nrules == 0)
-           ch_collseq = collseqmb[ch];
-         else
-           ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
-         if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
-           bitset_set (sbcset, ch);
+         mbcset->range_starts = new_array_start;
+         mbcset->range_ends = new_array_end;
+         *range_alloc = new_nranges;
        }
-      return REG_NOERROR;
+
+      mbcset->range_starts[mbcset->nranges] = start_collseq;
+      mbcset->range_ends[mbcset->nranges++] = end_collseq;
     }
 
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Build the collating element which is represented by NAME.
-     The result are written to MBCSET and SBCSET.
-     COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
-     pointer argument since we may update it.  */
+  /* Build the table for single byte characters.  */
+  for (ch = 0; ch < SBC_MAX; ch++)
+    {
+      uint32_t ch_collseq;
+      /* if (MB_CUR_MAX == 1) */
+      if (nrules == 0)
+       ch_collseq = collseqmb[ch];
+      else
+       ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
+      if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
+       bitset_set (sbcset, ch);
+    }
+  return REG_NOERROR;
+}
 
-  auto inline reg_errcode_t
-  __attribute__ ((always_inline))
-  build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
-                         Idx *coll_sym_alloc, const unsigned char *name)
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Build the collating element which is represented by NAME.
+   The result are written to MBCSET and SBCSET.
+   COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
+   pointer argument since we may update it.  */
+
+static __always_inline reg_errcode_t
+build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+                       Idx *coll_sym_alloc, const unsigned char *name,
+                       uint_fast32_t nrules, int_fast32_t table_size,
+                       const int32_t *symb_table, const unsigned char *extra)
+{
+  int32_t elem, idx;
+  size_t name_len = strlen ((const char *) name);
+  if (nrules != 0)
     {
-      int32_t elem, idx;
-      size_t name_len = strlen ((const char *) name);
-      if (nrules != 0)
+      elem = seek_collating_symbol_entry (name, name_len, symb_table,
+                                         table_size, extra);
+      if (elem != -1)
        {
-         elem = seek_collating_symbol_entry (name, name_len);
-         if (elem != -1)
-           {
-             /* We found the entry.  */
-             idx = symb_table[2 * elem + 1];
-             /* Skip the name of collating element name.  */
-             idx += 1 + extra[idx];
-           }
-         else if (name_len == 1)
-           {
-             /* No valid character, treat it as a normal
-                character.  */
-             bitset_set (sbcset, name[0]);
-             return REG_NOERROR;
-           }
-         else
-           return REG_ECOLLATE;
-
-         /* Got valid collation sequence, add it as a new entry.  */
-         /* Check the space of the arrays.  */
-         if (__glibc_unlikely (*coll_sym_alloc == mbcset->ncoll_syms))
-           {
-             /* Not enough, realloc it.  */
-             /* +1 in case of mbcset->ncoll_syms is 0.  */
-             Idx new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1;
-             /* Use realloc since mbcset->coll_syms is NULL
-                if *alloc == 0.  */
-             int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t,
-                                                  new_coll_sym_alloc);
-             if (__glibc_unlikely (new_coll_syms == NULL))
-               return REG_ESPACE;
-             mbcset->coll_syms = new_coll_syms;
-             *coll_sym_alloc = new_coll_sym_alloc;
-           }
-         mbcset->coll_syms[mbcset->ncoll_syms++] = idx;
+         /* We found the entry.  */
+         idx = symb_table[2 * elem + 1];
+         /* Skip the name of collating element name.  */
+         idx += 1 + extra[idx];
+       }
+      else if (name_len == 1)
+       {
+         /* No valid character, treat it as a normal
+            character.  */
+         bitset_set (sbcset, name[0]);
          return REG_NOERROR;
        }
       else
+       return REG_ECOLLATE;
+
+      /* Got valid collation sequence, add it as a new entry.  */
+      /* Check the space of the arrays.  */
+      if (__glibc_unlikely (*coll_sym_alloc == mbcset->ncoll_syms))
        {
-         if (__glibc_unlikely (name_len != 1))
-           return REG_ECOLLATE;
-         else
-           {
-             bitset_set (sbcset, name[0]);
-             return REG_NOERROR;
-           }
+         /* Not enough, realloc it.  */
+         /* +1 in case of mbcset->ncoll_syms is 0.  */
+         int new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1;
+         /* Use realloc since mbcset->coll_syms is NULL
+            if *alloc == 0.  */
+         int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t,
+                                              new_coll_sym_alloc);
+          if (__glibc_unlikely (new_coll_syms == NULL))
+           return REG_ESPACE;
+         mbcset->coll_syms = new_coll_syms;
+         *coll_sym_alloc = new_coll_sym_alloc;
        }
+      mbcset->coll_syms[mbcset->ncoll_syms++] = idx;
+      return REG_NOERROR;
     }
-#endif
+  else
+    {
+      if (__glibc_unlikely (name_len != 1))
+       return REG_ECOLLATE;
+      else
+       {
+         bitset_set (sbcset, name[0]);
+         return REG_NOERROR;
+       }
+    }
+}
+#endif /* _LIBC */
+
+/* This function parse bracket expression like "[abc]", "[a-c]",
+   "[[.a-a.]]" etc.  */
+
+static bin_tree_t *
+parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
+                  reg_syntax_t syntax, reg_errcode_t *err)
+{
+  const unsigned char *collseqmb = NULL;
+  const char *collseqwc = NULL;
+  uint_fast32_t nrules = 0;
+  int_fast32_t table_size = 0;
+  const void *symb_table = NULL;
+  const unsigned char *extra = NULL;
 
   re_token_t br_token;
   re_bitset_ptr_t sbcset;
-#ifdef RE_ENABLE_I18N
   re_charset_t *mbcset;
   Idx coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
   Idx equiv_class_alloc = 0, char_class_alloc = 0;
-#endif /* not RE_ENABLE_I18N */
   bool non_match = false;
   bin_tree_t *work_tree;
   int token_len;
@@ -3111,26 +3040,17 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
       */
       collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC);
       table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB);
-      symb_table = (const int32_t *) _NL_CURRENT (LC_COLLATE,
-                                                 _NL_COLLATE_SYMB_TABLEMB);
+      symb_table = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB);
       extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
                                                   _NL_COLLATE_SYMB_EXTRAMB);
     }
 #endif
   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
-#ifdef RE_ENABLE_I18N
   mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
-#endif /* RE_ENABLE_I18N */
-#ifdef RE_ENABLE_I18N
   if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
-#else
-  if (__glibc_unlikely (sbcset == NULL))
-#endif /* RE_ENABLE_I18N */
     {
       re_free (sbcset);
-#ifdef RE_ENABLE_I18N
       re_free (mbcset);
-#endif
       *err = REG_ESPACE;
       return NULL;
     }
@@ -3143,9 +3063,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
     }
   if (token->type == OP_NON_MATCH_LIST)
     {
-#ifdef RE_ENABLE_I18N
       mbcset->non_match = 1;
-#endif /* not RE_ENABLE_I18N */
       non_match = true;
       if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
        bitset_set (sbcset, '\n');
@@ -3228,18 +3146,10 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
 
          token_len = peek_token_bracket (token, regexp, syntax);
 
-#ifdef _LIBC
          *err = build_range_exp (sbcset, mbcset, &range_alloc,
-                                 &start_elem, &end_elem);
-#else
-# ifdef RE_ENABLE_I18N
-         *err = build_range_exp (syntax, sbcset,
-                                 dfa->mb_cur_max > 1 ? mbcset : NULL,
-                                 &range_alloc, &start_elem, &end_elem);
-# else
-         *err = build_range_exp (syntax, sbcset, &start_elem, &end_elem);
-# endif
-#endif /* RE_ENABLE_I18N */
+                                 &start_elem, &end_elem,
+                                 dfa, syntax, nrules, collseqmb, collseqwc,
+                                 table_size, symb_table, extra);
          if (__glibc_unlikely (*err != REG_NOERROR))
            goto parse_bracket_exp_free_return;
        }
@@ -3250,7 +3160,6 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
            case SB_CHAR:
              bitset_set (sbcset, start_elem.opr.ch);
              break;
-#ifdef RE_ENABLE_I18N
            case MB_CHAR:
              /* Check whether the array has enough space.  */
              if (__glibc_unlikely (mbchar_alloc == mbcset->nmbchars))
@@ -3268,30 +3177,24 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
                }
              mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
              break;
-#endif /* RE_ENABLE_I18N */
            case EQUIV_CLASS:
              *err = build_equiv_class (sbcset,
-#ifdef RE_ENABLE_I18N
                                        mbcset, &equiv_class_alloc,
-#endif /* RE_ENABLE_I18N */
                                        start_elem.opr.name);
              if (__glibc_unlikely (*err != REG_NOERROR))
                goto parse_bracket_exp_free_return;
              break;
            case COLL_SYM:
              *err = build_collating_symbol (sbcset,
-#ifdef RE_ENABLE_I18N
                                             mbcset, &coll_sym_alloc,
-#endif /* RE_ENABLE_I18N */
-                                            start_elem.opr.name);
+                                            start_elem.opr.name,
+                                            nrules, table_size, symb_table, 
extra);
              if (__glibc_unlikely (*err != REG_NOERROR))
                goto parse_bracket_exp_free_return;
              break;
            case CHAR_CLASS:
              *err = build_charclass (regexp->trans, sbcset,
-#ifdef RE_ENABLE_I18N
                                      mbcset, &char_class_alloc,
-#endif /* RE_ENABLE_I18N */
                                      (const char *) start_elem.opr.name,
                                      syntax);
              if (__glibc_unlikely (*err != REG_NOERROR))
@@ -3317,7 +3220,6 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
   if (non_match)
     bitset_not (sbcset);
 
-#ifdef RE_ENABLE_I18N
   /* Ensure only single byte characters are set.  */
   if (dfa->mb_cur_max > 1)
     bitset_mask (sbcset, dfa->sb_char);
@@ -3361,11 +3263,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
        }
     }
   else
-#endif /* not RE_ENABLE_I18N */
     {
-#ifdef RE_ENABLE_I18N
       free_charset (mbcset);
-#endif
       /* Build a tree for simple bracket.  */
       br_token.type = SIMPLE_BRACKET;
       br_token.opr.sbcset = sbcset;
@@ -3379,9 +3278,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
   *err = REG_ESPACE;
  parse_bracket_exp_free_return:
   re_free (sbcset);
-#ifdef RE_ENABLE_I18N
   free_charset (mbcset);
-#endif /* RE_ENABLE_I18N */
   return NULL;
 }
 
@@ -3392,7 +3289,6 @@ parse_bracket_element (bracket_elem_t *elem, re_string_t 
*regexp,
                       re_token_t *token, int token_len, re_dfa_t *dfa,
                       reg_syntax_t syntax, bool accept_hyphen)
 {
-#ifdef RE_ENABLE_I18N
   int cur_char_size;
   cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
   if (cur_char_size > 1)
@@ -3402,7 +3298,6 @@ parse_bracket_element (bracket_elem_t *elem, re_string_t 
*regexp,
       re_string_skip_bytes (regexp, cur_char_size);
       return REG_NOERROR;
     }
-#endif /* RE_ENABLE_I18N */
   re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
   if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
       || token->type == OP_OPEN_EQUIV_CLASS)
@@ -3475,12 +3370,8 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t 
*regexp,
      is a pointer argument since we may update it.  */
 
 static reg_errcode_t
-#ifdef RE_ENABLE_I18N
 build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
                   Idx *equiv_class_alloc, const unsigned char *name)
-#else /* not RE_ENABLE_I18N */
-build_equiv_class (bitset_t sbcset, const unsigned char *name)
-#endif /* not RE_ENABLE_I18N */
 {
 #ifdef _LIBC
   uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
@@ -3560,14 +3451,9 @@ build_equiv_class (bitset_t sbcset, const unsigned char 
*name)
      is a pointer argument since we may update it.  */
 
 static reg_errcode_t
-#ifdef RE_ENABLE_I18N
 build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
                 re_charset_t *mbcset, Idx *char_class_alloc,
                 const char *class_name, reg_syntax_t syntax)
-#else /* not RE_ENABLE_I18N */
-build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
-                const char *class_name, reg_syntax_t syntax)
-#endif /* not RE_ENABLE_I18N */
 {
   int i;
   const char *name = class_name;
@@ -3578,7 +3464,6 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
       && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
     name = "alpha";
 
-#ifdef RE_ENABLE_I18N
   /* Check the space of the arrays.  */
   if (__glibc_unlikely (*char_class_alloc == mbcset->nchar_classes))
     {
@@ -3594,7 +3479,6 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
       *char_class_alloc = new_char_class_alloc;
     }
   mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
-#endif /* RE_ENABLE_I18N */
 
 #define BUILD_CHARCLASS_LOOP(ctype_func)       \
   do {                                         \
@@ -3649,10 +3533,8 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE 
trans,
                    reg_errcode_t *err)
 {
   re_bitset_ptr_t sbcset;
-#ifdef RE_ENABLE_I18N
   re_charset_t *mbcset;
   Idx alloc = 0;
-#endif /* not RE_ENABLE_I18N */
   reg_errcode_t ret;
   bin_tree_t *tree;
 
@@ -3662,7 +3544,6 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE 
trans,
       *err = REG_ESPACE;
       return NULL;
     }
-#ifdef RE_ENABLE_I18N
   mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
   if (__glibc_unlikely (mbcset == NULL))
     {
@@ -3671,21 +3552,14 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE 
trans,
       return NULL;
     }
   mbcset->non_match = non_match;
-#endif /* RE_ENABLE_I18N */
 
   /* We don't care the syntax in this case.  */
-  ret = build_charclass (trans, sbcset,
-#ifdef RE_ENABLE_I18N
-                        mbcset, &alloc,
-#endif /* RE_ENABLE_I18N */
-                        class_name, 0);
+  ret = build_charclass (trans, sbcset, mbcset, &alloc, class_name, 0);
 
   if (__glibc_unlikely (ret != REG_NOERROR))
     {
       re_free (sbcset);
-#ifdef RE_ENABLE_I18N
       free_charset (mbcset);
-#endif /* RE_ENABLE_I18N */
       *err = ret;
       return NULL;
     }
@@ -3697,11 +3571,9 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE 
trans,
   if (non_match)
     bitset_not (sbcset);
 
-#ifdef RE_ENABLE_I18N
   /* Ensure only single byte characters are set.  */
   if (dfa->mb_cur_max > 1)
     bitset_mask (sbcset, dfa->sb_char);
-#endif
 
   /* Build a tree for simple bracket.  */
   re_token_t br_token = { .type = SIMPLE_BRACKET, .opr.sbcset = sbcset };
@@ -3709,7 +3581,6 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE 
trans,
   if (__glibc_unlikely (tree == NULL))
     goto build_word_op_espace;
 
-#ifdef RE_ENABLE_I18N
   if (dfa->mb_cur_max > 1)
     {
       bin_tree_t *mbc_tree;
@@ -3730,15 +3601,10 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE 
trans,
       free_charset (mbcset);
       return tree;
     }
-#else /* not RE_ENABLE_I18N */
-  return tree;
-#endif /* not RE_ENABLE_I18N */
 
  build_word_op_espace:
   re_free (sbcset);
-#ifdef RE_ENABLE_I18N
   free_charset (mbcset);
-#endif /* RE_ENABLE_I18N */
   *err = REG_ESPACE;
   return NULL;
 }
@@ -3771,21 +3637,19 @@ fetch_number (re_string_t *input, re_token_t *token, 
reg_syntax_t syntax)
   return num;
 }
 
-#ifdef RE_ENABLE_I18N
 static void
 free_charset (re_charset_t *cset)
 {
   re_free (cset->mbchars);
-# ifdef _LIBC
+#ifdef _LIBC
   re_free (cset->coll_syms);
   re_free (cset->equiv_classes);
-# endif
+#endif
   re_free (cset->range_starts);
   re_free (cset->range_ends);
   re_free (cset->char_classes);
   re_free (cset);
 }
-#endif /* RE_ENABLE_I18N */
 
 /* Functions for binary tree operation.  */
 
@@ -3851,13 +3715,10 @@ mark_opt_subexp (void *extra, bin_tree_t *node)
 static void
 free_token (re_token_t *node)
 {
-#ifdef RE_ENABLE_I18N
   if (node->type == COMPLEX_BRACKET && node->duplicated == 0)
     free_charset (node->opr.mbcset);
-  else
-#endif /* RE_ENABLE_I18N */
-    if (node->type == SIMPLE_BRACKET && node->duplicated == 0)
-      re_free (node->opr.sbcset);
+  else if (node->type == SIMPLE_BRACKET && node->duplicated == 0)
+    re_free (node->opr.sbcset);
 }
 
 /* Worker function for tree walking.  Free the allocated memory inside NODE
diff --git a/lib/regex.c b/lib/regex.c
index d32863972c..ff1176782e 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
diff --git a/lib/regex.h b/lib/regex.h
index adb69768ee..a7e0bd0275 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -1,6 +1,6 @@
 /* Definitions for data structures and routines for the regular
    expression library.
-   Copyright (C) 1985, 1989-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1989-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index aefcfa2f52..3945ee7ecb 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
@@ -30,10 +30,8 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t 
*dfa,
                                          re_hashval_t hash);
 static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
                                                Idx new_buf_len);
-#ifdef RE_ENABLE_I18N
 static void build_wcs_buffer (re_string_t *pstr);
 static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr);
-#endif /* RE_ENABLE_I18N */
 static void build_upper_buffer (re_string_t *pstr);
 static void re_string_translate_buffer (re_string_t *pstr);
 static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
@@ -91,7 +89,6 @@ re_string_construct (re_string_t *pstr, const char *str, Idx 
len,
 
   if (icase)
     {
-#ifdef RE_ENABLE_I18N
       if (dfa->mb_cur_max > 1)
        {
          while (1)
@@ -109,16 +106,13 @@ re_string_construct (re_string_t *pstr, const char *str, 
Idx len,
            }
        }
       else
-#endif /* RE_ENABLE_I18N  */
        build_upper_buffer (pstr);
     }
   else
     {
-#ifdef RE_ENABLE_I18N
       if (dfa->mb_cur_max > 1)
        build_wcs_buffer (pstr);
       else
-#endif /* RE_ENABLE_I18N  */
        {
          if (trans != NULL)
            re_string_translate_buffer (pstr);
@@ -139,7 +133,6 @@ static reg_errcode_t
 __attribute_warn_unused_result__
 re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
 {
-#ifdef RE_ENABLE_I18N
   if (pstr->mb_cur_max > 1)
     {
       wint_t *new_wcs;
@@ -162,7 +155,6 @@ re_string_realloc_buffers (re_string_t *pstr, Idx 
new_buf_len)
          pstr->offsets = new_offsets;
        }
     }
-#endif /* RE_ENABLE_I18N  */
   if (pstr->mbs_allocated)
     {
       unsigned char *new_mbs = re_realloc (pstr->mbs, unsigned char,
@@ -194,7 +186,6 @@ re_string_construct_common (const char *str, Idx len, 
re_string_t *pstr,
   pstr->raw_stop = pstr->stop;
 }
 
-#ifdef RE_ENABLE_I18N
 
 /* Build wide character buffer PSTR->WCS.
    If the byte sequence of the string are:
@@ -530,7 +521,6 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, 
wint_t *last_wc)
   *last_wc = wc;
   return rawbuf_idx;
 }
-#endif /* RE_ENABLE_I18N  */
 
 /* Build the buffer PSTR->MBS, and apply the translation if we need.
    This function is used in case of REG_ICASE.  */
@@ -585,10 +575,8 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
   else
     {
       /* Reset buffer.  */
-#ifdef RE_ENABLE_I18N
       if (pstr->mb_cur_max > 1)
        memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
-#endif /* RE_ENABLE_I18N */
       pstr->len = pstr->raw_len;
       pstr->stop = pstr->raw_stop;
       pstr->valid_len = 0;
@@ -608,7 +596,6 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
       if (__glibc_likely (offset < pstr->valid_raw_len))
        {
          /* Yes, move them to the front of the buffer.  */
-#ifdef RE_ENABLE_I18N
          if (__glibc_unlikely (pstr->offsets_needed))
            {
              Idx low = 0, high = pstr->valid_len, mid;
@@ -672,15 +659,12 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
                }
            }
          else
-#endif
            {
              pstr->tip_context = re_string_context_at (pstr, offset - 1,
                                                        eflags);
-#ifdef RE_ENABLE_I18N
              if (pstr->mb_cur_max > 1)
                memmove (pstr->wcs, pstr->wcs + offset,
                         (pstr->valid_len - offset) * sizeof (wint_t));
-#endif /* RE_ENABLE_I18N */
              if (__glibc_unlikely (pstr->mbs_allocated))
                memmove (pstr->mbs, pstr->mbs + offset,
                         pstr->valid_len - offset);
@@ -691,7 +675,6 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
        }
       else
        {
-#ifdef RE_ENABLE_I18N
          /* No, skip all characters until IDX.  */
          Idx prev_valid_len = pstr->valid_len;
 
@@ -701,9 +684,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
              pstr->stop = pstr->raw_stop - idx + offset;
              pstr->offsets_needed = 0;
            }
-#endif
          pstr->valid_len = 0;
-#ifdef RE_ENABLE_I18N
          if (pstr->mb_cur_max > 1)
            {
              Idx wcs_idx;
@@ -787,7 +768,6 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
              pstr->valid_raw_len = pstr->valid_len;
            }
          else
-#endif /* RE_ENABLE_I18N */
            {
              int c = pstr->raw_mbs[pstr->raw_mbs_idx + offset - 1];
              pstr->valid_raw_len = 0;
@@ -807,7 +787,6 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
   pstr->stop -= offset;
 
   /* Then build the buffers.  */
-#ifdef RE_ENABLE_I18N
   if (pstr->mb_cur_max > 1)
     {
       if (pstr->icase)
@@ -820,7 +799,6 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int 
eflags)
        build_wcs_buffer (pstr);
     }
   else
-#endif /* RE_ENABLE_I18N */
     if (__glibc_unlikely (pstr->mbs_allocated))
       {
        if (pstr->icase)
@@ -846,28 +824,22 @@ re_string_peek_byte_case (const re_string_t *pstr, Idx 
idx)
   if (__glibc_likely (!pstr->mbs_allocated))
     return re_string_peek_byte (pstr, idx);
 
-#ifdef RE_ENABLE_I18N
   if (pstr->mb_cur_max > 1
       && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
     return re_string_peek_byte (pstr, idx);
-#endif
 
   off = pstr->cur_idx + idx;
-#ifdef RE_ENABLE_I18N
   if (pstr->offsets_needed)
     off = pstr->offsets[off];
-#endif
 
   ch = pstr->raw_mbs[pstr->raw_mbs_idx + off];
 
-#ifdef RE_ENABLE_I18N
   /* Ensure that e.g. for tr_TR.UTF-8 BACKSLASH DOTLESS SMALL LETTER I
      this function returns CAPITAL LETTER I instead of first byte of
      DOTLESS SMALL LETTER I.  The latter would confuse the parser,
      since peek_byte_case doesn't advance cur_idx in any way.  */
   if (pstr->offsets_needed && !isascii (ch))
     return re_string_peek_byte (pstr, idx);
-#endif
 
   return ch;
 }
@@ -878,7 +850,6 @@ re_string_fetch_byte_case (re_string_t *pstr)
   if (__glibc_likely (!pstr->mbs_allocated))
     return re_string_fetch_byte (pstr);
 
-#ifdef RE_ENABLE_I18N
   if (pstr->offsets_needed)
     {
       Idx off;
@@ -904,7 +875,6 @@ re_string_fetch_byte_case (re_string_t *pstr)
                            re_string_char_size_at (pstr, pstr->cur_idx));
       return ch;
     }
-#endif
 
   return pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++];
 }
@@ -912,10 +882,8 @@ re_string_fetch_byte_case (re_string_t *pstr)
 static void
 re_string_destruct (re_string_t *pstr)
 {
-#ifdef RE_ENABLE_I18N
   re_free (pstr->wcs);
   re_free (pstr->offsets);
-#endif /* RE_ENABLE_I18N  */
   if (pstr->mbs_allocated)
     re_free (pstr->mbs);
 }
@@ -933,7 +901,6 @@ re_string_context_at (const re_string_t *input, Idx idx, 
int eflags)
   if (__glibc_unlikely (idx == input->len))
     return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
            : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
-#ifdef RE_ENABLE_I18N
   if (input->mb_cur_max > 1)
     {
       wint_t wc;
@@ -953,7 +920,6 @@ re_string_context_at (const re_string_t *input, Idx idx, 
int eflags)
              ? CONTEXT_NEWLINE : 0);
     }
   else
-#endif
     {
       c = re_string_byte_at (input, idx);
       if (bitset_contain (input->word_char, c))
@@ -1451,11 +1417,9 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
     }
   dfa->nodes[dfa->nodes_len] = token;
   dfa->nodes[dfa->nodes_len].constraint = 0;
-#ifdef RE_ENABLE_I18N
   dfa->nodes[dfa->nodes_len].accept_mb =
     ((token.type == OP_PERIOD && dfa->mb_cur_max > 1)
      || token.type == COMPLEX_BRACKET);
-#endif
   dfa->nexts[dfa->nodes_len] = -1;
   re_node_set_init_empty (dfa->edests + dfa->nodes_len);
   re_node_set_init_empty (dfa->eclosures + dfa->nodes_len);
@@ -1651,9 +1615,7 @@ create_ci_newstate (const re_dfa_t *dfa, const 
re_node_set *nodes,
       re_token_type_t type = node->type;
       if (type == CHARACTER && !node->constraint)
        continue;
-#ifdef RE_ENABLE_I18N
       newstate->accept_mb |= node->accept_mb;
-#endif /* RE_ENABLE_I18N */
 
       /* If the state has the halt node, the state is a halt state.  */
       if (type == END_OF_RE)
@@ -1705,9 +1667,7 @@ create_cd_newstate (const re_dfa_t *dfa, const 
re_node_set *nodes,
 
       if (type == CHARACTER && !constraint)
        continue;
-#ifdef RE_ENABLE_I18N
       newstate->accept_mb |= node->accept_mb;
-#endif /* RE_ENABLE_I18N */
 
       /* If the state has the halt node, the state is a halt state.  */
       if (type == END_OF_RE)
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 1245e782ff..57a455b1f4 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
@@ -116,10 +116,6 @@
 # define gettext_noop(String) String
 #endif
 
-#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC
-# define RE_ENABLE_I18N
-#endif
-
 /* Number of ASCII characters.  */
 #define ASCII_CHARS 0x80
 
@@ -150,6 +146,11 @@
 # define __regfree regfree
 #endif /* not _LIBC */
 
+/* Types related to integers.  Unless protected by #ifdef _LIBC, the
+   regex code should avoid exact-width types like int32_t and uint64_t
+   as some non-GCC platforms lack them, an issue when this code is
+   used in Gnulib.  */
+
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
@@ -246,10 +247,8 @@ typedef enum
   SIMPLE_BRACKET = 3,
   OP_BACK_REF = 4,
   OP_PERIOD = 5,
-#ifdef RE_ENABLE_I18N
   COMPLEX_BRACKET = 6,
   OP_UTF8_PERIOD = 7,
-#endif /* RE_ENABLE_I18N */
 
   /* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
      when the debugger shows values of this enum type.  */
@@ -287,30 +286,29 @@ typedef enum
 
 } re_token_type_t;
 
-#ifdef RE_ENABLE_I18N
 typedef struct
 {
   /* Multibyte characters.  */
   wchar_t *mbchars;
 
+#ifdef _LIBC
   /* Collating symbols.  */
-# ifdef _LIBC
   int32_t *coll_syms;
-# endif
+#endif
 
+#ifdef _LIBC
   /* Equivalence classes. */
-# ifdef _LIBC
   int32_t *equiv_classes;
-# endif
+#endif
 
   /* Range expressions. */
-# ifdef _LIBC
+#ifdef _LIBC
   uint32_t *range_starts;
   uint32_t *range_ends;
-# else /* not _LIBC */
+#else
   wchar_t *range_starts;
   wchar_t *range_ends;
-# endif /* not _LIBC */
+#endif
 
   /* Character classes. */
   wctype_t *char_classes;
@@ -333,7 +331,6 @@ typedef struct
   /* # of character classes. */
   Idx nchar_classes;
 } re_charset_t;
-#endif /* RE_ENABLE_I18N */
 
 typedef struct
 {
@@ -341,9 +338,7 @@ typedef struct
   {
     unsigned char c;           /* for CHARACTER */
     re_bitset_ptr_t sbcset;    /* for SIMPLE_BRACKET */
-#ifdef RE_ENABLE_I18N
     re_charset_t *mbcset;      /* for COMPLEX_BRACKET */
-#endif /* RE_ENABLE_I18N */
     Idx idx;                   /* for BACK_REF */
     re_context_type ctx_type;  /* for ANCHOR */
   } opr;
@@ -355,12 +350,10 @@ typedef struct
   unsigned int constraint : 10;        /* context constraint */
   unsigned int duplicated : 1;
   unsigned int opt_subexp : 1;
-#ifdef RE_ENABLE_I18N
   unsigned int accept_mb : 1;
   /* These 2 bits can be moved into the union if needed (e.g. if running out
      of bits; move opr.c to opr.c.c and move the flags to opr.c.flags).  */
   unsigned int mb_partial : 1;
-#endif
   unsigned int word_char : 1;
 } re_token_t;
 
@@ -375,12 +368,10 @@ struct re_string_t
      REG_ICASE, upper cases of the string are stored, otherwise MBS points
      the same address that RAW_MBS points.  */
   unsigned char *mbs;
-#ifdef RE_ENABLE_I18N
   /* Store the wide character string which is corresponding to MBS.  */
   wint_t *wcs;
   Idx *offsets;
   mbstate_t cur_state;
-#endif
   /* Index in RAW_MBS.  Each character mbs[i] corresponds to
      raw_mbs[raw_mbs_idx + i].  */
   Idx raw_mbs_idx;
@@ -779,7 +770,6 @@ bitset_mask (bitset_t dest, const bitset_t src)
     dest[bitset_i] &= src[bitset_i];
 }
 
-#ifdef RE_ENABLE_I18N
 /* Functions for re_string.  */
 static int
 __attribute__ ((pure, unused))
@@ -803,15 +793,15 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
   return (wint_t) pstr->wcs[idx];
 }
 
-# ifdef _LIBC
-#  include <locale/weight.h>
-# endif
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
 
 static int
 __attribute__ ((pure, unused))
 re_string_elem_size_at (const re_string_t *pstr, Idx idx)
 {
-# ifdef _LIBC
+#ifdef _LIBC
   const unsigned char *p, *extra;
   const int32_t *table, *indirect;
   uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
@@ -827,11 +817,10 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
       findidx (table, indirect, extra, &p, pstr->len - idx);
       return p - pstr->mbs - idx;
     }
-  else
-# endif /* _LIBC */
-    return 1;
+#endif /* _LIBC */
+
+  return 1;
 }
-#endif /* RE_ENABLE_I18N */
 
 #ifdef _LIBC
 # if __GNUC__ >= 7
diff --git a/lib/regexec.c b/lib/regexec.c
index 83e9aaf8ca..aea1e7da52 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
@@ -67,11 +67,9 @@ static reg_errcode_t set_regs (const regex_t *preg,
                               bool fl_backtrack);
 static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs);
 
-#ifdef RE_ENABLE_I18N
 static int sift_states_iter_mb (const re_match_context_t *mctx,
                                re_sift_context_t *sctx,
                                Idx node_idx, Idx str_idx, Idx max_str_idx);
-#endif /* RE_ENABLE_I18N */
 static reg_errcode_t sift_states_backward (const re_match_context_t *mctx,
                                           re_sift_context_t *sctx);
 static reg_errcode_t build_sifted_states (const re_match_context_t *mctx,
@@ -123,10 +121,8 @@ static re_dfastate_t *transit_state_sb (reg_errcode_t *err,
                                        re_match_context_t *mctx,
                                        re_dfastate_t *pstate);
 #endif
-#ifdef RE_ENABLE_I18N
 static reg_errcode_t transit_state_mb (re_match_context_t *mctx,
                                       re_dfastate_t *pstate);
-#endif /* RE_ENABLE_I18N */
 static reg_errcode_t transit_state_bkref (re_match_context_t *mctx,
                                          const re_node_set *nodes);
 static reg_errcode_t get_subexp (re_match_context_t *mctx,
@@ -156,14 +152,12 @@ static reg_errcode_t expand_bkref_cache 
(re_match_context_t *mctx,
                                         re_node_set *cur_nodes, Idx cur_str,
                                         Idx subexp_num, int type);
 static bool build_trtable (const re_dfa_t *dfa, re_dfastate_t *state);
-#ifdef RE_ENABLE_I18N
 static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
                                    const re_string_t *input, Idx idx);
-# ifdef _LIBC
+#ifdef _LIBC
 static unsigned int find_collation_sequence_value (const unsigned char *mbs,
                                                   size_t name_len);
-# endif /* _LIBC */
-#endif /* RE_ENABLE_I18N */
+#endif
 static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa,
                                       const re_dfastate_t *state,
                                       re_node_set *states_node,
@@ -758,10 +752,9 @@ re_search_internal (const regex_t *preg, const char 
*string, Idx length,
 
                  offset = match_first - mctx.input.raw_mbs_idx;
                }
-             /* If MATCH_FIRST is out of the buffer, leave it as '\0'.
-                Note that MATCH_FIRST must not be smaller than 0.  */
-             ch = (match_first >= length
-                   ? 0 : re_string_byte_at (&mctx.input, offset));
+             /* Use buffer byte if OFFSET is in buffer, otherwise '\0'.  */
+             ch = (offset < mctx.input.valid_len
+                   ? re_string_byte_at (&mctx.input, offset) : 0);
              if (fastmap[ch])
                break;
              match_first += incr;
@@ -780,12 +773,10 @@ re_search_internal (const regex_t *preg, const char 
*string, Idx length,
       if (__glibc_unlikely (err != REG_NOERROR))
        goto free_return;
 
-#ifdef RE_ENABLE_I18N
-     /* Don't consider this char as a possible match start if it part,
-       yet isn't the head, of a multibyte character.  */
+      /* Don't consider this char as a possible match start if it part,
+         yet isn't the head, of a multibyte character.  */
       if (!sb && !re_string_first_byte (&mctx.input, 0))
        continue;
-#endif
 
       /* It seems to be appropriate one, then use the matcher.  */
       /* We assume that the matching starts from 0.  */
@@ -859,7 +850,6 @@ re_search_internal (const regex_t *preg, const char 
*string, Idx length,
       for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
        if (pmatch[reg_idx].rm_so != -1)
          {
-#ifdef RE_ENABLE_I18N
            if (__glibc_unlikely (mctx.input.offsets_needed != 0))
              {
                pmatch[reg_idx].rm_so =
@@ -871,9 +861,6 @@ re_search_internal (const regex_t *preg, const char 
*string, Idx length,
                   ? mctx.input.valid_raw_len
                   : mctx.input.offsets[pmatch[reg_idx].rm_eo]);
              }
-#else
-           DEBUG_ASSERT (mctx.input.offsets_needed == 0);
-#endif
            pmatch[reg_idx].rm_so += match_first;
            pmatch[reg_idx].rm_eo += match_first;
          }
@@ -997,8 +984,7 @@ prune_impossible_nodes (re_match_context_t *mctx)
    We must select appropriate initial state depending on the context,
    since initial states may have constraints like "\<", "^", etc..  */
 
-static inline re_dfastate_t *
-__attribute__ ((always_inline))
+static __always_inline re_dfastate_t *
 acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
                            Idx idx)
 {
@@ -1262,12 +1248,9 @@ proceed_next_node (const re_match_context_t *mctx, Idx 
nregs, regmatch_t *regs,
       Idx naccepted = 0;
       re_token_type_t type = dfa->nodes[node].type;
 
-#ifdef RE_ENABLE_I18N
       if (dfa->nodes[node].accept_mb)
        naccepted = check_node_accept_bytes (dfa, node, &mctx->input, *pidx);
-      else
-#endif /* RE_ENABLE_I18N */
-      if (type == OP_BACK_REF)
+      else if (type == OP_BACK_REF)
        {
          Idx subexp_idx = dfa->nodes[node].opr.idx + 1;
          if (subexp_idx < nregs)
@@ -1635,12 +1618,10 @@ build_sifted_states (const re_match_context_t *mctx, 
re_sift_context_t *sctx,
       bool ok;
       DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[prev_node].type));
 
-#ifdef RE_ENABLE_I18N
       /* If the node may accept "multi byte".  */
       if (dfa->nodes[prev_node].accept_mb)
        naccepted = sift_states_iter_mb (mctx, sctx, prev_node,
                                         str_idx, sctx->last_str_idx);
-#endif /* RE_ENABLE_I18N */
 
       /* We don't check backreferences here.
         See update_cur_sifted_state().  */
@@ -1689,6 +1670,7 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx 
next_state_log_idx)
 
   if (top < next_state_log_idx)
     {
+      DEBUG_ASSERT (mctx->state_log != NULL);
       memset (mctx->state_log + top + 1, '\0',
              sizeof (re_dfastate_t *) * (next_state_log_idx - top));
       mctx->state_log_top = next_state_log_idx;
@@ -2177,7 +2159,6 @@ sift_states_bkref (const re_match_context_t *mctx, 
re_sift_context_t *sctx,
 }
 
 
-#ifdef RE_ENABLE_I18N
 static int
 sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
                     Idx node_idx, Idx str_idx, Idx max_str_idx)
@@ -2197,8 +2178,6 @@ sift_states_iter_mb (const re_match_context_t *mctx, 
re_sift_context_t *sctx,
      'naccepted' bytes input.  */
   return naccepted;
 }
-#endif /* RE_ENABLE_I18N */
-
 
 /* Functions for state transition.  */
 
@@ -2216,7 +2195,6 @@ transit_state (reg_errcode_t *err, re_match_context_t 
*mctx,
   re_dfastate_t **trtable;
   unsigned char ch;
 
-#ifdef RE_ENABLE_I18N
   /* If the current state can accept multibyte.  */
   if (__glibc_unlikely (state->accept_mb))
     {
@@ -2224,7 +2202,6 @@ transit_state (reg_errcode_t *err, re_match_context_t 
*mctx,
       if (__glibc_unlikely (*err != REG_NOERROR))
        return NULL;
     }
-#endif /* RE_ENABLE_I18N */
 
   /* Then decide the next state with the single byte.  */
 #if 0
@@ -2445,7 +2422,6 @@ transit_state_sb (reg_errcode_t *err, re_match_context_t 
*mctx,
 }
 #endif
 
-#ifdef RE_ENABLE_I18N
 static reg_errcode_t
 transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
 {
@@ -2513,7 +2489,6 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t 
*pstate)
     }
   return REG_NOERROR;
 }
-#endif /* RE_ENABLE_I18N */
 
 static reg_errcode_t
 transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
@@ -3003,9 +2978,7 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, 
Idx str_idx,
   const re_dfa_t *const dfa = mctx->dfa;
   bool ok;
   Idx cur_idx;
-#ifdef RE_ENABLE_I18N
   reg_errcode_t err = REG_NOERROR;
-#endif
   re_node_set union_set;
   re_node_set_init_empty (&union_set);
   for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx)
@@ -3014,7 +2987,6 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, 
Idx str_idx,
       Idx cur_node = cur_nodes->elems[cur_idx];
       DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[cur_node].type));
 
-#ifdef RE_ENABLE_I18N
       /* If the node may accept "multi byte".  */
       if (dfa->nodes[cur_node].accept_mb)
        {
@@ -3052,7 +3024,7 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, 
Idx str_idx,
                }
            }
        }
-#endif /* RE_ENABLE_I18N */
+
       if (naccepted
          || check_node_accept (mctx, dfa->nodes + cur_node, str_idx))
        {
@@ -3476,18 +3448,15 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const 
re_dfastate_t *state,
        }
       else if (type == OP_PERIOD)
        {
-#ifdef RE_ENABLE_I18N
          if (dfa->mb_cur_max > 1)
            bitset_merge (accepts, dfa->sb_char);
          else
-#endif
            bitset_set_all (accepts);
          if (!(dfa->syntax & RE_DOT_NEWLINE))
            bitset_clear (accepts, '\n');
          if (dfa->syntax & RE_DOT_NOT_NULL)
            bitset_clear (accepts, '\0');
        }
-#ifdef RE_ENABLE_I18N
       else if (type == OP_UTF8_PERIOD)
        {
          if (ASCII_CHARS % BITSET_WORD_BITS == 0)
@@ -3499,7 +3468,6 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const 
re_dfastate_t *state,
          if (dfa->syntax & RE_DOT_NOT_NULL)
            bitset_clear (accepts, '\0');
        }
-#endif
       else
        continue;
 
@@ -3530,12 +3498,10 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const 
re_dfastate_t *state,
                  bitset_empty (accepts);
                  continue;
                }
-#ifdef RE_ENABLE_I18N
              if (dfa->mb_cur_max > 1)
                for (j = 0; j < BITSET_WORDS; ++j)
                  any_set |= (accepts[j] &= (dfa->word_char[j] | 
~dfa->sb_char[j]));
              else
-#endif
                for (j = 0; j < BITSET_WORDS; ++j)
                  any_set |= (accepts[j] &= dfa->word_char[j]);
              if (!any_set)
@@ -3549,12 +3515,10 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const 
re_dfastate_t *state,
                  bitset_empty (accepts);
                  continue;
                }
-#ifdef RE_ENABLE_I18N
              if (dfa->mb_cur_max > 1)
                for (j = 0; j < BITSET_WORDS; ++j)
                  any_set |= (accepts[j] &= ~(dfa->word_char[j] & 
dfa->sb_char[j]));
              else
-#endif
                for (j = 0; j < BITSET_WORDS; ++j)
                  any_set |= (accepts[j] &= ~dfa->word_char[j]);
              if (!any_set)
@@ -3631,7 +3595,6 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const 
re_dfastate_t *state,
   return -1;
 }
 
-#ifdef RE_ENABLE_I18N
 /* Check how many bytes the node 'dfa->nodes[node_idx]' accepts.
    Return the number of the bytes the node accepts.
    STR_IDX is the current index of the input string.
@@ -3640,9 +3603,9 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const 
re_dfastate_t *state,
    one collating element like '.', '[a-z]', opposite to the other nodes
    can only accept one byte.  */
 
-# ifdef _LIBC
-#  include <locale/weight.h>
-# endif
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
 
 static int
 check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
@@ -3726,12 +3689,12 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx 
node_idx,
   if (node->type == COMPLEX_BRACKET)
     {
       const re_charset_t *cset = node->opr.mbcset;
-# ifdef _LIBC
+#ifdef _LIBC
       const unsigned char *pin
        = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
       Idx j;
       uint32_t nrules;
-# endif /* _LIBC */
+#endif
       int match_len = 0;
       wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
                    ? re_string_wchar_at (input, str_idx) : 0);
@@ -3754,7 +3717,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx 
node_idx,
            }
        }
 
-# ifdef _LIBC
+#ifdef _LIBC
       nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
       if (nrules != 0)
        {
@@ -3843,7 +3806,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx 
node_idx,
            }
        }
       else
-# endif /* _LIBC */
+#endif /* _LIBC */
        {
          /* match with range expression?  */
          for (i = 0; i < cset->nranges; ++i)
@@ -3869,7 +3832,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx 
node_idx,
   return 0;
 }
 
-# ifdef _LIBC
+#ifdef _LIBC
 static unsigned int
 find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
 {
@@ -3927,8 +3890,7 @@ find_collation_sequence_value (const unsigned char *mbs, 
size_t mbs_len)
       return UINT_MAX;
     }
 }
-# endif /* _LIBC */
-#endif /* RE_ENABLE_I18N */
+#endif /* _LIBC */
 
 /* Check whether the node accepts the byte which is IDX-th
    byte of the INPUT.  */
@@ -3951,12 +3913,10 @@ check_node_accept (const re_match_context_t *mctx, 
const re_token_t *node,
         return false;
       break;
 
-#ifdef RE_ENABLE_I18N
     case OP_UTF8_PERIOD:
       if (ch >= ASCII_CHARS)
         return false;
       FALLTHROUGH;
-#endif
     case OP_PERIOD:
       if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE))
          || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL)))
@@ -4017,7 +3977,6 @@ extend_buffers (re_match_context_t *mctx, int min_len)
   /* Then reconstruct the buffers.  */
   if (pstr->icase)
     {
-#ifdef RE_ENABLE_I18N
       if (pstr->mb_cur_max > 1)
        {
          ret = build_wcs_upper_buffer (pstr);
@@ -4025,16 +3984,13 @@ extend_buffers (re_match_context_t *mctx, int min_len)
            return ret;
        }
       else
-#endif /* RE_ENABLE_I18N  */
        build_upper_buffer (pstr);
     }
   else
     {
-#ifdef RE_ENABLE_I18N
       if (pstr->mb_cur_max > 1)
        build_wcs_buffer (pstr);
       else
-#endif /* RE_ENABLE_I18N  */
        {
          if (pstr->trans != NULL)
            re_string_translate_buffer (pstr);
diff --git a/lib/root-uid.h b/lib/root-uid.h
index b367d5ab69..b3274e39aa 100644
--- a/lib/root-uid.h
+++ b/lib/root-uid.h
@@ -1,6 +1,6 @@
 /* The user ID that always has appropriate privileges in the POSIX sense.
 
-   Copyright 2012-2021 Free Software Foundation, Inc.
+   Copyright 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 9b625c739d..ecaef8974a 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -1,6 +1,6 @@
 /* save-cwd.c -- Save and restore current working directory.
 
-   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2021 Free Software
+   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2022 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/save-cwd.h b/lib/save-cwd.h
index 3cefba58c0..7aa124c42f 100644
--- a/lib/save-cwd.h
+++ b/lib/save-cwd.h
@@ -1,6 +1,6 @@
 /* Save and restore current working directory.
 
-   Copyright (C) 1995, 1997-1998, 2003, 2009-2021 Free Software Foundation,
+   Copyright (C) 1995, 1997-1998, 2003, 2009-2022 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h
index 88735771d2..f4fe5e8d34 100644
--- a/lib/scratch_buffer.h
+++ b/lib/scratch_buffer.h
@@ -1,5 +1,5 @@
 /* Variable-sized buffer with on-stack default allocation.
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index 5c837f1238..7a7c5e4ed0 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -1,6 +1,6 @@
 /* Set permissions of a file.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sha1.c b/lib/sha1.c
index 52b1020319..79e50ba0b0 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -1,7 +1,7 @@
 /* sha1.c - Functions to compute SHA1 message digest of files or
    memory blocks according to the NIST specification FIPS-180-1.
 
-   Copyright (C) 2000-2001, 2003-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003-2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sha1.h b/lib/sha1.h
index e12a23cd4d..098678d8da 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA1 sum
    library functions.
-   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2021 Free Software
+   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/sha256.c b/lib/sha256.c
index 2b8687f1db..c9ca618c67 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -1,7 +1,7 @@
 /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
    memory blocks according to the NIST specification FIPS-180-2.
 
-   Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sha256.h b/lib/sha256.h
index e09b3de807..dc9d87e615 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA256 and SHA224 sum
    library functions.
-   Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sha512.c b/lib/sha512.c
index 2865d6e588..6776bb464d 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -1,7 +1,7 @@
 /* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
    memory blocks according to the NIST specification FIPS-180-2.
 
-   Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sha512.h b/lib/sha512.h
index e15afe996e..f38819faf0 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA512 and SHA384 sum
    library functions.
-   Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sig2str.c b/lib/sig2str.c
index c2cc35d830..f2f01d1f6f 100644
--- a/lib/sig2str.c
+++ b/lib/sig2str.c
@@ -1,6 +1,6 @@
 /* sig2str.c -- convert between signal names and numbers
 
-   Copyright (C) 2002, 2004, 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sig2str.h b/lib/sig2str.h
index f736aa1b0d..a507170b64 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -1,6 +1,6 @@
 /* sig2str.h -- convert between signal names and numbers
 
-   Copyright (C) 2002, 2005, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sigdescr_np.c b/lib/sigdescr_np.c
index bf6abe55c4..652bc8d75b 100644
--- a/lib/sigdescr_np.c
+++ b/lib/sigdescr_np.c
@@ -1,5 +1,5 @@
 /* English descriptions of signals.
-   Copyright (C) 2020-2021 Free Software Foundation, Inc.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 275da8c817..640b5022f5 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/stat-time.c b/lib/stat-time.c
index 7b92792694..3d48a2b5b0 100644
--- a/lib/stat-time.c
+++ b/lib/stat-time.c
@@ -1,6 +1,6 @@
 /* stat-related time functions.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 6b2cc686ae..6b0088e328 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -1,6 +1,6 @@
 /* stat-related time functions.
 
-   Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index 592d58e372..3b117df11f 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -1,6 +1,6 @@
 /* A substitute for ISO C11 <stdalign.h>.
 
-   Copyright 2011-2021 Free Software Foundation, Inc.
+   Copyright 2011-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 42290d448d..5c9a747d7d 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 85c5418f14..eaa7874f53 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2022 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 3fa94b487e..ed32e6981a 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -1,5 +1,5 @@
 /* Implementation details of FILE streams.
-   Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008, 2010-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 0ca2c8e10c..7b36dac2f5 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -399,7 +399,8 @@ _GL_CXXALIASWARN (fileno);
 #endif
 
 #if @GNULIB_FOPEN@
-# if @REPLACE_FOPEN@
+# if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
+     || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef fopen
 #   define fopen rpl_fopen
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 0855112d19..d52c2f7963 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -260,7 +260,8 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
-# if @REPLACE_CALLOC@
+# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
+     || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef calloc
 #   define calloc rpl_calloc
@@ -474,7 +475,8 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
    by never specifying a zero size), so it does not need malloc or
    realloc to be redefined.  */
 #if @GNULIB_MALLOC_POSIX@
-# if @REPLACE_MALLOC@
+# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
+     || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
 #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
         || _GL_USE_STDLIB_ALLOC)
 #   undef malloc
@@ -828,29 +830,35 @@ _GL_CXXALIASWARN (putenv);
 /* Sort an array of NMEMB elements, starting at address BASE, each element
    occupying SIZE bytes, in ascending order according to the comparison
    function COMPARE.  */
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_qsort_r_fn_types
+typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
+#  define GNULIB_defined_qsort_r_fn_types 1
+# endif
+# ifdef __cplusplus
+}
+# endif
 # if @REPLACE_QSORT_R@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef qsort_r
 #   define qsort_r rpl_qsort_r
 #  endif
 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
-                                  int (*compare) (void const *, void const *,
-                                                  void *),
+                                  _gl_qsort_r_compar_fn compare,
                                   void *arg) _GL_ARG_NONNULL ((1, 4)));
 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
-                                  int (*compare) (void const *, void const *,
-                                                  void *),
+                                  _gl_qsort_r_compar_fn compare,
                                   void *arg));
 # else
 #  if !@HAVE_QSORT_R@
 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
-                                  int (*compare) (void const *, void const *,
-                                                  void *),
+                                  _gl_qsort_r_compar_fn compare,
                                   void *arg) _GL_ARG_NONNULL ((1, 4)));
 #  endif
 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
-                                  int (*compare) (void const *, void const *,
-                                                  void *),
+                                  _gl_qsort_r_compar_fn compare,
                                   void *arg));
 # endif
 _GL_CXXALIASWARN (qsort_r);
@@ -1101,7 +1109,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
 
 
 #if @GNULIB_REALLOC_POSIX@
-# if @REPLACE_REALLOC@
+# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
+     || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
 #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
         || _GL_USE_STDLIB_ALLOC)
 #   undef realloc
diff --git a/lib/stpcpy.c b/lib/stpcpy.c
index c312fe44ba..434f84ae76 100644
--- a/lib/stpcpy.c
+++ b/lib/stpcpy.c
@@ -1,5 +1,5 @@
 /* stpcpy.c -- copy a string and return pointer to end of new string
-   Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2021 Free Software
+   Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2022 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C 
Library.
diff --git a/lib/str-two-way.h b/lib/str-two-way.h
index fc2db03b7b..7ee344aea1 100644
--- a/lib/str-two-way.h
+++ b/lib/str-two-way.h
@@ -1,5 +1,5 @@
 /* Byte-wise substring search, using the Two-Way algorithm.
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Eric Blake <ebb9@byu.net>, 2008.
 
diff --git a/lib/strftime.h b/lib/strftime.h
index 790a80ed8f..9e5cdc3f32 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
 /* declarations for strftime.c
 
-   Copyright (C) 2002, 2004, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2008-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/string.in.h b/lib/string.in.h
index 8d77ae3800..03e6a17a36 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -67,6 +67,35 @@
 # include <strings.h>
 #endif
 
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+   can be freed via 'free'; it can be used only after declaring 'free'.  */
+/* Applies to: functions.  Cannot be used on inline functions.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The attribute __pure__ was added in gcc 2.96.  */
 #ifndef _GL_ATTRIBUTE_PURE
@@ -83,12 +112,26 @@
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
-/* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE.  */
-_GL_EXTERN_C void free (void *);
+/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
+   been included yet.  */
 #if @GNULIB_FREE_POSIX@
 # if (@REPLACE_FREE@ && !defined free \
       && !(defined __cplusplus && defined GNULIB_NAMESPACE))
-#  define free rpl_free
+/* We can't do '#define free rpl_free' here.  */
+_GL_EXTERN_C void rpl_free (void *);
+#  undef _GL_ATTRIBUTE_DEALLOC_FREE
+#  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
+# else
+#  if defined _MSC_VER
+_GL_EXTERN_C void __cdecl free (void *);
+#  else
+_GL_EXTERN_C void free (void *);
+#  endif
+# endif
+#else
+# if defined _MSC_VER
+_GL_EXTERN_C void __cdecl free (void *);
+# else
 _GL_EXTERN_C void free (void *);
 # endif
 #endif
diff --git a/lib/strnlen.c b/lib/strnlen.c
index ded06ce23f..c8fc69c6a9 100644
--- a/lib/strnlen.c
+++ b/lib/strnlen.c
@@ -1,5 +1,5 @@
 /* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index bf8534a767..d562746ee7 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an intmax_t value.
 
-   Copyright (C) 1999, 2001-2004, 2006, 2009-2021 Free Software Foundation,
+   Copyright (C) 1999, 2001-2004, 2006, 2009-2022 Free Software Foundation,
    Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/lib/strtol.c b/lib/strtol.c
index c49321ba0c..457f7a5d64 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2021 Free Software
+   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2022 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/strtoll.c b/lib/strtoll.c
index 8e6f93faeb..5124168c1b 100644
--- a/lib/strtoll.c
+++ b/lib/strtoll.c
@@ -1,5 +1,5 @@
 /* Function to parse a 'long long int' from text.
-   Copyright (C) 1995-1997, 1999, 2001, 2009-2021 Free Software Foundation,
+   Copyright (C) 1995-1997, 1999, 2001, 2009-2022 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/symlink.c b/lib/symlink.c
index 4bb0884aca..51850b2732 100644
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -1,5 +1,5 @@
 /* Stub for symlink().
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h
index 1abd6c544e..e730e6139f 100644
--- a/lib/sys_random.in.h
+++ b/lib/sys_random.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <sys/random.h>.
-   Copyright (C) 2020-2021 Free Software Foundation, Inc.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -23,8 +23,10 @@
 
 #if @HAVE_SYS_RANDOM_H@
 
-/* On uClibc, <sys/random.h> assumes prior inclusion of <stddef.h>.  */
-# if defined __UCLIBC__
+/* On uClibc < 1.0.35, <sys/random.h> assumes prior inclusion of <stddef.h>.
+   Do not use __UCLIBC__ here, as it might not be defined yet.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
 #  include <stddef.h>
 # endif
 /* On Mac OS X 10.5, <sys/random.h> assumes prior inclusion of <sys/types.h>.
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 910bea5d12..2bd0e0f79a 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <sys/select.h>.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -279,9 +279,13 @@ _GL_FUNCDECL_SYS (pselect, int,
                   (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
                    struct timespec const *restrict, const sigset_t *restrict));
 #  endif
-_GL_CXXALIAS_SYS (pselect, int,
-                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
-                   struct timespec const *restrict, const sigset_t *restrict));
+/* Need to cast, because on AIX 7, the second, third, fourth argument may be
+                        void *restrict,   void *restrict,   void *restrict.  */
+_GL_CXXALIAS_SYS_CAST (pselect, int,
+                       (int,
+                        fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                        struct timespec const *restrict,
+                        const sigset_t *restrict));
 # endif
 _GL_CXXALIASWARN (pselect);
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index babe3dba3e..28ddd42f81 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat.h header file.
-   Copyright (C) 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 8035fbe7ec..87db1a8874 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/time.h.
 
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index 2079d72efc..698e88d632 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/types.h.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/tempname.c b/lib/tempname.c
index 7675aa076d..5fc5efe031 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/tempname.h b/lib/tempname.h
index 795bb49764..c172820f7f 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -1,6 +1,6 @@
 /* Create a temporary file or directory.
 
-   Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/time-internal.h b/lib/time-internal.h
index 6bbd0a727b..e1bb56e53e 100644
--- a/lib/time-internal.h
+++ b/lib/time-internal.h
@@ -1,6 +1,6 @@
 /* Time internal interface
 
-   Copyright 2015-2021 Free Software Foundation, Inc.
+   Copyright 2015-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/time.in.h b/lib/time.in.h
index a73fe59cbb..6d4c771963 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -120,6 +120,17 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, 
int base));
 _GL_CXXALIASWARN (timespec_get);
 # endif
 
+/* Set *TS to the current time resolution, and return BASE.
+   Upon failure, return 0.  */
+# if @GNULIB_TIMESPEC_GETRES@
+#  if ! @HAVE_TIMESPEC_GETRES@
+_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
+                                        _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
+_GL_CXXALIASWARN (timespec_getres);
+# endif
+
 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
    return -1 and store the remaining time into RMTP.  See
    
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html>.  */
diff --git a/lib/time_r.c b/lib/time_r.c
index 88d3c1c76f..d4b2275545 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006-2007, 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2010-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/time_rz.c b/lib/time_rz.c
index e7722447c0..d0ae717f30 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -1,6 +1,6 @@
 /* Time zone functions such as tzalloc and localtime_rz
 
-   Copyright 2015-2021 Free Software Foundation, Inc.
+   Copyright 2015-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/timegm.c b/lib/timegm.c
index 7e723e1fb8..a1b19efc39 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -1,6 +1,6 @@
 /* Convert UTC calendar time to simple time.  Like mktime but assumes UTC.
 
-   Copyright (C) 1994-2021 Free Software Foundation, Inc.
+   Copyright (C) 1994-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/timespec-add.c b/lib/timespec-add.c
index 5460a042cc..cd0b5f5f5b 100644
--- a/lib/timespec-add.c
+++ b/lib/timespec-add.c
@@ -1,6 +1,6 @@
 /* Add two struct timespec values.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c
index 88ef69a817..2b2aaa5937 100644
--- a/lib/timespec-sub.c
+++ b/lib/timespec-sub.c
@@ -1,6 +1,6 @@
 /* Subtract two struct timespec values.
 
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/timespec.c b/lib/timespec.c
index 957b5fbba4..82630c2f5a 100644
--- a/lib/timespec.c
+++ b/lib/timespec.c
@@ -1,6 +1,6 @@
 /* Inline functions for <timespec.h>.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/timespec.h b/lib/timespec.h
index 94a5db751f..e130d2c6e2 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -1,6 +1,6 @@
 /* timespec -- System time interface
 
-   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2021 Free Software
+   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2022 Free Software
    Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
@@ -88,6 +88,7 @@ timespectod (struct timespec a)
   return a.tv_sec + a.tv_nsec / 1e9;
 }
 
+long int gettime_res (void);
 struct timespec current_timespec (void);
 void gettime (struct timespec *) _GL_ARG_NONNULL ((1));
 int settime (struct timespec const *) _GL_ARG_NONNULL ((1));
diff --git a/lib/u64.c b/lib/u64.c
index c905af626f..0eefeae801 100644
--- a/lib/u64.c
+++ b/lib/u64.c
@@ -1,6 +1,6 @@
 /* uint64_t-like operations that work even on hosts lacking uint64_t
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/u64.h b/lib/u64.h
index 8d21ec17ed..1908e7c389 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -1,6 +1,6 @@
 /* uint64_t-like operations that work even on hosts lacking uint64_t
 
-   Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/unistd.c b/lib/unistd.c
index 0763456021..95978e6ad0 100644
--- a/lib/unistd.c
+++ b/lib/unistd.c
@@ -1,6 +1,6 @@
 /* Inline functions for <unistd.h>.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 73c882f97b..3386f0b0f7 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
@@ -1409,7 +1409,8 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable 
- "
      Read a password from /dev/tty or stdin.
    Function getpass() from module 'getpass-gnu':
      Read a password of arbitrary length from /dev/tty or stdin.  */
-# if @REPLACE_GETPASS@
+# if (@GNULIB_GETPASS@ && @REPLACE_GETPASS@) \
+     || (@GNULIB_GETPASS_GNU@ && @REPLACE_GETPASS_FOR_GETPASS_GNU@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef getpass
 #   define getpass rpl_getpass
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h
index ca184b31fb..ce52f8f977 100644
--- a/lib/unlocked-io.h
+++ b/lib/unlocked-io.h
@@ -1,6 +1,6 @@
 /* Prefer faster, non-thread-safe stdio functions if available.
 
-   Copyright (C) 2001-2004, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/utimens.c b/lib/utimens.c
index a34180050e..f4907ae4e6 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -1,6 +1,6 @@
 /* Set file access and modification times.
 
-   Copyright (C) 2003-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/utimens.h b/lib/utimens.h
index d17953c052..c3054da0c6 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -1,6 +1,6 @@
 /* Set file access and modification times.
 
-   Copyright 2012-2021 Free Software Foundation, Inc.
+   Copyright 2012-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/utimensat.c b/lib/utimensat.c
index 9fdecd681f..2e4c7bf966 100644
--- a/lib/utimensat.c
+++ b/lib/utimensat.c
@@ -1,5 +1,5 @@
 /* Set the access and modification time of a file relative to directory fd.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/verify.h b/lib/verify.h
index a8ca59b093..07b2f4866f 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lib/vla.h b/lib/vla.h
index 333b626420..adc8f8f68b 100644
--- a/lib/vla.h
+++ b/lib/vla.h
@@ -1,6 +1,6 @@
 /* vla.h - variable length arrays
 
-   Copyright 2014-2021 Free Software Foundation, Inc.
+   Copyright 2014-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h
index 612937abb0..94f5b9201e 100644
--- a/lib/warn-on-use.h
+++ b/lib/warn-on-use.h
@@ -1,5 +1,5 @@
 /* A C macro for emitting warnings if a function is used.
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
@@ -84,20 +84,20 @@
 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
 #  define _GL_WARN_ON_USE(function, message) \
-extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
+_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ 
(message)))
 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
   __attribute__ ((__warning__ (message)))
 # elif __clang_major__ >= 4
 /* Another compiler attribute is available in clang.  */
 #  define _GL_WARN_ON_USE(function, message) \
-extern __typeof__ (function) function \
+_GL_WARN_EXTERN_C __typeof__ (function) function \
   __attribute__ ((__diagnose_if__ (1, message, "warning")))
 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
   __attribute__ ((__diagnose_if__ (1, message, "warning")))
 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
 /* Verify the existence of the function.  */
 #  define _GL_WARN_ON_USE(function, message) \
-extern __typeof__ (function) function
+_GL_WARN_EXTERN_C __typeof__ (function) function
 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
 # else /* Unsupported.  */
 #  define _GL_WARN_ON_USE(function, message) \
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index 4184f33955..aefa6fd804 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -1,6 +1,6 @@
 /* xalloc-oversized.h -- memory allocation size checking
 
-   Copyright (C) 1990-2000, 2003-2004, 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 1990-2000, 2003-2004, 2006-2022 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
diff --git a/lisp/ChangeLog.1 b/lisp/ChangeLog.1
index 9fda59b63b..2311a9f383 100644
--- a/lisp/ChangeLog.1
+++ b/lisp/ChangeLog.1
@@ -3244,7 +3244,7 @@
                Set current buffer variables from defaults
                in case user's init file has changed them.
 
-  Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index c8b0bdabc5..0b97a64109 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -23541,7 +23541,7 @@ See ChangeLog.9 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.11 b/lisp/ChangeLog.11
index 0c72cb4c12..53a83c638c 100644
--- a/lisp/ChangeLog.11
+++ b/lisp/ChangeLog.11
@@ -14321,7 +14321,7 @@ See ChangeLog.10 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2003-2011, 2013-2021 Free Software Foundation, Inc.
+  Copyright (C) 2003-2011, 2013-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.12 b/lisp/ChangeLog.12
index d841a75c5d..c45c8ae735 100644
--- a/lisp/ChangeLog.12
+++ b/lisp/ChangeLog.12
@@ -33334,7 +33334,7 @@ See ChangeLog.11 for earlier changes.
 ;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 2005-2021 Free Software Foundation, Inc.
+    Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.13 b/lisp/ChangeLog.13
index d849bd88fc..369aec81ef 100644
--- a/lisp/ChangeLog.13
+++ b/lisp/ChangeLog.13
@@ -16697,7 +16697,7 @@ See ChangeLog.12 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2007-2021 Free Software Foundation, Inc.
+  Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.14 b/lisp/ChangeLog.14
index edd5bdb7f9..c84e44536d 100644
--- a/lisp/ChangeLog.14
+++ b/lisp/ChangeLog.14
@@ -20547,7 +20547,7 @@ See ChangeLog.13 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2008-2021 Free Software Foundation, Inc.
+    Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.15 b/lisp/ChangeLog.15
index 29fbe47489..53caf69e1c 100644
--- a/lisp/ChangeLog.15
+++ b/lisp/ChangeLog.15
@@ -22802,7 +22802,7 @@ See ChangeLog.14 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2009-2021 Free Software Foundation, Inc.
+  Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16
index 67b62767ed..f0a50bb4bc 100644
--- a/lisp/ChangeLog.16
+++ b/lisp/ChangeLog.16
@@ -25223,7 +25223,7 @@ See ChangeLog.15 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2021 Free Software Foundation, Inc.
+  Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.17 b/lisp/ChangeLog.17
index 4dd3df5953..6333d1dadd 100644
--- a/lisp/ChangeLog.17
+++ b/lisp/ChangeLog.17
@@ -26294,7 +26294,7 @@ See ChangeLog.16 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2021 Free Software Foundation, Inc.
+  Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.2 b/lisp/ChangeLog.2
index ea6ddbb70a..d5b40eb77a 100644
--- a/lisp/ChangeLog.2
+++ b/lisp/ChangeLog.2
@@ -3992,7 +3992,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-    Copyright (C) 1986-1988, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1986-1988, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.3 b/lisp/ChangeLog.3
index a4470b9cfd..7f5ceb4b85 100644
--- a/lisp/ChangeLog.3
+++ b/lisp/ChangeLog.3
@@ -12433,7 +12433,7 @@ See ChangeLog.2 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1989, 1993, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1989, 1993, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.4 b/lisp/ChangeLog.4
index 47a8bfdff7..e965dbb5ef 100644
--- a/lisp/ChangeLog.4
+++ b/lisp/ChangeLog.4
@@ -8934,7 +8934,7 @@ See ChangeLog.3 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.5 b/lisp/ChangeLog.5
index 1a3a13c6bb..4c54f148c1 100644
--- a/lisp/ChangeLog.5
+++ b/lisp/ChangeLog.5
@@ -9268,7 +9268,7 @@ See ChangeLog.4 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.6 b/lisp/ChangeLog.6
index 492dae18e0..e2128b94c0 100644
--- a/lisp/ChangeLog.6
+++ b/lisp/ChangeLog.6
@@ -8021,7 +8021,7 @@ See ChangeLog.5 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1995-1996, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index 3dd8313c6a..747a9ffab9 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -23110,7 +23110,7 @@ See ChangeLog.6 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-       Copyright (C) 1997-1998, 2001-2021 Free Software Foundation,
+       Copyright (C) 1997-1998, 2001-2022 Free Software Foundation,
        Inc.
 
   This file is part of GNU Emacs.
diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8
index 39e757bfff..78fc7e2056 100644
--- a/lisp/ChangeLog.8
+++ b/lisp/ChangeLog.8
@@ -9992,7 +9992,7 @@ See ChangeLog.7 for earlier changes.
 ;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.9 b/lisp/ChangeLog.9
index a8ef2ffa44..00c8133743 100644
--- a/lisp/ChangeLog.9
+++ b/lisp/ChangeLog.9
@@ -20685,7 +20685,7 @@ See ChangeLog.8 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2000-2011, 2013-2021 Free Software Foundation, Inc.
+    Copyright (C) 2000-2011, 2013-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index df9e5c36ee..d29dec08a5 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2000-2021 Free Software Foundation, Inc.
+# Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -255,9 +255,9 @@ ${ETAGS}: FORCE
 ## compile-main.  But maybe this is not even necessary any more now
 ## that this uses relative filenames.
 TAGS: ${ETAGS} ${tagsfiles}
-       $(AM_V_at)rm -f $@
+       $(AM_V_GEN)rm -f $@
        $(AM_V_at)touch $@
-       $(AM_V_GEN)ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@
+       $(AM_V_at)ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@
 
 
 # The src/Makefile.in has its own set of dependencies and when they decide
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 386aff1627..448e184255 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -1,6 +1,6 @@
 ;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1992, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/align.el b/lisp/align.el
index 2fd6dcda6d..2279c659b4 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -1,6 +1,6 @@
 ;;; align.el --- align text to a specific column, by regexp -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index f18d488854..736fb7d99d 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -1,6 +1,6 @@
 ;;; allout-widgets.el --- Visually highlight allout outline structure.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail...>
 ;; Version: 1.0
diff --git a/lisp/allout.el b/lisp/allout.el
index 174184fc7a..4624c236f5 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1,6 +1,6 @@
 ;;; allout.el --- extensive outline mode for use alone and with other modes  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail...>
 ;; Created: Dec 1991 -- first release to usenet
@@ -133,15 +133,10 @@ respective `allout-mode' keybinding variables, 
`allout-command-prefix',
     (when (boundp 'allout-unprefixed-keybindings)
       (dolist (entry allout-unprefixed-keybindings)
         (define-key map (car (read-from-string (car entry))) (cadr entry))))
-    (substitute-key-definition #'beginning-of-line #'allout-beginning-of-line
-                               map global-map)
-    (substitute-key-definition #'move-beginning-of-line
-                               #'allout-beginning-of-line
-                               map global-map)
-    (substitute-key-definition #'end-of-line #'allout-end-of-line
-                               map global-map)
-    (substitute-key-definition #'move-end-of-line #'allout-end-of-line
-                               map global-map)
+    (define-key map [remap beginning-of-line]      #'allout-beginning-of-line)
+    (define-key map [remap move-beginning-of-line] #'allout-beginning-of-line)
+    (define-key map [remap end-of-line]            #'allout-end-of-line)
+    (define-key map [remap move-end-of-line]       #'allout-end-of-line)
     (allout-institute-keymap map)))
 ;;;_  > allout-institute-keymap (map)
 (defun allout-institute-keymap (map)
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index b23e826a0a..a280df20a5 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -1,6 +1,6 @@
 ;;; ansi-color.el --- translate ANSI escape sequences into faces -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Version: 3.4.2
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 66a594d588..6ff444f868 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -1,6 +1,6 @@
 ;;; apropos.el --- apropos commands for users and programmers  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1994-1995, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1989, 1994-1995, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Joe Wells <jbw@bigbird.bu.edu>
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 5576ae3505..4f0edbbfa9 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1,6 +1,6 @@
 ;;; arc-mode.el --- simple editing of archives  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 1997-1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1995, 1997-1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Morten Welinder <terra@gnu.org>
@@ -431,12 +431,8 @@ be added."
     ;; Let mouse-1 follow the link.
     (define-key map [follow-link] 'mouse-face)
 
-    (if (fboundp 'command-remapping)
-        (progn
-          (define-key map [remap advertised-undo] 'archive-undo)
-          (define-key map [remap undo] 'archive-undo))
-      (substitute-key-definition 'advertised-undo 'archive-undo map global-map)
-      (substitute-key-definition 'undo 'archive-undo map global-map))
+    (define-key map [remap advertised-undo] #'archive-undo)
+    (define-key map [remap undo] #'archive-undo)
 
     (define-key map [mouse-2] 'archive-extract)
 
@@ -621,12 +617,8 @@ OLDMODE will be modified accordingly just like chmod(2) 
would have done."
 
 (defun archive-unixdate (low high)
   "Stringify Unix (LOW HIGH) date."
-  (let* ((time (list high low))
-        (str (current-time-string time)))
-    (format "%s-%s-%s"
-           (substring str 8 10)
-           (substring str 4 7)
-           (format-time-string "%Y" time))))
+  (let ((system-time-locale "C"))
+    (format-time-string "%e-%b-%Y" (list high low))))
 
 (defun archive-unixtime (low high)
   "Stringify Unix (LOW HIGH) time."
diff --git a/lisp/array.el b/lisp/array.el
index 2c9a6815d2..31cf9cf302 100644
--- a/lisp/array.el
+++ b/lisp/array.el
@@ -1,6 +1,6 @@
 ;;; array.el --- array editing commands for GNU Emacs  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1987, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: David M. Brown
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 162a3ec23c..86e0b48a79 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -1,6 +1,6 @@
 ;;; auth-source-pass.el --- Integrate auth-source with password-store -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2015, 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <damien@cassou.me>,
 ;;         Nicolas Petton <nicolas@petton.fr>
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 3c1a6feaee..80c220561a 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -1,6 +1,6 @@
 ;;; auth-source.el --- authentication sources for Gnus and Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 ;; Keywords: news
@@ -45,6 +45,9 @@
 (require 'cl-lib)
 (require 'eieio)
 
+(declare-function gnutls-symmetric-decrypt "gnutls.c")
+(declare-function gnutls-ciphers "gnutls.c")
+
 (autoload 'secrets-create-item "secrets")
 (autoload 'secrets-delete-item "secrets")
 (autoload 'secrets-get-alias "secrets")
@@ -253,7 +256,7 @@ can get pretty complex."
                         (choice :tag "Authentication backend choice"
                                 (string :tag "Authentication Source (file)")
                                 (list
-                                 :tag "Secret Service API/KWallet/GNOME 
Keyring"
+                                 :tag "Secret Service API/KWallet/GNOME 
Keyring/KeyPassXC"
                                  (const :format "" :value :secrets)
                                  (choice :tag "Collection to use"
                                          (string :tag "Collection name")
diff --git a/lisp/autoarg.el b/lisp/autoarg.el
index b52a4305be..b0d6abe020 100644
--- a/lisp/autoarg.el
+++ b/lisp/autoarg.el
@@ -1,6 +1,6 @@
 ;;; autoarg.el --- make digit keys supply prefix args -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author:  Dave Love <fx@gnu.org>
 ;; Created: 1998-09-04
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index b448c0f8da..f60aa9be6f 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -1,6 +1,6 @@
 ;;; autoinsert.el --- automatic mode-dependent insertion of text into new 
files  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1994-1995, 1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1987, 1994-1995, 1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Charlie Martin <crm@cs.duke.edu>
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 5b1cd32247..97a122b7bc 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -1,6 +1,6 @@
 ;;; autorevert.el --- revert buffers when files on disk change  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: convenience
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 03707d1046..b53d84d2e8 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -1,6 +1,6 @@
 ;;; avoid.el --- make mouse pointer stay out of the way of editing  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: mouse
diff --git a/lisp/battery.el b/lisp/battery.el
index bf864c2bd4..45334163fa 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -1,6 +1,6 @@
 ;;; battery.el --- display battery status information  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <rs@ralph-schleicher.de>
 ;; Maintainer: emacs-devel@gnu.org
@@ -113,6 +113,10 @@ Value does not include \".\" or \"..\"."
                   (and (eq (call-process "pmset" nil t nil "-g" "ps") 0)
                        (not (bobp))))))
         #'battery-pmset)
+        ((and (eq system-type 'haiku)
+              ;; TODO: Support the Haiku APM battery driver.
+              (file-directory-p "/dev/power/acpi_battery"))
+         #'battery-haiku-acpi-battery)
        ((fboundp 'w32-battery-status)
         #'w32-battery-status))
   "Function for getting battery status information.
@@ -600,6 +604,103 @@ The following %-sequences are provided:
                      (_ "N/A"))))))
 
 
+;;; `/dev/power/acpi_battery' interface for Haiku.
+
+(defun battery--search-haiku-acpi-status ()
+  "Search forward for battery status in the current buffer.
+Return a property list once all relevant properties are found.
+The following properties may be inside the list:
+
+  - `:capacity' (the current capacity of the battery.)
+  - `:voltage' (the current voltage of the battery.)
+  - `:rate', (the current rate of charge or discharge.)
+  - `:state' (the current state of the battery.)
+  - `:design-capacity' (the design capacity of the battery.)
+  - `:design-voltage' (the design voltage of the battery.)
+  - `:last-full-charge' (the capacity at the last full charge of
+    the battery.)
+
+`:capacity' and `:design-capacity' are both represented in
+terms of milliamp-hours."
+  (let ((state-regexp "State \\([[:digit:]]+\\), Current Rate 
\\([[:digit:]]+\\), \
+Capacity \\([[:digit:]]+\\), Voltage \\([[:digit:]]+\\)")
+        (pu-regexp "Power Unit \\([[:digit:]]\\)+, Design Capacity 
\\([[:digit:]]+\\), \
+Last Full Charge \\([[:digit:]]+\\)")
+        (design-regexp "Design Voltage \\([[:digit:]]+\\)")
+        power-unit last-full-charge state rate capacity
+        voltage design-capacity design-voltage)
+    (when (re-search-forward state-regexp)
+      (setq state (string-to-number (match-string 1)))
+      (setq rate (string-to-number (match-string 2)))
+      (setq capacity (string-to-number (match-string 3)))
+      (setq voltage (/ (string-to-number (match-string 4)) 1000.0)))
+    (when (re-search-forward pu-regexp)
+      (setq power-unit (string-to-number (match-string 1)))
+      (setq design-capacity (string-to-number (match-string 2)))
+      (setq last-full-charge (string-to-number (match-string 3))))
+    (when (re-search-forward design-regexp)
+      (setq design-voltage (/ (string-to-number (match-string 1)) 1000.0)))
+    ;; Convert capacity fields to milliamp-hours if they're
+    ;; specified as miliwatt-hours.
+    (when (eq power-unit 0)
+      (setq capacity (/ capacity voltage))
+      (setq design-capacity (/ design-capacity design-voltage))
+      (setq last-full-charge (/ last-full-charge voltage)))
+    (list :capacity capacity :voltage voltage
+          :rate rate :state (cond
+                             ((not (zerop (logand state 2))) 'charging)
+                             ((not (zerop (logand state 1))) 'discharging)
+                             ((not (zerop (logand state 4))) 'critical)
+                             (t 'fully-charged))
+          :design-capacity design-capacity
+          :design-voltage design-voltage
+          :last-full-charge last-full-charge)))
+
+(defun battery-haiku-acpi-battery ()
+  "Get battery status from `/dev/power/acpi_battery'.
+This function only works on Haiku systems with an ACPI battery.
+
+The following %-sequences are provided:
+%c Current capacity (mAh)
+%r Current rate of charge or discharge
+%L AC line status (verbose)
+%B Battery status (verbose)
+%b Battery status: empty means high, `-' means low,
+   `!' means critical, and `+' means charging
+%p Battery load percentage"
+  (with-temp-buffer
+    (dolist (file (battery--files "/dev/power/acpi_battery"))
+      (insert-file-contents (expand-file-name file "/dev/power/acpi_battery")))
+    ;; I don't think Haiku actually supports multiple batteries yet,
+    ;; since the code in PowerStatus doesn't take care of that
+    ;; situation.
+    (let ((list (ignore-errors (battery--search-haiku-acpi-status))))
+      (if list
+          (list (cons ?c (format "%.0f" (plist-get list :capacity)))
+                (cons ?r (format "%.0f" (plist-get list :rate)))
+                (cons ?B (symbol-name (plist-get list :state)))
+                (cons ?b (let ((state (plist-get list :state)))
+                           (cond
+                            ((eq state 'charging) "+")
+                            ((and (eq state 'discharging)
+                                  (< (/ (plist-get list :capacity)
+                                        (plist-get list :last-full-charge))
+                                     0.15))
+                             "-")
+                            ((eq state 'critical) "!")
+                            (t ""))))
+                (cons ?L (if (not (eq (plist-get list :state) 'discharging))
+                             "on-line" "off-line"))
+                (cons ?p (format "%.0f"
+                                 (* 100 (/ (plist-get list :capacity)
+                                           (plist-get list 
:last-full-charge))))))
+        '((?c . "N/A")
+          (?r . "N/A")
+          (?B . "N/A")
+          (?b . "N/A")
+          (?p . "N/A"))))))
+
+
 ;;; UPower interface.
 
 (defconst battery-upower-interface "org.freedesktop.UPower"
diff --git a/lisp/bindings.el b/lisp/bindings.el
index ba3bf81b3e..86c0ea1a90 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1,6 +1,6 @@
 ;;; bindings.el --- define standard key bindings and some variables  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1987, 1992-1996, 1999-2021 Free Software
+;; Copyright (C) 1985-1987, 1992-1996, 1999-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -501,7 +501,7 @@ mouse-1: Display Line and Column Mode Menu"))
 
 (defvar mode-line-position
   `((:propertize
-     (" " mode-line-percent-position)
+     ("" mode-line-percent-position)
      local-map ,mode-line-column-line-number-mode-map
      display (min-width (5.0))
      mouse-face mode-line-highlight
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index f35cbc1a5e..0279d5ea83 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1,6 +1,6 @@
 ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <kfogel@red-bean.com>
 ;; Created: July, 1993
@@ -1155,7 +1155,7 @@ and then show any annotations for this bookmark."
   ;; FIXME: we used to only run bookmark-after-jump-hook in
   ;; `bookmark-jump' itself, but in none of the other commands.
   (when bookmark-set-fringe-mark
-    (let ((overlays (overlays-in (point) (point)))
+    (let ((overlays (overlays-in (point-at-bol) (1+ (point-at-bol))))
           temp found)
       (while (and (not found) (setq temp (pop overlays)))
         (when (eq 'bookmark (overlay-get temp 'category))
diff --git a/lisp/bs.el b/lisp/bs.el
index ccb06bbdba..cff19c81cb 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -1,6 +1,6 @@
 ;;; bs.el --- menu for selecting and displaying buffers -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 ;; Author: Olaf Sylvester <Olaf.Sylvester@netsurf.de>
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: convenience
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 1013a7c497..50c2c155ca 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -1,6 +1,6 @@
 ;;; buff-menu.el --- Interface for viewing and manipulating buffers -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1993-1995, 2000-2021 Free Software
+;; Copyright (C) 1985-1987, 1993-1995, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -116,43 +116,41 @@ as it is by default."
 This is set by the prefix argument to `buffer-menu' and related
 commands.")
 
-(defvar Buffer-menu-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map tabulated-list-mode-map)
-    (define-key map "v" 'Buffer-menu-select)
-    (define-key map "2" 'Buffer-menu-2-window)
-    (define-key map "1" 'Buffer-menu-1-window)
-    (define-key map "f" 'Buffer-menu-this-window)
-    (define-key map "e" 'Buffer-menu-this-window)
-    (define-key map "\C-m" 'Buffer-menu-this-window)
-    (define-key map "o" 'Buffer-menu-other-window)
-    (define-key map "\C-o" 'Buffer-menu-switch-other-window)
-    (define-key map "s" 'Buffer-menu-save)
-    (define-key map "d" 'Buffer-menu-delete)
-    (define-key map "k" 'Buffer-menu-delete)
-    (define-key map "\C-k" 'Buffer-menu-delete)
-    (define-key map "\C-d" 'Buffer-menu-delete-backwards)
-    (define-key map "x" 'Buffer-menu-execute)
-    (define-key map " " 'next-line)
-    (define-key map "\177" 'Buffer-menu-backup-unmark)
-    (define-key map "~" 'Buffer-menu-not-modified)
-    (define-key map "u" 'Buffer-menu-unmark)
-    (define-key map "\M-\177" 'Buffer-menu-unmark-all-buffers)
-    (define-key map "U" 'Buffer-menu-unmark-all)
-    (define-key map "m" 'Buffer-menu-mark)
-    (define-key map "t" 'Buffer-menu-visit-tags-table)
-    (define-key map "%" 'Buffer-menu-toggle-read-only)
-    (define-key map "b" 'Buffer-menu-bury)
-    (define-key map "V" 'Buffer-menu-view)
-    (define-key map "T" 'Buffer-menu-toggle-files-only)
-    (define-key map (kbd "M-s a C-s")   'Buffer-menu-isearch-buffers)
-    (define-key map (kbd "M-s a M-C-s") 'Buffer-menu-isearch-buffers-regexp)
-    (define-key map (kbd "M-s a C-o") 'Buffer-menu-multi-occur)
-
-    (define-key map [mouse-2] 'Buffer-menu-mouse-select)
-    (define-key map [follow-link] 'mouse-face)
-    map)
-  "Local keymap for `Buffer-menu-mode' buffers.")
+(defvar-keymap Buffer-menu-mode-map
+  :doc "Local keymap for `Buffer-menu-mode' buffers."
+  :parent tabulated-list-mode-map
+  "v"           #'Buffer-menu-select
+  "2"           #'Buffer-menu-2-window
+  "1"           #'Buffer-menu-1-window
+  "f"           #'Buffer-menu-this-window
+  "e"           #'Buffer-menu-this-window
+  "C-m"         #'Buffer-menu-this-window
+  "o"           #'Buffer-menu-other-window
+  "C-o"         #'Buffer-menu-switch-other-window
+  "s"           #'Buffer-menu-save
+  "d"           #'Buffer-menu-delete
+  "k"           #'Buffer-menu-delete
+  "C-k"         #'Buffer-menu-delete
+  "C-d"         #'Buffer-menu-delete-backwards
+  "x"           #'Buffer-menu-execute
+  "SPC"         #'next-line
+  "DEL"         #'Buffer-menu-backup-unmark
+  "~"           #'Buffer-menu-not-modified
+  "u"           #'Buffer-menu-unmark
+  "M-DEL"       #'Buffer-menu-unmark-all-buffers
+  "U"           #'Buffer-menu-unmark-all
+  "m"           #'Buffer-menu-mark
+  "t"           #'Buffer-menu-visit-tags-table
+  "%"           #'Buffer-menu-toggle-read-only
+  "b"           #'Buffer-menu-bury
+  "V"           #'Buffer-menu-view
+  "T"           #'Buffer-menu-toggle-files-only
+  "M-s a C-s"   #'Buffer-menu-isearch-buffers
+  "M-s a C-M-s" #'Buffer-menu-isearch-buffers-regexp
+  "M-s a C-o"   #'Buffer-menu-multi-occur
+
+  "<mouse-2>"     #'Buffer-menu-mouse-select
+  "<follow-link>" 'mouse-face)
 
 (easy-menu-define Buffer-menu-mode-menu Buffer-menu-mode-map
   "Menu for `Buffer-menu-mode' buffers."
diff --git a/lisp/button.el b/lisp/button.el
index dd5a71d116..8a7751d00d 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -1,6 +1,6 @@
 ;;; button.el --- clickable buttons -*- lexical-binding: t -*-
 ;;
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: extensions, hypermedia
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 52c024865a..ef3e0d4b67 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -1,6 +1,6 @@
 ;;; calc-aent.el --- algebraic entry functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el
index 162026d092..93ff5ee240 100644
--- a/lisp/calc/calc-alg.el
+++ b/lisp/calc/calc-alg.el
@@ -1,6 +1,6 @@
 ;;; calc-alg.el --- algebraic functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el
index 9787fe0d60..025c1ab7f3 100644
--- a/lisp/calc/calc-arith.el
+++ b/lisp/calc/calc-arith.el
@@ -1,6 +1,6 @@
 ;;; calc-arith.el --- arithmetic functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el
index a1f4ca43e7..6c6b22296a 100644
--- a/lisp/calc/calc-bin.el
+++ b/lisp/calc/calc-bin.el
@@ -1,6 +1,6 @@
 ;;; calc-bin.el --- binary functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el
index dc95221350..c1352fa324 100644
--- a/lisp/calc/calc-comb.el
+++ b/lisp/calc/calc-comb.el
@@ -1,6 +1,6 @@
 ;;; calc-comb.el --- combinatoric functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-cplx.el b/lisp/calc/calc-cplx.el
index 03462020ea..a084afde18 100644
--- a/lisp/calc/calc-cplx.el
+++ b/lisp/calc/calc-cplx.el
@@ -1,6 +1,6 @@
 ;;; calc-cplx.el --- Complex number functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-embed.el b/lisp/calc/calc-embed.el
index 7455140477..9a580d9602 100644
--- a/lisp/calc/calc-embed.el
+++ b/lisp/calc/calc-embed.el
@@ -1,6 +1,6 @@
 ;;; calc-embed.el --- embed Calc in a buffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 93ba8c4b6b..7ee73d100a 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -1,6 +1,6 @@
 ;;; calc-ext.el --- various extension functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-fin.el b/lisp/calc/calc-fin.el
index 76bb53e7b1..1ff6914ebd 100644
--- a/lisp/calc/calc-fin.el
+++ b/lisp/calc/calc-fin.el
@@ -1,6 +1,6 @@
 ;;; calc-fin.el --- financial functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index ce8e3579f4..8f5104e9dc 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -1,6 +1,6 @@
 ;;; calc-forms.el --- data format conversion functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-frac.el b/lisp/calc/calc-frac.el
index bf3c16816d..0a2ad52cd6 100644
--- a/lisp/calc/calc-frac.el
+++ b/lisp/calc/calc-frac.el
@@ -1,6 +1,6 @@
 ;;; calc-frac.el --- fraction functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-funcs.el b/lisp/calc/calc-funcs.el
index 053fa2e585..23d33b38a7 100644
--- a/lisp/calc/calc-funcs.el
+++ b/lisp/calc/calc-funcs.el
@@ -1,6 +1,6 @@
 ;;; calc-funcs.el --- well-known functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index b6ee124a72..a95967bef4 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -1,6 +1,6 @@
 ;;; calc-graph.el --- graph output functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index 2633d64fe4..a513a7de0c 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -1,6 +1,6 @@
 ;;; calc-help.el --- help display functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-incom.el b/lisp/calc/calc-incom.el
index e27d65092e..5ef3b22470 100644
--- a/lisp/calc/calc-incom.el
+++ b/lisp/calc/calc-incom.el
@@ -1,6 +1,6 @@
 ;;; calc-incom.el --- complex data type input functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-keypd.el b/lisp/calc/calc-keypd.el
index acbef27a1d..6144ee1c08 100644
--- a/lisp/calc/calc-keypd.el
+++ b/lisp/calc/calc-keypd.el
@@ -1,6 +1,6 @@
 ;;; calc-keypd.el --- mouse-capable keypad input for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index aef3173f5c..5c36dd30b9 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -1,6 +1,6 @@
 ;;; calc-lang.el --- calc language functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-macs.el b/lisp/calc/calc-macs.el
index 63258cde50..0d27b627f2 100644
--- a/lisp/calc/calc-macs.el
+++ b/lisp/calc/calc-macs.el
@@ -1,6 +1,6 @@
 ;;; calc-macs.el --- important macros for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el
index d12d05f305..638a4cdbe8 100644
--- a/lisp/calc/calc-map.el
+++ b/lisp/calc/calc-map.el
@@ -1,6 +1,6 @@
 ;;; calc-map.el --- higher-order functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-math.el b/lisp/calc/calc-math.el
index ba2b6b2ca9..40236e452c 100644
--- a/lisp/calc/calc-math.el
+++ b/lisp/calc/calc-math.el
@@ -1,6 +1,6 @@
 ;;; calc-math.el --- mathematical functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-menu.el b/lisp/calc/calc-menu.el
index eed20a89a4..9d69e44771 100644
--- a/lisp/calc/calc-menu.el
+++ b/lisp/calc/calc-menu.el
@@ -1,6 +1,6 @@
 ;;; calc-menu.el --- a menu for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el
index 1c4438e7f7..bd1635f2bf 100644
--- a/lisp/calc/calc-misc.el
+++ b/lisp/calc/calc-misc.el
@@ -1,6 +1,6 @@
 ;;; calc-misc.el --- miscellaneous functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el
index 211b8e661f..5690f10118 100644
--- a/lisp/calc/calc-mode.el
+++ b/lisp/calc/calc-mode.el
@@ -1,6 +1,6 @@
 ;;; calc-mode.el --- calculator modes for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-mtx.el b/lisp/calc/calc-mtx.el
index 9a08b8cb76..d54efb6637 100644
--- a/lisp/calc/calc-mtx.el
+++ b/lisp/calc/calc-mtx.el
@@ -1,6 +1,6 @@
 ;;; calc-mtx.el --- matrix functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-nlfit.el b/lisp/calc/calc-nlfit.el
index f676b098e5..2b2abc3fdb 100644
--- a/lisp/calc/calc-nlfit.el
+++ b/lisp/calc/calc-nlfit.el
@@ -1,6 +1,6 @@
 ;;; calc-nlfit.el --- nonlinear curve fitting for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el
index 5d74a8f106..3e98b0532f 100644
--- a/lisp/calc/calc-poly.el
+++ b/lisp/calc/calc-poly.el
@@ -1,6 +1,6 @@
 ;;; calc-poly.el --- polynomial functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el
index b381f8afcf..dc2a086bbd 100644
--- a/lisp/calc/calc-prog.el
+++ b/lisp/calc/calc-prog.el
@@ -1,6 +1,6 @@
 ;;; calc-prog.el --- user programmability functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-rewr.el b/lisp/calc/calc-rewr.el
index e3d4852a72..5da91b49c8 100644
--- a/lisp/calc/calc-rewr.el
+++ b/lisp/calc/calc-rewr.el
@@ -1,6 +1,6 @@
 ;;; calc-rewr.el --- rewriting functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-rules.el b/lisp/calc/calc-rules.el
index 00080b6989..96264bf18f 100644
--- a/lisp/calc/calc-rules.el
+++ b/lisp/calc/calc-rules.el
@@ -1,6 +1,6 @@
 ;;; calc-rules.el --- rules for simplifying algebraic expressions in Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-sel.el b/lisp/calc/calc-sel.el
index 18fd483baf..64f8007e52 100644
--- a/lisp/calc/calc-sel.el
+++ b/lisp/calc/calc-sel.el
@@ -1,6 +1,6 @@
 ;;; calc-sel.el --- data selection functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-stat.el b/lisp/calc/calc-stat.el
index 3cf9bec834..a7fe36001f 100644
--- a/lisp/calc/calc-stat.el
+++ b/lisp/calc/calc-stat.el
@@ -1,6 +1,6 @@
 ;;; calc-stat.el --- statistical functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el
index 817b50951d..023dd40c15 100644
--- a/lisp/calc/calc-store.el
+++ b/lisp/calc/calc-store.el
@@ -1,6 +1,6 @@
 ;;; calc-store.el --- value storage functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-stuff.el b/lisp/calc/calc-stuff.el
index 9281666c3b..0e8ea42bed 100644
--- a/lisp/calc/calc-stuff.el
+++ b/lisp/calc/calc-stuff.el
@@ -1,6 +1,6 @@
 ;;; calc-stuff.el --- miscellaneous functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-trail.el b/lisp/calc/calc-trail.el
index 2cf5160d5d..d8c6eb615f 100644
--- a/lisp/calc/calc-trail.el
+++ b/lisp/calc/calc-trail.el
@@ -1,6 +1,6 @@
 ;;; calc-trail.el --- functions for manipulating the Calc "trail"  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-undo.el b/lisp/calc/calc-undo.el
index 4add99a250..9ff5d4dfbb 100644
--- a/lisp/calc/calc-undo.el
+++ b/lisp/calc/calc-undo.el
@@ -1,6 +1,6 @@
 ;;; calc-undo.el --- undo functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index f6d749db11..c8405c7d1a 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -1,6 +1,6 @@
 ;;; calc-units.el --- unit conversion functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index 73783dd2c2..3b8629b797 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -1,6 +1,6 @@
 ;;; calc-vec.el --- vector functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index 762adbd407..8c6d3f51e5 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -1,6 +1,6 @@
 ;;; calc-yank.el --- kill-ring functionality for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 9774ddff40..3b1cf248fd 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1,6 +1,6 @@
 ;;; calc.el --- the GNU Emacs calculator  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Keywords: convenience, extensions
@@ -1423,7 +1423,7 @@ commands given here will actually operate on the 
*Calculator* stack."
     (require 'calc-ext)
     (calc-set-language calc-language calc-language-option t)))
 
-(defcustom calc-make-windows-dedicated t
+(defcustom calc-make-windows-dedicated nil
   "If non-nil, windows displaying Calc buffers will be marked dedicated.
 See `window-dedicated-p' for what that means."
   :version "28.1"
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el
index 8d93ae987a..0f3f37de76 100644
--- a/lisp/calc/calcalg2.el
+++ b/lisp/calc/calcalg2.el
@@ -1,6 +1,6 @@
 ;;; calcalg2.el --- more algebraic functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calcalg3.el b/lisp/calc/calcalg3.el
index a61cdb5d0e..1d85f3d549 100644
--- a/lisp/calc/calcalg3.el
+++ b/lisp/calc/calcalg3.el
@@ -1,6 +1,6 @@
 ;;; calcalg3.el --- more algebraic functions for Calc  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el
index bd81d7fe40..60b25e6441 100644
--- a/lisp/calc/calccomp.el
+++ b/lisp/calc/calccomp.el
@@ -1,6 +1,6 @@
 ;;; calccomp.el --- composition functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calc/calcsel2.el b/lisp/calc/calcsel2.el
index 9c2ac975f0..317a628c6d 100644
--- a/lisp/calc/calcsel2.el
+++ b/lisp/calc/calcsel2.el
@@ -1,6 +1,6 @@
 ;;; calcsel2.el --- selection functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 
diff --git a/lisp/calculator.el b/lisp/calculator.el
index 0c255c0cf9..a80437d6ec 100644
--- a/lisp/calculator.el
+++ b/lisp/calculator.el
@@ -1,6 +1,6 @@
 ;;; calculator.el --- a calculator for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Barzilay <eli@barzilay.org>
 ;; Keywords: tools, convenience
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index f523863440..ebdafb438e 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -1,6 +1,6 @@
 ;;; appt.el --- appointment notification functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1989-1990, 1994, 1998, 2001-2021 Free Software
+;; Copyright (C) 1989-1990, 1994, 1998, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Neil Mager <neilm@juliet.ll.mit.edu>
diff --git a/lisp/calendar/cal-bahai.el b/lisp/calendar/cal-bahai.el
index 350b7e51cb..74ce36d21e 100644
--- a/lisp/calendar/cal-bahai.el
+++ b/lisp/calendar/cal-bahai.el
@@ -1,6 +1,6 @@
 ;;; cal-bahai.el --- calendar functions for the Bahá’í calendar.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: calendar
diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el
index 9a28984a7a..c7f7be0dce 100644
--- a/lisp/calendar/cal-china.el
+++ b/lisp/calendar/cal-china.el
@@ -1,6 +1,6 @@
 ;;; cal-china.el --- calendar functions for the Chinese calendar  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-coptic.el b/lisp/calendar/cal-coptic.el
index 11785c48f1..4c6aa2a941 100644
--- a/lisp/calendar/cal-coptic.el
+++ b/lisp/calendar/cal-coptic.el
@@ -1,6 +1,6 @@
 ;;; cal-coptic.el --- calendar functions for the Coptic/Ethiopic calendars  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index 29864110a3..5f601f24d2 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -1,6 +1,6 @@
 ;;; cal-dst.el --- calendar functions for daylight saving rules  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Paul Eggert <eggert@cs.ucla.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/cal-french.el b/lisp/calendar/cal-french.el
index 1789f16445..d70db8de0c 100644
--- a/lisp/calendar/cal-french.el
+++ b/lisp/calendar/cal-french.el
@@ -1,6 +1,6 @@
 ;;; cal-french.el --- calendar functions for the French Revolutionary calendar 
 -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1988-1989, 1992, 1994-1995, 1997, 2001-2021 Free
+;; Copyright (C) 1988-1989, 1992, 1994-1995, 1997, 2001-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el
index 50b4fc363b..61ce029e07 100644
--- a/lisp/calendar/cal-hebrew.el
+++ b/lisp/calendar/cal-hebrew.el
@@ -1,6 +1,6 @@
 ;;; cal-hebrew.el --- calendar functions for the Hebrew calendar  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Nachum Dershowitz <nachum@cs.uiuc.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/cal-html.el b/lisp/calendar/cal-html.el
index 58a5a0f83a..b1c829af48 100644
--- a/lisp/calendar/cal-html.el
+++ b/lisp/calendar/cal-html.el
@@ -1,6 +1,6 @@
 ;;; cal-html.el --- functions for printing HTML calendars  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Anna M. Bigatti <bigatti@dima.unige.it>
 ;; Keywords: calendar
diff --git a/lisp/calendar/cal-islam.el b/lisp/calendar/cal-islam.el
index 45c6ffa7bd..c6afb27b44 100644
--- a/lisp/calendar/cal-islam.el
+++ b/lisp/calendar/cal-islam.el
@@ -1,6 +1,6 @@
 ;;; cal-islam.el --- calendar functions for the Islamic calendar  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-iso.el b/lisp/calendar/cal-iso.el
index 90f57c25e9..880dd539aa 100644
--- a/lisp/calendar/cal-iso.el
+++ b/lisp/calendar/cal-iso.el
@@ -1,6 +1,6 @@
 ;;; cal-iso.el --- calendar functions for the ISO calendar  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-julian.el b/lisp/calendar/cal-julian.el
index 47880a4e97..e614d3a1f6 100644
--- a/lisp/calendar/cal-julian.el
+++ b/lisp/calendar/cal-julian.el
@@ -1,6 +1,6 @@
 ;;; cal-julian.el --- calendar functions for the Julian calendar  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-mayan.el b/lisp/calendar/cal-mayan.el
index 9a22192113..c1f235ae76 100644
--- a/lisp/calendar/cal-mayan.el
+++ b/lisp/calendar/cal-mayan.el
@@ -1,6 +1,6 @@
 ;;; cal-mayan.el --- calendar functions for the Mayan calendars  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992-1993, 1995, 1997, 2001-2021 Free Software
+;; Copyright (C) 1992-1993, 1995, 1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Stewart M. Clamen <clamen@cs.cmu.edu>
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el
index ef84bfadd3..d66d82d6f4 100644
--- a/lisp/calendar/cal-menu.el
+++ b/lisp/calendar/cal-menu.el
@@ -1,6 +1,6 @@
 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;;         Lara Rios <lrios@coewl.cen.uiuc.edu>
diff --git a/lisp/calendar/cal-move.el b/lisp/calendar/cal-move.el
index 9294362cb4..4febad53fc 100644
--- a/lisp/calendar/cal-move.el
+++ b/lisp/calendar/cal-move.el
@@ -1,6 +1,6 @@
 ;;; cal-move.el --- calendar functions for movement in the calendar  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-persia.el b/lisp/calendar/cal-persia.el
index dd005e8660..f38eb8779a 100644
--- a/lisp/calendar/cal-persia.el
+++ b/lisp/calendar/cal-persia.el
@@ -1,6 +1,6 @@
 ;;; cal-persia.el --- calendar functions for the Persian calendar  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index c5b456c4c2..4458fd6d6c 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -1,6 +1,6 @@
 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Steve Fisk <fisk@bowdoin.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/cal-x.el b/lisp/calendar/cal-x.el
index ca303ce39a..bbc8f27394 100644
--- a/lisp/calendar/cal-x.el
+++ b/lisp/calendar/cal-x.el
@@ -1,6 +1,6 @@
 ;;; cal-x.el --- calendar windows in dedicated frames  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index e06239a5c8..48d308afad 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1,6 +1,6 @@
 ;;; calendar.el --- calendar functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988-1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1988-1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 2eb7977a16..45df0c6259 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1,6 +1,6 @@
 ;;; diary-lib.el --- diary functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1989-1990, 1992-1995, 2001-2021 Free Software
+;; Copyright (C) 1989-1990, 1992-1995, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index bda5dc5a6b..2afa667a56 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -1,6 +1,6 @@
 ;;; holidays.el --- holiday functions for the calendar package  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2021 Free Software
+;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 01387341d6..1a5a071e20 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -1,6 +1,6 @@
 ;;; icalendar.el --- iCalendar implementation -*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author:         Ulf Jasper <ulf.jasper@web.de>
 ;; Created:        August 2002
@@ -645,10 +645,10 @@ FIXME: multiple comma-separated values should be allowed!"
           (setq second (read (substring isodatetimestring 13 15))))
        ;; FIXME: Support subseconds.
         (when (> (length isodatetimestring) 15)
-          (pcase (aref isodatetimestring 15)
+         (pcase (aref isodatetimestring 15)
             (?Z
              (setq source-zone t))
-            ((or ?- ?+)
+           ((or ?- ?+)
              (setq source-zone
                    (concat "UTC" (substring isodatetimestring 15))))))
         ;; shift if necessary
diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el
index 1de1796a05..e31120f52f 100644
--- a/lisp/calendar/iso8601.el
+++ b/lisp/calendar/iso8601.el
@@ -1,6 +1,6 @@
 ;;; iso8601.el --- parse ISO 8601 date/time strings  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Keywords: dates
 
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index dd1d923f42..751bfa1cc8 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -1,6 +1,6 @@
 ;;; lunar.el --- calendar functions for phases of the moon  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-1993, 1995, 1997, 2001-2021 Free Software
+;; Copyright (C) 1992-1993, 1995, 1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 5a3d2706af..f3ad513925 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -1,6 +1,6 @@
 ;;; parse-time.el --- parsing time strings -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Erik Naggum <erik@naggum.no>
 ;; Keywords: util
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el
index b5f2f454ae..8f501824bb 100644
--- a/lisp/calendar/solar.el
+++ b/lisp/calendar/solar.el
@@ -1,6 +1,6 @@
 ;;; solar.el --- calendar functions for solar events  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-1993, 1995, 1997, 2001-2021 Free Software
+;; Copyright (C) 1992-1993, 1995, 1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index b36171259c..51cf7eb213 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -1,6 +1,6 @@
 ;;; time-date.el --- Date and time handling functions  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu Umeda <umerin@mse.kyutech.ac.jp>
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 0b94bcb77f..1c6a557a0d 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -1,6 +1,6 @@
 ;;; timeclock.el --- mode for keeping track of how much you work  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Created: 25 Mar 1999
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 51a2751132..57fcd1b17e 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1,6 +1,6 @@
 ;;; todo-mode.el --- facilities for making and maintaining todo lists  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <privat@os10000.net>
 ;;     Stephen Berman <stephen.berman@gmx.net>
diff --git a/lisp/case-table.el b/lisp/case-table.el
index 457e026f91..f6f6851dd3 100644
--- a/lisp/case-table.el
+++ b/lisp/case-table.el
@@ -1,6 +1,6 @@
 ;;; case-table.el --- code to extend the character set and support case tables 
 -*- lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/cdl.el b/lisp/cdl.el
index 0f181ac6d4..81d64b10f6 100644
--- a/lisp/cdl.el
+++ b/lisp/cdl.el
@@ -1,6 +1,6 @@
 ;;; cdl.el --- Common Data Language (CDL) utility functions for GNU Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ata Etemadi <ATAE@spva.physics.imperial.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/cedet/ChangeLog.1 b/lisp/cedet/ChangeLog.1
index 0fe55739ef..aa54bdd9b0 100644
--- a/lisp/cedet/ChangeLog.1
+++ b/lisp/cedet/ChangeLog.1
@@ -3460,7 +3460,7 @@
 ;; coding: utf-8
 ;; End:
 
-       Copyright (C) 2009-2021 Free Software Foundation, Inc.
+       Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/cedet-cscope.el b/lisp/cedet/cedet-cscope.el
index 6ffc2765d6..454005f864 100644
--- a/lisp/cedet/cedet-cscope.el
+++ b/lisp/cedet/cedet-cscope.el
@@ -1,6 +1,6 @@
 ;;; cedet-cscope.el --- CScope support for CEDET  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Package: cedet
diff --git a/lisp/cedet/cedet-files.el b/lisp/cedet/cedet-files.el
index f540fb5540..19a6d3935e 100644
--- a/lisp/cedet/cedet-files.el
+++ b/lisp/cedet/cedet-files.el
@@ -1,6 +1,6 @@
 ;;; cedet-files.el --- Common routines dealing with file names.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Package: cedet
diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el
index 227ebd54b8..6a147bf430 100644
--- a/lisp/cedet/cedet-global.el
+++ b/lisp/cedet/cedet-global.el
@@ -1,6 +1,6 @@
 ;;; cedet-global.el --- GNU Global support for CEDET.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Package: cedet
diff --git a/lisp/cedet/cedet-idutils.el b/lisp/cedet/cedet-idutils.el
index a2b8cb3524..5c500f7e06 100644
--- a/lisp/cedet/cedet-idutils.el
+++ b/lisp/cedet/cedet-idutils.el
@@ -1,6 +1,6 @@
 ;;; cedet-idutils.el --- ID Utils support for CEDET.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Old-Version: 0.2
diff --git a/lisp/cedet/cedet.el b/lisp/cedet/cedet.el
index b6043f1403..e6befb10e9 100644
--- a/lisp/cedet/cedet.el
+++ b/lisp/cedet/cedet.el
@@ -1,6 +1,6 @@
 ;;; cedet.el --- Setup CEDET environment  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Maintainer: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el
index d8d1364491..0edc853edd 100644
--- a/lisp/cedet/data-debug.el
+++ b/lisp/cedet/data-debug.el
@@ -1,6 +1,6 @@
 ;;; data-debug.el --- Data structure debugger  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Old-Version: 0.2
diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el
index 2ec9f5d9d6..4ea14e33c5 100644
--- a/lisp/cedet/ede.el
+++ b/lisp/cedet/ede.el
@@ -1,6 +1,6 @@
 ;;; ede.el --- Emacs Development Environment gloss  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el
index da6a3f3e90..7af9987de1 100644
--- a/lisp/cedet/ede/auto.el
+++ b/lisp/cedet/ede/auto.el
@@ -1,6 +1,6 @@
 ;;; ede/auto.el --- Autoload features for EDE  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/autoconf-edit.el b/lisp/cedet/ede/autoconf-edit.el
index d6f0a86f9a..faf50edaa1 100644
--- a/lisp/cedet/ede/autoconf-edit.el
+++ b/lisp/cedet/ede/autoconf-edit.el
@@ -1,6 +1,6 @@
 ;;; ede/autoconf-edit.el --- Keymap for autoconf  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2000, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2000, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 004da6b95d..9d23909d62 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -1,6 +1,6 @@
 ;;; ede/base.el --- Baseclasses for EDE  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/config.el b/lisp/cedet/ede/config.el
index 98a0419e8b..529b96f2b0 100644
--- a/lisp/cedet/ede/config.el
+++ b/lisp/cedet/ede/config.el
@@ -1,6 +1,6 @@
 ;;; ede/config.el --- Configuration Handler baseclass  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index fd37e53ed4..fe81a4c87d 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -1,6 +1,6 @@
 ;;; ede/cpp-root.el --- A simple way to wrap a C++ project with a single root  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/custom.el b/lisp/cedet/ede/custom.el
index ac4f9f6684..2d4f408e96 100644
--- a/lisp/cedet/ede/custom.el
+++ b/lisp/cedet/ede/custom.el
@@ -1,6 +1,6 @@
 ;;; ede/custom.el --- customization of EDE projects.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el
index c933fc4515..609103566a 100644
--- a/lisp/cedet/ede/detect.el
+++ b/lisp/cedet/ede/detect.el
@@ -1,6 +1,6 @@
 ;;; ede/detect.el --- EDE project detection and file associations  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/dired.el b/lisp/cedet/ede/dired.el
index 27735176c2..dc987b2d5d 100644
--- a/lisp/cedet/ede/dired.el
+++ b/lisp/cedet/ede/dired.el
@@ -1,6 +1,6 @@
 ;;; ede/dired.el --- EDE extensions to dired.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998-2000, 2003, 2009-2021 Free Software Foundation,
+;; Copyright (C) 1998-2000, 2003, 2009-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el
index 00496ace16..5a23f504f7 100644
--- a/lisp/cedet/ede/emacs.el
+++ b/lisp/cedet/ede/emacs.el
@@ -1,6 +1,6 @@
 ;;; ede/emacs.el --- Special project for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el
index 6b7e159564..3b9002a6e3 100644
--- a/lisp/cedet/ede/files.el
+++ b/lisp/cedet/ede/files.el
@@ -1,6 +1,6 @@
 ;;; ede/files.el --- Associate projects with files and directories.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el
index 4537f59ac9..de94808666 100644
--- a/lisp/cedet/ede/generic.el
+++ b/lisp/cedet/ede/generic.el
@@ -1,6 +1,6 @@
 ;;; ede/generic.el --- Base Support for generic build systems  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/linux.el b/lisp/cedet/ede/linux.el
index 4b5530d6ac..718eaabb7a 100644
--- a/lisp/cedet/ede/linux.el
+++ b/lisp/cedet/ede/linux.el
@@ -1,6 +1,6 @@
 ;;; ede/linux.el --- Special project for Linux  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/locate.el b/lisp/cedet/ede/locate.el
index 016092cd8b..b9b1194ccc 100644
--- a/lisp/cedet/ede/locate.el
+++ b/lisp/cedet/ede/locate.el
@@ -1,6 +1,6 @@
 ;;; ede/locate.el --- Locate support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el
index 3402020fc4..5db78a1afb 100644
--- a/lisp/cedet/ede/make.el
+++ b/lisp/cedet/ede/make.el
@@ -1,6 +1,6 @@
 ;;; ede/make.el --- General information about "make"  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2009-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/makefile-edit.el b/lisp/cedet/ede/makefile-edit.el
index 709963d6fa..1b424bc6d0 100644
--- a/lisp/cedet/ede/makefile-edit.el
+++ b/lisp/cedet/ede/makefile-edit.el
@@ -1,6 +1,6 @@
 ;;; makefile-edit.el --- Makefile editing/scanning commands.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el
index c5b2ea4cb6..d747326a3a 100644
--- a/lisp/cedet/ede/pconf.el
+++ b/lisp/cedet/ede/pconf.el
@@ -1,6 +1,6 @@
 ;;; ede/pconf.el --- configure.ac maintenance for EDE  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1998-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project
diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el
index fd6918c4e8..9a913109f0 100644
--- a/lisp/cedet/ede/pmake.el
+++ b/lisp/cedet/ede/pmake.el
@@ -1,6 +1,6 @@
 ;;; ede-pmake.el --- EDE Generic Project Makefile code generator  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-archive.el b/lisp/cedet/ede/proj-archive.el
index 9da6374d09..5de46a4912 100644
--- a/lisp/cedet/ede/proj-archive.el
+++ b/lisp/cedet/ede/proj-archive.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-archive.el --- EDE Generic Project archive support  -*- 
lexical-binding: t -*-
 
-;;  Copyright (C) 1998-2001, 2009-2021 Free Software Foundation, Inc.
+;;  Copyright (C) 1998-2001, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-aux.el b/lisp/cedet/ede/proj-aux.el
index 73259558a6..73808da092 100644
--- a/lisp/cedet/ede/proj-aux.el
+++ b/lisp/cedet/ede/proj-aux.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-aux.el --- EDE Generic Project auxiliary file support  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2000, 2007, 2009-2021 Free Software Foundation,
+;; Copyright (C) 1998-2000, 2007, 2009-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/ede/proj-comp.el b/lisp/cedet/ede/proj-comp.el
index 0d797aa5fb..ec676ac04b 100644
--- a/lisp/cedet/ede/proj-comp.el
+++ b/lisp/cedet/ede/proj-comp.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-comp.el --- EDE Generic Project compiler/rule driver  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2001, 2004-2005, 2007, 2009-2021 Free Software
+;; Copyright (C) 1999-2001, 2004-2005, 2007, 2009-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/ede/proj-elisp.el b/lisp/cedet/ede/proj-elisp.el
index 7a3b36f30f..0c65af15c4 100644
--- a/lisp/cedet/ede/proj-elisp.el
+++ b/lisp/cedet/ede/proj-elisp.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-elisp.el --- EDE Generic Project Emacs Lisp support  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-info.el b/lisp/cedet/ede/proj-info.el
index dbb86edb21..299b45967a 100644
--- a/lisp/cedet/ede/proj-info.el
+++ b/lisp/cedet/ede/proj-info.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-info.el --- EDE Generic Project texinfo support  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-misc.el b/lisp/cedet/ede/proj-misc.el
index 068e998d1a..80cbe53475 100644
--- a/lisp/cedet/ede/proj-misc.el
+++ b/lisp/cedet/ede/proj-misc.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-misc.el --- EDE Generic Project Emacs Lisp support  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2001, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2001, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-obj.el b/lisp/cedet/ede/proj-obj.el
index 1b96376d3e..852bbd643a 100644
--- a/lisp/cedet/ede/proj-obj.el
+++ b/lisp/cedet/ede/proj-obj.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-obj.el --- EDE Generic Project Object code generation support  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-prog.el b/lisp/cedet/ede/proj-prog.el
index 87b2ff7a55..fab1de81a0 100644
--- a/lisp/cedet/ede/proj-prog.el
+++ b/lisp/cedet/ede/proj-prog.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-prog.el --- EDE Generic Project program support  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2001, 2005, 2008-2021 Free Software Foundation,
+;; Copyright (C) 1998-2001, 2005, 2008-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/ede/proj-scheme.el b/lisp/cedet/ede/proj-scheme.el
index b0e287895f..7b3df3ca00 100644
--- a/lisp/cedet/ede/proj-scheme.el
+++ b/lisp/cedet/ede/proj-scheme.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-scheme.el --- EDE Generic Project scheme (guile) support  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2000, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2000, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make, scheme
diff --git a/lisp/cedet/ede/proj-shared.el b/lisp/cedet/ede/proj-shared.el
index 01f19bc657..84bb7f2f3c 100644
--- a/lisp/cedet/ede/proj-shared.el
+++ b/lisp/cedet/ede/proj-shared.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-shared.el --- EDE Generic Project shared library support  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el
index 1352e5c193..7a486754a0 100644
--- a/lisp/cedet/ede/proj.el
+++ b/lisp/cedet/ede/proj.el
@@ -1,6 +1,6 @@
 ;;; ede/proj.el --- EDE Generic Project file driver  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1998-2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el
index e7f5640c07..2803e1c307 100644
--- a/lisp/cedet/ede/project-am.el
+++ b/lisp/cedet/ede/project-am.el
@@ -1,6 +1,6 @@
 ;;; project-am.el --- A project management scheme based on automake files.  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2000, 2003, 2005, 2007-2021 Free Software
+;; Copyright (C) 1998-2000, 2003, 2005, 2007-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/ede/shell.el b/lisp/cedet/ede/shell.el
index 371b04f9d2..fcf7294215 100644
--- a/lisp/cedet/ede/shell.el
+++ b/lisp/cedet/ede/shell.el
@@ -1,6 +1,6 @@
 ;;; ede/shell.el --- A shell controlled by EDE.  -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/simple.el b/lisp/cedet/ede/simple.el
index aaeb3f713c..83b99d9658 100644
--- a/lisp/cedet/ede/simple.el
+++ b/lisp/cedet/ede/simple.el
@@ -1,6 +1,6 @@
 ;;; ede/simple.el --- Overlay an EDE structure on an existing project  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/source.el b/lisp/cedet/ede/source.el
index 338b03d25d..e4c8b3cee2 100644
--- a/lisp/cedet/ede/source.el
+++ b/lisp/cedet/ede/source.el
@@ -1,6 +1,6 @@
 ;; ede/source.el --- EDE source code object  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/speedbar.el b/lisp/cedet/ede/speedbar.el
index b321cb637b..f99a1d114b 100644
--- a/lisp/cedet/ede/speedbar.el
+++ b/lisp/cedet/ede/speedbar.el
@@ -1,6 +1,6 @@
 ;;; ede/speedbar.el --- Speedbar viewing of EDE projects  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1998-2001, 2003, 2005, 2007-2021 Free Software
+;; Copyright (C) 1998-2001, 2003, 2005, 2007-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/ede/srecode.el b/lisp/cedet/ede/srecode.el
index dd009bfb31..0aab5b3e6b 100644
--- a/lisp/cedet/ede/srecode.el
+++ b/lisp/cedet/ede/srecode.el
@@ -1,6 +1,6 @@
 ;;; ede/srecode.el --- EDE utilities on top of SRecoder  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/ede/system.el b/lisp/cedet/ede/system.el
index 1300ba9011..2da16b37d7 100644
--- a/lisp/cedet/ede/system.el
+++ b/lisp/cedet/ede/system.el
@@ -1,6 +1,6 @@
 ;;; ede-system.el --- EDE working with the system (VC, FTP, ETC)  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2003, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2003, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make, vc
diff --git a/lisp/cedet/ede/util.el b/lisp/cedet/ede/util.el
index 2b2402c642..2a7aecc8bc 100644
--- a/lisp/cedet/ede/util.el
+++ b/lisp/cedet/ede/util.el
@@ -1,6 +1,6 @@
 ;;; ede/util.el --- EDE utilities  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000, 2005, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2005, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index e0717fbfe5..b1a4fe4d54 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -1,6 +1,6 @@
 ;;; mode-local.el --- Support for mode local facilities  -*- lexical-binding:t 
-*-
 ;;
-;; Copyright (C) 2004-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2005, 2007-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 27 Apr 2004
diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index b026944029..f7af10887c 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -1,6 +1,6 @@
 ;;; pulse.el --- Pulsing Overlays  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 1.0
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 205d6a812a..dc6751db6c 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -1,6 +1,6 @@
 ;;; semantic.el --- Semantic buffer evaluator.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax tools
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index 1a4be11c78..4c60136ca3 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze.el --- Analyze semantic tags against local context  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/analyze/complete.el 
b/lisp/cedet/semantic/analyze/complete.el
index 5c3228ae16..66ce4ff892 100644
--- a/lisp/cedet/semantic/analyze/complete.el
+++ b/lisp/cedet/semantic/analyze/complete.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/complete.el --- Smart Completions  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/analyze/debug.el 
b/lisp/cedet/semantic/analyze/debug.el
index 69b3b9c832..f750814baa 100644
--- a/lisp/cedet/semantic/analyze/debug.el
+++ b/lisp/cedet/semantic/analyze/debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/debug.el --- Debug the analyzer  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/analyze/fcn.el 
b/lisp/cedet/semantic/analyze/fcn.el
index d47e8976e5..7f60162115 100644
--- a/lisp/cedet/semantic/analyze/fcn.el
+++ b/lisp/cedet/semantic/analyze/fcn.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/fcn.el --- Analyzer support functions.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/analyze/refs.el 
b/lisp/cedet/semantic/analyze/refs.el
index 31cbb9e117..d06962f6fc 100644
--- a/lisp/cedet/semantic/analyze/refs.el
+++ b/lisp/cedet/semantic/analyze/refs.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/refs.el --- Analysis of the references between tags.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/bovine.el b/lisp/cedet/semantic/bovine.el
index 6be6dfd8df..1e52b1f850 100644
--- a/lisp/cedet/semantic/bovine.el
+++ b/lisp/cedet/semantic/bovine.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine.el --- LL Parser/Analyzer core  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2004, 2006-2007, 2009-2021 Free Software
+;; Copyright (C) 1999-2004, 2006-2007, 2009-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 19e2fee2ba..ee1cbcad4d 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/c.el --- Semantic details for C  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/bovine/debug.el 
b/lisp/cedet/semantic/bovine/debug.el
index 64ccbb4519..880be91547 100644
--- a/lisp/cedet/semantic/bovine/debug.el
+++ b/lisp/cedet/semantic/bovine/debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/debug.el --- Debugger support for bovinator  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el
index ebb20448ed..61b400b505 100644
--- a/lisp/cedet/semantic/bovine/el.el
+++ b/lisp/cedet/semantic/bovine/el.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/el.el --- Semantic details for Emacs Lisp  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/bovine/gcc.el 
b/lisp/cedet/semantic/bovine/gcc.el
index 02bd0defef..01dbec0113 100644
--- a/lisp/cedet/semantic/bovine/gcc.el
+++ b/lisp/cedet/semantic/bovine/gcc.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/gcc.el --- gcc querying special code for the C parser  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/bovine/grammar.el 
b/lisp/cedet/semantic/bovine/grammar.el
index a2717d711f..d478b12f64 100644
--- a/lisp/cedet/semantic/bovine/grammar.el
+++ b/lisp/cedet/semantic/bovine/grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/grammar.el --- Bovine's input grammar mode  -*- 
lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 26 Aug 2002
diff --git a/lisp/cedet/semantic/bovine/make.el 
b/lisp/cedet/semantic/bovine/make.el
index bb579cfde3..bfc3de20ff 100644
--- a/lisp/cedet/semantic/bovine/make.el
+++ b/lisp/cedet/semantic/bovine/make.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/make.el --- Makefile parsing rules.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2000-2004, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2004, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/bovine/scm.el 
b/lisp/cedet/semantic/bovine/scm.el
index 0395412069..e1cb07034a 100644
--- a/lisp/cedet/semantic/bovine/scm.el
+++ b/lisp/cedet/semantic/bovine/scm.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/scm.el --- Semantic details for Scheme (guile)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/chart.el b/lisp/cedet/semantic/chart.el
index 0abbe45864..342b03f8bb 100644
--- a/lisp/cedet/semantic/chart.el
+++ b/lisp/cedet/semantic/chart.el
@@ -1,6 +1,6 @@
 ;;; semantic/chart.el --- Utilities for use with semantic tag tables  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2001, 2003, 2005, 2008-2021 Free Software
+;; Copyright (C) 1999-2001, 2003, 2005, 2008-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 375b97a7a5..2c608fca38 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -1,6 +1,6 @@
 ;;; semantic/complete.el --- Routines for performing tag completion  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el
index 17ffaeff5e..57c158fc9c 100644
--- a/lisp/cedet/semantic/ctxt.el
+++ b/lisp/cedet/semantic/ctxt.el
@@ -1,6 +1,6 @@
 ;;; semantic/ctxt.el --- Context calculations for Semantic tools  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/db-debug.el b/lisp/cedet/semantic/db-debug.el
index d8f7034f03..5ce9717421 100644
--- a/lisp/cedet/semantic/db-debug.el
+++ b/lisp/cedet/semantic/db-debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-debug.el --- Extra level debugging routines for Semantic  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/db-ebrowse.el 
b/lisp/cedet/semantic/db-ebrowse.el
index 8bc3b810a6..f0e1d9f029 100644
--- a/lisp/cedet/semantic/db-ebrowse.el
+++ b/lisp/cedet/semantic/db-ebrowse.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-ebrowse.el --- Semanticdb backend using ebrowse.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric M. Ludlam <zappo@gnu.org>
 ;;     Joakim Verona
diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el
index c9ae68e9fa..73ef37ea2a 100644
--- a/lisp/cedet/semantic/db-el.el
+++ b/lisp/cedet/semantic/db-el.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el
index c9007ac7a0..d00ab47ce6 100644
--- a/lisp/cedet/semantic/db-file.el
+++ b/lisp/cedet/semantic/db-file.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-file.el --- Save a semanticdb to a cache file.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el
index e6a7879775..3012af41c5 100644
--- a/lisp/cedet/semantic/db-find.el
+++ b/lisp/cedet/semantic/db-find.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-find.el --- Searching through semantic databases.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-global.el b/lisp/cedet/semantic/db-global.el
index fad24485ed..1ef97a6036 100644
--- a/lisp/cedet/semantic/db-global.el
+++ b/lisp/cedet/semantic/db-global.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-global.el --- Semantic database extensions for GLOBAL  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2006, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-javascript.el 
b/lisp/cedet/semantic/db-javascript.el
index bf3d612295..9c62329e43 100644
--- a/lisp/cedet/semantic/db-javascript.el
+++ b/lisp/cedet/semantic/db-javascript.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-javascript.el --- Semantic database extensions for javascript  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Joakim Verona
 
diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el
index 839dcb8172..7c471bee4f 100644
--- a/lisp/cedet/semantic/db-mode.el
+++ b/lisp/cedet/semantic/db-mode.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-mode.el --- Semanticdb Minor Mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/db-ref.el b/lisp/cedet/semantic/db-ref.el
index 10108d3977..47fd3a903f 100644
--- a/lisp/cedet/semantic/db-ref.el
+++ b/lisp/cedet/semantic/db-ref.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-ref.el --- Handle cross-db file references  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/db-typecache.el 
b/lisp/cedet/semantic/db-typecache.el
index 03158171a2..38caac2292 100644
--- a/lisp/cedet/semantic/db-typecache.el
+++ b/lisp/cedet/semantic/db-typecache.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-typecache.el --- Manage Datatypes  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index 38e2b34b0d..7f25a84891 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -1,6 +1,6 @@
 ;;; semantic/db.el --- Semantic tag database manager  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/debug.el b/lisp/cedet/semantic/debug.el
index c13952265e..2fe651a559 100644
--- a/lisp/cedet/semantic/debug.el
+++ b/lisp/cedet/semantic/debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/debug.el --- Language Debugger framework  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2003-2005, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/decorate.el b/lisp/cedet/semantic/decorate.el
index 3e6651df15..ca2a6de3d3 100644
--- a/lisp/cedet/semantic/decorate.el
+++ b/lisp/cedet/semantic/decorate.el
@@ -1,6 +1,6 @@
 ;;; semantic/decorate.el --- Utilities for decorating/highlighting tokens.  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/decorate/include.el 
b/lisp/cedet/semantic/decorate/include.el
index ae2895c2b9..144e2ce018 100644
--- a/lisp/cedet/semantic/decorate/include.el
+++ b/lisp/cedet/semantic/decorate/include.el
@@ -1,6 +1,6 @@
 ;;; semantic/decorate/include.el --- Decoration modes for include statements  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/decorate/mode.el 
b/lisp/cedet/semantic/decorate/mode.el
index 0a234b3000..ad215db0f6 100644
--- a/lisp/cedet/semantic/decorate/mode.el
+++ b/lisp/cedet/semantic/decorate/mode.el
@@ -1,6 +1,6 @@
 ;;; semantic/decorate/mode.el --- Minor mode for decorating tags  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el
index cae38e6f11..eb922a1250 100644
--- a/lisp/cedet/semantic/dep.el
+++ b/lisp/cedet/semantic/dep.el
@@ -1,6 +1,6 @@
 ;;; semantic/dep.el --- Methods for tracking dependencies (include files)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/doc.el b/lisp/cedet/semantic/doc.el
index 413ed83a15..32cd63bce9 100644
--- a/lisp/cedet/semantic/doc.el
+++ b/lisp/cedet/semantic/doc.el
@@ -1,6 +1,6 @@
 ;;; semantic/doc.el --- Routines for documentation strings  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2003, 2005, 2008-2021 Free Software Foundation,
+;; Copyright (C) 1999-2003, 2005, 2008-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/semantic/ede-grammar.el 
b/lisp/cedet/semantic/ede-grammar.el
index 9a4d412d5d..ff9f991ff4 100644
--- a/lisp/cedet/semantic/ede-grammar.el
+++ b/lisp/cedet/semantic/ede-grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el
index b2e56360cf..76230d438a 100644
--- a/lisp/cedet/semantic/edit.el
+++ b/lisp/cedet/semantic/edit.el
@@ -1,6 +1,6 @@
 ;;; semantic/edit.el --- Edit Management for Semantic  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el
index 17fb20fa0a..e894022315 100644
--- a/lisp/cedet/semantic/find.el
+++ b/lisp/cedet/semantic/find.el
@@ -1,6 +1,6 @@
 ;;; semantic/find.el --- Search routines for Semantic  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1999-2005, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el
index a68ef8064d..80e7f1117a 100644
--- a/lisp/cedet/semantic/format.el
+++ b/lisp/cedet/semantic/format.el
@@ -1,6 +1,6 @@
 ;;; semantic/format.el --- Routines for formatting tags  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el
index 3502cda500..fd61751cb5 100644
--- a/lisp/cedet/semantic/fw.el
+++ b/lisp/cedet/semantic/fw.el
@@ -1,6 +1,6 @@
 ;;; semantic/fw.el --- Framework for Semantic  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index 33c66da9a6..74d4a229fa 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/grammar.el --- Major mode framework for Semantic grammars  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 
diff --git a/lisp/cedet/semantic/grm-wy-boot.el 
b/lisp/cedet/semantic/grm-wy-boot.el
index ce63421fb3..376fab89c2 100644
--- a/lisp/cedet/semantic/grm-wy-boot.el
+++ b/lisp/cedet/semantic/grm-wy-boot.el
@@ -1,6 +1,6 @@
 ;;; semantic/grammar-wy.el --- Generated parser support file  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el
index ad5d2c798f..718ce3c4c7 100644
--- a/lisp/cedet/semantic/html.el
+++ b/lisp/cedet/semantic/html.el
@@ -1,6 +1,6 @@
 ;;; semantic/html.el --- Semantic details for html files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2004-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/ia-sb.el b/lisp/cedet/semantic/ia-sb.el
index 12a2f1db92..25a011188e 100644
--- a/lisp/cedet/semantic/ia-sb.el
+++ b/lisp/cedet/semantic/ia-sb.el
@@ -1,6 +1,6 @@
 ;;; semantic/ia-sb.el --- Speedbar analysis display interactor  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el
index 7186a78123..2172085d6b 100644
--- a/lisp/cedet/semantic/ia.el
+++ b/lisp/cedet/semantic/ia.el
@@ -1,6 +1,6 @@
 ;;; semantic/ia.el --- Interactive Analysis functions  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2000-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el
index a14994424d..1afb1d841d 100644
--- a/lisp/cedet/semantic/idle.el
+++ b/lisp/cedet/semantic/idle.el
@@ -1,6 +1,6 @@
 ;;; idle.el --- Schedule parsing tasks in idle time  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2003-2006, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2006, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el
index a5db85bb51..235965a995 100644
--- a/lisp/cedet/semantic/imenu.el
+++ b/lisp/cedet/semantic/imenu.el
@@ -1,6 +1,6 @@
 ;;; semantic/imenu.el --- Use Semantic as an imenu tag generator  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2005, 2007-2008, 2010-2021 Free Software
+;; Copyright (C) 2000-2005, 2007-2008, 2010-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el
index 0c2fb843f0..a7c02032e2 100644
--- a/lisp/cedet/semantic/java.el
+++ b/lisp/cedet/semantic/java.el
@@ -1,6 +1,6 @@
 ;;; semantic/java.el --- Semantic functions for Java  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1999-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index 3297367db9..26a3b39f0d 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -1,6 +1,6 @@
 ;;; semantic/lex-spp.el --- Semantic Lexical Pre-processor  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index d524b733db..885ffbf5a7 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -1,6 +1,6 @@
 ;;; semantic/lex.el --- Lexical Analyzer builder  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/mru-bookmark.el 
b/lisp/cedet/semantic/mru-bookmark.el
index 2e77e6b75f..9dee0415a3 100644
--- a/lisp/cedet/semantic/mru-bookmark.el
+++ b/lisp/cedet/semantic/mru-bookmark.el
@@ -1,6 +1,6 @@
 ;;; semantic/mru-bookmark.el --- Automatic bookmark tracking  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/sb.el b/lisp/cedet/semantic/sb.el
index fe981d34fb..cf18160ad7 100644
--- a/lisp/cedet/semantic/sb.el
+++ b/lisp/cedet/semantic/sb.el
@@ -1,6 +1,6 @@
 ;;; semantic/sb.el --- Semantic tag display for speedbar  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/scope.el b/lisp/cedet/semantic/scope.el
index 2d806e58ee..83e7ed66c1 100644
--- a/lisp/cedet/semantic/scope.el
+++ b/lisp/cedet/semantic/scope.el
@@ -1,6 +1,6 @@
 ;;; semantic/scope.el --- Analyzer Scope Calculations  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el
index 19530094fb..ebc4159a4c 100644
--- a/lisp/cedet/semantic/senator.el
+++ b/lisp/cedet/semantic/senator.el
@@ -1,6 +1,6 @@
 ;;; semantic/senator.el --- SEmantic NAvigaTOR  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el
index b4b09dc02c..1503a766dc 100644
--- a/lisp/cedet/semantic/sort.el
+++ b/lisp/cedet/semantic/sort.el
@@ -1,6 +1,6 @@
 ;;; semantic/sort.el --- Utilities for sorting and re-arranging tag tables.  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 701f9ad3e0..ba236059f6 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref.el --- Symbol Reference API  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/symref/cscope.el 
b/lisp/cedet/semantic/symref/cscope.el
index bc3f4a248b..f0246c77d2 100644
--- a/lisp/cedet/semantic/symref/cscope.el
+++ b/lisp/cedet/semantic/symref/cscope.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/cscope.el --- Semantic-symref support via cscope  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/symref/filter.el 
b/lisp/cedet/semantic/symref/filter.el
index 7ef3cd90d6..3a8f4ad357 100644
--- a/lisp/cedet/semantic/symref/filter.el
+++ b/lisp/cedet/semantic/symref/filter.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/filter.el --- Filter symbol reference hits for accuracy  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/symref/global.el 
b/lisp/cedet/semantic/symref/global.el
index 23e40349a6..b5de9cb90e 100644
--- a/lisp/cedet/semantic/symref/global.el
+++ b/lisp/cedet/semantic/symref/global.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/global.el --- Use GNU Global for symbol references  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/symref/grep.el 
b/lisp/cedet/semantic/symref/grep.el
index 077a2d4861..27ea80fc32 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/grep.el --- Symref implementation using find/grep  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/symref/idutils.el 
b/lisp/cedet/semantic/symref/idutils.el
index 3e3e3b0a94..a8d84c7dec 100644
--- a/lisp/cedet/semantic/symref/idutils.el
+++ b/lisp/cedet/semantic/symref/idutils.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/idutils.el --- Symref implementation for idutils  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/symref/list.el 
b/lisp/cedet/semantic/symref/list.el
index b1b36132b3..7823dad6ef 100644
--- a/lisp/cedet/semantic/symref/list.el
+++ b/lisp/cedet/semantic/symref/list.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/list.el --- Symref Output List UI  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/tag-file.el b/lisp/cedet/semantic/tag-file.el
index 06dd274b32..7a80bccb53 100644
--- a/lisp/cedet/semantic/tag-file.el
+++ b/lisp/cedet/semantic/tag-file.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag-file.el --- Routines that find files based on tags.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/tag-ls.el b/lisp/cedet/semantic/tag-ls.el
index 4bdae58690..244bd57af9 100644
--- a/lisp/cedet/semantic/tag-ls.el
+++ b/lisp/cedet/semantic/tag-ls.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag-ls.el --- Language Specific override functions for tags  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/tag-write.el b/lisp/cedet/semantic/tag-write.el
index 9d5aeea098..2b2e866524 100644
--- a/lisp/cedet/semantic/tag-write.el
+++ b/lisp/cedet/semantic/tag-write.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag-write.el --- Write tags to a text stream  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el
index a86ed020bb..16695a108a 100644
--- a/lisp/cedet/semantic/tag.el
+++ b/lisp/cedet/semantic/tag.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag.el --- Tag creation and access  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el
index 5a38280d2a..1917bcb40a 100644
--- a/lisp/cedet/semantic/texi.el
+++ b/lisp/cedet/semantic/texi.el
@@ -1,6 +1,6 @@
 ;;; semantic/texi.el --- Semantic details for Texinfo files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/semantic/util-modes.el 
b/lisp/cedet/semantic/util-modes.el
index 5ce1108044..fdd93c6bcf 100644
--- a/lisp/cedet/semantic/util-modes.el
+++ b/lisp/cedet/semantic/util-modes.el
@@ -1,6 +1,6 @@
 ;;; semantic/util-modes.el --- Semantic minor modes  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric M. Ludlam <zappo@gnu.org>
 ;;          David Ponce <david@dponce.com>
diff --git a/lisp/cedet/semantic/util.el b/lisp/cedet/semantic/util.el
index bfc923c75b..69a7c8f59c 100644
--- a/lisp/cedet/semantic/util.el
+++ b/lisp/cedet/semantic/util.el
@@ -1,6 +1,6 @@
 ;;; semantic/util.el --- Utilities for use with semantic tag tables  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/wisent.el b/lisp/cedet/semantic/wisent.el
index afcdd14282..55eeef453e 100644
--- a/lisp/cedet/semantic/wisent.el
+++ b/lisp/cedet/semantic/wisent.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent.el --- Wisent - Semantic gateway  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2001-2007, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2007, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 30 Aug 2001
diff --git a/lisp/cedet/semantic/wisent/comp.el 
b/lisp/cedet/semantic/wisent/comp.el
index a87ed51890..f842b3c364 100644
--- a/lisp/cedet/semantic/wisent/comp.el
+++ b/lisp/cedet/semantic/wisent/comp.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/comp.el --- GNU Bison for Emacs - Grammar compiler  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000-2007, 2009-2021 Free
+;; Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000-2007, 2009-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
diff --git a/lisp/cedet/semantic/wisent/grammar.el 
b/lisp/cedet/semantic/wisent/grammar.el
index c5e4554082..5ca22bac86 100644
--- a/lisp/cedet/semantic/wisent/grammar.el
+++ b/lisp/cedet/semantic/wisent/grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/grammar.el --- Wisent's input grammar mode  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 26 Aug 2002
diff --git a/lisp/cedet/semantic/wisent/java-tags.el 
b/lisp/cedet/semantic/wisent/java-tags.el
index 90dd40c51a..de75c0dda8 100644
--- a/lisp/cedet/semantic/wisent/java-tags.el
+++ b/lisp/cedet/semantic/wisent/java-tags.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2006, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2006, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 15 Dec 2001
diff --git a/lisp/cedet/semantic/wisent/javascript.el 
b/lisp/cedet/semantic/wisent/javascript.el
index 1932f205ee..cc7ae1b181 100644
--- a/lisp/cedet/semantic/wisent/javascript.el
+++ b/lisp/cedet/semantic/wisent/javascript.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/javascript.el --- javascript parser support  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/wisent/python.el 
b/lisp/cedet/semantic/wisent/python.el
index 2eeade6646..941efbbbef 100644
--- a/lisp/cedet/semantic/wisent/python.el
+++ b/lisp/cedet/semantic/wisent/python.el
@@ -1,6 +1,6 @@
 ;;; wisent-python.el --- Semantic support for Python  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard Kim <emacs18@gmail.com>
 ;; Created: June 2002
diff --git a/lisp/cedet/semantic/wisent/wisent.el 
b/lisp/cedet/semantic/wisent/wisent.el
index 62d99ef697..a73fb167b1 100644
--- a/lisp/cedet/semantic/wisent/wisent.el
+++ b/lisp/cedet/semantic/wisent/wisent.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/wisent.el --- GNU Bison for Emacs - Runtime  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 30 January 2002
diff --git a/lisp/cedet/srecode.el b/lisp/cedet/srecode.el
index 83e9754a60..7c054d4c10 100644
--- a/lisp/cedet/srecode.el
+++ b/lisp/cedet/srecode.el
@@ -1,6 +1,6 @@
 ;;; srecode.el --- Semantic buffer evaluator.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2005-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: codegeneration
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index 79d2700c5d..eb141e34ca 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -1,6 +1,6 @@
 ;;; srecode/args.el --- Provide some simple template arguments  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index 15107ef1e4..37c83be811 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -1,6 +1,6 @@
 ;;; srecode/compile --- Compilation of srecode template files.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: codegeneration
diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el
index dc5e8da5cd..ba9e81715a 100644
--- a/lisp/cedet/srecode/cpp.el
+++ b/lisp/cedet/srecode/cpp.el
@@ -1,6 +1,6 @@
 ;;; srecode/cpp.el --- C++ specific handlers for Semantic Recoder  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;;         Jan Moringen <scymtym@users.sourceforge.net>
diff --git a/lisp/cedet/srecode/ctxt.el b/lisp/cedet/srecode/ctxt.el
index fe887c281c..195b2f433e 100644
--- a/lisp/cedet/srecode/ctxt.el
+++ b/lisp/cedet/srecode/ctxt.el
@@ -1,6 +1,6 @@
 ;;; srecode/ctxt.el --- Derive a context from the source buffer.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el
index e47a09fd84..5e986827c9 100644
--- a/lisp/cedet/srecode/dictionary.el
+++ b/lisp/cedet/srecode/dictionary.el
@@ -1,6 +1,6 @@
 ;;; srecode/dictionary.el --- Dictionary code for the semantic recoder.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/document.el b/lisp/cedet/srecode/document.el
index 270b80d901..8c5f343e98 100644
--- a/lisp/cedet/srecode/document.el
+++ b/lisp/cedet/srecode/document.el
@@ -1,6 +1,6 @@
 ;;; srecode/document.el --- Documentation (comment) generation  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/el.el b/lisp/cedet/srecode/el.el
index 974a4fac72..ebfec20509 100644
--- a/lisp/cedet/srecode/el.el
+++ b/lisp/cedet/srecode/el.el
@@ -1,6 +1,6 @@
 ;;; srecode/el.el --- Emacs Lisp specific arguments  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/expandproto.el 
b/lisp/cedet/srecode/expandproto.el
index a40d5aec24..125e841c4d 100644
--- a/lisp/cedet/srecode/expandproto.el
+++ b/lisp/cedet/srecode/expandproto.el
@@ -1,6 +1,6 @@
 ;;; srecode/expandproto.el --- Expanding prototypes.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/extract.el b/lisp/cedet/srecode/extract.el
index 9e6a98fd76..7d4539dcb4 100644
--- a/lisp/cedet/srecode/extract.el
+++ b/lisp/cedet/srecode/extract.el
@@ -1,6 +1,6 @@
 ;;; srecode/extract.el --- Extract content from previously inserted macro.  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/fields.el b/lisp/cedet/srecode/fields.el
index e65e319432..2fc79d01a7 100644
--- a/lisp/cedet/srecode/fields.el
+++ b/lisp/cedet/srecode/fields.el
@@ -1,6 +1,6 @@
 ;;; srecode/fields.el --- Handling type-in fields in a buffer.  -*- 
lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/filters.el b/lisp/cedet/srecode/filters.el
index b76ce2c94b..5c11f8c31b 100644
--- a/lisp/cedet/srecode/filters.el
+++ b/lisp/cedet/srecode/filters.el
@@ -1,6 +1,6 @@
 ;;; srecode/filters.el --- Filters for use in template variables.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/find.el b/lisp/cedet/srecode/find.el
index 1c208d0f32..c13342e88f 100644
--- a/lisp/cedet/srecode/find.el
+++ b/lisp/cedet/srecode/find.el
@@ -1,6 +1,6 @@
 ;;;; srecode/find.el --- Tools for finding templates in the database.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/getset.el b/lisp/cedet/srecode/getset.el
index ce4c818c70..4623d2cdef 100644
--- a/lisp/cedet/srecode/getset.el
+++ b/lisp/cedet/srecode/getset.el
@@ -1,6 +1,6 @@
 ;;; srecode/getset.el --- Package for inserting new get/set methods.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index f20842b1d8..8dd5d25157 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -1,6 +1,6 @@
 ;;; srecode/insert.el --- Insert srecode templates to an output stream  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index 0f0a80ee29..52a0020320 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -1,6 +1,6 @@
 ;;; srecode/java.el --- Srecode Java support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index 254b15e6e0..32de258827 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -1,6 +1,6 @@
 ;;; srecode/map.el --- Manage a template file map  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el
index 9b1c8491a1..e8c7762c72 100644
--- a/lisp/cedet/srecode/mode.el
+++ b/lisp/cedet/srecode/mode.el
@@ -1,6 +1,6 @@
 ;;; srecode/mode.el --- Minor mode for managing and using SRecode templates  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el
index fbb6984dc1..ea7fda004e 100644
--- a/lisp/cedet/srecode/semantic.el
+++ b/lisp/cedet/srecode/semantic.el
@@ -1,6 +1,6 @@
 ;;; srecode/semantic.el --- Semantic specific extensions to SRecode  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index 7157915849..724a6e0a94 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -1,6 +1,6 @@
 ;;; srecode/srt-mode.el --- Major mode for writing screcode macros  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/srecode/srt.el b/lisp/cedet/srecode/srt.el
index 161b5105b5..4b3b5eaeb7 100644
--- a/lisp/cedet/srecode/srt.el
+++ b/lisp/cedet/srecode/srt.el
@@ -1,6 +1,6 @@
 ;;; srecode/srt.el --- argument handlers for SRT files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/table.el b/lisp/cedet/srecode/table.el
index 7ce5cc73b6..3dfbb9d58b 100644
--- a/lisp/cedet/srecode/table.el
+++ b/lisp/cedet/srecode/table.el
@@ -1,6 +1,6 @@
 ;;; srecode/table.el --- Tables of Semantic Recoders  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/cedet/srecode/template.el b/lisp/cedet/srecode/template.el
index 1f6f0d345d..7bd142e75d 100644
--- a/lisp/cedet/srecode/template.el
+++ b/lisp/cedet/srecode/template.el
@@ -1,6 +1,6 @@
 ;;; srecode/template.el --- SRecoder template language parser support.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/srecode/texi.el b/lisp/cedet/srecode/texi.el
index 1312a55a89..50b0e150ff 100644
--- a/lisp/cedet/srecode/texi.el
+++ b/lisp/cedet/srecode/texi.el
@@ -1,6 +1,6 @@
 ;;; srecode/texi.el --- Srecode texinfo support.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/lisp/char-fold.el b/lisp/char-fold.el
index e3ab7d5b64..05ae52cae0 100644
--- a/lisp/char-fold.el
+++ b/lisp/char-fold.el
@@ -1,6 +1,6 @@
 ;;; char-fold.el --- match unicode to similar ASCII -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: matching
@@ -26,6 +26,7 @@
 
 (eval-and-compile
   (put 'char-fold-table 'char-table-extra-slots 1)
+  (defconst char-fold--default-override nil)
   (defconst char-fold--default-include
     '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" 
"🙶" "🙸" "«" "»")
       (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›")
@@ -40,7 +41,8 @@
       ))
   (defconst char-fold--default-symmetric nil)
   (defvar char-fold--previous
-    (list char-fold--default-include
+    (list char-fold--default-override
+          char-fold--default-include
           char-fold--default-exclude
           char-fold--default-symmetric)))
 
@@ -67,48 +69,50 @@
       ;; - A single char of the decomp might be allowed to match the
       ;;   character.
       ;; Some examples in the comments below.
-      (map-char-table
-       (lambda (char decomp)
-         (when (consp decomp)
-           ;; Skip trivial cases like ?a decomposing to (?a).
-           (unless (and (not (cdr decomp))
-                        (eq char (car decomp)))
-             (if (symbolp (car decomp))
-                 ;; Discard a possible formatting tag.
-                 (setq decomp (cdr decomp))
-               ;; If there's no formatting tag, ensure that char matches
-               ;; its decomp exactly.  This is because we want 'ä' to
-               ;; match 'ä', but we don't want '¹' to match '1'.
-               (aset equiv char
-                     (cons (apply #'string decomp)
-                           (aref equiv char))))
-
-             ;; Allow the entire decomp to match char.  If decomp has
-             ;; multiple characters, this is done by adding an entry
-             ;; to the alist of the first character in decomp.  This
-             ;; allows 'ff' to match 'ff', 'ä' to match 'ä', and '1' to
-             ;; match '¹'.
-             (let ((make-decomp-match-char
-                    (lambda (decomp char)
-                      (if (cdr decomp)
-                          (aset equiv-multi (car decomp)
-                                (cons (cons (apply #'string (cdr decomp))
-                                            (regexp-quote (string char)))
-                                      (aref equiv-multi (car decomp))))
-                        (aset equiv (car decomp)
-                              (cons (char-to-string char)
-                                    (aref equiv (car decomp))))))))
-               (funcall make-decomp-match-char decomp char)
-               ;; Check to see if the first char of the decomposition
-               ;; has a further decomposition.  If so, add a mapping
-               ;; back from that second decomposition to the original
-               ;; character.  This allows e.g. 'ι' (GREEK SMALL LETTER
-               ;; IOTA) to match both the Basic Greek block and
-               ;; Extended Greek block variants of IOTA +
-               ;; diacritical(s).  Repeat until there are no more
-               ;; decompositions.
-               (let ((dec decomp)
-                     next-decomp)
+      (unless (or (bound-and-true-p char-fold-override)
+                  char-fold--default-override)
+        (map-char-table
+         (lambda (char decomp)
+           (when (consp decomp)
+             ;; Skip trivial cases like ?a decomposing to (?a).
+             (unless (and (not (cdr decomp))
+                          (eq char (car decomp)))
+               (if (symbolp (car decomp))
+                   ;; Discard a possible formatting tag.
+                   (setq decomp (cdr decomp))
+                 ;; If there's no formatting tag, ensure that char matches
+                 ;; its decomp exactly.  This is because we want 'ä' to
+                 ;; match 'ä', but we don't want '¹' to match '1'.
+                 (aset equiv char
+                       (cons (apply #'string decomp)
+                             (aref equiv char))))
+
+               ;; Allow the entire decomp to match char.  If decomp has
+               ;; multiple characters, this is done by adding an entry
+               ;; to the alist of the first character in decomp.  This
+               ;; allows 'ff' to match 'ff', 'ä' to match 'ä', and '1' to
+               ;; match '¹'.
+               (let ((make-decomp-match-char
+                      (lambda (decomp char)
+                        (if (cdr decomp)
+                            (aset equiv-multi (car decomp)
+                                  (cons (cons (apply #'string (cdr decomp))
+                                              (regexp-quote (string char)))
+                                        (aref equiv-multi (car decomp))))
+                          (aset equiv (car decomp)
+                                (cons (char-to-string char)
+                                      (aref equiv (car decomp))))))))
+                 (funcall make-decomp-match-char decomp char)
+                 ;; Check to see if the first char of the decomposition
+                 ;; has a further decomposition.  If so, add a mapping
+                 ;; back from that second decomposition to the original
+                 ;; character.  This allows e.g. 'ι' (GREEK SMALL LETTER
+                 ;; IOTA) to match both the Basic Greek block and
+                 ;; Extended Greek block variants of IOTA +
+                 ;; diacritical(s).  Repeat until there are no more
+                 ;; decompositions.
+                 (let ((dec decomp)
+                       next-decomp)
                    (while dec
                      (setq next-decomp (char-table-range table (car dec)))
                      (when (consp next-decomp)
@@ -118,24 +122,24 @@
                                     (car next-decomp)))
                            (funcall make-decomp-match-char (list (car 
next-decomp)) char)))
                      (setq dec next-decomp)))
-               ;; Do it again, without the non-spacing characters.
-               ;; This allows 'a' to match 'ä'.
-               (let ((simpler-decomp nil)
-                     (found-one nil))
-                 (dolist (c decomp)
-                   (if (> (get-char-code-property c 
'canonical-combining-class) 0)
-                       (setq found-one t)
-                     (push c simpler-decomp)))
-                 (when (and simpler-decomp found-one)
-                   (funcall make-decomp-match-char simpler-decomp char)
-                   ;; Finally, if the decomp only had one spacing
-                   ;; character, we allow this character to match the
-                   ;; decomp.  This is to let 'a' match 'ä'.
-                   (unless (cdr simpler-decomp)
-                     (aset equiv (car simpler-decomp)
-                           (cons (apply #'string decomp)
-                                 (aref equiv (car simpler-decomp)))))))))))
-       table)
+                 ;; Do it again, without the non-spacing characters.
+                 ;; This allows 'a' to match 'ä'.
+                 (let ((simpler-decomp nil)
+                       (found-one nil))
+                   (dolist (c decomp)
+                     (if (> (get-char-code-property c 
'canonical-combining-class) 0)
+                         (setq found-one t)
+                       (push c simpler-decomp)))
+                   (when (and simpler-decomp found-one)
+                     (funcall make-decomp-match-char simpler-decomp char)
+                     ;; Finally, if the decomp only had one spacing
+                     ;; character, we allow this character to match the
+                     ;; decomp.  This is to let 'a' match 'ä'.
+                     (unless (cdr simpler-decomp)
+                       (aset equiv (car simpler-decomp)
+                             (cons (apply #'string decomp)
+                                   (aref equiv (car simpler-decomp)))))))))))
+         table))
 
       ;; Add some entries to default decomposition
       (dolist (it (or (bound-and-true-p char-fold-include)
@@ -232,7 +236,9 @@ Exceptionally for the space character (32), ALIST is 
ignored.")
 
 (defun char-fold-update-table ()
   "Update char-fold-table only when one of the options changes its value."
-  (let ((new (list (or (bound-and-true-p char-fold-include)
+  (let ((new (list (or (bound-and-true-p char-fold-override)
+                       char-fold--default-override)
+                   (or (bound-and-true-p char-fold-include)
                        char-fold--default-include)
                    (or (bound-and-true-p char-fold-exclude)
                        char-fold--default-exclude)
@@ -242,6 +248,22 @@ Exceptionally for the space character (32), ALIST is 
ignored.")
       (setq char-fold-table (char-fold--make-table)
             char-fold--previous new))))
 
+(defcustom char-fold-override char-fold--default-override
+  "Non-nil means to override the default definitions of equivalent characters.
+When nil (the default), the table of character equivalences used
+for character-folding is populated with the default set of equivalent
+characters; customize `char-fold-exclude' to remove unneeded equivalences,
+and `char-fold-include' to add your own.
+When this variable is non-nil, the table of equivalences starts empty,
+and you can add your own equivalences by customizing `char-fold-include'."
+  :type 'boolean
+  :initialize #'custom-initialize-default
+  :set (lambda (sym val)
+         (custom-set-default sym val)
+         (char-fold-update-table))
+  :group 'isearch
+  :version "29.1")
+
 (defcustom char-fold-include char-fold--default-include
   "Additional character foldings to include.
 Each entry is a list of a character and the strings that fold into it."
diff --git a/lisp/chistory.el b/lisp/chistory.el
index 95c1b49cd8..dd0f499743 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -1,6 +1,6 @@
 ;;; chistory.el --- list command history  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el
index 47113ad8c2..e64d9d28dd 100644
--- a/lisp/cmuscheme.el
+++ b/lisp/cmuscheme.el
@@ -1,6 +1,6 @@
 ;;; cmuscheme.el --- Scheme process in a buffer. Adapted from tea.el  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988-2022 Free Software Foundation, Inc.
 
 ;; Author: Olin Shivers <olin.shivers@cs.cmu.edu>
 ;; Maintainer: emacs-devel@gnu.org
@@ -237,7 +237,7 @@ is run).
        (inferior-scheme-mode)))
   (setq scheme-program-name cmd)
   (setq scheme-buffer "*scheme*")
-  (pop-to-buffer-same-window "*scheme*"))
+  (pop-to-buffer "*scheme*" display-comint-buffer-action))
 
 (defun scheme-start-file (prog)
   "Return the name of the start file corresponding to PROG.
@@ -357,7 +357,7 @@ With argument, position cursor at end of buffer."
   (interactive "P")
   (if (or (and scheme-buffer (get-buffer scheme-buffer))
           (scheme-interactively-start-process))
-      (pop-to-buffer-same-window scheme-buffer)
+      (pop-to-buffer scheme-buffer display-comint-buffer-action)
     (error "No current process buffer.  See variable `scheme-buffer'"))
   (when eob-p
     (push-mark)
diff --git a/lisp/color.el b/lisp/color.el
index fec36eecc3..0fe663d97a 100644
--- a/lisp/color.el
+++ b/lisp/color.el
@@ -1,6 +1,6 @@
 ;;; color.el --- Color manipulation library -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Authors: Julien Danjou <julien@danjou.info>
 ;;          Drew Adams <drew.adams@oracle.com>
diff --git a/lisp/comint.el b/lisp/comint.el
index 5f99f560cf..fdea3e33bb 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1,6 +1,6 @@
 ;;; comint.el --- general command interpreter in a window stuff -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1990, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1990, 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
 ;;     Simon Marshall <simon@gnu.org>
@@ -2036,7 +2036,7 @@ the start, the cdr to the end of the last prompt 
recognized.")
 Freezes the `font-lock-face' text property in place."
   (when comint-last-prompt
     (with-silent-modifications
-      (font-lock-prepend-text-property
+      (font-lock-append-text-property
        (car comint-last-prompt)
        (cdr comint-last-prompt)
        'font-lock-face 'comint-highlight-prompt))
diff --git a/lisp/completion.el b/lisp/completion.el
index 643f2da0d2..fb700954b0 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -1,6 +1,6 @@
 ;;; completion.el --- dynamic word-completion code  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1990-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: abbrev convenience
@@ -492,7 +492,7 @@ Used to decide whether to save completions.")
     table))
 
 ;; Old name, non-namespace-clean.
-(defvaralias 'cmpl-syntax-table 'completion-syntax-table)
+(define-obsolete-variable-alias 'cmpl-syntax-table 'completion-syntax-table 
"29.1")
 
 (defvar-local completion-syntax-table completion-standard-syntax-table
   "This variable holds the current completion syntax table.")
@@ -2220,7 +2220,7 @@ TYPE is the type of the wrapper to be added.  Can be 
:before or :under."
 (completion-def-wrapper 'delete-backward-char-untabify :backward)
 
 ;; Old name, non-namespace-clean.
-(defalias 'initialize-completions #'completion-initialize)
+(define-obsolete-function-alias 'initialize-completions 
#'completion-initialize "29.1")
 
 (provide 'completion)
 
diff --git a/lisp/composite.el b/lisp/composite.el
index c2289e8998..d7ac75708c 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -1,6 +1,6 @@
 ;;; composite.el --- support character composition  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010, 2011
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el
index 31a896088a..87dcbbb004 100644
--- a/lisp/cus-dep.el
+++ b/lisp/cus-dep.el
@@ -1,6 +1,6 @@
 ;;; cus-dep.el --- find customization dependencies  -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index ac586b67fa..caac8ce34f 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1,6 +1,6 @@
 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages -*- 
lexical-binding:t -*-
 ;;
-;; Copyright (C) 1996-1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: emacs-devel@gnu.org
@@ -2176,7 +2176,7 @@ and `face'."
 ;;; The `custom' Widget.
 
 (defface custom-button
-  '((((type x w32 ns haiku) (class color))     ; Like default mode line
+  '((((type x w32 ns haiku pgtk) (class color))        ; Like default mode line
      :box (:line-width 2 :style released-button)
      :background "lightgrey" :foreground "black"))
   "Face for custom buffer buttons if `custom-raised-buttons' is non-nil."
@@ -2184,7 +2184,7 @@ and `face'."
   :group 'custom-faces)
 
 (defface custom-button-mouse
-  '((((type x w32 ns haiku) (class color))
+  '((((type x w32 ns haiku pgtk) (class color))
      :box (:line-width 2 :style released-button)
      :background "grey90" :foreground "black")
     (t
@@ -2209,7 +2209,7 @@ and `face'."
       (if custom-raised-buttons 'custom-button-mouse 'highlight))
 
 (defface custom-button-pressed
-  '((((type x w32 ns haiku) (class color))
+  '((((type x w32 ns haiku pgtk) (class color))
      :box (:line-width 2 :style pressed-button)
      :background "lightgrey" :foreground "black")
     (t :inverse-video t))
@@ -3458,6 +3458,10 @@ MS Windows.")
                                           :sibling-args (:help-echo "\
 GNUstep or Macintosh OS Cocoa interface.")
                                           ns)
+                                   (const :format "PGTK "
+                                          :sibling-args (:help-echo "\
+Pure-GTK interface.")
+                                          ns)
                                    (const :format "DOS "
                                           :sibling-args (:help-echo "\
 Plain MS-DOS.")
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index c78a327fdf..fa6d940d7c 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -1,6 +1,6 @@
 ;;; cus-face.el --- customization support for faces  -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 1996-1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: help, faces
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 579beae123..667e36b211 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -1,6 +1,6 @@
 ;;; cus-start.el --- define customization properties of builtins  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index ce3f16255d..9a0e5066af 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -1,6 +1,6 @@
 ;;; cus-theme.el --- custom theme creation user interface  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/custom.el b/lisp/custom.el
index 9252e80411..76c14831ca 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1,6 +1,6 @@
 ;;; custom.el --- tools for declaring and initializing options  -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 1996-1997, 1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1996-1997, 1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 037787797b..220a2f52e9 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -1,6 +1,6 @@
 ;;; dabbrev.el --- dynamic abbreviation package  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994, 1996-1997, 2000-2021 Free
+;; Copyright (C) 1985-1986, 1992, 1994, 1996-1997, 2000-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Don Morrison
diff --git a/lisp/delim-col.el b/lisp/delim-col.el
index ac78e568da..e1e166cc48 100644
--- a/lisp/delim-col.el
+++ b/lisp/delim-col.el
@@ -1,6 +1,6 @@
 ;;; delim-col.el --- prettify all columns in a region or rectangle  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Old-Version: 2.1
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 93fdc6a886..f5fe7cf793 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -1,6 +1,6 @@
 ;;; delsel.el --- delete selection if you insert  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992, 1997-1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1997-1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Matthieu Devin <devin@lucid.com>
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 2a239f8100..a816088932 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -1,6 +1,6 @@
 ;;; descr-text.el --- describe text mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 3b25713216..e7a368e21f 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1,6 +1,6 @@
 ;;; desktop.el --- save partial status of Emacs when killed -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993-1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
diff --git a/lisp/dframe.el b/lisp/dframe.el
index 1ddf11a8aa..6593708a13 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -1,6 +1,6 @@
 ;;; dframe.el --- dedicate frame support modes  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 56c7e191e1..3dbc037eb6 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1,6 +1,6 @@
 ;;; dired-aux.el --- less commonly used parts of dired -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>.
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 38d8a954a8..bdf416b3ed 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1,6 +1,6 @@
 ;;; dired-x.el --- extra Dired functionality  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 1997, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1993-1994, 1997, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
diff --git a/lisp/dired.el b/lisp/dired.el
index b964fd9c18..9813fca435 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1,6 +1,6 @@
 ;;; dired.el --- directory-browsing commands -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992-1997, 2000-2021 Free Software
+;; Copyright (C) 1985-1986, 1992-1997, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
@@ -1920,154 +1920,152 @@ Do so according to the former subdir alist 
OLD-SUBDIR-ALIST."
 
 ;;; Dired mode key bindings and menus
 
-(defvar dired-mode-map
+(defvar-keymap dired-mode-map
+  :doc "Local keymap for Dired mode buffers."
+  :full t
+  :parent special-mode-map
   ;; This looks ugly when substitute-command-keys uses C-d instead d:
-  ;;  (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
-  (let ((map (make-keymap)))
-    (set-keymap-parent map special-mode-map)
-    (define-key map [mouse-2] 'dired-mouse-find-file-other-window)
-    (define-key map [follow-link] 'mouse-face)
-    ;; Commands to mark or flag certain categories of files
-    (define-key map "#" 'dired-flag-auto-save-files)
-    (define-key map "." 'dired-clean-directory)
-    (define-key map "~" 'dired-flag-backup-files)
-    ;; Upper case keys (except !) for operating on the marked files
-    (define-key map "A" 'dired-do-find-regexp)
-    (define-key map "C" 'dired-do-copy)
-    (define-key map "B" 'dired-do-byte-compile)
-    (define-key map "D" 'dired-do-delete)
-    (define-key map "G" 'dired-do-chgrp)
-    (define-key map "H" 'dired-do-hardlink)
-    (define-key map "L" 'dired-do-load)
-    (define-key map "M" 'dired-do-chmod)
-    (define-key map "O" 'dired-do-chown)
-    (define-key map "P" 'dired-do-print)
-    (define-key map "Q" 'dired-do-find-regexp-and-replace)
-    (define-key map "R" 'dired-do-rename)
-    (define-key map "S" 'dired-do-symlink)
-    (define-key map "T" 'dired-do-touch)
-    (define-key map "X" 'dired-do-shell-command)
-    (define-key map "Z" 'dired-do-compress)
-    (define-key map "c" 'dired-do-compress-to)
-    (define-key map "!" 'dired-do-shell-command)
-    (define-key map "&" 'dired-do-async-shell-command)
-    ;; Comparison commands
-    (define-key map "=" 'dired-diff)
-    ;; Tree Dired commands
-    (define-key map "\M-\C-?" 'dired-unmark-all-files)
-    (define-key map "\M-\C-d" 'dired-tree-down)
-    (define-key map "\M-\C-u" 'dired-tree-up)
-    (define-key map "\M-\C-n" 'dired-next-subdir)
-    (define-key map "\M-\C-p" 'dired-prev-subdir)
-    ;; move to marked files
-    (define-key map "\M-{" 'dired-prev-marked-file)
-    (define-key map "\M-}" 'dired-next-marked-file)
-    ;; Make all regexp commands share a `%' prefix:
-    ;; We used to get to the submap via a symbol dired-regexp-prefix,
-    ;; but that seems to serve little purpose, and copy-keymap
-    ;; does a better job without it.
-    (define-key map "%" nil)
-    (define-key map "%u" 'dired-upcase)
-    (define-key map "%l" 'dired-downcase)
-    (define-key map "%d" 'dired-flag-files-regexp)
-    (define-key map "%g" 'dired-mark-files-containing-regexp)
-    (define-key map "%m" 'dired-mark-files-regexp)
-    (define-key map "%r" 'dired-do-rename-regexp)
-    (define-key map "%C" 'dired-do-copy-regexp)
-    (define-key map "%H" 'dired-do-hardlink-regexp)
-    (define-key map "%R" 'dired-do-rename-regexp)
-    (define-key map "%S" 'dired-do-symlink-regexp)
-    (define-key map "%&" 'dired-flag-garbage-files)
-    ;; Commands for marking and unmarking.
-    (define-key map "*" nil)
-    (define-key map "**" 'dired-mark-executables)
-    (define-key map "*/" 'dired-mark-directories)
-    (define-key map "*@" 'dired-mark-symlinks)
-    (define-key map "*%" 'dired-mark-files-regexp)
-    (define-key map "*N" 'dired-number-of-marked-files)
-    (define-key map "*c" 'dired-change-marks)
-    (define-key map "*s" 'dired-mark-subdir-files)
-    (define-key map "*m" 'dired-mark)
-    (define-key map "*u" 'dired-unmark)
-    (define-key map "*?" 'dired-unmark-all-files)
-    (define-key map "*!" 'dired-unmark-all-marks)
-    (define-key map "U" 'dired-unmark-all-marks)
-    (define-key map "*\177" 'dired-unmark-backward)
-    (define-key map "*\C-n" 'dired-next-marked-file)
-    (define-key map "*\C-p" 'dired-prev-marked-file)
-    (define-key map "*t" 'dired-toggle-marks)
-    ;; Lower keys for commands not operating on all the marked files
-    (define-key map "a" 'dired-find-alternate-file)
-    (define-key map "d" 'dired-flag-file-deletion)
-    (define-key map "e" 'dired-find-file)
-    (define-key map "f" 'dired-find-file)
-    (define-key map "\C-m" 'dired-find-file)
-    (put 'dired-find-file :advertised-binding "\C-m")
-    (define-key map "g" 'revert-buffer)
-    (define-key map "i" 'dired-maybe-insert-subdir)
-    (define-key map "j" 'dired-goto-file)
-    (define-key map "k" 'dired-do-kill-lines)
-    (define-key map "l" 'dired-do-redisplay)
-    (define-key map "m" 'dired-mark)
-    (define-key map "n" 'dired-next-line)
-    (define-key map "o" 'dired-find-file-other-window)
-    (define-key map "\C-o" 'dired-display-file)
-    (define-key map "p" 'dired-previous-line)
-    (define-key map "s" 'dired-sort-toggle-or-edit)
-    (define-key map "t" 'dired-toggle-marks)
-    (define-key map "u" 'dired-unmark)
-    (define-key map "v" 'dired-view-file)
-    (define-key map "w" 'dired-copy-filename-as-kill)
-    (define-key map "W" 'browse-url-of-dired-file)
-    (define-key map "x" 'dired-do-flagged-delete)
-    (define-key map "y" 'dired-show-file-type)
-    (define-key map "+" 'dired-create-directory)
-    ;; moving
-    (define-key map "<" 'dired-prev-dirline)
-    (define-key map ">" 'dired-next-dirline)
-    (define-key map "^" 'dired-up-directory)
-    (define-key map " " 'dired-next-line)
-    (define-key map [?\S-\ ] 'dired-previous-line)
-    (define-key map [remap next-line] 'dired-next-line)
-    (define-key map [remap previous-line] 'dired-previous-line)
-    ;; hiding
-    (define-key map "$" 'dired-hide-subdir)
-    (define-key map "\M-$" 'dired-hide-all)
-    (define-key map "(" 'dired-hide-details-mode)
-    ;; isearch
-    (define-key map (kbd "M-s a C-s")   'dired-do-isearch)
-    (define-key map (kbd "M-s a M-C-s") 'dired-do-isearch-regexp)
-    (define-key map (kbd "M-s f C-s")   'dired-isearch-filenames)
-    (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp)
-    ;; misc
-    (define-key map [remap read-only-mode] 'dired-toggle-read-only)
-    ;; `toggle-read-only' is an obsolete alias for `read-only-mode'
-    (define-key map [remap toggle-read-only] 'dired-toggle-read-only)
-    (define-key map "?" 'dired-summary)
-    (define-key map "\177" 'dired-unmark-backward)
-    (define-key map [remap undo] 'dired-undo)
-    (define-key map [remap advertised-undo] 'dired-undo)
-    (define-key map [remap vc-next-action] 'dired-vc-next-action)
-    ;; thumbnail manipulation (image-dired)
-    (define-key map "\C-td" 'image-dired-display-thumbs)
-    (define-key map "\C-tt" 'image-dired-tag-files)
-    (define-key map "\C-tr" 'image-dired-delete-tag)
-    (define-key map "\C-tj" 'image-dired-jump-thumbnail-buffer)
-    (define-key map "\C-ti" 'image-dired-dired-display-image)
-    (define-key map "\C-tx" 'image-dired-dired-display-external)
-    (define-key map "\C-ta" 'image-dired-display-thumbs-append)
-    (define-key map "\C-t." 'image-dired-display-thumb)
-    (define-key map "\C-tc" 'image-dired-dired-comment-files)
-    (define-key map "\C-tf" 'image-dired-mark-tagged-files)
-    (define-key map "\C-t\C-t" 'image-dired-dired-toggle-marked-thumbs)
-    (define-key map "\C-te" 'image-dired-dired-edit-comment-and-tags)
-    ;; encryption and decryption (epa-dired)
-    (define-key map ":d" 'epa-dired-do-decrypt)
-    (define-key map ":v" 'epa-dired-do-verify)
-    (define-key map ":s" 'epa-dired-do-sign)
-    (define-key map ":e" 'epa-dired-do-encrypt)
-    map)
-  "Local keymap for Dired mode buffers.")
+  ;;  "C-d" #'dired-flag-file-deletion
+  "<mouse-2>"     #'dired-mouse-find-file-other-window
+  "<follow-link>" 'mouse-face
+  ;; Commands to mark or flag certain categories of files
+  "#"       #'dired-flag-auto-save-files
+  "."       #'dired-clean-directory
+  "~"       #'dired-flag-backup-files
+  ;; Upper case keys (except !) for operating on the marked files
+  "A"       #'dired-do-find-regexp
+  "C"       #'dired-do-copy
+  "B"       #'dired-do-byte-compile
+  "D"       #'dired-do-delete
+  "G"       #'dired-do-chgrp
+  "H"       #'dired-do-hardlink
+  "L"       #'dired-do-load
+  "M"       #'dired-do-chmod
+  "O"       #'dired-do-chown
+  "P"       #'dired-do-print
+  "Q"       #'dired-do-find-regexp-and-replace
+  "R"       #'dired-do-rename
+  "S"       #'dired-do-symlink
+  "T"       #'dired-do-touch
+  "X"       #'dired-do-shell-command
+  "Z"       #'dired-do-compress
+  "c"       #'dired-do-compress-to
+  "!"       #'dired-do-shell-command
+  "&"       #'dired-do-async-shell-command
+  ;; Comparison commands
+  "="       #'dired-diff
+  ;; Tree Dired commands
+  "M-DEL"   #'dired-unmark-all-files
+  "C-M-d"   #'dired-tree-down
+  "C-M-u"   #'dired-tree-up
+  "C-M-n"   #'dired-next-subdir
+  "C-M-p"   #'dired-prev-subdir
+  ;; move to marked files
+  "M-{"     #'dired-prev-marked-file
+  "M-}"     #'dired-next-marked-file
+  ;; Make all regexp commands share a `%' prefix:
+  ;; We used to get to the submap via a symbol dired-regexp-prefix,
+  ;; but that seems to serve little purpose, and copy-keymap
+  ;; does a better job without it.
+  "% u"     #'dired-upcase
+  "% l"     #'dired-downcase
+  "% d"     #'dired-flag-files-regexp
+  "% g"     #'dired-mark-files-containing-regexp
+  "% m"     #'dired-mark-files-regexp
+  "% r"     #'dired-do-rename-regexp
+  "% C"     #'dired-do-copy-regexp
+  "% H"     #'dired-do-hardlink-regexp
+  "% R"     #'dired-do-rename-regexp
+  "% S"     #'dired-do-symlink-regexp
+  "% &"     #'dired-flag-garbage-files
+  ;; Commands for marking and unmarking.
+  "* *"     #'dired-mark-executables
+  "* /"     #'dired-mark-directories
+  "* @"     #'dired-mark-symlinks
+  "* %"     #'dired-mark-files-regexp
+  "* N"     #'dired-number-of-marked-files
+  "* c"     #'dired-change-marks
+  "* s"     #'dired-mark-subdir-files
+  "* m"     #'dired-mark
+  "* u"     #'dired-unmark
+  "* ?"     #'dired-unmark-all-files
+  "* !"     #'dired-unmark-all-marks
+  "U"       #'dired-unmark-all-marks
+  "* DEL"   #'dired-unmark-backward
+  "* C-n"   #'dired-next-marked-file
+  "* C-p"   #'dired-prev-marked-file
+  "* t"     #'dired-toggle-marks
+  ;; Lower keys for commands not operating on all the marked files
+  "a"       #'dired-find-alternate-file
+  "d"       #'dired-flag-file-deletion
+  "e"       #'dired-find-file
+  "f"       #'dired-find-file
+  "C-m"     #'dired-find-file
+  "g"       #'revert-buffer
+  "i"       #'dired-maybe-insert-subdir
+  "j"       #'dired-goto-file
+  "k"       #'dired-do-kill-lines
+  "l"       #'dired-do-redisplay
+  "m"       #'dired-mark
+  "n"       #'dired-next-line
+  "o"       #'dired-find-file-other-window
+  "C-o"     #'dired-display-file
+  "p"       #'dired-previous-line
+  "s"       #'dired-sort-toggle-or-edit
+  "t"       #'dired-toggle-marks
+  "u"       #'dired-unmark
+  "v"       #'dired-view-file
+  "w"       #'dired-copy-filename-as-kill
+  "W"       #'browse-url-of-dired-file
+  "x"       #'dired-do-flagged-delete
+  "y"       #'dired-show-file-type
+  "+"       #'dired-create-directory
+  ;; moving
+  "<"       #'dired-prev-dirline
+  ">"       #'dired-next-dirline
+  "^"       #'dired-up-directory
+  "SPC"     #'dired-next-line
+  "S-SPC"   #'dired-previous-line
+  "<remap> <next-line>"        #'dired-next-line
+  "<remap> <previous-line>"    #'dired-previous-line
+  ;; hiding
+  "$"       #'dired-hide-subdir
+  "M-$"     #'dired-hide-all
+  "("       #'dired-hide-details-mode
+  ;; isearch
+  "M-s a C-s"   #'dired-do-isearch
+  "M-s a C-M-s" #'dired-do-isearch-regexp
+  "M-s f C-s"   #'dired-isearch-filenames
+  "M-s f C-M-s" #'dired-isearch-filenames-regexp
+  ;; misc
+  "<remap> <read-only-mode>"   #'dired-toggle-read-only
+  ;; `toggle-read-only' is an obsolete alias for `read-only-mode'
+  "<remap> <toggle-read-only>" #'dired-toggle-read-only
+  "?"       #'dired-summary
+  "DEL"     #'dired-unmark-backward
+  "<remap> <undo>"             #'dired-undo
+  "<remap> <advertised-undo>"  #'dired-undo
+  "<remap> <vc-next-action>"   #'dired-vc-next-action
+  ;; thumbnail manipulation (image-dired)
+  "C-t d"   #'image-dired-display-thumbs
+  "C-t t"   #'image-dired-tag-files
+  "C-t r"   #'image-dired-delete-tag
+  "C-t j"   #'image-dired-jump-thumbnail-buffer
+  "C-t i"   #'image-dired-dired-display-image
+  "C-t x"   #'image-dired-dired-display-external
+  "C-t a"   #'image-dired-display-thumbs-append
+  "C-t ."   #'image-dired-display-thumb
+  "C-t c"   #'image-dired-dired-comment-files
+  "C-t f"   #'image-dired-mark-tagged-files
+  "C-t C-t" #'image-dired-dired-toggle-marked-thumbs
+  "C-t e"   #'image-dired-dired-edit-comment-and-tags
+  ;; encryption and decryption (epa-dired)
+  ": d"     #'epa-dired-do-decrypt
+  ": v"     #'epa-dired-do-verify
+  ": s"     #'epa-dired-do-sign
+  ": e"     #'epa-dired-do-encrypt)
+
+(put 'dired-find-file :advertised-binding (kbd "RET"))
 
 (easy-menu-define dired-mode-subdir-menu dired-mode-map
   "Subdir menu for Dired mode."
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index be8db75c96..da60840f8b 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -1,6 +1,6 @@
 ;;; dirtrack.el --- Directory Tracking by watching the prompt  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Sun Nov 17 1996
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index a7fc8f0a76..422728c61c 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -1,6 +1,6 @@
 ;;; disp-table.el --- functions for dealing with char tables  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1987, 1994-1995, 1999, 2001-2021 Free Software
+;; Copyright (C) 1987, 1994-1995, 1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Erik Naggum <erik@naggum.no>
diff --git a/lisp/display-fill-column-indicator.el 
b/lisp/display-fill-column-indicator.el
index 7e9d62c5d1..a13f6b547f 100644
--- a/lisp/display-fill-column-indicator.el
+++ b/lisp/display-fill-column-indicator.el
@@ -1,6 +1,6 @@
 ;;; display-fill-column-indicator.el --- interface for 
display-fill-column-indicator -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: convenience
diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
index 72928492bb..860aa758bc 100644
--- a/lisp/display-line-numbers.el
+++ b/lisp/display-line-numbers.el
@@ -1,6 +1,6 @@
 ;;; display-line-numbers.el --- interface for display-line-numbers -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: convenience
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 44316154b0..97e81e9bf1 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -1,6 +1,6 @@
 ;;; dnd.el --- drag and drop support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 11559bf2f5..5b462b24f5 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1,6 +1,6 @@
 ;;; doc-view.el --- Document viewer for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Tassilo Horn <tsdh@gnu.org>
 ;; Keywords: files, pdf, ps, dvi
diff --git a/lisp/dom.el b/lisp/dom.el
index 71793c0d67..f8c794a300 100644
--- a/lisp/dom.el
+++ b/lisp/dom.el
@@ -1,6 +1,6 @@
 ;;; dom.el --- XML/HTML (etc.) DOM manipulation and searching functions -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: xml, html
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index 07c77faa23..ea54eea603 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -1,6 +1,6 @@
 ;;; dos-fns.el --- MS-Dos specific functions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1991, 1993, 1995-1996, 2001-2021 Free Software
+;; Copyright (C) 1991, 1993, 1995-1996, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/dos-vars.el b/lisp/dos-vars.el
index 7fcbb56d22..87a758f408 100644
--- a/lisp/dos-vars.el
+++ b/lisp/dos-vars.el
@@ -1,6 +1,6 @@
 ;;; dos-vars.el --- MS-Dos specific user options  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el
index 45daaad8ef..8bfbf4ffde 100644
--- a/lisp/dos-w32.el
+++ b/lisp/dos-w32.el
@@ -1,6 +1,6 @@
 ;;; dos-w32.el --- Functions shared among MS-DOS and W32 (NT/95) platforms  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Geoff Voelker <voelker@cs.washington.edu>
 ;; Keywords: internal
diff --git a/lisp/double.el b/lisp/double.el
index f9227a8bbd..d990fa8d90 100644
--- a/lisp/double.el
+++ b/lisp/double.el
@@ -1,6 +1,6 @@
 ;;; double.el --- support for keyboard remapping with double clicking  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994, 1997-1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1994, 1997-1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el
index 6b037aa2a6..8ac9a1e9e6 100644
--- a/lisp/dynamic-setting.el
+++ b/lisp/dynamic-setting.el
@@ -1,6 +1,6 @@
 ;;; dynamic-setting.el --- Support dynamic changes  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index 7fecf1a504..0c3d4af569 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -1,6 +1,6 @@
 ;;; ebuff-menu.el --- electric-buffer-list mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Richard Mlynarik <mly@ai.mit.edu>
diff --git a/lisp/echistory.el b/lisp/echistory.el
index 15679b13d5..809010d016 100644
--- a/lisp/echistory.el
+++ b/lisp/echistory.el
@@ -1,6 +1,6 @@
 ;;; echistory.el --- Electric Command History Mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el
index 105edc48a0..260657e0f7 100644
--- a/lisp/ecomplete.el
+++ b/lisp/ecomplete.el
@@ -1,6 +1,6 @@
 ;;; ecomplete.el --- electric completion of addresses and the like  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 78faf46e30..40742d0085 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -1,6 +1,6 @@
 ;;; edmacro.el --- keyboard macro editor  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: abbrev
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index aa809d6f6f..8c1555249c 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -1,6 +1,6 @@
 ;;; ehelp.el --- bindings for electric-help mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard Mlynarik
 ;; (according to ack.texi and authors.el)
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index f907bba4c6..c3fd90e5bf 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -1,6 +1,6 @@
 ;;; elec-pair.el --- Automatic parenthesis pairing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 
diff --git a/lisp/electric.el b/lisp/electric.el
index a2f24ca05c..905d4a87c7 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -1,6 +1,6 @@
 ;;; electric.el --- window maker and Command loop for `electric' modes  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1986, 1995, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1995, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: K. Shane Hartman
diff --git a/lisp/elide-head.el b/lisp/elide-head.el
index c0857e3938..dab51cabc4 100644
--- a/lisp/elide-head.el
+++ b/lisp/elide-head.el
@@ -1,6 +1,6 @@
 ;;; elide-head.el --- hide headers in files  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: outlines tools
@@ -50,13 +50,24 @@
   :group 'tools)
 
 (defcustom elide-head-headers-to-hide
-  '(("is free software[:;] you can redistribute it" . ; GNU boilerplate
-     "\\(Boston, MA 0211\\(1-1307\\|0-1301\\), USA\\|\
-If not, see <https?://www\\.gnu\\.org/licenses/>\\)\\.")
-    ("The Regents of the University of California\\.  All rights reserved\\." .
-     "SUCH DAMAGE\\.")                               ; BSD
-    ("Permission is hereby granted, free of charge" . ; X11
-     "authorization from the X Consortium\\."))
+  `(;; GNU GPL
+    ("is free software[:;] you can redistribute it" .
+     ,(rx (or (seq "If not, see " (? "<")
+                   "http" (? "s") "://www.gnu.org/licenses/"
+                   (? ">") (? " "))
+              (seq "Boston, MA " (? " ")
+                   "0211" (or "1-1307" "0-1301")
+                   (or "  " ", ") "USA")
+              "675 Mass Ave, Cambridge, MA 02139, USA")
+          (? ".")))
+    ;; FreeBSD license / Modified BSD license (3-clause)
+    (,(rx (or "The Regents of the University of California.  All rights 
reserved."
+              "Redistribution and use in source and binary"))
+     . "POSSIBILITY OF SUCH DAMAGE\\.")
+    ;; X11 and Expat
+    ("Permission is hereby granted, free of charge" .
+     ,(rx (or "authorization from the X Consortium."           ; X11
+              "THE USE OR OTHER DEALINGS IN THE SOFTWARE.")))) ; Expat
   "Alist of regexps defining start and end of text to elide.
 
 The cars of elements of the list are searched for in order.  Text is
@@ -64,7 +75,8 @@ elided with an invisible overlay from the end of the line 
where the
 first match is found to the end of the match for the corresponding
 cdr."
   :type '(alist :key-type  (regexp :tag "Start regexp")
-               :value-type (regexp :tag "End regexp")))
+                :value-type (regexp :tag "End regexp"))
+  :version "29.1")
 
 (defvar-local elide-head-overlay nil)
 
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 15e413e0e8..8e43ae6807 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -1,6 +1,6 @@
 ;;; advice.el --- An overloading mechanism for Emacs Lisp functions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Hans Chalupsky <hans@cs.buffalo.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index d8b4c1f885..a51fd8ca25 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -1,6 +1,6 @@
 ;;; autoload.el --- maintain autoloads in loaddefs.el  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1991-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
 ;; Keywords: maint
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index 3f803107a1..8886d84b2d 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -1,6 +1,6 @@
 ;;; avl-tree.el --- balanced binary trees, AVL-trees  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1995, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Cederqvist <ceder@lysator.liu.se>
 ;;         Inge Wallin <inge@lysator.liu.se>
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index fe39e8d099..3aef4a28bb 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -1,6 +1,6 @@
 ;;; backquote.el --- implement the ` Lisp construct  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1990, 1992, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1990, 1992, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Rick Sladkey <jrs@world.std.com>
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index a8b484aee0..3231877a30 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -1,6 +1,6 @@
 ;;; backtrace.el --- generic major mode for Elisp backtraces -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 ;; Keywords: lisp, tools, maint
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index 64c628822d..c5f621c6c8 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -1,6 +1,6 @@
 ;;; benchmark.el --- support for benchmarking code  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: lisp, extensions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el
index 76c2e80fda..c6d64975ec 100644
--- a/lisp/emacs-lisp/bindat.el
+++ b/lisp/emacs-lisp/bindat.el
@@ -1,6 +1,6 @@
 ;;; bindat.el --- binary data structure packing and unpacking.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Assignment name: struct.el
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 2bdf1f5511..bd57e2b203 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1,6 +1,6 @@
 ;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1991, 1994, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
 ;;     Hallvard Furuseth <hbf@ulrik.uio.no>
@@ -1464,6 +1464,7 @@ See Info node `(elisp) Integer Basics'."
 (let ((side-effect-free-fns
        '(% * + - / /= 1+ 1- < <= = > >= abs acos append aref ash asin atan
         assq
+         base64-decode-string base64-encode-string base64url-encode-string
          bool-vector-count-consecutive bool-vector-count-population
          bool-vector-subsetp
         boundp buffer-file-name buffer-local-variables buffer-modified-p
@@ -1620,6 +1621,7 @@ See Info node `(elisp) Integer Basics'."
          assq rassq rassoc
          plist-get lax-plist-get plist-member
          aref elt
+         base64-decode-string base64-encode-string base64url-encode-string
          bool-vector-subsetp
          bool-vector-count-population bool-vector-count-consecutive
          )))
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 2ce2efd2aa..47f331fd9d 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -1,6 +1,6 @@
 ;;; byte-run.el --- byte-compiler support for inlining  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
 ;;     Hallvard Furuseth <hbf@ulrik.uio.no>
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index f52a673ab3..0f130bf626 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1,6 +1,6 @@
 ;;; bytecomp.el --- compilation of Lisp code into byte code -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 1994, 1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1987, 1992, 1994, 1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
@@ -510,7 +510,7 @@ Return the compile-time value of FORM."
                               ;; whether to compile as byte-compile-form
                               ;; or byte-compile-file-form.
                               (let ((expanded
-                                     (macroexpand-all
+                                     (macroexpand--all-toplevel
                                       form
                                       macroexpand-all-environment)))
                                 (eval expanded lexical-binding)
@@ -2677,15 +2677,6 @@ list that represents a doc string reference.
   (prog1 (byte-compile-keep-pending form)
     (apply 'make-obsolete (mapcar 'eval (cdr form)))))
 
-;; This handler is not necessary, but it makes the output from dont-compile
-;; and similar macros cleaner.
-(put 'eval 'byte-hunk-handler 'byte-compile-file-form-eval)
-(defun byte-compile-file-form-eval (form)
-  (if (and (eq (car-safe (nth 1 form)) 'quote)
-           (equal (nth 2 form) lexical-binding))
-      (nth 1 (nth 1 form))
-    (byte-compile-keep-pending form)))
-
 (defun byte-compile-file-form-defmumble (name macro arglist body rest)
   "Process a `defalias' for NAME.
 If MACRO is non-nil, the definition is known to be a macro.
@@ -4935,13 +4926,13 @@ binding slots have been popped."
   ;; if it weren't for the fact that we need to figure out when a defalias
   ;; defines a macro, so as to add it to byte-compile-macro-environment.
   ;;
-  ;; FIXME: we also use this hunk-handler to implement the function's dynamic
-  ;; docstring feature.  We could actually implement it more elegantly in
-  ;; byte-compile-lambda so it applies to all lambdas, but the problem is that
-  ;; the resulting .elc format will not be recognized by make-docfile, so
-  ;; either we stop using DOC for the docstrings of preloaded elc files (at the
-  ;; cost of around 24KB on 32bit hosts, double on 64bit hosts) or we need to
-  ;; build DOC in a more clever way (e.g. handle anonymous elements).
+  ;; FIXME: we also use this hunk-handler to implement the function's
+  ;; dynamic docstring feature (via byte-compile-file-form-defmumble).
+  ;; We should actually implement it (more elegantly) in
+  ;; byte-compile-lambda so it applies to all lambdas.  We did it here
+  ;; so the resulting .elc format was recognizable by make-docfile,
+  ;; but since then we stopped using DOC for the docstrings of
+  ;; preloaded elc files so that obstacle is gone.
   (let ((byte-compile-free-references nil)
         (byte-compile-free-assignments nil))
     (pcase form
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 90d2157847..11e1a0aa08 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -1,6 +1,6 @@
 ;;; cconv.el --- Closure conversion for statically scoped Emacs Lisp. -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Igor Kuzmin <kzuminig@iro.umontreal.ca>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 0494497fea..4186a541f8 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -1,6 +1,6 @@
 ;;; chart.el --- Draw charts (bar charts, etc)  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2021 Free
+;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el
index 83a9d3ea6a..eeefb3de10 100644
--- a/lisp/emacs-lisp/check-declare.el
+++ b/lisp/emacs-lisp/check-declare.el
@@ -1,6 +1,6 @@
 ;;; check-declare.el --- Check declare-function statements  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <rgm@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index ab2f34c310..334988e713 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1,6 +1,6 @@
 ;;; checkdoc.el --- check documentation strings for style requirements  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Old-Version: 0.6.2
@@ -161,6 +161,7 @@
 
 ;;; Code:
 
+(require 'bytecomp)  ;; for byte-compile-docstring-max-column
 (require 'cl-lib)
 (require 'help-mode) ;; for help-xref-info-regexp
 (require 'thingatpt) ;; for handy thing-at-point-looking-at
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 499d26b737..ed9b1b7d83 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -1,6 +1,6 @@
 ;;; cl-extra.el --- Common Lisp features, part 2  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index e8923ade74..90c82dbdab 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -612,7 +612,9 @@ The set of acceptable TYPEs (also called \"specializers\") 
is defined
 
 (defun cl--generic-get-dispatcher (dispatch)
   (with-memoization
-      (gethash dispatch cl--generic-dispatchers)
+      ;; We need `copy-sequence` here because this `dispatch' object might be
+      ;; modified by side-effect in `cl-generic-define-method' (bug#46722).
+      (gethash (copy-sequence dispatch) cl--generic-dispatchers)
     ;; (message "cl--generic-get-dispatcher (%S)" dispatch)
     (let* ((dispatch-arg (car dispatch))
            (generalizers (cdr dispatch))
diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
index 9d8aae2844..213eecf88d 100644
--- a/lisp/emacs-lisp/cl-indent.el
+++ b/lisp/emacs-lisp/cl-indent.el
@@ -1,6 +1,6 @@
 ;;; cl-indent.el --- Enhanced lisp-indent mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1987, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard Mlynarik <mly@eddie.mit.edu>
 ;; Created: July 1987
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index b01a32ca60..4e60a3c63d 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -1,6 +1,6 @@
 ;;; cl-lib.el --- Common Lisp extensions for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Version: 1.0
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 21b877c630..dc8d3d6c54 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2146,9 +2146,14 @@ Like `cl-flet' but the definitions can refer to previous 
ones.
                    ;; setq the fresh new `ofargs' vars instead ;-)
                    (let ((shadowings
                           (mapcar (lambda (b) (if (consp b) (car b) b)) 
bindings)))
-                     ;; If `var' is shadowed, then it clearly can't be
-                     ;; tail-called any more.
-                     (not (memq var shadowings)))))
+                     (and
+                      ;; If `var' is shadowed, then it clearly can't be
+                      ;; tail-called any more.
+                      (not (memq var shadowings))
+                      ;; If any of the new bindings is a dynamic
+                      ;; variable, the body is not in tail position.
+                      (not (delq nil (mapcar #'macroexp--dynamic-variable-p
+                                             shadowings)))))))
              `(,(car exp) ,bindings . ,(funcall opt-exps exps)))
             ((and `(condition-case ,err-var ,bodyform . ,handlers)
                   (guard (not (eq err-var var))))
diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 0131913a06..30d7e6525a 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -1,6 +1,6 @@
 ;;; cl-print.el --- CL-style generic printing  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index 329bd7c1b3..64ae05bf2a 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -1,6 +1,6 @@
 ;;; cl-seq.el --- Common Lisp features, part 3  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Old-Version: 2.02
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 3e81619520..ad956dabd8 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -1,6 +1,6 @@
 ;;; comp-cstr.el --- native compiler constraint library -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.com>
 ;; Keywords: lisp
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index b51224088f..cf2dbd62f1 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1,6 +1,6 @@
 ;;; comp.el --- compilation of Lisp code into native code -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.com>
 ;; Keywords: lisp
@@ -1181,7 +1181,9 @@ clashes."
                           for i across orig-name
                           for byte = (format "%x" i)
                           do (aset str j (aref byte 0))
-                             (aset str (1+ j) (aref byte 1))
+                             (aset str (1+ j) (if (length> byte 1)
+                                                  (aref byte 1)
+                                                ?\_))
                           finally return str))
          (human-readable (string-replace
                           "-" "_" orig-name))
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 9da370a725..09c6ded295 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -1,6 +1,6 @@
 ;;; copyright.el --- update the copyright notice in current buffer  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1991-1995, 1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1991-1995, 1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 9ac4747f54..2d939ac7db 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -1,6 +1,6 @@
 ;;; crm.el --- read multiple strings with completion  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1985-1986, 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Sen Nagata <sen@eccosys.com>
 ;; Keywords: completion, minibuffer, multiple elements
diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el
index ffeddadd57..a3b40ef8b2 100644
--- a/lisp/emacs-lisp/cursor-sensor.el
+++ b/lisp/emacs-lisp/cursor-sensor.el
@@ -1,6 +1,6 @@
 ;;; cursor-sensor.el --- React to cursor movement  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 163528acf6..46b0306d64 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -1,6 +1,6 @@
 ;;; debug.el --- debuggers and related commands for Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index af5eecc22a..b9958f4951 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -1,7 +1,7 @@
 ;;; derived.el --- allow inheritance of major modes  -*- lexical-binding: t; 
-*-
 ;; (formerly mode-clone.el)
 
-;; Copyright (C) 1993-1994, 1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1993-1994, 1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: David Megginson (dmeggins@aix1.uottawa.ca)
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 6c019e7387..d6a3636e60 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -1,6 +1,6 @@
 ;;; disass.el --- disassembler for compiled Emacs Lisp code  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1986, 1991, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1991, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Doug Cutting <doug@csli.stanford.edu>
 ;;     Jamie Zawinski <jwz@lucid.com>
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index db86e0e029..2d95e91833 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -1,6 +1,6 @@
 ;;; easy-mmode.el --- easy definition for major and minor modes  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Georges Brun-Cottan <Georges.Brun-Cottan@inria.fr>
 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 360e685ea0..43ce1872f9 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -1,6 +1,6 @@
 ;;; easymenu.el --- support the easymenu interface for defining a menu  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994, 1996, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1996, 1998-2022 Free Software Foundation, Inc.
 
 ;; Keywords: emulations
 ;; Author: Richard Stallman <rms@gnu.org>
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index ac1cd22ac2..fe97804ec4 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1,6 +1,6 @@
 ;;; edebug.el --- a source-level debugger for Emacs Lisp  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1988-1995, 1997, 1999-2021 Free Software Foundation,
+;; Copyright (C) 1988-1995, 1997, 1999-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 5414c32c34..4c702deaa9 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -1,6 +1,6 @@
 ;;; eieio-base.el --- Base classes for EIEIO.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: OO, lisp
diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el
index 4813ce8c33..ebb6f2cd8c 100644
--- a/lisp/emacs-lisp/eieio-custom.el
+++ b/lisp/emacs-lisp/eieio-custom.el
@@ -1,6 +1,6 @@
 ;;; eieio-custom.el --- eieio object customization  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2001, 2005, 2007-2021 Free Software Foundation,
+;; Copyright (C) 1999-2001, 2005, 2007-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/emacs-lisp/eieio-datadebug.el 
b/lisp/emacs-lisp/eieio-datadebug.el
index 9e89ce8917..d10804b36a 100644
--- a/lisp/emacs-lisp/eieio-datadebug.el
+++ b/lisp/emacs-lisp/eieio-datadebug.el
@@ -1,6 +1,6 @@
 ;;; eieio-datadebug.el --- EIEIO extensions to the data debugger.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: OO, lisp
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index 680395387c..72108f807f 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -1,6 +1,6 @@
 ;;; eieio-opt.el --- eieio optional functions (debug, printing, speedbar)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996, 1998-2003, 2005, 2008-2021 Free Software
+;; Copyright (C) 1996, 1998-2003, 2005, 2008-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/emacs-lisp/eieio-speedbar.el 
b/lisp/emacs-lisp/eieio-speedbar.el
index 86b22cad73..cc201b5d9c 100644
--- a/lisp/emacs-lisp/eieio-speedbar.el
+++ b/lisp/emacs-lisp/eieio-speedbar.el
@@ -1,6 +1,6 @@
 ;;; eieio-speedbar.el --- Classes for managing speedbar displays.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2002, 2005, 2007-2021 Free Software Foundation,
+;; Copyright (C) 1999-2002, 2005, 2007-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index cd0e7dca7c..74a20b8a8b 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -1,6 +1,6 @@
 ;;; eldoc.el --- Show function arglist or variable docstring in echo area  -*- 
lexical-binding:t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Noah Friedman <friedman@splode.com>
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index 32b2cbdb45..ab141489c4 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -1,6 +1,6 @@
 ;;; elint.el --- Lint Emacs Lisp -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter Liljenberg <petli@lysator.liu.se>
 ;; Created: May 1997
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index fde7947a27..e5c94c09c2 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -1,6 +1,6 @@
 ;;; elp.el --- Emacs Lisp Profiler  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw
 ;; Maintainer: emacs-devel@gnu.org
@@ -298,10 +298,18 @@ For example, to instrument all ELP functions, do the 
following:
     'intern
     (all-completions prefix obarray 'elp-profilable-p))))
 
+(defun elp-restore-package (prefix)
+  "Remove instrumentation from functions with names starting with PREFIX."
+  (interactive "SPrefix: ")
+  (elp-restore-list
+   (mapcar #'intern
+           (all-completions (symbol-name prefix)
+                            obarray 'elp-profilable-p))))
+
 (defun elp-restore-list (&optional list)
   "Restore the original definitions for all functions in `elp-function-list'.
 Use optional LIST if provided instead."
-  (interactive "PList of functions to restore: ") ;FIXME: Doesn't work!?
+  (interactive)
   (mapcar #'elp-restore-function (or list elp-function-list)))
 
 (defun elp-restore-all ()
@@ -323,7 +331,7 @@ Use optional LIST if provided instead."
 (defun elp-reset-list (&optional list)
   "Reset the profiling information for all functions in `elp-function-list'.
 Use optional LIST if provided instead."
-  (interactive "PList of functions to reset: ") ;FIXME: Doesn't work!?
+  (interactive)
   (let ((list (or list elp-function-list)))
     (mapcar 'elp-reset-function list)))
 
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index 7fc316d146..2818d4b6cc 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -1,6 +1,6 @@
 ;;; ert-x.el --- Staging area for experimental extensions to ERT  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
 ;;         Christian Ohler <ohler@gnu.org>
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 946193e40d..e31ebf5f7b 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1,6 +1,6 @@
 ;;; ert.el --- Emacs Lisp Regression Testing  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2008, 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Christian Ohler <ohler@gnu.org>
 ;; Keywords: lisp, tools
@@ -39,7 +39,7 @@
 ;; but signals a different error when its condition is violated that
 ;; is caught and processed by ERT.  In addition, it analyzes its
 ;; argument form and records information that helps debugging
-;; (`assert' tries to do something similar when its second argument
+;; (`cl-assert' tries to do something similar when its second argument
 ;; SHOW-ARGS is true, but `should' is more sophisticated).  For
 ;; information on `should-not' and `should-error', see their
 ;; docstrings.  `skip-unless' skips the test immediately without
@@ -65,6 +65,8 @@
 (require 'pp)
 (require 'map)
 
+(autoload 'xml-escape-string "xml.el")
+
 ;;; UI customization options.
 
 (defgroup ert ()
@@ -247,7 +249,6 @@ in batch mode, an error is signalled.
           "%s\\(\\s-\\|$\\)")
   "The regexp the `find-function' mechanisms use for finding test 
definitions.")
 
-
 (define-error 'ert-test-failed "Test failed")
 (define-error 'ert-test-skipped "Test skipped")
 
@@ -677,7 +678,6 @@ and is displayed in front of the value of MESSAGE-FORM."
      ,@body))
 
 
-
 ;;; Facilities for running a single test.
 
 (defvar ert-debug-on-error nil
@@ -950,7 +950,8 @@ t    -- Selects UNIVERSE.
 :expected, :unexpected -- Select tests according to their most recent result.
 a string -- A regular expression selecting all tests with matching names.
 a test   -- (i.e., an object of the ert-test data-type) Selects that test.
-a symbol -- Selects the test that the symbol names, errors if none.
+a symbol -- Selects the test that the symbol names, signals an
+    `ert-test-unbound' error if none.
 \(member TESTS...) -- Selects the elements of TESTS, a list of tests
     or symbols naming tests.
 \(eql TEST) -- Selects TEST, a test or a symbol naming a test.
@@ -1012,52 +1013,47 @@ contained in UNIVERSE."
                           universe))))
     ((pred ert-test-p) (list selector))
     ((pred symbolp)
-     (cl-assert (ert-test-boundp selector))
+     (unless (ert-test-boundp selector)
+       (signal 'ert-test-unbound (list selector)))
      (list (ert-get-test selector)))
-    (`(,operator . ,operands)
-     (cl-ecase operator
-       (member
-        (mapcar (lambda (purported-test)
-                  (pcase-exhaustive purported-test
-                    ((pred symbolp)
-                     (cl-assert (ert-test-boundp purported-test))
-                     (ert-get-test purported-test))
-                    ((pred ert-test-p) purported-test)))
-                operands))
-       (eql
-        (cl-assert (eql (length operands) 1))
-        (ert-select-tests `(member ,@operands) universe))
-       (and
-        ;; Do these definitions of AND, NOT and OR satisfy de
-        ;; Morgan's laws?  Should they?
-        (cl-case (length operands)
-          (0 (ert-select-tests 't universe))
-          (t (ert-select-tests `(and ,@(cdr operands))
-                               (ert-select-tests (car operands)
-                                                 universe)))))
-       (not
-        (cl-assert (eql (length operands) 1))
-        (let ((all-tests (ert-select-tests 't universe)))
-          (cl-set-difference all-tests
-                             (ert-select-tests (car operands)
-                                               all-tests))))
-       (or
-        (cl-case (length operands)
-          (0 (ert-select-tests 'nil universe))
-          (t (cl-union (ert-select-tests (car operands) universe)
-                       (ert-select-tests `(or ,@(cdr operands))
-                                         universe)))))
-       (tag
-        (cl-assert (eql (length operands) 1))
-        (let ((tag (car operands)))
-          (ert-select-tests `(satisfies
-                              ,(lambda (test)
-                                 (member tag (ert-test-tags test))))
-                            universe)))
-       (satisfies
-        (cl-assert (eql (length operands) 1))
-        (cl-remove-if-not (car operands)
-                          (ert-select-tests 't universe)))))))
+    (`(member . ,operands)
+     (mapcar (lambda (purported-test)
+               (pcase-exhaustive purported-test
+                 ((pred symbolp)
+                  (unless (ert-test-boundp purported-test)
+                    (signal 'ert-test-unbound
+                            (list purported-test)))
+                  (ert-get-test purported-test))
+                 ((pred ert-test-p) purported-test)))
+             operands))
+    (`(eql ,operand)
+     (ert-select-tests `(member ,operand) universe))
+    ;; Do these definitions of AND, NOT and OR satisfy de Morgan's
+    ;; laws?  Should they?
+    (`(and)
+     (ert-select-tests 't universe))
+    (`(and ,first . ,rest)
+     (ert-select-tests `(and ,@rest)
+                       (ert-select-tests first universe)))
+    (`(not ,operand)
+     (let ((all-tests (ert-select-tests 't universe)))
+       (cl-set-difference all-tests
+                          (ert-select-tests operand all-tests))))
+    (`(or)
+     (ert-select-tests 'nil universe))
+    (`(or ,first . ,rest)
+     (cl-union (ert-select-tests first universe)
+               (ert-select-tests `(or ,@rest) universe)))
+    (`(tag ,tag)
+     (ert-select-tests `(satisfies
+                         ,(lambda (test)
+                            (member tag (ert-test-tags test))))
+                       universe))
+    (`(satisfies ,predicate)
+     (cl-remove-if-not predicate
+                       (ert-select-tests 't universe)))))
+
+(define-error 'ert-test-unbound "ERT test is unbound")
 
 (defun ert--insert-human-readable-selector (selector)
   "Insert a human-readable presentation of SELECTOR into the current buffer."
@@ -1437,7 +1433,9 @@ Returns the stats object."
                                   (if (getenv "EMACS_TEST_VERBOSE")
                                       (ert-reason-for-test-result result)
                                     ""))))
-              (message "%s" "")))))
+              (message "%s" ""))
+            (when (getenv "EMACS_TEST_JUNIT_REPORT")
+              (ert-write-junit-test-report stats)))))
        (test-started)
        (test-ended
         (cl-destructuring-bind (stats test result) event-args
@@ -1525,6 +1523,183 @@ the tests)."
           (backtrace))
       (kill-emacs 2))))
 
+(defvar ert-load-file-name nil
+  "The name of the loaded ERT test file, a string.
+Usually, it is not needed to be defined, but if different ERT
+test packages depend on each other, it might be helpful.")
+
+(defun ert-write-junit-test-report (stats)
+  "Write a JUnit test report, generated from STATS."
+  ;; 
https://www.ibm.com/docs/en/developer-for-zos/14.1.0?topic=formats-junit-xml-format
+  ;; https://llg.cubic.org/docs/junit/
+  (when-let ((symbol (car (apropos-internal "" #'ert-test-boundp)))
+             (test-file (symbol-file symbol 'ert--test))
+             (test-report
+              (file-name-with-extension
+               (or ert-load-file-name test-file) "xml")))
+    (with-temp-file test-report
+      (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
+      (insert (format "<testsuites name=\"%s\" tests=\"%s\" errors=\"%s\" 
failures=\"%s\" skipped=\"%s\" time=\"%s\">\n"
+                      (file-name-nondirectory test-report)
+                      (ert-stats-total stats)
+                      (if (ert--stats-aborted-p stats) 1 0)
+                      (ert-stats-completed-unexpected stats)
+                      (ert-stats-skipped stats)
+                      (float-time
+                       (time-subtract
+                        (ert--stats-end-time stats)
+                        (ert--stats-start-time stats)))))
+      (insert (format "  <testsuite id=\"0\" name=\"%s\" tests=\"%s\" 
errors=\"%s\" failures=\"%s\" skipped=\"%s\" time=\"%s\" timestamp=\"%s\">\n"
+                      (file-name-nondirectory test-report)
+                      (ert-stats-total stats)
+                      (if (ert--stats-aborted-p stats) 1 0)
+                      (ert-stats-completed-unexpected stats)
+                      (ert-stats-skipped stats)
+                      (float-time
+                       (time-subtract
+                        (ert--stats-end-time stats)
+                        (ert--stats-start-time stats)))
+                      (ert--format-time-iso8601 (ert--stats-end-time stats))))
+      ;; If the test has aborted, `ert--stats-selector' might return
+      ;; huge junk.  Skip this.
+      (when (< (length (format "%s" (ert--stats-selector stats))) 1024)
+        (insert "    <properties>\n"
+                (format "      <property name=\"selector\" value=\"%s\"/>\n"
+                        (xml-escape-string
+                         (format "%s" (ert--stats-selector stats)) 'noerror))
+                "    </properties>\n"))
+      (cl-loop for test across (ert--stats-tests stats)
+               for result = (ert-test-most-recent-result test) do
+               (insert (format "    <testcase name=\"%s\" status=\"%s\" 
time=\"%s\""
+                               (xml-escape-string
+                                (symbol-name (ert-test-name test)) 'noerror)
+                               (ert-string-for-test-result
+                                result
+                                (ert-test-result-expected-p test result))
+                               (ert-test-result-duration result)))
+               (if (and (ert-test-result-expected-p test result)
+                        (not (ert-test-aborted-with-non-local-exit-p result))
+                        (not (ert-test-skipped-p result))
+                        (zerop (length (ert-test-result-messages result))))
+                   (insert "/>\n")
+                 (insert ">\n")
+                 (cond
+                  ((ert-test-skipped-p result)
+                   (insert (format "      <skipped message=\"%s\" 
type=\"%s\">\n"
+                                   (xml-escape-string
+                                    (string-trim
+                                     (ert-reason-for-test-result result))
+                                    'noerror)
+                                   (ert-string-for-test-result
+                                    result
+                                    (ert-test-result-expected-p
+                                     test result)))
+                           (xml-escape-string
+                            (string-trim
+                             (ert-reason-for-test-result result))
+                            'noerror)
+                           "\n"
+                           "      </skipped>\n"))
+                  ((ert-test-aborted-with-non-local-exit-p result)
+                   (insert (format "      <error message=\"%s\" type=\"%s\">\n"
+                                   (file-name-nondirectory test-report)
+                                   (ert-string-for-test-result
+                                    result
+                                    (ert-test-result-expected-p
+                                     test result)))
+                           (format "Test %s aborted with non-local exit\n"
+                                   (xml-escape-string
+                                    (symbol-name (ert-test-name test)) 
'noerror))
+                           "      </error>\n"))
+                  ((not (ert-test-result-type-p
+                         result (ert-test-expected-result-type test)))
+                   (insert (format "      <failure message=\"%s\" 
type=\"%s\">\n"
+                                   (xml-escape-string
+                                    (string-trim
+                                     (ert-reason-for-test-result result))
+                                    'noerror)
+                                   (ert-string-for-test-result
+                                    result
+                                    (ert-test-result-expected-p
+                                     test result)))
+                           (xml-escape-string
+                            (string-trim
+                             (ert-reason-for-test-result result))
+                            'noerror)
+                           "\n"
+                           "      </failure>\n")))
+                 (unless (zerop (length (ert-test-result-messages result)))
+                   (insert "      <system-out>\n"
+                           (xml-escape-string
+                            (ert-test-result-messages result) 'noerror)
+                           "      </system-out>\n"))
+                 (insert "    </testcase>\n")))
+      (insert "  </testsuite>\n")
+      (insert "</testsuites>\n"))))
+
+(defun ert-write-junit-test-summary-report (&rest logfiles)
+  "Write a JUnit summary test report, generated from LOGFILES."
+  (let ((report (file-name-with-extension
+                 (getenv "EMACS_TEST_JUNIT_REPORT") "xml"))
+        (tests 0) (errors 0) (failures 0) (skipped 0) (time 0) (id 0))
+    (with-temp-file report
+      (dolist (logfile logfiles)
+        (let ((test-report (file-name-with-extension logfile "xml")))
+          (if (not (file-readable-p test-report))
+              (let* ((logfile (file-name-with-extension logfile "log"))
+                     (logfile-contents
+                      (when (file-readable-p logfile)
+                        (with-temp-buffer
+                          (insert-file-contents-literally logfile)
+                          (buffer-string)))))
+                (unless
+                    ;; No defined tests, perhaps a helper file.
+                    (and logfile-contents
+                         (string-match-p "^Running 0 tests" logfile-contents))
+                  (insert (format "  <testsuite id=\"%s\" name=\"%s\" 
tests=\"1\" errors=\"1\" failures=\"0\" skipped=\"0\" time=\"0\" 
timestamp=\"%s\">\n"
+                                  id test-report
+                                  (ert--format-time-iso8601 (current-time))))
+                  (insert (format "    <testcase name=\"Test report missing 
%s\" status=\"error\" time=\"0\">\n"
+                                  (file-name-nondirectory test-report)))
+                  (insert (format "      <error message=\"Test report missing 
%s\" type=\"error\">\n"
+                                  (file-name-nondirectory test-report)))
+                  (when logfile-contents
+                    (insert (xml-escape-string logfile-contents 'noerror)))
+                  (insert "      </error>\n"
+                          "    </testcase>\n"
+                          "  </testsuite>\n")
+                  (cl-incf errors 1)
+                  (cl-incf id 1)))
+
+            (insert-file-contents-literally test-report)
+            (when (looking-at-p
+                   (regexp-quote "<?xml version=\"1.0\" encoding=\"utf-8\"?>"))
+              (delete-region (point) (line-beginning-position 2)))
+            (when (looking-at
+                   "<testsuites name=\".+\" tests=\"\\(.+\\)\" 
errors=\"\\(.+\\)\" failures=\"\\(.+\\)\" skipped=\"\\(.+\\)\" 
time=\"\\(.+\\)\">")
+              (cl-incf tests (string-to-number (match-string 1)))
+              (cl-incf errors  (string-to-number (match-string 2)))
+              (cl-incf failures  (string-to-number (match-string 3)))
+              (cl-incf skipped (string-to-number (match-string 4)))
+              (cl-incf time (string-to-number (match-string 5)))
+              (delete-region (point) (line-beginning-position 2)))
+            (when (looking-at "  <testsuite id=\"\\(0\\)\"")
+              (replace-match (number-to-string id) nil nil nil 1)
+              (cl-incf id 1))
+            (goto-char (point-max))
+            (beginning-of-line 0)
+            (when (looking-at-p "</testsuites>")
+              (delete-region (point) (line-beginning-position 2))))
+
+          (narrow-to-region (point-max) (point-max))))
+
+      (insert "</testsuites>\n")
+      (widen)
+      (goto-char (point-min))
+      (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
+      (insert (format "<testsuites name=\"%s\" tests=\"%s\" errors=\"%s\" 
failures=\"%s\" skipped=\"%s\" time=\"%s\">\n"
+                      (file-name-nondirectory report)
+                      tests errors failures skipped time)))))
 
 (defun ert-summarize-tests-batch-and-exit (&optional high)
   "Summarize the results of testing.
@@ -1540,6 +1715,8 @@ If HIGH is a natural number, the HIGH long lasting tests 
are summarized."
   ;; behavior.
   (setq attempt-stack-overflow-recovery nil
         attempt-orderly-shutdown-on-fatal-signal nil)
+  (when (getenv "EMACS_TEST_JUNIT_REPORT")
+    (apply #'ert-write-junit-test-summary-report command-line-args-left))
   (let ((nlogs (length command-line-args-left))
         (ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0)
         nnotrun logfile notests badtests unexpected skipped tests)
@@ -1855,7 +2032,6 @@ Also sets `ert--results-progress-bar-button-begin'."
      ;; should test it again.)
      "\n")))
 
-
 (defvar ert-test-run-redisplay-interval-secs .1
   "How many seconds ERT should wait between redisplays while running tests.
 
@@ -2037,7 +2213,6 @@ STATS is the stats object; LISTENER is the results 
listener."
           (goto-char (1- (point-max)))
           buffer)))))
 
-
 (defvar ert--selector-history nil
   "List of recent test selectors read from terminal.")
 
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index 8636dc92a1..e1acd7e1ba 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -1,6 +1,6 @@
 ;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Cederqvist <ceder@lysator.liu.se>
 ;;     Inge Wallin <inge@lysator.liu.se>
diff --git a/lisp/emacs-lisp/faceup.el b/lisp/emacs-lisp/faceup.el
index 629029aabc..77689f434c 100644
--- a/lisp/emacs-lisp/faceup.el
+++ b/lisp/emacs-lisp/faceup.el
@@ -1,6 +1,6 @@
 ;;; faceup.el --- Markup language for faces and font-lock regression testing  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Version: 0.0.6
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 303039d653..c4f48b8a79 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -1,6 +1,6 @@
 ;;; find-func.el --- find the definition of the Emacs Lisp function near point 
 -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jens Petersen <petersen@kurims.kyoto-u.ac.jp>
 ;; Keywords: emacs-lisp, functions, variables
diff --git a/lisp/emacs-lisp/float-sup.el b/lisp/emacs-lisp/float-sup.el
index 0e86b923c4..d21e96ca78 100644
--- a/lisp/emacs-lisp/float-sup.el
+++ b/lisp/emacs-lisp/float-sup.el
@@ -1,6 +1,6 @@
 ;;; float-sup.el --- define some constants useful for floating point numbers.  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el
index a768c6ae83..8fbc3b0364 100644
--- a/lisp/emacs-lisp/generator.el
+++ b/lisp/emacs-lisp/generator.el
@@ -1,6 +1,6 @@
 ;;; generator.el --- generators  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Colascione <dancol@dancol.org>
 ;; Keywords: extensions, elisp
@@ -143,8 +143,7 @@ the CPS state machinery."
          (setf ,static-var ,dynamic-var)))))
 
 (defmacro cps--with-dynamic-binding (dynamic-var static-var &rest body)
-  "Evaluate BODY such that generated atomic evaluations run with
-DYNAMIC-VAR bound to STATIC-VAR."
+  "Run BODY's atomic evaluations run with DYNAMIC-VAR bound to STATIC-VAR."
   (declare (indent 2))
   `(cps--with-value-wrapper
        (cps--make-dynamic-binding-wrapper ,dynamic-var ,static-var)
@@ -645,12 +644,11 @@ modified copy."
                          (iter-close iterator)))))
          iterator))))
 
-(defun iter-yield (value)
+(defun iter-yield (_value)
   "When used inside a generator, yield control to caller.
 The caller of `iter-next' receives VALUE, and the next call to
 `iter-next' resumes execution with the form immediately following this
 `iter-yield' call."
-  (identity value)
   (error "`iter-yield' used outside a generator"))
 
 (defmacro iter-yield-from (value)
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el
index 294aba66c3..c6b33b09ba 100644
--- a/lisp/emacs-lisp/generic.el
+++ b/lisp/emacs-lisp/generic.el
@@ -1,6 +1,6 @@
 ;;; generic.el --- defining simple major modes with comment and font-lock  -*- 
lexical-binding: t; -*-
 ;;
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Fri Sep 27 1996
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index ebcc63cc2a..1e9793261f 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -1,6 +1,6 @@
 ;;; gv.el --- generalized variables  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el
index a5f21a5592..930dbfe6c4 100644
--- a/lisp/emacs-lisp/helper.el
+++ b/lisp/emacs-lisp/helper.el
@@ -1,6 +1,6 @@
 ;;; helper.el --- utility help package supporting help in electric modes  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/hierarchy.el b/lisp/emacs-lisp/hierarchy.el
index 58234852a0..6c95d86b47 100644
--- a/lisp/emacs-lisp/hierarchy.el
+++ b/lisp/emacs-lisp/hierarchy.el
@@ -1,6 +1,6 @@
 ;;; hierarchy.el --- Library to create and display hierarchical structures  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <damien@cassou.me>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/inline.el b/lisp/emacs-lisp/inline.el
index 36d71a8c04..963e117ff3 100644
--- a/lisp/emacs-lisp/inline.el
+++ b/lisp/emacs-lisp/inline.el
@@ -1,6 +1,6 @@
 ;;; inline.el --- Define functions by their inliner  -*- lexical-binding:t; -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el
index 2d634b7b03..6a085f0a8c 100644
--- a/lisp/emacs-lisp/let-alist.el
+++ b/lisp/emacs-lisp/let-alist.el
@@ -1,6 +1,6 @@
 ;;; let-alist.el --- Easily let-bind values of an assoc-list by their names 
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <emacs@endlessparentheses.com>
 ;; Package-Requires: ((emacs "24.1"))
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index 96ac054a7d..b871a83246 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -1,6 +1,6 @@
 ;;; lisp-mnt.el --- utility functions for Emacs Lisp maintainers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992, 1994, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 416d64558d..7df40e36f8 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1,6 +1,6 @@
 ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1999-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: lisp, languages
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 9b38d86e2c..4aeca9c6b0 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -1,6 +1,6 @@
 ;;; lisp.el --- Lisp editing commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1994, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 4226ed231f..b44917f7d5 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -1,6 +1,6 @@
 ;;; macroexp.el --- Additional macro-expansion support -*- lexical-binding: t 
-*-
 ;;
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: lisp, compiler, macros
@@ -289,6 +289,16 @@ is executed without being compiled first."
           `(let ,(nreverse bindings) . ,body)
         (macroexp-progn body)))))
 
+(defun macroexp--dynamic-variable-p (var)
+  "Whether the variable VAR is dynamically scoped.
+Only valid during macro-expansion."
+  (defvar byte-compile-bound-variables)
+  (or (not lexical-binding)
+      (special-variable-p var)
+      (memq var macroexp--dynvars)
+      (and (boundp 'byte-compile-bound-variables)
+           (memq var byte-compile-bound-variables))))
+
 (defun macroexp--expand-all (form)
   "Expand all macros in FORM.
 This is an internal version of `macroexpand-all'.
@@ -316,28 +326,32 @@ Assumes the caller has bound 
`macroexpand-all-environment'."
                                         (cddr form))
                         (cdr form))
         form))
-      (`(,(or 'defvar 'defconst) . ,_) (macroexp--all-forms form 2))
+      (`(,(or 'defvar 'defconst) ,(and name (pred symbolp)) . ,_)
+       (push name macroexp--dynvars)
+       (macroexp--all-forms form 2))
       (`(function ,(and f `(lambda . ,_)))
-       (macroexp--cons 'function
-                       (macroexp--cons (macroexp--all-forms f 2)
-                                       nil
-                                       (cdr form))
-                       form))
+       (let ((macroexp--dynvars macroexp--dynvars))
+         (macroexp--cons 'function
+                         (macroexp--cons (macroexp--all-forms f 2)
+                                         nil
+                                         (cdr form))
+                         form)))
       (`(,(or 'function 'quote) . ,_) form)
       (`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body)
                                            pcase--dontcare))
-       (macroexp--cons
-        fun
-        (macroexp--cons
-         (macroexp--all-clauses bindings 1)
-         (if (null body)
-             (macroexp-unprogn
-              (macroexp-warn-and-return
-               (format "Empty %s body" fun)
-               nil nil 'compile-only))
-           (macroexp--all-forms body))
-         (cdr form))
-        form))
+       (let ((macroexp--dynvars macroexp--dynvars))
+         (macroexp--cons
+          fun
+          (macroexp--cons
+           (macroexp--all-clauses bindings 1)
+           (if (null body)
+               (macroexp-unprogn
+                (macroexp-warn-and-return
+                 (format "Empty %s body" fun)
+                 nil nil 'compile-only))
+             (macroexp--all-forms body))
+           (cdr form))
+          form)))
       (`(,(and fun `(lambda . ,_)) . ,args)
        ;; Embedded lambda in function position.
        ;; If the byte-optimizer is loaded, try to unfold this,
@@ -421,6 +435,14 @@ Assumes the caller has bound 
`macroexpand-all-environment'."
 If no macros are expanded, FORM is returned unchanged.
 The second optional arg ENVIRONMENT specifies an environment of macro
 definitions to shadow the loaded ones for use in file byte-compilation."
+  (let ((macroexpand-all-environment environment)
+        (macroexp--dynvars macroexp--dynvars))
+    (macroexp--expand-all form)))
+
+;; This function is like `macroexpand-all' but for use with top-level
+;; forms.  It does not dynbind `macroexp--dynvars' because we want
+;; top-level `defvar' declarations to be recorded in that variable.
+(defun macroexpand--all-toplevel (form &optional environment)
   (let ((macroexpand-all-environment environment))
     (macroexp--expand-all form)))
 
@@ -702,11 +724,18 @@ test of free variables in the following ways:
       (push 'skip macroexp--pending-eager-loads)
       form))
    (t
-    (let ((macroexp--pending-eager-loads
-           (cons load-file-name macroexp--pending-eager-loads)))
-      (if full-p
-          (macroexpand-all form)
-        (macroexpand form))))))
+    (condition-case err
+        (let ((macroexp--pending-eager-loads
+               (cons load-file-name macroexp--pending-eager-loads)))
+          (if full-p
+              (macroexpand--all-toplevel form)
+            (macroexpand form)))
+      (error
+       ;; Hopefully this shouldn't happen thanks to the cycle detection,
+       ;; but in case it does happen, let's catch the error and give the
+       ;; code a chance to macro-expand later.
+       (message "Eager macro-expansion failure: %S" err)
+       form)))))
 
 ;; ¡¡¡ Big Ugly Hack !!!
 ;; src/bootstrap-emacs is mostly used to compile .el files, so it needs
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 2f2f96ca0d..b3e7fca478 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -1,6 +1,6 @@
 ;;; map-ynp.el --- general-purpose boolean question-asker  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1991-1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index da4502f9ed..dea5b34991 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -1,6 +1,6 @@
 ;;; map.el --- Map manipulation functions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el
index 450cdaa7a8..6cb4cb02e0 100644
--- a/lisp/emacs-lisp/memory-report.el
+++ b/lisp/emacs-lisp/memory-report.el
@@ -1,6 +1,6 @@
 ;;; memory-report.el --- Short function summaries  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Keywords: lisp, help
 
diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
new file mode 100644
index 0000000000..e6a2424c51
--- /dev/null
+++ b/lisp/emacs-lisp/multisession.el
@@ -0,0 +1,449 @@
+;;; multisession.el --- Multisession storage for variables  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2021-2022 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 'cl-lib)
+(require 'eieio)
+(require 'sqlite)
+(require 'tabulated-list)
+
+(defcustom multisession-storage 'files
+  "Storage method for multisession variables.
+Valid methods are `sqlite' and `files'."
+  :type '(choice (const :tag "SQLite" sqlite)
+                 (const :tag "Files" files))
+  :version "29.1"
+  :group 'files)
+
+(defcustom multisession-directory (expand-file-name "multisession/"
+                                                    user-emacs-directory)
+  "Directory to store multisession variables."
+  :type 'file
+  :version "29.1"
+  :group 'files)
+
+;;;###autoload
+(defmacro define-multisession-variable (name initial-value &optional doc
+                                             &rest args)
+  "Make NAME into a multisession variable initialized from INITIAL-VALUE.
+DOC should be a doc string, and ARGS are keywords as applicable to
+`make-multisession'."
+  (declare (indent defun))
+  (unless (plist-get args :package)
+    (setq args (nconc (list :package
+                            (replace-regexp-in-string "-.*" ""
+                                                      (symbol-name name)))
+                      args)))
+  `(defvar ,name
+     (make-multisession :key ,(symbol-name name)
+                        :initial-value ,initial-value
+                        ,@args)
+     ,@(list doc)))
+
+(defconst multisession--unbound (make-symbol "unbound"))
+
+(cl-defstruct (multisession
+               (:constructor nil)
+               (:constructor multisession--create)
+               (:conc-name multisession--))
+  "A persistent variable that will live across Emacs invocations."
+  key
+  (initial-value nil)
+  package
+  (storage multisession-storage)
+  (synchronized nil)
+  (cached-value multisession--unbound)
+  (cached-sequence 0))
+
+(cl-defun make-multisession (&key key initial-value package synchronized
+                                  storage)
+  "Create a multisession object."
+  (unless package
+    (error "No package for the multisession object"))
+  (unless key
+    (error "No key for the multisession object"))
+  (unless (stringp package)
+    (error "The package has to be a string"))
+  (unless (stringp key)
+    (error "The key has to be a string"))
+  (multisession--create
+   :key key
+   :synchronized synchronized
+   :initial-value initial-value
+   :package package
+   :storage (or storage multisession-storage)))
+
+(defun multisession-value (object)
+  "Return the value of the multisession OBJECT."
+  (if (null user-init-file)
+      ;; If we don't have storage, then just return the value from the
+      ;; object.
+      (if (eq (multisession--cached-value object) multisession--unbound)
+          (multisession--initial-value object)
+        (multisession--cached-value object))
+    ;; We have storage, so we update from storage.
+    (multisession-backend-value (multisession--storage object) object)))
+
+(defun multisession--set-value (object value)
+  "Set the stored value of OBJECT to VALUE."
+  (if (null user-init-file)
+      ;; We have no backend, so just store the value.
+      (setf (multisession--cached-value object) value)
+    ;; We have a backend.
+    (multisession--backend-set-value (multisession--storage object)
+                                     object value)))
+
+(defun multisession-delete (object)
+  "Delete OBJECT from the backend storage."
+  (multisession--backend-delete (multisession--storage object) object))
+
+(gv-define-simple-setter multisession-value multisession--set-value)
+
+;; SQLite Backend
+
+(declare-function sqlite-execute "sqlite.c")
+(declare-function sqlite-select "sqlite.c")
+(declare-function sqlite-open "sqlite.c")
+(declare-function sqlite-pragma "sqlite.c")
+(declare-function sqlite-transaction "sqlite.c")
+(declare-function sqlite-commit "sqlite.c")
+
+(defvar multisession--db nil)
+
+(defun multisession--ensure-db ()
+  (unless multisession--db
+    (let* ((file (expand-file-name "sqlite/multisession.sqlite"
+                                   multisession-directory))
+           (dir (file-name-directory file)))
+      (unless (file-exists-p dir)
+        (make-directory dir t))
+      (setq multisession--db (sqlite-open file)))
+    (with-sqlite-transaction multisession--db
+      ;; Use a write-ahead-log (available since 2010), which makes
+      ;; writes a lot faster.
+      (sqlite-pragma multisession--db "journal_mode = WAL")
+      (sqlite-pragma multisession--db "synchronous = NORMAL")
+      (unless (sqlite-select
+               multisession--db
+               "select name from sqlite_master where type = 'table' and name = 
'multisession'")
+        ;; Tidy up the database automatically.
+        (sqlite-pragma multisession--db "auto_vacuum = FULL")
+        ;; Create the table.
+        (sqlite-execute
+         multisession--db
+         "create table multisession (package text not null, key text not null, 
sequence number not null default 1, value text not null)")
+        (sqlite-execute
+         multisession--db
+         "create unique index multisession_idx on multisession (package, 
key)")))))
+
+(cl-defmethod multisession-backend-value ((_type (eql 'sqlite)) object)
+  (multisession--ensure-db)
+  (let ((id (list (multisession--package object)
+                  (multisession--key object))))
+    (cond
+     ;; We have no value yet; check the database.
+     ((eq (multisession--cached-value object) multisession--unbound)
+      (let ((stored
+             (car
+              (sqlite-select
+               multisession--db
+               "select value, sequence from multisession where package = ? and 
key = ?"
+               id))))
+        (if stored
+            (let ((value (car (read-from-string (car stored)))))
+              (setf (multisession--cached-value object) value
+                    (multisession--cached-sequence object) (cadr stored))
+              value)
+          ;; Nothing; return the initial value.
+          (multisession--initial-value object))))
+     ;; We have a value, but we want to update in case some other
+     ;; Emacs instance has updated.
+     ((multisession--synchronized object)
+      (let ((stored
+             (car
+              (sqlite-select
+               multisession--db
+               "select value, sequence from multisession where sequence > ? 
and package = ? and key = ?"
+               (cons (multisession--cached-sequence object) id)))))
+        (if stored
+            (let ((value (car (read-from-string (car stored)))))
+              (setf (multisession--cached-value object) value
+                    (multisession--cached-sequence object) (cadr stored))
+              value)
+          ;; Nothing, return the cached value.
+          (multisession--cached-value object))))
+     ;; Just return the cached value.
+     (t
+      (multisession--cached-value object)))))
+
+(cl-defmethod multisession--backend-set-value ((_type (eql 'sqlite))
+                                               object value)
+  (catch 'done
+    (let ((i 0))
+      (while (< i 10)
+        (condition-case nil
+            (throw 'done (multisession--set-value-sqlite object value))
+          (sqlite-locked-error
+           (setq i (1+ i))
+           (sleep-for (+ 0.1 (/ (float (random 10)) 10))))))
+      (signal 'sqlite-locked-error "Database is locked"))))
+
+(defun multisession--set-value-sqlite (object value)
+  (multisession--ensure-db)
+  (with-sqlite-transaction multisession--db
+    (let ((id (list (multisession--package object)
+                    (multisession--key object)))
+          (pvalue
+           (let ((print-length nil)
+                 (print-circle t)
+                 (print-level nil))
+             (prin1-to-string value))))
+      (condition-case nil
+          (ignore (read-from-string pvalue))
+        (error (error "Unable to store unreadable value: %s" pvalue)))
+      (sqlite-execute
+       multisession--db
+       "insert into multisession(package, key, sequence, value) values(?, ?, 
1, ?) on conflict(package, key) do update set sequence = sequence + 1, value = 
?"
+       (append id (list pvalue pvalue)))
+      (setf (multisession--cached-sequence object)
+            (caar (sqlite-select
+                   multisession--db
+                   "select sequence from multisession where package = ? and 
key = ?"
+                   id)))
+      (setf (multisession--cached-value object) value))))
+
+(cl-defmethod multisession--backend-values ((_type (eql 'sqlite)))
+  (multisession--ensure-db)
+  (sqlite-select
+   multisession--db
+   "select package, key, value from multisession order by package, key"))
+
+(cl-defmethod multisession--backend-delete ((_type (eql 'sqlite)) object)
+  (sqlite-execute multisession--db
+                  "delete from multisession where package = ? and key = ?"
+                  (list (multisession--package object)
+                        (multisession--key object))))
+
+;; Files Backend
+
+(defun multisession--encode-file-name (name)
+  (url-hexify-string name))
+
+(defun multisession--read-file-value (file object)
+  (catch 'done
+    (let ((i 0)
+          last-error)
+      (while (< i 10)
+        (condition-case err
+            (throw 'done
+                   (with-temp-buffer
+                     (let* ((time (file-attribute-modification-time
+                                   (file-attributes file)))
+                            (coding-system-for-read 'utf-8-emacs-unix))
+                       (insert-file-contents file)
+                       (let ((stored (read (current-buffer))))
+                         (setf (multisession--cached-value object) stored
+                               (multisession--cached-sequence object) time)
+                         stored))))
+          ;; Windows uses OS-level file locking that may preclude
+          ;; reading the file in some circumstances.  In addition,
+          ;; rename-file is not an atomic operation on MS-Windows,
+          ;; when the target file already exists, so there could be a
+          ;; small race window when the file to read doesn't yet
+          ;; exist.  So when these problems happen, wait a bit and retry.
+          ((permission-denied file-missing)
+           (setq i (1+ i)
+                 last-error err)
+           (sleep-for (+ 0.1 (/ (float (random 10)) 10))))))
+      (signal (car last-error) (cdr last-error)))))
+
+(defun multisession--object-file-name (object)
+  (expand-file-name
+   (concat "files/"
+           (multisession--encode-file-name (multisession--package object))
+           "/"
+           (multisession--encode-file-name (multisession--key object))
+           ".value")
+   multisession-directory))
+
+(cl-defmethod multisession-backend-value ((_type (eql 'files)) object)
+  (let ((file (multisession--object-file-name object)))
+    (cond
+     ;; We have no value yet; see whether it's stored.
+     ((eq (multisession--cached-value object) multisession--unbound)
+      (if (file-exists-p file)
+          (multisession--read-file-value file object)
+        ;; Nope; return the initial value.
+        (multisession--initial-value object)))
+     ;; We have a value, but we want to update in case some other
+     ;; Emacs instance has updated.
+     ((multisession--synchronized object)
+      (if (and (file-exists-p file)
+               (time-less-p (multisession--cached-sequence object)
+                            (file-attribute-modification-time
+                             (file-attributes file))))
+          (multisession--read-file-value file object)
+        ;; Nothing, return the cached value.
+        (multisession--cached-value object)))
+     ;; Just return the cached value.
+     (t
+      (multisession--cached-value object)))))
+
+(cl-defmethod multisession--backend-set-value ((_type (eql 'files))
+                                               object value)
+  (let ((file (multisession--object-file-name object))
+        (time (current-time)))
+    ;; Ensure that the directory exists.
+    (let ((dir (file-name-directory file)))
+      (unless (file-exists-p dir)
+        (make-directory dir t)))
+    (with-temp-buffer
+      (let ((print-length nil)
+            (print-circle t)
+            (print-level nil))
+        (prin1 value (current-buffer)))
+      (goto-char (point-min))
+      (condition-case nil
+          (read (current-buffer))
+        (error (error "Unable to store unreadable value: %s" (buffer-string))))
+      ;; Write to a temp file in the same directory and rename to the
+      ;; file for somewhat better atomicity.
+      (let ((coding-system-for-write 'utf-8-emacs-unix)
+            (create-lockfiles nil)
+            (temp (make-temp-name file))
+            (write-region-inhibit-fsync nil))
+        (write-region (point-min) (point-max) temp nil 'silent)
+        (set-file-times temp time)
+        (rename-file temp file t)))
+    (setf (multisession--cached-sequence object) time
+          (multisession--cached-value object) value)))
+
+(cl-defmethod multisession--backend-values ((_type (eql 'files)))
+  (mapcar (lambda (file)
+            (let ((bits (file-name-split file)))
+              (list (url-unhex-string (car (last bits 2)))
+                    (url-unhex-string
+                     (file-name-sans-extension (car (last bits))))
+                    (with-temp-buffer
+                      (let ((coding-system-for-read 'utf-8-emacs-unix))
+                        (insert-file-contents file)
+                        (read (current-buffer)))))))
+          (directory-files-recursively
+           (expand-file-name "files" multisession-directory)
+           "\\.value\\'")))
+
+(cl-defmethod multisession--backend-delete ((_type (eql 'files)) object)
+  (let ((file (multisession--object-file-name object)))
+    (when (file-exists-p file)
+      (delete-file file))))
+
+;; Mode for editing.
+
+(defvar-keymap multisession-edit-mode-map
+  :parent tabulated-list-mode-map
+  "d" #'multisession-delete-value
+  "e" #'multisession-edit-value)
+
+(define-derived-mode multisession-edit-mode special-mode "Multisession"
+  "This mode lists all elements in the \"multisession\" database."
+  :interactive nil
+  (buffer-disable-undo)
+  (setq-local buffer-read-only t
+              truncate-lines t)
+  (setq tabulated-list-format
+        [("Package" 10)
+         ("Key" 30)
+         ("Value" 30)])
+  (setq-local revert-buffer-function #'multisession-edit-mode--revert))
+
+;;;###autoload
+(defun list-multisession-values (&optional choose-storage)
+  "List all values in the \"multisession\" database.
+If CHOOSE-STORAGE (interactively, the prefix), query for the
+storage method to list."
+  (interactive "P")
+  (let ((storage
+         (if choose-storage
+             (intern (completing-read "Storage method: " '(sqlite files) nil 
t))
+           multisession-storage)))
+    (pop-to-buffer (get-buffer-create (format "*Multisession %s*" storage)))
+    (multisession-edit-mode)
+    (setq-local multisession-storage storage)
+    (multisession-edit-mode--revert)
+    (goto-char (point-min))))
+
+(defun multisession-edit-mode--revert (&rest _)
+  (let ((inhibit-read-only t)
+        (id (get-text-property (point) 'tabulated-list-id)))
+    (erase-buffer)
+    (tabulated-list-init-header)
+    (setq tabulated-list-entries
+          (mapcar (lambda (elem)
+                    (list
+                     (cons (car elem) (cadr elem))
+                     (vector (car elem) (cadr elem)
+                             (string-replace "\n" "\\n"
+                                             (format "%s" (caddr elem))))))
+                  (multisession--backend-values multisession-storage)))
+    (tabulated-list-print t)
+    (goto-char (point-min))
+    (when id
+      (when-let ((match
+                  (text-property-search-forward 'tabulated-list-id id t)))
+        (goto-char (prop-match-beginning match))))))
+
+(defun multisession-delete-value (id)
+  "Delete the value at point."
+  (interactive (list (get-text-property (point) 'tabulated-list-id))
+               multisession-edit-mode)
+  (unless id
+    (error "No value on the current line"))
+  (unless (yes-or-no-p "Really delete this item? ")
+    (user-error "Not deleting"))
+  (multisession--backend-delete multisession-storage
+                                (make-multisession :package (car id)
+                                                   :key (cdr id)))
+  (let ((inhibit-read-only t))
+    (beginning-of-line)
+    (delete-region (point) (progn (forward-line 1) (point)))))
+
+(defun multisession-edit-value (id)
+  "Edit the value at point."
+  (interactive (list (get-text-property (point) 'tabulated-list-id))
+               multisession-edit-mode)
+  (unless id
+    (error "No value on the current line"))
+  (let* ((object (make-multisession
+                  :package (car id)
+                  :key (cdr id)
+                  :storage multisession-storage))
+         (value (multisession-value object)))
+    (setf (multisession-value object)
+          (car (read-from-string
+                (read-string "New value: " (prin1-to-string value))))))
+  (multisession-edit-mode--revert))
+
+(provide 'multisession)
+
+;;; multisession.el ends here
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index 0175857b7f..78f2d36c6f 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -1,6 +1,6 @@
 ;;; package-x.el --- Package extras  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;; Created: 10 Mar 2007
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index de4cebccca..42979d1675 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1,6 +1,6 @@
 ;;; package.el --- Simple package system for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;;         Daniel Hackney <dan@haxney.org>
@@ -4076,7 +4076,9 @@ The list is displayed in a buffer named `*Packages*'."
   "Return the version number of the package in which this is used.
 Assumes it is used from an Elisp file placed inside the top-level directory
 of an installed ELPA package.
-The return value is a string (or nil in case we can't find it)."
+The return value is a string (or nil in case we can't find it).
+It works in more cases if the call is in the file which contains
+the `Version:' header."
   ;; In a sense, this is a lie, but it does just what we want: precompute
   ;; the version at compile time and hardcodes it into the .elc file!
   (declare (pure t))
@@ -4095,6 +4097,7 @@ The return value is a string (or nil in case we can't 
find it)."
       (let* ((pkgdir (file-name-directory file))
              (pkgname (file-name-nondirectory (directory-file-name pkgdir)))
              (mainfile (expand-file-name (concat pkgname ".el") pkgdir)))
+        (unless (file-readable-p mainfile) (setq mainfile file))
         (when (file-readable-p mainfile)
           (require 'lisp-mnt)
           (with-temp-buffer
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index a3498d2da8..7a82b416e5 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -1,6 +1,6 @@
 ;;; pcase.el --- ML-style pattern-matching macro for Elisp -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 8464b5a519..d199716b2c 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -1,6 +1,6 @@
 ;;; pp.el --- pretty printer for Emacs Lisp  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Randal Schwartz <merlyn@stonehenge.com>
 ;; Keywords: lisp
@@ -24,6 +24,7 @@
 
 ;;; Code:
 
+(require 'cl-lib)
 (defvar font-lock-verbose)
 
 (defgroup pp nil
@@ -233,13 +234,14 @@ Use the `pp-max-width' variable to control the desired 
line length."
     (cons (cond
            ((consp (cdr sexp))
             (if (and (length= sexp 2)
-                     (eq (car sexp) 'quote))
+                     (memq (car sexp) '(quote function)))
                 (cond
                  ((symbolp (cadr sexp))
                   (let ((print-quoted t))
                     (prin1 sexp (current-buffer))))
                  ((consp (cadr sexp))
-                  (insert "'")
+                  (insert (if (eq (car sexp) 'quote)
+                              "'" "#'"))
                   (pp--format-list (cadr sexp)
                                    (set-marker (make-marker) (1- (point))))))
               (pp--format-list sexp)))
diff --git a/lisp/emacs-lisp/radix-tree.el b/lisp/emacs-lisp/radix-tree.el
index a529ed025d..dbf8558d2f 100644
--- a/lisp/emacs-lisp/radix-tree.el
+++ b/lisp/emacs-lisp/radix-tree.el
@@ -1,6 +1,6 @@
 ;;; radix-tree.el --- A simple library of radix trees  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 9be6ac649f..38726ca048 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -1,6 +1,6 @@
 ;;; re-builder.el --- building Regexps with visual feedback -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Detlev Zundel <dzu@gnu.org>
 ;; Keywords: matching, lisp, tools
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index 2a40290249..cae5dd00d1 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -1,6 +1,6 @@
 ;;; regexp-opt.el --- generate efficient regexps to match strings -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <simon@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/regi.el b/lisp/emacs-lisp/regi.el
index 527af1ddf2..0099d157e4 100644
--- a/lisp/emacs-lisp/regi.el
+++ b/lisp/emacs-lisp/regi.el
@@ -1,6 +1,6 @@
 ;;; regi.el --- REGular expression Interpreting engine  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw, Century Computing, Inc. <bwarsaw@cen.com>
 ;; Created:       24-Feb-1993
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index ea27bb3c31..2b2039f9d1 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -1,6 +1,6 @@
 ;;; ring.el --- handle rings of items   -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 8abe570e64..e635c7f200 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -1,6 +1,6 @@
 ;;; rmc.el --- read from a multiple choice question -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
@@ -25,8 +25,101 @@
 
 (require 'seq)
 
+(defun rmc--add-key-description (elem)
+  (let* ((char (car elem))
+         (name (cadr elem))
+         (pos (seq-position name char))
+         (desc (key-description (char-to-string char)))
+         (graphical-terminal
+          (display-supports-face-attributes-p
+           '(:underline t) (window-frame)))
+         (altered-name
+          (cond
+           ;; Not in the name string, or a special character.
+           ((or (not pos)
+                (member desc '("ESC" "TAB" "RET" "DEL" "SPC")))
+            (format "%s %s"
+                    (if graphical-terminal
+                        (propertize desc 'face 'read-multiple-choice-face)
+                      (propertize desc 'face 'help-key-binding))
+                    name))
+           ;; The prompt character is in the name, so highlight
+           ;; it on graphical terminals.
+           (graphical-terminal
+            (setq name (copy-sequence name))
+            (put-text-property pos (1+ pos)
+                               'face 'read-multiple-choice-face
+                               name)
+            name)
+           ;; And put it in [bracket] on non-graphical terminals.
+           (t
+            (concat
+             (substring name 0 pos)
+             "["
+             (upcase (substring name pos (1+ pos)))
+             "]"
+             (substring name (1+ pos)))))))
+    (cons char altered-name)))
+
+(defun rmc--show-help (prompt help-string show-help choices altered-names)
+  (let* ((buf-name (if (stringp show-help)
+                       show-help
+                     "*Multiple Choice Help*"))
+         (buf (get-buffer-create buf-name)))
+    (if (stringp help-string)
+        (with-help-window buf
+          (with-current-buffer buf
+            (insert help-string)))
+      (with-help-window buf
+        (with-current-buffer buf
+          (erase-buffer)
+          (pop-to-buffer buf)
+          (insert prompt "\n\n")
+          (let* ((columns (/ (window-width) 25))
+                 (fill-column 21)
+                 (times 0)
+                 (start (point)))
+            (dolist (elem choices)
+              (goto-char start)
+              (unless (zerop times)
+                (if (zerop (mod times columns))
+                    ;; Go to the next "line".
+                    (goto-char (setq start (point-max)))
+                  ;; Add padding.
+                  (while (not (eobp))
+                    (end-of-line)
+                    (insert (make-string (max (- (* (mod times columns)
+                                                    (+ fill-column 4))
+                                                 (current-column))
+                                              0)
+                                         ?\s))
+                    (forward-line 1))))
+              (setq times (1+ times))
+              (let ((text
+                     (with-temp-buffer
+                       (insert (format
+                                "%c: %s\n"
+                                (car elem)
+                                (cdr (assq (car elem) altered-names))))
+                       (fill-region (point-min) (point-max))
+                       (when (nth 2 elem)
+                         (let ((start (point)))
+                           (insert (nth 2 elem))
+                           (unless (bolp)
+                             (insert "\n"))
+                           (fill-region start (point-max))))
+                       (buffer-string))))
+                (goto-char start)
+                (dolist (line (split-string text "\n"))
+                  (end-of-line)
+                  (if (bolp)
+                      (insert line "\n")
+                    (insert line))
+                  (forward-line 1))))))))
+    buf))
+
 ;;;###autoload
-(defun read-multiple-choice (prompt choices &optional help-string)
+(defun read-multiple-choice (prompt choices &optional help-string show-help)
   "Ask user to select an entry from CHOICES, promting with PROMPT.
 This function allows to ask the user a multiple-choice question.
 
@@ -42,6 +135,9 @@ the optional argument HELP-STRING.  This argument is a 
string that
 should contain a more detailed description of all of the possible
 choices.  `read-multiple-choice' will display that description in a
 help buffer if the user requests that.
+If optional argument SHOW-HELP is non-nil, show the help screen
+immediately, before any user input.  If SHOW-HELP is a string,
+use it as the name of the help buffer.
 
 This function translates user input into responses by consulting
 the bindings in `query-replace-map'; see the documentation of
@@ -67,45 +163,19 @@ Usage example:
                       \\='((?a \"always\")
                         (?s \"session only\")
                         (?n \"no\")))"
-  (let* ((altered-names nil)
+  (let* ((choices (if show-help choices (append choices '((?? "?")))))
+         (altered-names (mapcar #'rmc--add-key-description choices))
          (full-prompt
           (format
            "%s (%s): "
            prompt
-           (mapconcat
-            (lambda (elem)
-              (let* ((name (cadr elem))
-                     (pos (seq-position name (car elem)))
-                     (altered-name
-                      (cond
-                       ;; Not in the name string.
-                       ((not pos)
-                        (format "[%c] %s" (car elem) name))
-                       ;; The prompt character is in the name, so highlight
-                       ;; it on graphical terminals...
-                       ((display-supports-face-attributes-p
-                         '(:underline t) (window-frame))
-                        (setq name (copy-sequence name))
-                        (put-text-property pos (1+ pos)
-                                           'face 'read-multiple-choice-face
-                                           name)
-                        name)
-                       ;; And put it in [bracket] on non-graphical terminals.
-                       (t
-                        (concat
-                         (substring name 0 pos)
-                         "["
-                         (upcase (substring name pos (1+ pos)))
-                         "]"
-                         (substring name (1+ pos)))))))
-                (push (cons (car elem) altered-name)
-                      altered-names)
-                altered-name))
-            (append choices '((?? "?")))
-            ", ")))
+           (mapconcat (lambda (e) (cdr e)) altered-names ", ")))
          tchar buf wrong-char answer)
     (save-window-excursion
       (save-excursion
+        (if show-help
+            (setq buf (rmc--show-help prompt help-string show-help
+                                   choices altered-names)))
        (while (not tchar)
          (message "%s%s"
                    (if wrong-char
@@ -161,57 +231,8 @@ Usage example:
                   tchar nil)
             (when wrong-char
               (ding))
-            (setq buf (get-buffer-create "*Multiple Choice Help*"))
-            (if (stringp help-string)
-                (with-help-window buf
-                  (with-current-buffer buf
-                    (insert help-string)))
-              (with-help-window buf
-                (with-current-buffer buf
-                  (erase-buffer)
-                  (pop-to-buffer buf)
-                  (insert prompt "\n\n")
-                  (let* ((columns (/ (window-width) 25))
-                         (fill-column 21)
-                         (times 0)
-                         (start (point)))
-                    (dolist (elem choices)
-                      (goto-char start)
-                      (unless (zerop times)
-                        (if (zerop (mod times columns))
-                            ;; Go to the next "line".
-                            (goto-char (setq start (point-max)))
-                          ;; Add padding.
-                          (while (not (eobp))
-                            (end-of-line)
-                            (insert (make-string (max (- (* (mod times columns)
-                                                            (+ fill-column 4))
-                                                         (current-column))
-                                                      0)
-                                                 ?\s))
-                            (forward-line 1))))
-                      (setq times (1+ times))
-                      (let ((text
-                             (with-temp-buffer
-                               (insert (format
-                                        "%c: %s\n"
-                                        (car elem)
-                                        (cdr (assq (car elem) altered-names))))
-                               (fill-region (point-min) (point-max))
-                               (when (nth 2 elem)
-                                 (let ((start (point)))
-                                   (insert (nth 2 elem))
-                                   (unless (bolp)
-                                     (insert "\n"))
-                                   (fill-region start (point-max))))
-                               (buffer-string))))
-                        (goto-char start)
-                        (dolist (line (split-string text "\n"))
-                          (end-of-line)
-                          (if (bolp)
-                              (insert line "\n")
-                            (insert line))
-                          (forward-line 1))))))))))))
+            (setq buf (rmc--show-help prompt help-string show-help
+                                   choices altered-names))))))
     (when (buffer-live-p buf)
       (kill-buffer buf))
     (assq tchar choices)))
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index c48052dee9..aa2486b47e 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1,6 +1,6 @@
 ;;; rx.el --- S-exp notation for regexps           --*- lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 451ff19631..abfe51d32b 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -1,6 +1,6 @@
 ;;; seq.el --- Sequence manipulation functions  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Keywords: sequences
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el
index 1fbe946a7f..8cd371321a 100644
--- a/lisp/emacs-lisp/shadow.el
+++ b/lisp/emacs-lisp/shadow.el
@@ -1,6 +1,6 @@
 ;;; shadow.el --- locate Emacs Lisp file shadowings  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Terry Jones <terry@santafe.edu>
 ;; Keywords: lisp
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index b9e000cc05..870d34527b 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -1,6 +1,6 @@
 ;;; shortdoc.el --- Short function summaries  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Keywords: lisp, help
 ;; Package: emacs
diff --git a/lisp/emacs-lisp/shorthands.el b/lisp/emacs-lisp/shorthands.el
index e9f5880ab2..a9e4343715 100644
--- a/lisp/emacs-lisp/shorthands.el
+++ b/lisp/emacs-lisp/shorthands.el
@@ -1,6 +1,6 @@
 ;;; shorthands.el --- Read code considering Elisp shorthands  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Keywords: lisp
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 8e14faea3a..b2283e66e4 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1,6 +1,6 @@
 ;;; smie.el --- Simple Minded Indentation Engine -*- lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: languages, lisp, internal, parsing, indentation
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index b53245b9b5..43e0fc4c9d 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -1,6 +1,6 @@
 ;;; subr-x.el --- extra Lisp functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: convenience
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 7ed1b2b137..e3fee4acca 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -1,6 +1,6 @@
 ;;; syntax.el --- helper functions to find syntactic context  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/emacs-lisp/tabulated-list.el 
b/lisp/emacs-lisp/tabulated-list.el
index 70ecda0fe4..513a0c1a1f 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -1,6 +1,6 @@
 ;;; tabulated-list.el --- generic major mode for tabulated lists -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <cyd@stupidchicken.com>
 ;; Keywords: extensions, lisp
diff --git a/lisp/emacs-lisp/tcover-ses.el b/lisp/emacs-lisp/tcover-ses.el
index 4460fef97b..2b1672ffd6 100644
--- a/lisp/emacs-lisp/tcover-ses.el
+++ b/lisp/emacs-lisp/tcover-ses.el
@@ -1,6 +1,6 @@
 ;;; tcover-ses.el --- Example use of `testcover' to test "SES"  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
 ;; Keywords: spreadsheet lisp utility
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index cdd966e51c..33628d8f47 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -1,6 +1,6 @@
 ;;; testcover.el --- Visual code-coverage tool  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
 ;; Keywords: lisp utility
diff --git a/lisp/emacs-lisp/text-property-search.el 
b/lisp/emacs-lisp/text-property-search.el
index 7da02a9cb2..9f86a28eb6 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -1,6 +1,6 @@
 ;;; text-property-search.el --- search for text properties  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: convenience
diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el
index 6f2e42af50..2d1efadb7f 100644
--- a/lisp/emacs-lisp/thunk.el
+++ b/lisp/emacs-lisp/thunk.el
@@ -1,6 +1,6 @@
 ;;; thunk.el --- Lazy form evaluation  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Keywords: sequences
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index d5bbe7d72c..c93a50cabf 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -1,6 +1,6 @@
 ;;; timer-list.el --- list active timers in a buffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Package: emacs
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index c7d02cc748..fd29abf40a 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -1,6 +1,6 @@
 ;;; timer.el --- run a function with args at some time in future -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Package: emacs
diff --git a/lisp/emacs-lisp/tq.el b/lisp/emacs-lisp/tq.el
index e02f4e4f25..d28f6bbf06 100644
--- a/lisp/emacs-lisp/tq.el
+++ b/lisp/emacs-lisp/tq.el
@@ -1,6 +1,6 @@
 ;;; tq.el --- utility to maintain a transaction queue  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1985-1987, 1992, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1992, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Scott Draves <spot@cs.cmu.edu>
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index 9354687b08..71eca5a323 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -1,6 +1,6 @@
 ;;; trace.el --- tracing facility for Emacs Lisp functions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993, 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Hans Chalupsky <hans@cs.buffalo.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/emacs-lisp/unsafep.el b/lisp/emacs-lisp/unsafep.el
index fa4e0583ed..88900dd565 100644
--- a/lisp/emacs-lisp/unsafep.el
+++ b/lisp/emacs-lisp/unsafep.el
@@ -1,6 +1,6 @@
 ;;; unsafep.el --- Determine whether a Lisp form is safe to evaluate  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
 ;; Keywords: safety lisp utility
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 1d061364a0..23e20c3b10 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -1,6 +1,6 @@
 ;;; warnings.el --- log and display warnings  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 5c436f599e..3d2eda99a9 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -1,6 +1,6 @@
 ;;; emacs-lock.el --- protect buffers against killing or exiting -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <lekktu@gmail.com>
 ;; Inspired by emacs-lock.el by Tom Wurgler <twurgler@goodyear.com>
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index befcb42382..162d1bb641 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1,6 +1,6 @@
 ;;; cua-base.el --- emulate CUA key bindings  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard emulations convenience cua
diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el
index 7014330b6e..1e7cc45c88 100644
--- a/lisp/emulation/cua-gmrk.el
+++ b/lisp/emulation/cua-gmrk.el
@@ -1,6 +1,6 @@
 ;;; cua-gmrk.el --- CUA unified global mark support  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard emulations convenience cua mark
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 7df45e705d..e399fd0fbf 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -1,6 +1,6 @@
 ;;; cua-rect.el --- CUA unified rectangle support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard emulations convenience CUA
diff --git a/lisp/emulation/edt-lk201.el b/lisp/emulation/edt-lk201.el
index b616fdf429..208cfda440 100644
--- a/lisp/emulation/edt-lk201.el
+++ b/lisp/emulation/edt-lk201.el
@@ -1,6 +1,6 @@
 ;;; edt-lk201.el --- enhanced EDT keypad mode emulation for LK-201 keyboards  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1992-1993, 1995, 2001-2021 Free Software
+;; Copyright (C) 1986, 1992-1993, 1995, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Kevin Gallagher <kevin.gal@verizon.net>
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index 8a42f89315..ed76d7108f 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -1,6 +1,6 @@
 ;;; edt-mapper.el --- create an EDT LK-201 map file for X-Windows Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallagher <kevin.gal@verizon.net>
 ;; Keywords: emulations
diff --git a/lisp/emulation/edt-pc.el b/lisp/emulation/edt-pc.el
index 3131c8f873..13804d11f5 100644
--- a/lisp/emulation/edt-pc.el
+++ b/lisp/emulation/edt-pc.el
@@ -1,6 +1,6 @@
 ;;; edt-pc.el --- enhanced EDT keypad mode emulation for PC 101 keyboards  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1994-1995, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1986, 1994-1995, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher <kevin.gal@verizon.net>
diff --git a/lisp/emulation/edt-vt100.el b/lisp/emulation/edt-vt100.el
index 8174d83eaa..e1ad70393c 100644
--- a/lisp/emulation/edt-vt100.el
+++ b/lisp/emulation/edt-vt100.el
@@ -1,6 +1,6 @@
 ;;; edt-vt100.el --- enhanced EDT keypad mode emulation for VT series 
terminals  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1992-1993, 1995, 2002-2021 Free Software
+;; Copyright (C) 1986, 1992-1993, 1995, 2002-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Kevin Gallagher <kevin.gal@verizon.net>
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index f11afb1d02..3f8113dea3 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -1,6 +1,6 @@
 ;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1986, 1992-1995, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1986, 1992-1995, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher <kevin.gal@verizon.net>
diff --git a/lisp/emulation/keypad.el b/lisp/emulation/keypad.el
index 4500faae57..da26e81df5 100644
--- a/lisp/emulation/keypad.el
+++ b/lisp/emulation/keypad.el
@@ -1,6 +1,6 @@
 ;;; keypad.el --- simplified keypad bindings  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard convenience
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 849ad3d824..83944285e9 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -1,6 +1,6 @@
 ;;; viper-cmd.el --- Vi command support for Viper  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 85c8b87b9a..d1bf5e38d5 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -1,6 +1,6 @@
 ;;; viper-ex.el --- functions implementing the Ex commands for Viper  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 368a5dc40a..5430cd700b 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -1,6 +1,6 @@
 ;;; viper-init.el --- some common definitions for Viper  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index 2f7d17351d..ca175c140c 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -1,6 +1,6 @@
 ;;; viper-keym.el --- Viper keymaps  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index fb60f6a545..c4eb183ce4 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -1,6 +1,6 @@
 ;;; viper-macs.el --- functions implementing keyboard macros for Viper  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index 879d8edca6..7581ece214 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -1,6 +1,6 @@
 ;;; viper-mous.el --- mouse support for Viper  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 0af54b3743..6d23ae9a0f 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -1,6 +1,6 @@
 ;;; viper-util.el --- Utilities used by viper.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 1ee5365126..b1c361145c 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -3,7 +3,7 @@
 ;;              and a venomous VI PERil.
 ;;              Viper Is also a Package for Emacs Rebels.
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Keywords: emulations
diff --git a/lisp/env.el b/lisp/env.el
index fc48059cfd..a630bf120f 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -1,6 +1,6 @@
 ;;; env.el --- functions to manipulate environment variables  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1991, 1994, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2000-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: processes, unix
diff --git a/lisp/epa-dired.el b/lisp/epa-dired.el
index 18f3f05574..f4dee5f58f 100644
--- a/lisp/epa-dired.el
+++ b/lisp/epa-dired.el
@@ -1,6 +1,6 @@
 ;;; epa-dired.el --- the EasyPG Assistant, dired extension -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index fe187589aa..be22b320a2 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -1,6 +1,6 @@
 ;;; epa-file.el --- the EasyPG Assistant, transparent file encryption -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epa-hook.el b/lisp/epa-hook.el
index 5b250af6d7..18e47c682e 100644
--- a/lisp/epa-hook.el
+++ b/lisp/epa-hook.el
@@ -1,6 +1,6 @@
 ;;; epa-hook.el --- preloaded code to enable epa-file.el -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el
index 5dd6ad34d7..1078c209ae 100644
--- a/lisp/epa-ks.el
+++ b/lisp/epa-ks.el
@@ -1,6 +1,6 @@
 ;;; epa-ks.el --- EasyPG Key Server Client -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Philip K. <philipk@posteo.net>
 ;; Keywords: PGP, GnuPG
@@ -295,12 +295,12 @@ enough, since keyservers have strict timeout settings."
                :created
                (and  (match-string 4)
                      (not (string-empty-p (match-string 4)))
-                     (seconds-to-time
+                    (time-convert
                       (string-to-number (match-string 4))))
                :expires
                (and (match-string 5)
                     (not (string-empty-p (match-string 5)))
-                    (seconds-to-time
+                   (time-convert
                      (string-to-number (match-string 5))))
                :flags
                (mapcar (lambda (flag)
@@ -319,15 +319,11 @@ enough, since keyservers have strict timeout settings."
                :created
                (and (match-string 2)
                     (not (string-empty-p (match-string 2)))
-                    (decode-time (seconds-to-time
-                                  (string-to-number
-                                   (match-string 2)))))
+                   (decode-time (string-to-number (match-string 2))))
                :expires
                (and (match-string 3)
                     (not (string-empty-p (match-string 3)))
-                    (decode-time (seconds-to-time
-                                  (string-to-number
-                                   (match-string 3)))))
+                   (decode-time (string-to-number (match-string 3))))
                :flags
                (mapcar (lambda (flag)
                          (cdr (assq flag '((?r revoked)
diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el
index 9b3aa0c7fd..6170dcb611 100644
--- a/lisp/epa-mail.el
+++ b/lisp/epa-mail.el
@@ -1,6 +1,6 @@
 ;;; epa-mail.el --- the EasyPG Assistant, minor-mode for mail composer -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG, mail, message
diff --git a/lisp/epa.el b/lisp/epa.el
index 93c85bfd37..742c37d085 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -1,6 +1,6 @@
 ;;; epa.el --- the EasyPG Assistant -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
@@ -235,11 +235,6 @@ You should bind this variable with `let', but do not set 
it globally.")
     (define-key keymap "q" 'epa-exit-buffer)
     keymap))
 
-(defvar epa-info-mode-map
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap "q" 'delete-window)
-    keymap))
-
 (defvar epa-exit-buffer-function #'quit-window)
 
 (defun epa--button-key-text (key)
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index d32c8c897c..28003eaf71 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -1,6 +1,6 @@
 ;;; epg-config.el --- configuration of the EasyPG Library  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epg.el b/lisp/epg.el
index 3354eb2c1e..c5d946cb76 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1,6 +1,6 @@
 ;;; epg.el --- the EasyPG Library -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/erc/ChangeLog.1 b/lisp/erc/ChangeLog.1
index 26c1bd689e..0ea7ef09aa 100644
--- a/lisp/erc/ChangeLog.1
+++ b/lisp/erc/ChangeLog.1
@@ -11702,7 +11702,7 @@
 
        * erc-speak.el, erc.el: New file.
 
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/erc/ChangeLog.2 b/lisp/erc/ChangeLog.2
index b54e3b9af2..86b6e5534c 100644
--- a/lisp/erc/ChangeLog.2
+++ b/lisp/erc/ChangeLog.2
@@ -757,7 +757,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-  Copyright (C) 2009-2021 Free Software Foundation, Inc.
+  Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
index f7de61ce79..979f93f693 100644
--- a/lisp/erc/erc-autoaway.el
+++ b/lisp/erc/erc-autoaway.el
@@ -1,6 +1,6 @@
 ;;; erc-autoaway.el --- Provides autoaway for ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <forcer@forcix.cx>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 69f63dfbc4..d54e92011b 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1,6 +1,6 @@
 ;;; erc-backend.el --- Backend network communication for ERC  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Filename: erc-backend.el
 ;; Author: Lawrence Mitchell <wence@gmx.li>
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 69972856d1..680de6d5aa 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -1,6 +1,6 @@
 ;;; erc-button.el --- A way of buttonizing certain things in ERC buffers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
index 19bc2dbb8e..7b7773d5e1 100644
--- a/lisp/erc/erc-capab.el
+++ b/lisp/erc/erc-capab.el
@@ -1,6 +1,6 @@
 ;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
 
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index 9bbc1f6a0d..00addde275 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -1,6 +1,6 @@
 ;;; erc-compat.el --- ERC compatibility code for older Emacsen  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index f27425ac8a..9654cab6e5 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -1,6 +1,6 @@
 ;;; erc-dcc.el --- CTCP DCC module for ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Ben A. Mesander <ben@gnu.ai.mit.edu>
 ;;         Noah Friedman <friedman@prep.ai.mit.edu>
diff --git a/lisp/erc/erc-desktop-notifications.el 
b/lisp/erc/erc-desktop-notifications.el
index 9838b23953..8ece765ef0 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -1,6 +1,6 @@
 ;;; erc-desktop-notifications.el --- Send notification on PRIVMSG or mentions 
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <julien@danjou.info>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
index 331d29a7b5..8f46a1c8dd 100644
--- a/lisp/erc/erc-ezbounce.el
+++ b/lisp/erc/erc-ezbounce.el
@@ -1,6 +1,6 @@
 ;;; erc-ezbounce.el ---  Handle EZBounce bouncer commands  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <asf@void.at>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
index 9f29b9dad9..492830c3e1 100644
--- a/lisp/erc/erc-fill.el
+++ b/lisp/erc/erc-fill.el
@@ -1,6 +1,6 @@
 ;;; erc-fill.el --- Filling IRC messages in various ways  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <asf@void.at>
 ;;         Mario Lang <mlang@delysid.org>
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 683ac2d37c..9b9f19a0db 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -1,6 +1,6 @@
 ;;; erc-goodies.el --- Collection of ERC modules  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <forcer@forcix.cx>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el
index 95eab04044..f1184ff5eb 100644
--- a/lisp/erc/erc-ibuffer.el
+++ b/lisp/erc/erc-ibuffer.el
@@ -1,6 +1,6 @@
 ;;; erc-ibuffer.el --- ibuffer integration with ERC  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el
index 8003900552..eab219f4c1 100644
--- a/lisp/erc/erc-identd.el
+++ b/lisp/erc/erc-identd.el
@@ -1,6 +1,6 @@
 ;;; erc-identd.el --- RFC1413 (identd authentication protocol) server  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el
index 522bc805f8..ea4f44b91c 100644
--- a/lisp/erc/erc-imenu.el
+++ b/lisp/erc/erc-imenu.el
@@ -1,6 +1,6 @@
 ;;; erc-imenu.el --- Imenu support for ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 2ed8622b85..175e83f3c9 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -1,6 +1,6 @@
 ;;; erc-join.el --- autojoin channels on connect and reconnects  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el
index 136131ca36..354203aa09 100644
--- a/lisp/erc/erc-lang.el
+++ b/lisp/erc/erc-lang.el
@@ -1,6 +1,6 @@
 ;;; erc-lang.el --- provide the LANG command to ERC  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el
index 31693a7b77..c7cd0ceba8 100644
--- a/lisp/erc/erc-list.el
+++ b/lisp/erc/erc-list.el
@@ -1,6 +1,6 @@
 ;;; erc-list.el --- /list support for ERC  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 7c5c495f9e..056701d620 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -1,6 +1,6 @@
 ;;; erc-log.el --- Logging facilities for ERC.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Lawrence Mitchell <wence@gmx.li>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 01d6e44d59..aa78590539 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -1,6 +1,6 @@
 ;;; erc-match.el --- Highlight messages matching certain regexps  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <asf@void.at>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index 2da1abb29a..fd14d8b0ad 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -1,6 +1,6 @@
 ;;; erc-menu.el --- Menu-bar definitions for ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2002, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index 994f2d07c3..30bb18344d 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -1,6 +1,6 @@
 ;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index 678c596760..9377e701c3 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -1,6 +1,6 @@
 ;;; erc-networks.el --- IRC networks  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@lexx.delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index d4f22ca0f5..a3fe04d392 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -1,6 +1,6 @@
 ;;; erc-notify.el --- Online status change notification  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@lexx.delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index 457e8cd468..e53178ce63 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -1,6 +1,6 @@
 ;;; erc-page.el --- CTCP PAGE support for ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
 
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
index c846a1f003..384be500ad 100644
--- a/lisp/erc/erc-pcomplete.el
+++ b/lisp/erc/erc-pcomplete.el
@@ -1,6 +1,6 @@
 ;;; erc-pcomplete.el --- Provides programmable completion for ERC  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Sacha Chua <sacha@free.net.ph>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index b2e9047ce7..ec4bf3ae53 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -1,6 +1,6 @@
 ;;; erc-replace.el --- wash and massage messages inserted into the buffer  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <asf@void.at>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el
index 52285a8343..0f6851a98a 100644
--- a/lisp/erc/erc-ring.el
+++ b/lisp/erc/erc-ring.el
@@ -1,6 +1,6 @@
 ;;; erc-ring.el --- Command history handling for erc using ring.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index 5e4cef5253..dcd786411f 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -1,6 +1,6 @@
 ;;; erc-services.el --- Identify to NickServ  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
 ;; URL: https://www.emacswiki.org/emacs/ErcNickserv
diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el
index cb4c232aba..86978f9d79 100644
--- a/lisp/erc/erc-sound.el
+++ b/lisp/erc/erc-sound.el
@@ -1,6 +1,6 @@
 ;;; erc-sound.el --- CTCP SOUND support for ERC  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2003, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2006-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
 ;; URL: https://www.emacswiki.org/emacs/ErcSound
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index 84854e3be5..ead0d374b1 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -1,6 +1,6 @@
 ;;; erc-speedbar.el --- Speedbar support for ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Contributor: Eric M. Ludlam <zappo@gnu.org>
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
index ddfaafb048..d9cfc9bc98 100644
--- a/lisp/erc/erc-spelling.el
+++ b/lisp/erc/erc-spelling.el
@@ -1,6 +1,6 @@
 ;;; erc-spelling.el --- use flyspell in ERC  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <forcer@forcix.cx>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 7d31bc971e..d74a53bc71 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -1,6 +1,6 @@
 ;;; erc-stamp.el --- Timestamping for ERC messages  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-status-sidebar.el b/lisp/erc/erc-status-sidebar.el
index a6ad856bfd..39430ee659 100644
--- a/lisp/erc/erc-status-sidebar.el
+++ b/lisp/erc/erc-status-sidebar.el
@@ -1,6 +1,6 @@
 ;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017, 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrew Barbarello
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 5755384490..2196c5411e 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -1,6 +1,6 @@
 ;;; erc-track.el --- Track modified channel buffers  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el
index 2c4002f0ee..8a8842bc48 100644
--- a/lisp/erc/erc-truncate.el
+++ b/lisp/erc/erc-truncate.el
@@ -1,6 +1,6 @@
 ;;; erc-truncate.el --- Functions for truncating ERC buffers  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <asf@void.at>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el
index c17eb59da3..ee2a8c936f 100644
--- a/lisp/erc/erc-xdcc.el
+++ b/lisp/erc/erc-xdcc.el
@@ -1,6 +1,6 @@
 ;;; erc-xdcc.el --- XDCC file-server support for ERC  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index df6c3c09d9..24f4762571 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1,6 +1,6 @@
 ;;; erc.el --- An Emacs Internet Relay Chat client  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexander L. Belikoff (alexander@belikoff.net)
 ;; Maintainer: Amin Bandali <bandali@gnu.org>
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index ee7f4633e7..5d3aaf7c81 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -1,6 +1,6 @@
 ;;; em-alias.el --- creation and management of command aliases  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el
index 034fa059b1..a2f8a58220 100644
--- a/lisp/eshell/em-banner.el
+++ b/lisp/eshell/em-banner.el
@@ -1,6 +1,6 @@
 ;;; em-banner.el --- sample module that displays a login banner  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -61,10 +61,9 @@ modules may have a simple template to begin with."
   "The banner message to be displayed when Eshell is loaded.
 This can be any sexp, and should end with at least two newlines."
   :type 'sexp
+  :risky t
   :group 'eshell-banner)
 
-(put 'eshell-banner-message 'risky-local-variable t)
-
 (defcustom eshell-banner-load-hook nil
   "A list of functions to run when `eshell-banner' is loaded."
   :version "24.1"                       ; removed eshell-banner-initialize
diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el
index af5550b11d..27b343ad39 100644
--- a/lisp/eshell/em-basic.el
+++ b/lisp/eshell/em-basic.el
@@ -1,6 +1,6 @@
 ;;; em-basic.el --- basic shell builtin commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 4fd0afbeb8..c6a51b1793 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -1,6 +1,6 @@
 ;;; em-cmpl.el --- completion using the TAB key  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -226,19 +226,17 @@ to writing a completion function."
   (let ((completion-at-point-functions '(elisp-completion-at-point)))
     (completion-at-point)))
 
-(defvar eshell-cmpl-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [(control ?i)] #'completion-at-point)
-    ;; jww (1999-10-19): Will this work on anything but X?
-    (define-key map [backtab] #'pcomplete-reverse)
-    (define-key map [(meta ??)] #'completion-help-at-point)
-    (define-key map [(meta control ?i)] #'eshell-complete-lisp-symbol)
-    ;; C-c prefix:
-    (define-key map (kbd "C-c M-h") #'eshell-completion-help)
-    (define-key map (kbd "C-c TAB") #'pcomplete-expand-and-complete)
-    (define-key map (kbd "C-c C-i") #'pcomplete-expand-and-complete)
-    (define-key map (kbd "C-c SPC") #'pcomplete-expand)
-    map))
+(defvar-keymap eshell-cmpl-mode-map
+  "C-i"       #'completion-at-point
+  ;; jww (1999-10-19): Will this work on anything but X?
+  "<backtab>" #'pcomplete-reverse
+  "M-?"       #'completion-help-at-point
+  "C-M-i"     #'eshell-complete-lisp-symbol
+  ;; C-c prefix:
+  "C-c M-h"   #'eshell-completion-help
+  "C-c TAB"   #'pcomplete-expand-and-complete
+  "C-c C-i"   #'pcomplete-expand-and-complete
+  "C-c SPC"   #'pcomplete-expand)
 
 (define-minor-mode eshell-cmpl-mode
   "Minor mode that provides a keymap when `eshell-cmpl' active.
@@ -382,7 +380,7 @@ to writing a completion function."
                       (setq val (number-to-string val)))
                      ;; expand .../ etc that only eshell understands to
                      ;; standard ../../
-                     ((string-match "\\.\\.\\.+/" val)
+                     ((and (stringp val)) (string-match "\\.\\.\\.+/" val)
                       (setq val (eshell-expand-multiple-dots val))))
                (or val "")))
           args)
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index ee9057f50e..893cad7b4f 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -1,6 +1,6 @@
 ;;; em-dirs.el --- directory navigation commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index ba12e43a3c..842f27a492 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -1,6 +1,6 @@
 ;;; em-glob.el --- extended file name globbing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index aa158fa24c..16abf04489 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -1,6 +1,6 @@
 ;;; em-hist.el --- history list management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -125,16 +125,34 @@ the input history list.  Default is to save anything that 
isn't all
 whitespace."
   :type '(radio (function-item eshell-input-filter-default)
                 (function-item eshell-input-filter-initial-space)
-                (function :tag "Other function")))
-
-(put 'eshell-input-filter 'risky-local-variable t)
+                (function :tag "Other function"))
+  :risky t)
+
+(defun eshell-hist--update-keymap (symbol value)
+  "Update `eshell-hist-mode-map' for `eshell-hist-match-partial'."
+  ;; Don't try to set this before it is bound.  See below.
+  (when (and (boundp 'eshell-hist-mode-map)
+             (eq symbol 'eshell-hist-match-partial))
+    (dolist (keyb
+             (if value
+                 `(("M-p"     . ,#'eshell-previous-matching-input-from-input)
+                   ("M-n"     . ,#'eshell-next-matching-input-from-input)
+                   ("C-c M-p" . ,#'eshell-previous-input)
+                   ("C-c M-n" . ,#'eshell-next-input))
+               `(("M-p"     . ,#'eshell-previous-input)
+                 ("M-n"     . ,#'eshell-next-input)
+                 ("C-c M-p" . ,#'eshell-previous-matching-input-from-input)
+                 ("C-c M-n" . ,#'eshell-next-matching-input-from-input))))
+      (keymap-set eshell-hist-mode-map (car keyb) (cdr keyb))))
+  (set-default symbol value))
 
 (defcustom eshell-hist-match-partial t
   "If non-nil, movement through history is constrained by current input.
-Otherwise, typing <M-p> and <M-n> will always go to the next history
+Otherwise, typing \\`M-p' and \\`M-n' will always go to the next history
 element, regardless of any text on the command line.  In that case,
-<C-c M-r> and <C-c M-s> still offer that functionality."
-  :type 'boolean)
+\\`C-c M-r' and \\`C-c M-s' still offer that functionality."
+  :type 'boolean
+  :set 'eshell-hist--update-keymap)
 
 (defcustom eshell-hist-move-to-end t
   "If non-nil, move to the end of the buffer before cycling history."
@@ -180,43 +198,31 @@ element, regardless of any text on the command line.  In 
that case,
 (defvar eshell-matching-input-from-input-string "")
 (defvar eshell-save-history-index nil)
 
-(defvar eshell-isearch-map
-  (let ((map (copy-keymap isearch-mode-map)))
-    (define-key map [(control ?m)] 'eshell-isearch-return)
-    (define-key map [(control ?r)] 'eshell-isearch-repeat-backward)
-    (define-key map [(control ?s)] 'eshell-isearch-repeat-forward)
-    (define-key map [(control ?g)] 'eshell-isearch-abort)
-    (define-key map [backspace] 'eshell-isearch-delete-char)
-    (define-key map [delete] 'eshell-isearch-delete-char)
-    (define-key map "\C-c\C-c" 'eshell-isearch-cancel)
-    map)
-  "Keymap used in isearch in Eshell.")
-
-(defvar eshell-hist-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [up] #'eshell-previous-matching-input-from-input)
-    (define-key map [down] #'eshell-next-matching-input-from-input)
-    (define-key map [(control up)] #'eshell-previous-input)
-    (define-key map [(control down)] #'eshell-next-input)
-    (define-key map [(meta ?r)] #'eshell-previous-matching-input)
-    (define-key map [(meta ?s)] #'eshell-next-matching-input)
-    (define-key map (kbd "C-c M-r") 
#'eshell-previous-matching-input-from-input)
-    (define-key map (kbd "C-c M-s") #'eshell-next-matching-input-from-input)
-    ;; FIXME: Relies on `eshell-hist-match-partial' being set _before_
-    ;; em-hist is loaded and won't respect changes.
-    (if eshell-hist-match-partial
-       (progn
-         (define-key map [(meta ?p)] 
'eshell-previous-matching-input-from-input)
-         (define-key map [(meta ?n)] 'eshell-next-matching-input-from-input)
-         (define-key map (kbd "C-c M-p") #'eshell-previous-input)
-         (define-key map (kbd "C-c M-n") #'eshell-next-input))
-      (define-key map [(meta ?p)] #'eshell-previous-input)
-      (define-key map [(meta ?n)] #'eshell-next-input)
-      (define-key map (kbd "C-c M-p") 
#'eshell-previous-matching-input-from-input)
-      (define-key map (kbd "C-c M-n") #'eshell-next-matching-input-from-input))
-    (define-key map (kbd "C-c C-l") #'eshell-list-history)
-    (define-key map (kbd "C-c C-x") #'eshell-get-next-from-history)
-    map))
+(defvar-keymap eshell-isearch-map
+  :doc "Keymap used in isearch in Eshell."
+  :parent isearch-mode-map
+  "C-m"         #'eshell-isearch-return
+  "C-r"         #'eshell-isearch-repeat-backward
+  "C-s"         #'eshell-isearch-repeat-forward
+  "C-g"         #'eshell-isearch-abort
+  "<backspace>" #'eshell-isearch-delete-char
+  "<delete>"    #'eshell-isearch-delete-char
+  "C-c C-c"     #'eshell-isearch-cancel)
+
+(defvar-keymap eshell-hist-mode-map
+  "<up>"     #'eshell-previous-matching-input-from-input
+  "<down>"   #'eshell-next-matching-input-from-input
+  "C-<up>"   #'eshell-previous-input
+  "C-<down>" #'eshell-next-input
+  "M-r"      #'eshell-previous-matching-input
+  "M-s"      #'eshell-next-matching-input
+  "C-c M-r"  #'eshell-previous-matching-input-from-input
+  "C-c M-s"  #'eshell-next-matching-input-from-input
+  "C-c C-l"  #'eshell-list-history
+  "C-c C-x"  #'eshell-get-next-from-history)
+;; Update `eshell-hist-mode-map' for `eshell-hist-match-partial'.
+(eshell-hist--update-keymap 'eshell-hist-match-partial
+                            eshell-hist-match-partial)
 
 (defvar eshell-rebind-keys-alist)
 
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 57146bb126..846f3d5e29 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -1,6 +1,6 @@
 ;;; em-ls.el --- implementation of ls in Lisp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 75a803d3ad..216c71f59e 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -1,6 +1,6 @@
 ;;; em-pred.el --- argument predicates and modifiers (ala zsh)  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -107,9 +107,8 @@ ordinary strings."
 The format of each entry is
 
   (CHAR . PREDICATE-FUNC-SEXP)"
-  :type '(repeat (cons character sexp)))
-
-(put 'eshell-predicate-alist 'risky-local-variable t)
+  :type '(repeat (cons character sexp))
+  :risky t)
 
 (defcustom eshell-modifier-alist
   '((?E . (lambda (lst)
@@ -144,9 +143,8 @@ The format of each entry is
 The format of each entry is
 
   (CHAR ENTRYWISE-P MODIFIER-FUNC-SEXP)"
-  :type '(repeat (cons character sexp)))
-
-(put 'eshell-modifier-alist 'risky-local-variable t)
+  :type '(repeat (cons character sexp))
+  :risky t)
 
 (defvar eshell-predicate-help-string
   "Eshell predicate quick reference:
@@ -225,11 +223,9 @@ FOR LISTS OF ARGUMENTS:
 EXAMPLES:
   *.c(:o)  sorted list of .c files")
 
-(defvar eshell-pred-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-q") #'eshell-display-predicate-help)
-    (define-key map (kbd "C-c M-m") #'eshell-display-modifier-help)
-    map))
+(defvar-keymap eshell-pred-mode-map
+  "C-c M-q" #'eshell-display-predicate-help
+  "C-c M-m" #'eshell-display-modifier-help)
 
 ;;; Functions:
 
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index aa96166087..a1a91e7d63 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -1,6 +1,6 @@
 ;;; em-prompt.el --- command prompts  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -96,11 +96,9 @@ arriving, or after."
   :options '(eshell-show-maximum-output)
   :group 'eshell-prompt)
 
-(defvar eshell-prompt-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c C-n") #'eshell-next-prompt)
-    (define-key map (kbd "C-c C-p") #'eshell-previous-prompt)
-    map))
+(defvar-keymap eshell-prompt-mode-map
+  "C-c C-n" #'eshell-next-prompt
+  "C-c C-p" #'eshell-previous-prompt)
 
 ;;; Functions:
 
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index d70444ea10..f24758d4e3 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -1,6 +1,6 @@
 ;;; em-rebind.el --- rebind keys when point is at current input  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -136,10 +136,8 @@ This is default behavior of shells like bash."
   :type '(repeat function)
   :group 'eshell-rebind)
 
-(defvar eshell-rebind-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-l") #'eshell-lock-local-map)
-    map))
+(defvar-keymap eshell-rebind-mode-map
+  "C-c M-l" #'eshell-lock-local-map)
 
 ;; Internal Variables:
 
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el
index 1f08e89191..e8459513f3 100644
--- a/lisp/eshell/em-script.el
+++ b/lisp/eshell/em-script.el
@@ -1,6 +1,6 @@
 ;;; em-script.el --- Eshell script files  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el
index dffc8f804b..6768cee4c3 100644
--- a/lisp/eshell/em-smart.el
+++ b/lisp/eshell/em-smart.el
@@ -1,6 +1,6 @@
 ;;; em-smart.el --- smart display of output  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index f9d8acccf2..e34c5ae47c 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -1,6 +1,6 @@
 ;;; em-term.el --- running visual commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el
index e29e9e3e3a..e9018bdb93 100644
--- a/lisp/eshell/em-tramp.el
+++ b/lisp/eshell/em-tramp.el
@@ -1,6 +1,6 @@
 ;;; em-tramp.el --- Eshell features that require TRAMP  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Aidan Gauland <aidalgol@no8wireless.co.nz>
 
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index e71edaf476..3967817b0e 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -1,6 +1,6 @@
 ;;; em-unix.el --- UNIX command aliases  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el
index f58e1b85cb..2583738d55 100644
--- a/lisp/eshell/em-xtra.el
+++ b/lisp/eshell/em-xtra.el
@@ -1,6 +1,6 @@
 ;;; em-xtra.el --- extra alias functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 1990c0cfa5..1a2f2a57e8 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -1,6 +1,6 @@
 ;;; esh-arg.el --- argument processing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -152,10 +152,8 @@ treated as a literal character."
   :type 'hook
   :group 'eshell-arg)
 
-(defvar eshell-arg-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-b") #'eshell-insert-buffer-name)
-    map))
+(defvar-keymap eshell-arg-mode-map
+  "C-c M-b" #'eshell-insert-buffer-name)
 
 ;;; Functions:
 
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index a2464ad4a9..a2d7d9431a 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1,6 +1,6 @@
 ;;; esh-cmd.el --- command invocation  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -258,9 +258,8 @@ the command."
     (default-directory default-directory)
     (process-environment (eshell-copy-environment)))
   "A list of `let' bindings for subcommand environments."
-  :type 'sexp)
-
-(put 'risky-local-variable 'eshell-subcommand-bindings t)
+  :type 'sexp
+  :risky t)
 
 (defvar eshell-ensure-newline-p nil
   "If non-nil, ensure that a newline is emitted after a Lisp form.
@@ -945,12 +944,12 @@ at the moment are:
       ;; In that case, unwrap the value before checking the delimiter
       ;; value.
       (if (and val
-               (not (processp val))
+               (not (eshell-processp val))
                (not (eq val t)))
           (error "Unmatched delimiter: %S" val)
         ;; Eshell-command expect a list like (<process>) to know if the
         ;; command should be async or not.
-        (or (and (processp val) delim) val)))))
+        (or (and (eshell-processp val) delim) val)))))
 
 (defun eshell-resume-command (proc status)
   "Resume the current command when a process ends."
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index fa149dd46e..fc023f23ce 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -1,6 +1,6 @@
 ;;; esh-ext.el --- commands external to Eshell  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index c2471912ab..2e0f312f4a 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -1,6 +1,6 @@
 ;;; esh-io.el --- I/O management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -147,10 +147,9 @@ not be added to this variable."
                function
                (choice (const :tag "Func returns output-func" t)
                        (const :tag "Func is output-func" nil))))
+  :risky t
   :group 'eshell-io)
 
-(put 'eshell-virtual-targets 'risky-local-variable t)
-
 ;;; Internal Variables:
 
 (defvar eshell-current-handles nil)
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index cae5236d89..8302eefe1e 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -1,6 +1,6 @@
 ;;; esh-mode.el --- user interface  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -260,31 +260,28 @@ This is used by `eshell-watch-for-password-prompt'."
      (standard-syntax-table))
     st))
 
-(defvar eshell-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [(control ?c)] 'eshell-command-map)
-    (define-key map "\r" #'eshell-send-input)
-    (define-key map "\M-\r" #'eshell-queue-input)
-    (define-key map [(meta control ?l)] #'eshell-show-output)
-    (define-key map [(control ?a)] #'eshell-bol)
-    map))
-
-(defvar eshell-command-map
-  (let ((map (define-prefix-command 'eshell-command-map)))
-    (define-key map [(meta ?o)] #'eshell-mark-output)
-    (define-key map [(meta ?d)] #'eshell-toggle-direct-send)
-    (define-key map [(control ?a)] #'eshell-bol)
-    (define-key map [(control ?b)] #'eshell-backward-argument)
-    (define-key map [(control ?e)] #'eshell-show-maximum-output)
-    (define-key map [(control ?f)] #'eshell-forward-argument)
-    (define-key map [(control ?m)] #'eshell-copy-old-input)
-    (define-key map [(control ?o)] #'eshell-kill-output)
-    (define-key map [(control ?r)] #'eshell-show-output)
-    (define-key map [(control ?t)] #'eshell-truncate-buffer)
-    (define-key map [(control ?u)] #'eshell-kill-input)
-    (define-key map [(control ?w)] #'backward-kill-word)
-    (define-key map [(control ?y)] #'eshell-repeat-argument)
-    map))
+(defvar-keymap eshell-mode-map
+  "C-c"   'eshell-command-map
+  "RET"   #'eshell-send-input
+  "M-RET" #'eshell-queue-input
+  "C-M-l" #'eshell-show-output
+  "C-a"   #'eshell-bol)
+
+(defvar-keymap eshell-command-map
+  :prefix 'eshell-command-map
+  "M-o" #'eshell-mark-output
+  "M-d" #'eshell-toggle-direct-send
+  "C-a" #'eshell-bol
+  "C-b" #'eshell-backward-argument
+  "C-e" #'eshell-show-maximum-output
+  "C-f" #'eshell-forward-argument
+  "C-m" #'eshell-copy-old-input
+  "C-o" #'eshell-kill-output
+  "C-r" #'eshell-show-output
+  "C-t" #'eshell-truncate-buffer
+  "C-u" #'eshell-kill-input
+  "C-w" #'backward-kill-word
+  "C-y" #'eshell-repeat-argument)
 
 ;;; User Functions:
 
diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el
index 97ffedae62..ade151d7cd 100644
--- a/lisp/eshell/esh-module.el
+++ b/lisp/eshell/esh-module.el
@@ -1,6 +1,6 @@
 ;;; esh-module.el --- Eshell modules  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: processes
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index 7d31845528..d96b77ddd3 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -1,6 +1,6 @@
 ;;; esh-opt.el --- command options processing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 7a0b26a065..5ed692fb5a 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -1,6 +1,6 @@
 ;;; esh-proc.el --- process management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -101,15 +101,13 @@ information, for example."
 (defvar eshell-process-list nil
   "A list of the current status of subprocesses.")
 
-(defvar eshell-proc-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-i") #'eshell-insert-process)
-    (define-key map (kbd "C-c C-c") #'eshell-interrupt-process)
-    (define-key map (kbd "C-c C-k") #'eshell-kill-process)
-    (define-key map (kbd "C-c C-d") #'eshell-send-eof-to-process)
-    (define-key map (kbd "C-c C-s") #'list-processes)
-    (define-key map (kbd "C-c C-\\") #'eshell-quit-process)
-    map))
+(defvar-keymap eshell-proc-mode-map
+  "C-c M-i"  #'eshell-insert-process
+  "C-c C-c"  #'eshell-interrupt-process
+  "C-c C-k"  #'eshell-kill-process
+  "C-c C-d"  #'eshell-send-eof-to-process
+  "C-c C-s"  #'list-processes
+  "C-c C-\\" #'eshell-quit-process)
 
 ;;; Functions:
 
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 0eef45e0ef..0e04dbc7c9 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -1,6 +1,6 @@
 ;;; esh-util.el --- general utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index fa9853ae00..5c8dacd980 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -1,6 +1,6 @@
 ;;; esh-var.el --- handling of variables  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -205,14 +205,11 @@ Additionally, each member may specify if it should be 
copied to the
 environment of created subprocesses."
   :type '(repeat (list string sexp
                       (choice (const :tag "Copy to environment" t)
-                              (const :tag "Use only in Eshell" nil)))))
+                               (const :tag "Use only in Eshell" nil))))
+  :risky t)
 
-(put 'eshell-variable-aliases-list 'risky-local-variable t)
-
-(defvar eshell-var-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-v") #'eshell-insert-envvar)
-    map))
+(defvar-keymap eshell-var-mode-map
+  "C-c M-v" #'eshell-insert-envvar)
 
 ;;; Functions:
 
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index c66ad00072..5c356e8928 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -1,6 +1,6 @@
 ;;; eshell.el --- the Emacs command shell  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Version: 2.4.2
@@ -260,7 +260,7 @@ information on Eshell, see Info node `(eshell)Top'."
                   (t
                    (get-buffer-create eshell-buffer-name)))))
     (cl-assert (and buf (buffer-live-p buf)))
-    (pop-to-buffer-same-window buf)
+    (pop-to-buffer buf display-comint-buffer-action)
     (unless (derived-mode-p 'eshell-mode)
       (eshell-mode))
     buf))
diff --git a/lisp/expand.el b/lisp/expand.el
index deeec8c59d..44f41c5e1e 100644
--- a/lisp/expand.el
+++ b/lisp/expand.el
@@ -1,6 +1,6 @@
 ;;; expand.el --- make abbreviations more usable  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Frederic Lepied <Frederic.Lepied@sugix.frmug.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/ezimage.el b/lisp/ezimage.el
index 57033cde05..9e5a08e682 100644
--- a/lisp/ezimage.el
+++ b/lisp/ezimage.el
@@ -1,6 +1,6 @@
 ;;; ezimage.el --- Generalized Image management  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 50302b9682..95207959dd 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -1,6 +1,6 @@
 ;;; face-remap.el --- Functions for managing `face-remapping-alist'  -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: faces, face remapping, display, user commands
@@ -390,6 +390,40 @@ a top-level keymap, `text-scale-increase' or
                (lambda () (interactive) (text-scale-adjust (abs inc))))))
          map))))) ;; )
 
+(defvar-local text-scale--pinch-start-scale 0
+  "The text scale at the start of a pinch sequence.")
+
+;;;###autoload (define-key global-map [pinch] 'text-scale-pinch)
+;;;###autoload
+(defun text-scale-pinch (event)
+  "Adjust the height of the default face by the scale in the pinch event 
EVENT."
+  (interactive "e")
+  (when (not (eq (event-basic-type event) 'pinch))
+    (error "`text-scale-pinch' bound to bad event type"))
+  (let ((evt))
+    (catch 'done
+      (while t
+        (unless (and (setq evt (read-event nil nil 0.01))
+                     (eq (car evt) 'pinch))
+          (throw 'done nil))))
+    (when (and (consp evt)
+               (eq (car evt) 'pinch))
+      (setq event evt)))
+  (let ((window (posn-window (nth 1 event)))
+        (scale (nth 4 event))
+        (dx (nth 2 event))
+        (dy (nth 3 event))
+        (angle (nth 5 event)))
+    (with-selected-window window
+      (when (and (zerop dx)
+                 (zerop dy)
+                 (zerop angle))
+        (setq text-scale--pinch-start-scale
+              (if text-scale-mode text-scale-mode-amount 0)))
+      (text-scale-set
+       (+ text-scale--pinch-start-scale
+          (round (log scale text-scale-mode-step)))))))
+
 
 ;; ----------------------------------------------------------------
 ;; buffer-face-mode
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index fe458b8c07..b3e0169632 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -1,6 +1,6 @@
 ;;; facemenu.el --- create a face menu for interactively adding fonts to text  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: faces
diff --git a/lisp/faces.el b/lisp/faces.el
index 9caba3a11b..c69603af4d 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1,6 +1,6 @@
 ;;; faces.el --- Lisp faces -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1996, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1996, 1998-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
@@ -1172,13 +1172,13 @@ an integer value."
            (:height
             'integerp)
            (:stipple
-            (and (memq (window-system frame) '(x ns)) ; No stipple on w32 or 
haiku
+            (and (memq (window-system frame) '(x ns pgtk)) ; No stipple on w32 
or haiku
                  (mapcar #'list
                          (apply #'nconc
                                 (mapcar (lambda (dir)
                                           (and (file-readable-p dir)
                                                (file-directory-p dir)
-                                               (directory-files dir)))
+                                               (directory-files dir 'full)))
                                         x-bitmap-file-path)))))
            (:inherit
             (cons '("none" . nil)
@@ -1516,7 +1516,7 @@ If FRAME is nil, the current FRAME is used."
            match (cond ((eq req 'type)
                         (or (memq (window-system frame) options)
                             (and (memq 'graphic options)
-                                 (memq (window-system frame) '(x w32 ns)))
+                                 (memq (window-system frame) '(x w32 ns pgtk)))
                             ;; FIXME: This should be revisited to use
                             ;; display-graphic-p, provided that the
                             ;; color selection depends on the number
@@ -2630,7 +2630,7 @@ See `mode-line-display' for the face used on mode lines."
   :group 'basic-faces)
 
 (defface mode-line-active
-  '((t :inherit (mode-line variable-pitch)))
+  '((t :inherit mode-line))
   "Face for the selected mode line.
 This inherits from the `mode-line' face."
   :version "29.1"
@@ -2639,7 +2639,7 @@ This inherits from the `mode-line' face."
 
 (defface mode-line-inactive
   '((default
-     :inherit (mode-line variable-pitch))
+     :inherit mode-line)
     (((class color) (min-colors 88) (background light))
      :weight light
      :box (:line-width -1 :color "grey75" :style nil)
@@ -2840,7 +2840,7 @@ Note: Other faces cannot inherit from the cursor face."
   '((default
      :box (:line-width 1 :style released-button)
      :foreground "black")
-    (((type x w32 ns haiku) (class color))
+    (((type x w32 ns haiku pgtk) (class color))
      :background "grey75")
     (((type x) (class mono))
      :background "grey"))
@@ -2963,7 +2963,7 @@ It is used for characters of no fonts too."
   :group 'basic-faces)
 
 (defface read-multiple-choice-face
-  '((t (:inherit underline
+  '((t (:inherit (help-key-binding underline)
         :weight bold)))
   "Face for the symbol name in `read-multiple-choice' output."
   :group 'basic-faces
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 5d3cee591b..f9220817a7 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1,6 +1,6 @@
 ;;; ffap.el --- find file (or url) at point  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1995-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michelangelo Grigni <mic@mathcs.emory.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/filecache.el b/lisp/filecache.el
index 4223878b0e..8232357982 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -1,6 +1,6 @@
 ;;; filecache.el --- find files using a pre-loaded cache  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Sun Nov 10 1996
diff --git a/lisp/fileloop.el b/lisp/fileloop.el
index cd60600a25..b4f6179a93 100644
--- a/lisp/fileloop.el
+++ b/lisp/fileloop.el
@@ -1,6 +1,6 @@
 ;;; fileloop.el --- Operations on multiple files  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 26954cc73f..94e07289e3 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -1,6 +1,6 @@
 ;;; filenotify.el --- watch files for changes on disk  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/lisp/files-x.el b/lisp/files-x.el
index c7cc076f84..e86ba8f8d0 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -1,6 +1,6 @@
 ;;; files-x.el --- extended file handling commands  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@jurta.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/files.el b/lisp/files.el
index 34cc39da1a..94ac213a99 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1,6 +1,6 @@
 ;;; files.el --- file input and output commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Package: emacs
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 9182c53945..0bc44ecd91 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -1,6 +1,6 @@
 ;;; filesets.el --- handle group of files  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Thomas Link <sanobast-emacs@yahoo.de>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/find-cmd.el b/lisp/find-cmd.el
index bb2e97d866..e33a4ee61b 100644
--- a/lisp/find-cmd.el
+++ b/lisp/find-cmd.el
@@ -1,6 +1,6 @@
 ;;; find-cmd.el --- Build a valid find(1) command with sexps  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Philip Jackson <phil@shellarchive.co.uk>
 ;; Version: 0.6
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index ebdb10ae9f..c67138a800 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -1,6 +1,6 @@
 ;;; find-dired.el --- run a `find' command and dired the output  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994-1995, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1994-1995, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>,
diff --git a/lisp/find-file.el b/lisp/find-file.el
index afe6cb5150..809592413d 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -4,7 +4,7 @@
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: c, matching, tools
 
-;; Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el
index 6062bd2643..d4d899aced 100644
--- a/lisp/find-lisp.el
+++ b/lisp/find-lisp.el
@@ -4,7 +4,7 @@
 ;; Created: Fri Mar 26 1999
 ;; Keywords: unix
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/finder.el b/lisp/finder.el
index 00f321b802..5a6fe45192 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -1,6 +1,6 @@
 ;;; finder.el --- topic & keyword-based code finder  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1997-1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1997-1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
diff --git a/lisp/flow-ctrl.el b/lisp/flow-ctrl.el
index adb52d7253..3ee33c0d14 100644
--- a/lisp/flow-ctrl.el
+++ b/lisp/flow-ctrl.el
@@ -1,6 +1,6 @@
 ;;; flow-ctrl.el --- help for lusers on cu(1) or ttys with wired-in ^S/^Q flow 
control  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1990-1991, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1990-1991, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher
diff --git a/lisp/foldout.el b/lisp/foldout.el
index 8925241df3..4b192a7b6a 100644
--- a/lisp/foldout.el
+++ b/lisp/foldout.el
@@ -1,6 +1,6 @@
 ;;; foldout.el --- folding extensions for outline-mode and outline-minor-mode  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/follow.el b/lisp/follow.el
index 3761275bbf..6c721899d4 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -1,6 +1,6 @@
 ;;; follow.el --- synchronize windows showing the same buffer  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1995-1997, 1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1995-1997, 1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Anders Lindgren
diff --git a/lisp/font-core.el b/lisp/font-core.el
index 95bf46c9b8..2b75309ff3 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -1,6 +1,6 @@
 ;;; font-core.el --- Core interface to font-lock  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: languages, faces
@@ -66,7 +66,6 @@ Other variables include that for syntactic keyword 
fontification,
 functions, `font-lock-fontify-buffer-function',
 `font-lock-unfontify-buffer-function', `font-lock-fontify-region-function',
 `font-lock-unfontify-region-function', and `font-lock-inhibit-thing-lock'.")
-;;;###autoload
 (put 'font-lock-defaults 'risky-local-variable t)
 
 (defvar font-lock-function 'font-lock-default-function
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index c2590eb3c1..083bfb8626 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1,6 +1,6 @@
 ;;; font-lock.el --- Electric font lock mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski
 ;;     Richard Stallman
diff --git a/lisp/format-spec.el b/lisp/format-spec.el
index 202d65d8fc..45c19aebc8 100644
--- a/lisp/format-spec.el
+++ b/lisp/format-spec.el
@@ -1,6 +1,6 @@
 ;;; format-spec.el --- format arbitrary formatting strings -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: tools
diff --git a/lisp/format.el b/lisp/format.el
index 8ae51f19eb..6c7524891e 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -1,6 +1,6 @@
 ;;; format.el --- read and save files in multiple formats  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1995, 1997, 1999, 2001-2021 Free Software
+;; Copyright (C) 1994-1995, 1997, 1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
diff --git a/lisp/forms.el b/lisp/forms.el
index 551a1ba3c9..8bfeaad1c1 100644
--- a/lisp/forms.el
+++ b/lisp/forms.el
@@ -1,6 +1,6 @@
 ;;; forms.el --- Forms mode: edit a file as a form to fill in  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Johan Vromans <jvromans@squirrel.nl>
 
diff --git a/lisp/frame.el b/lisp/frame.el
index dc7c628e81..62b73f3157 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1,6 +1,6 @@
 ;;; frame.el --- multi-frame management independent of window systems  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 1996-1997, 2000-2021 Free Software
+;; Copyright (C) 1993-1994, 1996-1997, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -1637,6 +1637,7 @@ live frame and defaults to the selected one."
 (declare-function x-frame-geometry "xfns.c" (&optional frame))
 (declare-function w32-frame-geometry "w32fns.c" (&optional frame))
 (declare-function ns-frame-geometry "nsfns.m" (&optional frame))
+(declare-function pgtk-frame-geometry "pgtkfns.c" (&optional frame))
 (declare-function haiku-frame-geometry "haikufns.c" (&optional frame))
 
 (defun frame-geometry (&optional frame)
@@ -1687,6 +1688,8 @@ and width values are in pixels.
       (w32-frame-geometry frame))
      ((eq frame-type 'ns)
       (ns-frame-geometry frame))
+     ((eq frame-type 'pgtk)
+      (pgtk-frame-geometry frame))
      ((eq frame-type 'haiku)
       (haiku-frame-geometry frame))
      (t
@@ -1813,6 +1816,7 @@ of frames like calls to map a frame or change its 
visibility."
 (declare-function x-frame-edges "xfns.c" (&optional frame type))
 (declare-function w32-frame-edges "w32fns.c" (&optional frame type))
 (declare-function ns-frame-edges "nsfns.m" (&optional frame type))
+(declare-function pgtk-frame-edges "pgtkfns.c" (&optional frame type))
 (declare-function haiku-frame-edges "haikufns.c" (&optional frame type))
 
 (defun frame-edges (&optional frame type)
@@ -1837,6 +1841,8 @@ FRAME."
       (w32-frame-edges frame type))
      ((eq frame-type 'ns)
       (ns-frame-edges frame type))
+     ((eq frame-type 'pgtk)
+      (pgtk-frame-edges frame type))
      ((eq frame-type 'haiku)
       (haiku-frame-edges frame type))
      (t
@@ -1845,6 +1851,7 @@ FRAME."
 (declare-function w32-mouse-absolute-pixel-position "w32fns.c")
 (declare-function x-mouse-absolute-pixel-position "xfns.c")
 (declare-function ns-mouse-absolute-pixel-position "nsfns.m")
+(declare-function pgtk-mouse-absolute-pixel-position "pgtkfns.c")
 (declare-function haiku-mouse-absolute-pixel-position "haikufns.c")
 
 (defun mouse-absolute-pixel-position ()
@@ -1860,11 +1867,14 @@ position (0, 0) of the selected frame's terminal."
       (w32-mouse-absolute-pixel-position))
      ((eq frame-type 'ns)
       (ns-mouse-absolute-pixel-position))
+     ((eq frame-type 'pgtk)
+      (pgtk-mouse-absolute-pixel-position))
      ((eq frame-type 'haiku)
       (haiku-mouse-absolute-pixel-position))
      (t
       (cons 0 0)))))
 
+(declare-function pgtk-set-mouse-absolute-pixel-position "pgtkfns.c" (x y))
 (declare-function ns-set-mouse-absolute-pixel-position "nsfns.m" (x y))
 (declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y))
 (declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y))
@@ -1876,6 +1886,8 @@ The coordinates X and Y are interpreted in pixels 
relative to a
 position (0, 0) of the selected frame's terminal."
   (let ((frame-type (framep-on-display)))
     (cond
+     ((eq frame-type 'pgtk)
+      (pgtk-set-mouse-absolute-pixel-position x y))
      ((eq frame-type 'ns)
       (ns-set-mouse-absolute-pixel-position x y))
      ((eq frame-type 'x)
@@ -1976,6 +1988,7 @@ workarea attribute."
 (declare-function x-frame-list-z-order "xfns.c" (&optional display))
 (declare-function w32-frame-list-z-order "w32fns.c" (&optional display))
 (declare-function ns-frame-list-z-order "nsfns.m" (&optional display))
+(declare-function pgtk-frame-list-z-order "pgtkfns.c" (&optional display))
 (declare-function haiku-frame-list-z-order "haikufns.c" (&optional display))
 
 (defun frame-list-z-order (&optional display)
@@ -1997,12 +2010,16 @@ Return nil if DISPLAY contains no Emacs frame."
       (w32-frame-list-z-order display))
      ((eq frame-type 'ns)
       (ns-frame-list-z-order display))
+     ((eq frame-type 'pgtk)
+      (pgtk-frame-list-z-order display))
      ((eq frame-type 'haiku)
       (haiku-frame-list-z-order display)))))
 
 (declare-function x-frame-restack "xfns.c" (frame1 frame2 &optional above))
 (declare-function w32-frame-restack "w32fns.c" (frame1 frame2 &optional above))
 (declare-function ns-frame-restack "nsfns.m" (frame1 frame2 &optional above))
+(declare-function pgtk-frame-restack "pgtkfns.c" (frame1 frame2 &optional 
above))
+(declare-function haiku-frame-restack "haikufns.c" (frame1 frame2 &optional 
above))
 
 (defun frame-restack (frame1 frame2 &optional above)
   "Restack FRAME1 below FRAME2.
@@ -2032,7 +2049,11 @@ Some window managers may refuse to restack windows."
          ((eq frame-type 'w32)
           (w32-frame-restack frame1 frame2 above))
          ((eq frame-type 'ns)
-          (ns-frame-restack frame1 frame2 above))))
+          (ns-frame-restack frame1 frame2 above))
+         ((eq frame-type 'haiku)
+          (haiku-frame-restack frame1 frame2 above))
+         ((eq frame-type 'pgtk)
+          (pgtk-frame-restack frame1 frame2 above))))
     (error "Cannot restack frames")))
 
 (defun frame-size-changed-p (&optional frame)
@@ -2079,8 +2100,8 @@ frame's display)."
      ((eq frame-type 'w32)
       (with-no-warnings
        (> w32-num-mouse-buttons 0)))
-     ((memq frame-type '(x ns haiku))
-      t)    ;; We assume X, NeXTstep and Haiku *always* have a pointing device
+     ((memq frame-type '(x ns haiku pgtk))
+      t)    ;; We assume X, NeXTstep, GTK, and Haiku *always* have a pointing 
device
      (t
       (or (and (featurep 'xt-mouse)
               xterm-mouse-mode)
@@ -2105,7 +2126,7 @@ frames and several different fonts at once.  This is true 
for displays
 that use a window system such as X, and false for text-only terminals.
 DISPLAY can be a display name, a frame, or nil (meaning the selected
 frame's display)."
-  (not (null (memq (framep-on-display display) '(x w32 ns haiku)))))
+  (not (null (memq (framep-on-display display) '(x w32 ns pgtk haiku)))))
 
 (defun display-images-p (&optional display)
   "Return non-nil if DISPLAY can display images.
@@ -2133,7 +2154,7 @@ frame's display)."
       ;; a Windows DOS Box.
       (with-no-warnings
        (not (null dos-windows-version))))
-     ((memq frame-type '(x w32 ns))
+     ((memq frame-type '(x w32 ns pgtk))
       t)
      (t
       nil))))
@@ -2143,7 +2164,7 @@ frame's display)."
 This means that, for example, DISPLAY can differentiate between
 the keybinding RET and [return]."
   (let ((frame-type (framep-on-display display)))
-    (or (memq frame-type '(x w32 ns pc))
+    (or (memq frame-type '(x w32 ns pc pgtk))
         ;; MS-DOS and MS-Windows terminals have built-in support for
         ;; function (symbol) keys
         (memq system-type '(ms-dos windows-nt)))))
@@ -2156,7 +2177,7 @@ DISPLAY should be either a frame or a display name (a 
string).
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-screens display))
      (t
       1))))
@@ -2176,7 +2197,7 @@ with DISPLAY.  To get information for each physical 
monitor, use
 `display-monitor-attributes-list'."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-pixel-height display))
      (t
       (frame-height (if (framep display) display (selected-frame)))))))
@@ -2196,7 +2217,7 @@ with DISPLAY.  To get information for each physical 
monitor, use
 `display-monitor-attributes-list'."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-pixel-width display))
      (t
       (frame-width (if (framep display) display (selected-frame)))))))
@@ -2234,7 +2255,7 @@ For graphical terminals, note that on \"multi-monitor\" 
setups this
 refers to the height in millimeters for all physical monitors
 associated with DISPLAY.  To get information for each physical
 monitor, use `display-monitor-attributes-list'."
-  (and (memq (framep-on-display display) '(x w32 ns haiku))
+  (and (memq (framep-on-display display) '(x w32 ns haiku pgtk))
        (or (cddr (assoc (or display (frame-parameter nil 'display))
                        display-mm-dimensions-alist))
           (cddr (assoc t display-mm-dimensions-alist))
@@ -2255,7 +2276,7 @@ For graphical terminals, note that on \"multi-monitor\" 
setups this
 refers to the width in millimeters for all physical monitors
 associated with DISPLAY.  To get information for each physical
 monitor, use `display-monitor-attributes-list'."
-  (and (memq (framep-on-display display) '(x w32 ns haiku))
+  (and (memq (framep-on-display display) '(x w32 ns haiku pgtk))
        (or (cadr (assoc (or display (frame-parameter nil 'display))
                        display-mm-dimensions-alist))
           (cadr (assoc t display-mm-dimensions-alist))
@@ -2273,7 +2294,7 @@ DISPLAY can be a display name or a frame.
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-backing-store display))
      (t
       'not-useful))))
@@ -2286,7 +2307,7 @@ DISPLAY can be a display name or a frame.
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-save-under display))
      (t
       'not-useful))))
@@ -2299,7 +2320,7 @@ DISPLAY can be a display name or a frame.
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-planes display))
      ((eq frame-type 'pc)
       4)
@@ -2314,7 +2335,7 @@ DISPLAY can be a display name or a frame.
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-color-cells display))
      ((eq frame-type 'pc)
       16)
@@ -2331,7 +2352,7 @@ DISPLAY can be a display name or a frame.
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
   (let ((frame-type (framep-on-display display)))
     (cond
-     ((memq frame-type '(x w32 ns haiku))
+     ((memq frame-type '(x w32 ns haiku pgtk))
       (x-display-visual-class display))
      ((and (memq frame-type '(pc t))
           (tty-display-color-p display))
@@ -2345,6 +2366,8 @@ If DISPLAY is omitted or nil, it defaults to the selected 
frame's display."
                  (&optional display))
 (declare-function ns-display-monitor-attributes-list "nsfns.m"
                  (&optional terminal))
+(declare-function pgtk-display-monitor-attributes-list "pgtkfns.c"
+                 (&optional terminal))
 
 (defun display-monitor-attributes-list (&optional display)
   "Return a list of physical monitor attributes on DISPLAY.
@@ -2362,6 +2385,7 @@ of attribute keys and values as follows:
  mm-size  -- Width and height in millimeters in the form of
             (WIDTH HEIGHT)
  frames   -- List of frames dominated by the physical monitor
+ scale-factor (*) -- Scale factor (float)
  name (*) -- Name of the physical monitor as a string
  source (*) -- Source of multi-monitor information as a string
 
@@ -2393,6 +2417,8 @@ monitors."
       (w32-display-monitor-attributes-list display))
      ((eq frame-type 'ns)
       (ns-display-monitor-attributes-list display))
+     ((eq frame-type 'pgtk)
+      (pgtk-display-monitor-attributes-list display))
      (t
       (let ((geometry (list 0 0 (display-pixel-width display)
                            (display-pixel-height display))))
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 998f4fb4ca..10714af1fa 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -1,6 +1,6 @@
 ;;; frameset.el --- save and restore frame and window setup -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <lekktu@gmail.com>
 ;; Keywords: convenience
diff --git a/lisp/fringe.el b/lisp/fringe.el
index 82cfacc6b6..8c833f0242 100644
--- a/lisp/fringe.el
+++ b/lisp/fringe.el
@@ -1,6 +1,6 @@
 ;;; fringe.el --- fringe setup and control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index 4505d8513f..ecfa8aab84 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -1,6 +1,6 @@
 ;;; generic-x.el --- A collection of generic modes  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Tue Oct 08 1996
diff --git a/lisp/gnus/ChangeLog.1 b/lisp/gnus/ChangeLog.1
index 6ad87f06f2..1949f62609 100644
--- a/lisp/gnus/ChangeLog.1
+++ b/lisp/gnus/ChangeLog.1
@@ -3702,7 +3702,7 @@
        * gnus.el: Quassia Gnus v0.1 is released.
 
 
-  Copyright (C) 1997-2021 Free Software Foundation, Inc.
+  Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index 26ecaada5e..fd5fa0542f 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -18538,7 +18538,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-  Copyright (C) 2000-2002, 2004-2021 Free Software Foundation, Inc.
+  Copyright (C) 2000-2002, 2004-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/gnus/ChangeLog.3 b/lisp/gnus/ChangeLog.3
index 836cca87ff..c75f5354ca 100644
--- a/lisp/gnus/ChangeLog.3
+++ b/lisp/gnus/ChangeLog.3
@@ -26325,7 +26325,7 @@
 
 See ChangeLog.2 for earlier changes.
 
-  Copyright (C) 2004-2021 Free Software Foundation, Inc.
+  Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/gnus/canlock.el b/lisp/gnus/canlock.el
index dbdbaa83d7..71ed015e2c 100644
--- a/lisp/gnus/canlock.el
+++ b/lisp/gnus/canlock.el
@@ -1,6 +1,6 @@
 ;;; canlock.el --- functions for Cancel-Lock feature  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1998-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Katsumi Yamaoka <yamaoka@jpl.org>
 ;; Keywords: news, cancel-lock, hmac, sha1, rfc2104
diff --git a/lisp/gnus/deuglify.el b/lisp/gnus/deuglify.el
index e6c4630a67..d2edfdf09f 100644
--- a/lisp/gnus/deuglify.el
+++ b/lisp/gnus/deuglify.el
@@ -1,6 +1,6 @@
 ;;; deuglify.el --- deuglify broken Outlook (Express) articles  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Raymond Scholz <rscholz@zonix.de>
 ;;         Thomas Steffen
diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el
index 68a9098904..697ce01343 100644
--- a/lisp/gnus/gmm-utils.el
+++ b/lisp/gnus/gmm-utils.el
@@ -1,6 +1,6 @@
 ;;; gmm-utils.el --- Utility functions for Gnus, Message and MML  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Reiner Steib <reiner.steib@gmx.de>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 169a351c2c..fd66135b5c 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -1,6 +1,6 @@
 ;;; gnus-agent.el --- unplugged support for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index b7701f10a5..f26ab6ab4c 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1,6 +1,6 @@
 ;;; gnus-art.el --- article mode commands for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -6084,6 +6084,34 @@ If nil, don't show those extra buttons."
    ((equal (car handle) "multipart/encrypted")
     (gnus-add-wash-type 'encrypted)
     (gnus-mime-display-security handle))
+   ;; pkcs7-mime handling:
+   ;;
+   ;; although not really multipart these are structured internally by
+   ;; mm-dissect-buffer like multipart to not discard the decryption
+   ;; and verification results
+   ;;
+   ;; application/pkcs7-mime
+   ((and (equal (car handle) "application/pkcs7-mime")
+         (equal (mm-handle-multipart-ctl-parameter handle 'protocol)
+                "application/pkcs7-mime_signed-data"))
+    (gnus-add-wash-type 'signed)
+    (gnus-mime-display-security handle))
+   ((and (equal (car handle) "application/pkcs7-mime")
+         (equal (mm-handle-multipart-ctl-parameter handle 'protocol)
+                "application/pkcs7-mime_enveloped-data"))
+    (gnus-add-wash-type 'encrypted)
+    (gnus-mime-display-security handle))
+   ;; application/x-pkcs7-mime
+   ((and (equal (car handle) "application/x-pkcs7-mime")
+         (equal (mm-handle-multipart-ctl-parameter handle 'protocol)
+                "application/x-pkcs7-mime_signed-data"))
+    (gnus-add-wash-type 'signed)
+    (gnus-mime-display-security handle))
+   ((and (equal (car handle) "application/x-pkcs7-mime")
+         (equal (mm-handle-multipart-ctl-parameter handle 'protocol)
+                "application/x-pkcs7-mime_enveloped-data"))
+    (gnus-add-wash-type 'encrypted)
+    (gnus-mime-display-security handle))
    ;; Other multiparts are handled like multipart/mixed.
    (t
     (gnus-mime-display-mixed (cdr handle)))))
@@ -7907,8 +7935,8 @@ variable is the real callback function."
                       (function :tag "Callback")
                       (repeat :tag "Par"
                               :inline t
-                              (integer :tag "Regexp group")))))
-(put 'gnus-button-alist 'risky-local-variable t)
+                               (integer :tag "Regexp group"))))
+  :risky t)
 
 (defcustom gnus-header-button-alist
   '(("^\\(References\\|Message-I[Dd]\\|^In-Reply-To\\):" "<[^<>]+>"
@@ -7947,8 +7975,8 @@ HEADER is a regexp to match a header.  For a fuller 
explanation, see
                       (function :tag "Callback")
                       (repeat :tag "Par"
                               :inline t
-                              (integer :tag "Regexp group")))))
-(put 'gnus-header-button-alist 'risky-local-variable t)
+                               (integer :tag "Regexp group"))))
+  :risky t)
 
 ;;; Commands:
 
@@ -8833,11 +8861,19 @@ For example:
     (setq point (point))
     (with-current-buffer (mm-handle-multipart-original-buffer handle)
       (let* ((mm-verify-option 'known)
-            (mm-decrypt-option 'known)
-            (nparts (mm-possibly-verify-or-decrypt (cdr handle) handle)))
-       (unless (eq nparts (cdr handle))
-         (mm-destroy-parts (cdr handle))
-         (setcdr handle nparts))))
+             (mm-decrypt-option 'known)
+             (pkcs7-mime-p (or (equal (car handle) "application/pkcs7-mime")
+                               (equal (car handle) 
"application/x-pkcs7-mime")))
+             (nparts (if pkcs7-mime-p
+                         (list (mm-possibly-verify-or-decrypt
+                                (cadr handle) (cadadr handle)))
+                       (mm-possibly-verify-or-decrypt (cdr handle) handle))))
+        (unless (eq nparts (cdr handle))
+          ;; if pkcs7-mime don't destroy the parts as the buffer in
+          ;; the cdr still needs to be accessible
+          (when (not pkcs7-mime-p)
+            (mm-destroy-parts (cdr handle)))
+          (setcdr handle nparts))))
     (gnus-mime-display-security handle)
     (when region
       (delete-region (point) (cdr region))
@@ -8891,14 +8927,35 @@ For example:
   (let* ((protocol (mm-handle-multipart-ctl-parameter handle 'protocol))
         (gnus-tmp-type
          (concat
-          (or (nth 2 (assoc protocol mm-verify-function-alist))
-              (nth 2 (assoc protocol mm-decrypt-function-alist))
-              "Unknown")
-          (if (equal (car handle) "multipart/signed")
-              " Signed" " Encrypted")
-          " Part"))
-        (gnus-tmp-info
-         (or (mm-handle-multipart-ctl-parameter handle 'gnus-info)
+           (or (nth 2 (assoc protocol mm-verify-function-alist))
+               (nth 2 (assoc protocol mm-decrypt-function-alist))
+               "Unknown")
+           (cond ((equal (car handle) "multipart/signed") " Signed")
+                 ((equal (car handle) "multipart/encrypted") " Encrypted")
+                 ((and (equal (car handle) "application/pkcs7-mime")
+                       (equal
+                        (mm-handle-multipart-ctl-parameter handle 'protocol)
+                        "application/pkcs7-mime_signed-data"))
+                  " Signed")
+                 ((and (equal (car handle) "application/pkcs7-mime")
+                       (equal
+                        (mm-handle-multipart-ctl-parameter handle 'protocol)
+                        "application/pkcs7-mime_enveloped-data"))
+                  " Encrypted")
+                 ;; application/x-pkcs7-mime
+                 ((and (equal (car handle) "application/x-pkcs7-mime")
+                       (equal
+                        (mm-handle-multipart-ctl-parameter handle 'protocol)
+                        "application/x-pkcs7-mime_signed-data"))
+                  " Signed")
+                 ((and (equal (car handle) "application/x-pkcs7-mime")
+                       (equal
+                        (mm-handle-multipart-ctl-parameter handle 'protocol)
+                        "application/x-pkcs7-mime_enveloped-data"))
+                  " Encrypted"))
+           " Part"))
+         (gnus-tmp-info
+          (or (mm-handle-multipart-ctl-parameter handle 'gnus-info)
              "Undecided"))
         (gnus-tmp-details
          (mm-handle-multipart-ctl-parameter handle 'gnus-details))
diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el
index fefd02c7bf..a1dc2b46e6 100644
--- a/lisp/gnus/gnus-async.el
+++ b/lisp/gnus/gnus-async.el
@@ -1,6 +1,6 @@
 ;;; gnus-async.el --- asynchronous support for Gnus  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-bcklg.el b/lisp/gnus/gnus-bcklg.el
index 6c7ad0c474..173d2f0633 100644
--- a/lisp/gnus/gnus-bcklg.el
+++ b/lisp/gnus/gnus-bcklg.el
@@ -1,6 +1,6 @@
 ;;; gnus-bcklg.el --- backlog functions for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el
index e9696b66a9..4f5b9bd342 100644
--- a/lisp/gnus/gnus-bookmark.el
+++ b/lisp/gnus/gnus-bookmark.el
@@ -1,6 +1,6 @@
 ;;; gnus-bookmark.el --- Bookmarks in Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 34dba54c11..ee20ba3c7f 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -1,6 +1,6 @@
 ;;; gnus-cache.el --- cache interface for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el
index e9c912109e..3ba2bbd6fe 100644
--- a/lisp/gnus/gnus-cite.el
+++ b/lisp/gnus/gnus-cite.el
@@ -1,6 +1,6 @@
 ;;; gnus-cite.el --- parse citations in articles for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 
diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el
index 3bc94f11e7..6ed9e32c91 100644
--- a/lisp/gnus/gnus-cloud.el
+++ b/lisp/gnus/gnus-cloud.el
@@ -1,6 +1,6 @@
 ;;; gnus-cloud.el --- storing and retrieving data via IMAP  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index e7af94ff50..f8714a95d4 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -1,6 +1,6 @@
 ;;; gnus-cus.el --- customization commands for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1996, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-dbus.el b/lisp/gnus/gnus-dbus.el
index 12bf7bb926..15d0e6e191 100644
--- a/lisp/gnus/gnus-dbus.el
+++ b/lisp/gnus/gnus-dbus.el
@@ -1,6 +1,6 @@
 ;;; gnus-dbus.el --- DBUS integration for Gnus       -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
 
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el
index 944fd9795a..1b54344e12 100644
--- a/lisp/gnus/gnus-delay.el
+++ b/lisp/gnus/gnus-delay.el
@@ -1,6 +1,6 @@
 ;;; gnus-delay.el --- Delayed posting of articles  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 ;; Keywords: mail, news, extensions
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index e99247c0ca..d9da8529eb 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -1,6 +1,6 @@
 ;;; gnus-demon.el --- daemonic Gnus behavior  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el
index 7ecc97262a..cd2b53064b 100644
--- a/lisp/gnus/gnus-diary.el
+++ b/lisp/gnus/gnus-diary.el
@@ -1,6 +1,6 @@
 ;;; gnus-diary.el --- Wrapper around the NNDiary Gnus back end  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author:        Didier Verna <didier@didierverna.net>
 ;; Created:       Tue Jul 20 10:42:55 1999
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index 00769a5da6..3d8882b1a5 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -1,6 +1,6 @@
 ;;; gnus-dired.el --- utility functions where gnus and dired meet  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Authors: Benjamin Rutt <brutt@bloomington.in.us>,
 ;;          Shenghuo Zhu <zsh@cs.rochester.edu>
diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el
index 7c56db0ba4..cd9b025ff0 100644
--- a/lisp/gnus/gnus-draft.el
+++ b/lisp/gnus/gnus-draft.el
@@ -1,6 +1,6 @@
 ;;; gnus-draft.el --- draft message support for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-dup.el b/lisp/gnus/gnus-dup.el
index e4f3da9457..4bd2a4640a 100644
--- a/lisp/gnus/gnus-dup.el
+++ b/lisp/gnus/gnus-dup.el
@@ -1,6 +1,6 @@
 ;;; gnus-dup.el --- suppression of duplicate articles in Gnus  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-eform.el b/lisp/gnus/gnus-eform.el
index c727926731..300532de28 100644
--- a/lisp/gnus/gnus-eform.el
+++ b/lisp/gnus/gnus-eform.el
@@ -1,6 +1,6 @@
 ;;; gnus-eform.el --- a mode for editing forms for Gnus  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index 0754d7aa7b..0402837187 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -1,6 +1,6 @@
 ;;; gnus-fun.el --- various frivolous extension functions to Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-gravatar.el b/lisp/gnus/gnus-gravatar.el
index be57774fe9..d64e000d70 100644
--- a/lisp/gnus/gnus-gravatar.el
+++ b/lisp/gnus/gnus-gravatar.el
@@ -1,6 +1,6 @@
 ;;; gnus-gravatar.el --- Gnus Gravatar support -*- lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <julien@danjou.info>
 ;; Keywords: multimedia, news
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 2ec001faee..ab874dd060 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1,6 +1,6 @@
 ;;; gnus-group.el --- group mode commands for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -380,8 +380,8 @@ variables in the Lisp expression:
 `group-age': Time in seconds since the group was last read
            (see info node `(gnus)Group Timestamp')."
   :group 'gnus-group-visual
-  :type '(repeat (cons (sexp :tag "Form") face)))
-(put 'gnus-group-highlight 'risky-local-variable t)
+  :type '(repeat (cons (sexp :tag "Form") face))
+  :risky t)
 
 (defcustom gnus-new-mail-mark ?%
   "Mark used for groups with new mail."
@@ -409,8 +409,8 @@ requires an understanding of Lisp expressions.  Hopefully 
this will
 change in a future release.  For now, you can use the same
 variables in the Lisp expression as in `gnus-group-highlight'."
   :group 'gnus-group-icons
-  :type '(repeat (cons (sexp :tag "Form") file)))
-(put 'gnus-group-icon-list 'risky-local-variable t)
+  :type '(repeat (cons (sexp :tag "Form") file))
+  :risky t)
 
 (defcustom gnus-group-name-charset-method-alist nil
   "Alist of method and the charset for group names.
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index ef376f138e..45f1e6099e 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -1,6 +1,6 @@
 ;;; gnus-html.el --- Render HTML in a buffer.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: html, web
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 81e46d7a51..754a1d91cb 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -1,6 +1,6 @@
 ;;; gnus-icalendar.el --- reply to iCalendar meeting requests  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Tatarik <Jan.Tatarik@gmail.com>
 ;; Keywords: mail, icalendar, org
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 255c11f137..5a619e8f07 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -1,6 +1,6 @@
 ;;; gnus-int.el --- backend interface functions for Gnus  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el
index 7137efd730..bee7860efd 100644
--- a/lisp/gnus/gnus-kill.el
+++ b/lisp/gnus/gnus-kill.el
@@ -1,6 +1,6 @@
 ;;; gnus-kill.el --- kill commands for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el
index cdfdc9b731..3fb2ed3c62 100644
--- a/lisp/gnus/gnus-logic.el
+++ b/lisp/gnus/gnus-logic.el
@@ -1,6 +1,6 @@
 ;;; gnus-logic.el --- advanced scoring code for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-mh.el b/lisp/gnus/gnus-mh.el
index df076c1175..bfe22be45f 100644
--- a/lisp/gnus/gnus-mh.el
+++ b/lisp/gnus/gnus-mh.el
@@ -1,6 +1,6 @@
 ;;; gnus-mh.el --- mh-e interface for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/gnus-ml.el b/lisp/gnus/gnus-ml.el
index a5358e9ff4..211980aa9e 100644
--- a/lisp/gnus/gnus-ml.el
+++ b/lisp/gnus/gnus-ml.el
@@ -1,6 +1,6 @@
 ;;; gnus-ml.el --- Mailing list minor mode for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Gilles <jgilles@free.fr>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el
index 878e879cd7..1223e38104 100644
--- a/lisp/gnus/gnus-mlspl.el
+++ b/lisp/gnus/gnus-mlspl.el
@@ -1,6 +1,6 @@
 ;;; gnus-mlspl.el --- a group params-based mail splitting mechanism  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index c60faa1326..f38f6f4ee2 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1,6 +1,6 @@
 ;;; gnus-msg.el --- mail and post interface for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el
index 8646904637..ec3892c991 100644
--- a/lisp/gnus/gnus-notifications.el
+++ b/lisp/gnus/gnus-notifications.el
@@ -1,6 +1,6 @@
 ;;; gnus-notifications.el --- Send notification on new message in Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <julien@danjou.info>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-picon.el b/lisp/gnus/gnus-picon.el
index fd4d3b8a76..d0edf2cba8 100644
--- a/lisp/gnus/gnus-picon.el
+++ b/lisp/gnus/gnus-picon.el
@@ -1,6 +1,6 @@
 ;;; gnus-picon.el --- displaying pretty icons in Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news xpm annotation glyph faces
diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el
index a8f09b6371..da3ff47372 100644
--- a/lisp/gnus/gnus-range.el
+++ b/lisp/gnus/gnus-range.el
@@ -1,6 +1,6 @@
 ;;; gnus-range.el --- range and sequence functions for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 163d543afd..0c281a997f 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -1,6 +1,6 @@
 ;;; gnus-registry.el --- article registry for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 ;; Keywords: news registry
diff --git a/lisp/gnus/gnus-rfc1843.el b/lisp/gnus/gnus-rfc1843.el
index c135ecea36..9872f7b994 100644
--- a/lisp/gnus/gnus-rfc1843.el
+++ b/lisp/gnus/gnus-rfc1843.el
@@ -1,6 +1,6 @@
 ;;; gnus-rfc1843.el --- HZ (rfc1843) decoding interface functions for Gnus  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: news HZ HZ+ mail i18n
diff --git a/lisp/gnus/gnus-rmail.el b/lisp/gnus/gnus-rmail.el
new file mode 100644
index 0000000000..15ead1add4
--- /dev/null
+++ b/lisp/gnus/gnus-rmail.el
@@ -0,0 +1,142 @@
+;;; gnus-rmail.el --- Saving to rmail/babyl files  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021-2022 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:
+
+;;; Functions for saving to babyl/mail files.
+
+(require 'rmail)
+(require 'rmailsum)
+(require 'nnmail)
+
+(defun gnus-output-to-rmail (filename &optional ask)
+  "Append the current article to an Rmail file named FILENAME.
+In Emacs 22 this writes Babyl format; in Emacs 23 it writes mbox unless
+FILENAME exists and is Babyl format."
+  ;; Some of this codes is borrowed from rmailout.el.
+  (setq filename (expand-file-name filename))
+  ;; FIXME should we really be messing with this defcustom?
+  ;; It is not needed for the operation of this function.
+  (if (boundp 'rmail-default-rmail-file)
+      (setq rmail-default-rmail-file filename) ; 22
+    (setq rmail-default-file filename))        ; 23
+  (let ((artbuf (current-buffer))
+       (tmpbuf (gnus-get-buffer-create " *Gnus-output*"))
+        ;; Babyl rmail.el defines this, mbox does not.
+        (babyl (fboundp 'rmail-insert-rmail-file-header)))
+    (save-excursion
+      ;; Note that we ignore the possibility of visiting a Babyl
+      ;; format buffer in Emacs 23, since Rmail no longer supports that.
+     (or (get-file-buffer filename)
+         (progn
+           ;; In case someone wants to write to a Babyl file from Emacs 23.
+           (when (file-exists-p filename)
+             (setq babyl (mail-file-babyl-p filename))
+             t))
+         (if (or (not ask)
+                 (gnus-yes-or-no-p
+                  (concat "\"" filename "\" does not exist, create it? ")))
+             (let ((file-buffer (create-file-buffer filename)))
+               (with-current-buffer file-buffer
+                  (if (fboundp 'rmail-insert-rmail-file-header)
+                      (rmail-insert-rmail-file-header))
+                 (let ((require-final-newline nil)
+                       (coding-system-for-write mm-text-coding-system))
+                   (gnus-write-buffer filename)))
+               (kill-buffer file-buffer))
+           (error "Output file does not exist")))
+      (set-buffer tmpbuf)
+      (erase-buffer)
+      (insert-buffer-substring artbuf)
+      (if babyl
+          (gnus-convert-article-to-rmail)
+        ;; Non-Babyl case copied from gnus-output-to-mail.
+        (goto-char (point-min))
+        (if (looking-at "From ")
+            (forward-line 1)
+          (insert "From nobody " (current-time-string) "\n"))
+        (let (case-fold-search)
+          (while (re-search-forward "^From " nil t)
+            (beginning-of-line)
+            (insert ">"))))
+      ;; Decide whether to append to a file or to an Emacs buffer.
+      (let ((outbuf (get-file-buffer filename)))
+       (if (not outbuf)
+            (progn
+              (unless babyl             ; from gnus-output-to-mail
+                (let ((buffer-read-only nil))
+                  (goto-char (point-max))
+                  (forward-char -2)
+                  (unless (looking-at "\n\n")
+                    (goto-char (point-max))
+                    (unless (bolp)
+                      (insert "\n"))
+                    (insert "\n"))))
+              (let ((file-name-coding-system nnmail-pathname-coding-system))
+                (mm-append-to-file (point-min) (point-max) filename)))
+         ;; File has been visited, in buffer OUTBUF.
+         (set-buffer outbuf)
+         (let ((buffer-read-only nil)
+               (msg (and (boundp 'rmail-current-message)
+                         (symbol-value 'rmail-current-message))))
+           ;; If MSG is non-nil, buffer is in RMAIL mode.
+            ;; Compare this with rmail-output-to-rmail-buffer in Emacs 23.
+           (when msg
+              (unless babyl
+                (rmail-swap-buffers-maybe)
+                (rmail-maybe-set-message-counters))
+              (widen)
+              (unless babyl
+               (goto-char (point-max))
+               ;; Ensure we have a blank line before the next message.
+               (unless (bolp)
+                 (insert "\n"))
+               (insert "\n"))
+              (narrow-to-region (point-max) (point-max)))
+           (insert-buffer-substring tmpbuf)
+           (when msg
+              (when babyl
+                (goto-char (point-min))
+                (widen)
+                (search-backward "\n\^_")
+                (narrow-to-region (point) (point-max)))
+             (rmail-count-new-messages t)
+             (when (rmail-summary-exists)
+               (rmail-select-summary
+                (rmail-update-summary)))
+             (rmail-show-message msg))
+           (save-buffer)))))
+    (kill-buffer tmpbuf)))
+
+(defun gnus-convert-article-to-rmail ()
+  "Convert article in current buffer to Rmail message format."
+  (let ((buffer-read-only nil))
+    ;; Convert article directly into Babyl format.
+    (goto-char (point-min))
+    (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
+    (while (search-forward "\n\^_" nil t) ;single char
+      (replace-match "\n^_" t t))      ;2 chars: "^" and "_"
+    (goto-char (point-max))
+    (insert "\^_")))
+
+;;; gnus-rmail.el ends here
diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el
index 205e936bc7..3189655c8a 100644
--- a/lisp/gnus/gnus-salt.el
+++ b/lisp/gnus/gnus-salt.el
@@ -1,6 +1,6 @@
 ;;; gnus-salt.el --- alternate summary mode interfaces for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index a25673a0e7..c852986ae6 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1,6 +1,6 @@
 ;;; gnus-score.el --- scoring code for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <amanda@iesd.auc.dk>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index a79c106062..bf88abae76 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -1,6 +1,6 @@
 ;;; gnus-search.el --- Search facilities for Gnus    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
 
@@ -578,7 +578,7 @@ REL-DATE, or (current-time) if REL-DATE is nil."
        (seq-subseq
         (decode-time
          (time-subtract
-          (apply #'encode-time now)
+          (encode-time now)
           (days-to-time
            (* (string-to-number (match-string 1 value))
               (cdr (assoc (match-string 2 value)
@@ -597,7 +597,7 @@ REL-DATE, or (current-time) if REL-DATE is nil."
             ;; If DOW is given, handle that specially.
             (if (and (seq-elt d-time 6) (null (seq-elt d-time 3)))
                 (decode-time
-                 (time-subtract (apply #'encode-time now)
+                 (time-subtract (encode-time now)
                                 (days-to-time
                                  (+ (if (> (seq-elt d-time 6)
                                            (seq-elt now 6))
@@ -1060,7 +1060,7 @@ Responsible for handling and, or, and parenthetical 
expressions.")
               q-string)))
 
       (while (and (setq group (pop grouplist))
-                 (or (null single-search) (null artlist)))
+                 (or (null single-search) (= 0 (length artlist))))
        (when (nnimap-change-group
               (gnus-group-short-name group) server)
          (with-current-buffer (nnimap-buffer)
@@ -1257,9 +1257,7 @@ elements are present."
          (setq dmonth 1))))
     (format-time-string
      "%e-%b-%Y"
-     (apply #'encode-time
-           (append '(0 0 0)
-                   (list dday dmonth dyear))))))
+     (encode-time 0 0 0 dday dmonth dyear))))
 
 (cl-defmethod gnus-search-imap-handle-string ((engine gnus-search-imap)
                                              (str string))
diff --git a/lisp/gnus/gnus-sieve.el b/lisp/gnus/gnus-sieve.el
index d173decbb6..2d8552d42d 100644
--- a/lisp/gnus/gnus-sieve.el
+++ b/lisp/gnus/gnus-sieve.el
@@ -1,6 +1,6 @@
 ;;; gnus-sieve.el --- Utilities to manage sieve scripts for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: NAGY Andras <nagya@inf.elte.hu>,
 ;;     Simon Josefsson <simon@josefsson.org>
diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el
index 59c6956ac2..984774dc6a 100644
--- a/lisp/gnus/gnus-spec.el
+++ b/lisp/gnus/gnus-spec.el
@@ -1,6 +1,6 @@
 ;;; gnus-spec.el --- format spec functions for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index fa880b7edd..a520bfcd8b 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -1,6 +1,6 @@
 ;;; gnus-srvr.el --- virtual server support for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 606bd3a39a..252e6e2229 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1,6 +1,6 @@
 ;;; gnus-start.el --- startup functions for Gnus -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 1bd0e8847e..d3e476b5d6 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1,6 +1,6 @@
 ;;; gnus-sum.el --- summary mode commands for Gnus  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -1182,8 +1182,8 @@ mark:         The article's mark.
 uncached:     Non-nil if the article is uncached."
   :group 'gnus-summary-visual
   :type '(repeat (cons (sexp :tag "Form" nil)
-                      face)))
-(put 'gnus-summary-highlight 'risky-local-variable t)
+                       face))
+  :risky t)
 
 (defcustom gnus-alter-header-function nil
   "Function called to allow alteration of article header structures.
@@ -8658,20 +8658,20 @@ these articles."
        (gnus-fetch-old-headers nil)
        (gnus-build-sparse-threads nil))
     (prog1
-       (gnus-summary-limit (if thread-only articles
-                             (nconc articles gnus-newsgroup-limit)))
-      (gnus-summary-limit-include-matching-articles
-       "subject"
-       (regexp-quote (gnus-general-simplify-subject
-                     (mail-header-subject (gnus-id-to-header id)))))
-      ;; the previous two calls each push a limit onto the limit
-      ;; stack. the first pop remove the articles that match the
-      ;; subject, while the second pop gets us back to the state
-      ;; before we started to deal with the thread. presumably we want
-      ;; to think of the thread and its associated subject matches as
-      ;; a single thing so that we need to pop only once to get back
-      ;; to the original view.
-      (pop gnus-newsgroup-limits)
+        (gnus-summary-limit (if thread-only articles
+                              (nconc articles gnus-newsgroup-limit)))
+      (let ((matching-subject (gnus-general-simplify-subject
+                              (mail-header-subject (gnus-id-to-header id)))))
+        (when matching-subject
+          (gnus-summary-limit-include-matching-articles
+           "subject"
+           matching-subject)
+          ;; Each of the previous two limit calls push a limit onto
+          ;; the limit stack. Presumably we want to think of the
+          ;; thread and its associated subject matches as a single
+          ;; thing so we probably want a single pop to restore the
+          ;; original view. Hence we pop this last limit off.
+          (pop gnus-newsgroup-limits)))
       (gnus-summary-position-point))))
 
 (defun gnus-summary-limit-include-matching-articles (header regexp)
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el
index 0855e98917..c079d889d9 100644
--- a/lisp/gnus/gnus-topic.el
+++ b/lisp/gnus/gnus-topic.el
@@ -1,6 +1,6 @@
 ;;; gnus-topic.el --- a folding minor mode for Gnus group buffers  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Ilja Weis <kult@uni-paderborn.de>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/gnus-undo.el b/lisp/gnus/gnus-undo.el
index a82b1f87a3..8c2be7b07e 100644
--- a/lisp/gnus/gnus-undo.el
+++ b/lisp/gnus/gnus-undo.el
@@ -1,6 +1,6 @@
 ;;; gnus-undo.el --- minor mode for undoing in Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index a777157f89..6150781fec 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1,6 +1,6 @@
 ;;; gnus-util.el --- utility functions for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -858,126 +858,9 @@ variables and then do only the assignment atomically."
   `(let ((inhibit-quit gnus-atomic-be-safe))
      ,@forms))
 
-;;; Functions for saving to babyl/mail files.
-
-(require 'rmail)
-(autoload 'rmail-update-summary "rmailsum")
-
 (defvar mm-text-coding-system)
-
 (declare-function mm-append-to-file "mm-util"
                   (start end filename &optional codesys inhibit))
-(declare-function rmail-swap-buffers-maybe "rmail" ())
-(declare-function rmail-maybe-set-message-counters "rmail" ())
-(declare-function rmail-count-new-messages "rmail" (&optional nomsg))
-(declare-function rmail-summary-exists "rmail" ())
-(declare-function rmail-show-message "rmail" (&optional n no-summary))
-;; Macroexpansion of rmail-select-summary:
-(declare-function rmail-summary-displayed "rmail" ())
-(declare-function rmail-pop-to-buffer "rmail" (&rest args))
-(declare-function rmail-maybe-display-summary "rmail" ())
-
-(defun gnus-output-to-rmail (filename &optional ask)
-  "Append the current article to an Rmail file named FILENAME.
-In Emacs 22 this writes Babyl format; in Emacs 23 it writes mbox unless
-FILENAME exists and is Babyl format."
-  (require 'rmail)
-  (require 'mm-util)
-  (require 'nnmail)
-  ;; Some of this codes is borrowed from rmailout.el.
-  (setq filename (expand-file-name filename))
-  ;; FIXME should we really be messing with this defcustom?
-  ;; It is not needed for the operation of this function.
-  (if (boundp 'rmail-default-rmail-file)
-      (setq rmail-default-rmail-file filename) ; 22
-    (setq rmail-default-file filename))        ; 23
-  (let ((artbuf (current-buffer))
-       (tmpbuf (gnus-get-buffer-create " *Gnus-output*"))
-        ;; Babyl rmail.el defines this, mbox does not.
-        (babyl (fboundp 'rmail-insert-rmail-file-header)))
-    (save-excursion
-      ;; Note that we ignore the possibility of visiting a Babyl
-      ;; format buffer in Emacs 23, since Rmail no longer supports that.
-     (or (get-file-buffer filename)
-         (progn
-           ;; In case someone wants to write to a Babyl file from Emacs 23.
-           (when (file-exists-p filename)
-             (setq babyl (mail-file-babyl-p filename))
-             t))
-         (if (or (not ask)
-                 (gnus-yes-or-no-p
-                  (concat "\"" filename "\" does not exist, create it? ")))
-             (let ((file-buffer (create-file-buffer filename)))
-               (with-current-buffer file-buffer
-                  (if (fboundp 'rmail-insert-rmail-file-header)
-                      (rmail-insert-rmail-file-header))
-                 (let ((require-final-newline nil)
-                       (coding-system-for-write mm-text-coding-system))
-                   (gnus-write-buffer filename)))
-               (kill-buffer file-buffer))
-           (error "Output file does not exist")))
-      (set-buffer tmpbuf)
-      (erase-buffer)
-      (insert-buffer-substring artbuf)
-      (if babyl
-          (gnus-convert-article-to-rmail)
-        ;; Non-Babyl case copied from gnus-output-to-mail.
-        (goto-char (point-min))
-        (if (looking-at "From ")
-            (forward-line 1)
-          (insert "From nobody " (current-time-string) "\n"))
-        (let (case-fold-search)
-          (while (re-search-forward "^From " nil t)
-            (beginning-of-line)
-            (insert ">"))))
-      ;; Decide whether to append to a file or to an Emacs buffer.
-      (let ((outbuf (get-file-buffer filename)))
-       (if (not outbuf)
-            (progn
-              (unless babyl             ; from gnus-output-to-mail
-                (let ((buffer-read-only nil))
-                  (goto-char (point-max))
-                  (forward-char -2)
-                  (unless (looking-at "\n\n")
-                    (goto-char (point-max))
-                    (unless (bolp)
-                      (insert "\n"))
-                    (insert "\n"))))
-              (let ((file-name-coding-system nnmail-pathname-coding-system))
-                (mm-append-to-file (point-min) (point-max) filename)))
-         ;; File has been visited, in buffer OUTBUF.
-         (set-buffer outbuf)
-         (let ((buffer-read-only nil)
-               (msg (and (boundp 'rmail-current-message)
-                         (symbol-value 'rmail-current-message))))
-           ;; If MSG is non-nil, buffer is in RMAIL mode.
-            ;; Compare this with rmail-output-to-rmail-buffer in Emacs 23.
-           (when msg
-              (unless babyl
-                (rmail-swap-buffers-maybe)
-                (rmail-maybe-set-message-counters))
-              (widen)
-              (unless babyl
-               (goto-char (point-max))
-               ;; Ensure we have a blank line before the next message.
-               (unless (bolp)
-                 (insert "\n"))
-               (insert "\n"))
-              (narrow-to-region (point-max) (point-max)))
-           (insert-buffer-substring tmpbuf)
-           (when msg
-              (when babyl
-                (goto-char (point-min))
-                (widen)
-                (search-backward "\n\^_")
-                (narrow-to-region (point) (point-max)))
-             (rmail-count-new-messages t)
-             (when (rmail-summary-exists)
-               (rmail-select-summary
-                (rmail-update-summary)))
-             (rmail-show-message msg))
-           (save-buffer)))))
-    (kill-buffer tmpbuf)))
 
 (defun gnus-output-to-mail (filename &optional ask)
   "Append the current article to a mail file named FILENAME."
@@ -1035,17 +918,6 @@ FILENAME exists and is Babyl format."
            (insert-buffer-substring tmpbuf)))))
     (kill-buffer tmpbuf)))
 
-(defun gnus-convert-article-to-rmail ()
-  "Convert article in current buffer to Rmail message format."
-  (let ((buffer-read-only nil))
-    ;; Convert article directly into Babyl format.
-    (goto-char (point-min))
-    (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
-    (while (search-forward "\n\^_" nil t) ;single char
-      (replace-match "\n^_" t t))      ;2 chars: "^" and "_"
-    (goto-char (point-max))
-    (insert "\^_")))
-
 (defun gnus-map-function (funs arg)
   "Apply the result of the first function in FUNS to the second, and so on.
 ARG is passed to the first function."
@@ -1675,6 +1547,11 @@ lists of strings."
     (while overlays
       (delete-overlay (pop overlays)))))
 
+;; This function used to live in this file, but was moved to a
+;; separate file to avoid pulling in rmail.el when requiring
+;; gnus-util.
+(autoload 'gnus-output-to-rmail "gnus-rmail")
+
 (provide 'gnus-util)
 
 ;;; gnus-util.el ends here
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index 778a8a3ea0..6990d8ee77 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -1,6 +1,6 @@
 ;;; gnus-uu.el --- extract (uu)encoded files in Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1985-1987, 1993-1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1987, 1993-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/gnus-vm.el b/lisp/gnus/gnus-vm.el
index ec3601109e..5641442ed2 100644
--- a/lisp/gnus/gnus-vm.el
+++ b/lisp/gnus/gnus-vm.el
@@ -1,6 +1,6 @@
 ;;; gnus-vm.el --- vm interface for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Persson <pp@gnu.ai.mit.edu>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index 8ac4e39fa5..88d24cf0f3 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -1,6 +1,6 @@
 ;;; gnus-win.el --- window configuration functions for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index afe07ee46f..0daecf7df5 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -1,6 +1,6 @@
 ;;; gnus.el --- a newsreader for GNU Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1987-1990, 1993-1998, 2000-2021 Free Software
+;; Copyright (C) 1987-1990, 1993-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
@@ -2528,14 +2528,6 @@ are always t.")
      ("babel" babel-as-string)
      ("nnmail" nnmail-split-fancy nnmail-article-group)
      ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
-     ;; This is only used in message.el, which has an autoload.
-     ("rmailout" rmail-output)
-     ;; Next two used in gnus-util, which has autoloads, and contrib/sendmail.
-     ("rmail" rmail-count-new-messages rmail-show-message
-      ;; Next two only used in gnus-util.
-      rmail-summary-exists rmail-select-summary)
-     ;; Only used in gnus-util, which has an autoload.
-     ("rmailsum" rmail-update-summary)
      ("gnus-xmas" gnus-xmas-splash)
      ("score-mode" :interactive t gnus-score-mode gnus-score-edit-all-score)
      ("gnus-mh" gnus-summary-save-article-folder
diff --git a/lisp/gnus/gssapi.el b/lisp/gnus/gssapi.el
index 6ff2a4e285..6ace5f12ca 100644
--- a/lisp/gnus/gssapi.el
+++ b/lisp/gnus/gssapi.el
@@ -1,6 +1,6 @@
 ;;; gssapi.el --- GSSAPI/Kerberos 5 interface for Emacs  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;;         Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/legacy-gnus-agent.el b/lisp/gnus/legacy-gnus-agent.el
index 4f800891b2..7866543564 100644
--- a/lisp/gnus/legacy-gnus-agent.el
+++ b/lisp/gnus/legacy-gnus-agent.el
@@ -1,6 +1,6 @@
 ;;; legacy-gnus-agent.el --- Legacy unplugged support for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Kevin Greiner <kgreiner@xpediantsolutions.com>
 ;; Keywords: news
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index efdddea69f..d2f5b9a97e 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -1,6 +1,6 @@
 ;;; mail-source.el --- functions for fetching mail  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c2d14296f9..8f11e538c5 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1,6 +1,6 @@
 ;;; message.el --- composing mail and news messages -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail, news
@@ -2053,7 +2053,7 @@ You must have the \"hashcash\" binary installed, see 
`hashcash-path'."
 (autoload 'gnus-groups-from-server "gnus")
 (autoload 'gnus-open-server "gnus-int")
 (autoload 'gnus-output-to-mail "gnus-util")
-(autoload 'gnus-output-to-rmail "gnus-util")
+(autoload 'gnus-output-to-rmail "gnus-rmail")
 (autoload 'gnus-request-post "gnus-int")
 (autoload 'gnus-server-string "gnus")
 (autoload 'message-setup-toolbar "messagexmas")
@@ -4335,6 +4335,44 @@ Instead, just auto-save the buffer and then bury it."
 
 (autoload 'mml-secure-bcc-is-safe "mml-sec")
 
+(defcustom message-server-alist nil
+  "Alist of rules to generate \"X-Message-SMTP-Method\" header.
+The header will be inserted just before the message is sent.
+Elements should be of the form (COND . METHOD).
+If COND is a string, METHOD will be inserted if the \"From\"
+address compares equal with COND.
+If COND is a function, METHOD will be inserted if COND returns
+a non-nil value when called in the message buffer without any
+arguments.  If METHOD is nil in this case, the return value of
+the function will be inserted instead.
+If the buffer already has a\"X-Message-SMTP-Method\" header,
+it is left unchanged."
+  :type '(alist :key-type '(choice
+                            (string :tag "From Address")
+                            (function :tag "Predicate"))
+                :value-type 'string)
+  :version "29.1"
+  :group 'message-sending)
+
+(defun message-update-smtp-method-header ()
+  "Insert an X-Message-SMTP-Method header according to `message-server-alist'."
+  (unless (message-fetch-field "X-Message-SMTP-Method")
+    (let ((from (cadr (mail-extract-address-components (message-fetch-field 
"From"))))
+          method)
+      (catch 'exit
+        (dolist (server message-server-alist)
+          (cond ((functionp (car server))
+                 (let ((res (funcall (car server))))
+                   (when res
+                     (setq method (or (cdr server) res))
+                     (throw 'exit nil))))
+                ((and (stringp (car server))
+                      (string= (car server) from))
+                 (setq method (cdr server))
+                 (throw 'exit nil)))))
+      (when method
+        (message-add-header (concat "X-Message-SMTP-Method: " method))))))
+
 (defun message-send (&optional arg)
   "Send the message in the current buffer.
 If `message-interactive' is non-nil, wait for success indication or
@@ -4348,6 +4386,7 @@ It should typically alter the sending method in some way 
or other."
   (undo-boundary)
   (let ((inhibit-read-only t))
     (put-text-property (point-min) (point-max) 'read-only nil))
+  (message-update-smtp-method-header)
   (message-fix-before-sending)
   (run-hooks 'message-send-hook)
   (mml-secure-bcc-is-safe)
diff --git a/lisp/gnus/mm-archive.el b/lisp/gnus/mm-archive.el
index fdc83e1de6..e73daf2db7 100644
--- a/lisp/gnus/mm-archive.el
+++ b/lisp/gnus/mm-archive.el
@@ -1,6 +1,6 @@
 ;;; mm-archive.el --- Functions for parsing archive files as MIME  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/gnus/mm-bodies.el b/lisp/gnus/mm-bodies.el
index d6b71f15e5..956449dac1 100644
--- a/lisp/gnus/mm-bodies.el
+++ b/lisp/gnus/mm-bodies.el
@@ -1,6 +1,6 @@
 ;;; mm-bodies.el --- Functions for decoding MIME things  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index d781407cdc..7256e5a2f7 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1,6 +1,6 @@
 ;;; mm-decode.el --- Functions for decoding MIME things  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -474,6 +474,7 @@ The file will be saved in the directory 
`mm-tmp-directory'.")
 (autoload 'mml2015-verify-test "mml2015")
 (autoload 'mml-smime-verify "mml-smime")
 (autoload 'mml-smime-verify-test "mml-smime")
+(autoload 'mm-view-pkcs7-verify "mm-view")
 
 (defvar mm-verify-function-alist
   '(("application/pgp-signature" mml2015-verify "PGP" mml2015-verify-test)
@@ -482,7 +483,15 @@ The file will be saved in the directory 
`mm-tmp-directory'.")
     ("application/pkcs7-signature" mml-smime-verify "S/MIME"
      mml-smime-verify-test)
     ("application/x-pkcs7-signature" mml-smime-verify "S/MIME"
-     mml-smime-verify-test)))
+     mml-smime-verify-test)
+    ("application/x-pkcs7-signature" mml-smime-verify "S/MIME"
+     mml-smime-verify-test)
+    ;; these are only used for security-buttons and contain the
+    ;; smime-type after the underscore
+    ("application/pkcs7-mime_signed-data" mm-view-pkcs7-verify "S/MIME"
+     nil)
+    ("application/x-pkcs7-mime_signed-data" mml-view-pkcs7-verify "S/MIME"
+     nil)))
 
 (defcustom mm-verify-option 'never
   "Option of verifying signed parts.
@@ -501,11 +510,17 @@ result of the verification."
 
 (autoload 'mml2015-decrypt "mml2015")
 (autoload 'mml2015-decrypt-test "mml2015")
+(autoload 'mm-view-pkcs7-decrypt "mm-view")
 
 (defvar mm-decrypt-function-alist
   '(("application/pgp-encrypted" mml2015-decrypt "PGP" mml2015-decrypt-test)
     ("application/x-gnus-pgp-encrypted" mm-uu-pgp-encrypted-extract-1 "PGP"
-     mm-uu-pgp-encrypted-test)))
+     mm-uu-pgp-encrypted-test)
+    ;; these are only used for security-buttons and contain the
+    ;; smime-type after the underscore
+    ("application/pkcs7-mime_enveloped-data" mm-view-pkcs7-decrypt "S/MIME" 
nil)
+    ("application/x-pkcs7-mime_enveloped-data"
+     mm-view-pkcs7-decrypt "S/MIME" nil)))
 
 (defcustom mm-decrypt-option nil
   "Option of decrypting encrypted parts.
@@ -682,18 +697,35 @@ MIME-Version header before proceeding."
                                        'start start)
                                  (car ctl))
             (cons (car ctl) (mm-dissect-multipart ctl from))))
-         (t
-          (mm-possibly-verify-or-decrypt
-           (mm-dissect-singlepart
-            ctl
-            (and cte (intern (downcase (mail-header-strip-cte cte))))
-            no-strict-mime
-            (and cd (mail-header-parse-content-disposition cd))
-            description id)
-           ctl from))))
-       (when id
-         (when (string-match " *<\\(.*\\)> *" id)
-           (setq id (match-string 1 id)))
+          (t
+           (let* ((handle
+                   (mm-dissect-singlepart
+                    ctl
+                    (and cte (intern (downcase (mail-header-strip-cte cte))))
+                    no-strict-mime
+                    (and cd (mail-header-parse-content-disposition cd))
+                    description id))
+                  (intermediate-result
+                   (mm-possibly-verify-or-decrypt handle ctl from)))
+             (when (and (equal type "application")
+                        (or (equal subtype "pkcs7-mime")
+                            (equal subtype "x-pkcs7-mime")))
+               (add-text-properties
+                0 (length (car ctl))
+                (list 'protocol
+                      (concat (substring-no-properties (car ctl))
+                              "_"
+                              (cdr (assoc 'smime-type ctl))))
+                (car ctl))
+               ;; If this is a pkcs7-mime lets treat this special and
+               ;; more like multipart so the pkcs7-mime part does not
+               ;; get ignored.
+               (setq intermediate-result
+                     (cons (car ctl) (list intermediate-result))))
+             intermediate-result))))
+        (when id
+          (when (string-match " *<\\(.*\\)> *" id)
+            (setq id (match-string 1 id)))
          (push (cons id result) mm-content-id-alist))
        result))))
 
@@ -1677,43 +1709,40 @@ If RECURSIVE, search recursively."
     (cond
      ((or (equal type "application/x-pkcs7-mime")
          (equal type "application/pkcs7-mime"))
-      (with-temp-buffer
-       (when (and (cond
-                   ((equal smime-type "signed-data") t)
-                   ((eq mm-decrypt-option 'never) nil)
-                   ((eq mm-decrypt-option 'always) t)
-                   ((eq mm-decrypt-option 'known) t)
-                   (t (y-or-n-p "Decrypt (S/MIME) part? ")))
-                  (mm-view-pkcs7 parts from))
-         (goto-char (point-min))
-         ;; The encrypted document is a MIME part, and may use either
-         ;; CRLF (Outlook and the like) or newlines for end-of-line
-         ;; markers.  Translate from CRLF.
-         (while (search-forward "\r\n" nil t)
-           (replace-match "\n"))
-         ;; Normally there will be a Content-type header here, but
-         ;; some mailers don't add that to the encrypted part, which
-         ;; makes the subsequent re-dissection fail here.
-         (save-restriction
-           (mail-narrow-to-head)
-           (unless (mail-fetch-field "content-type")
-             (goto-char (point-max))
-             (insert "Content-type: text/plain\n\n")))
-         (setq parts
-               (if (equal smime-type "signed-data")
-                   (list (propertize
-                          "multipart/signed"
-                          'protocol "application/pkcs7-signature"
-                          'gnus-info
-                          (format
-                           "%s:%s"
-                           (get-text-property 0 'gnus-info
-                                              (car mm-security-handle))
-                           (get-text-property 0 'gnus-details
-                                              (car mm-security-handle))))
-                         (mm-dissect-buffer t)
-                         parts)
-                 (mm-dissect-buffer t))))))
+      (add-text-properties 0 (length (car ctl))
+                           (list 'buffer (car parts))
+                           (car ctl))
+      (let* ((envelope-p (string= smime-type "enveloped-data"))
+             (decrypt-or-verify-option (if envelope-p
+                                           mm-decrypt-option
+                                         mm-verify-option))
+             (question (if envelope-p
+                           "Decrypt (S/MIME) part? "
+                         "Verify signed (S/MIME) part? ")))
+        (with-temp-buffer
+         (when (and (cond
+                     ((equal smime-type "signed-data") t)
+                     ((eq decrypt-or-verify-option 'never) nil)
+                     ((eq decrypt-or-verify-option 'always) t)
+                     ((eq decrypt-or-verify-option 'known) t)
+                     (t (y-or-n-p (format question))))
+                     (mm-view-pkcs7 parts from))
+
+           (goto-char (point-min))
+           ;; The encrypted document is a MIME part, and may use either
+           ;; CRLF (Outlook and the like) or newlines for end-of-line
+           ;; markers.  Translate from CRLF.
+           (while (search-forward "\r\n" nil t)
+             (replace-match "\n"))
+           ;; Normally there will be a Content-type header here, but
+           ;; some mailers don't add that to the encrypted part, which
+           ;; makes the subsequent re-dissection fail here.
+           (save-restriction
+             (mail-narrow-to-head)
+             (unless (mail-fetch-field "content-type")
+               (goto-char (point-max))
+               (insert "Content-type: text/plain\n\n")))
+           (setq parts (mm-dissect-buffer t))))))
      ((equal subtype "signed")
       (unless (and (setq protocol
                         (mm-handle-multipart-ctl-parameter ctl 'protocol))
@@ -1840,7 +1869,7 @@ If RECURSIVE, search recursively."
   ;; Require since we bind its variables.
   (require 'shr)
   (let ((shr-width (if shr-use-fonts
-                      nil
+                      shr-width
                     fill-column))
        (shr-content-function (lambda (id)
                                (let ((handle (mm-get-content-id id)))
diff --git a/lisp/gnus/mm-encode.el b/lisp/gnus/mm-encode.el
index 84a3b0a8d1..ead3bae219 100644
--- a/lisp/gnus/mm-encode.el
+++ b/lisp/gnus/mm-encode.el
@@ -1,6 +1,6 @@
 ;;; mm-encode.el --- Functions for encoding MIME things  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
diff --git a/lisp/gnus/mm-extern.el b/lisp/gnus/mm-extern.el
index 4099a10eb3..abcd0b604c 100644
--- a/lisp/gnus/mm-extern.el
+++ b/lisp/gnus/mm-extern.el
@@ -1,6 +1,6 @@
 ;;; mm-extern.el --- showing message/external-body  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: message external-body
diff --git a/lisp/gnus/mm-partial.el b/lisp/gnus/mm-partial.el
index 0c628055ac..a66fafe194 100644
--- a/lisp/gnus/mm-partial.el
+++ b/lisp/gnus/mm-partial.el
@@ -1,6 +1,6 @@
 ;;; mm-partial.el --- showing message/partial  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: message partial
diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el
index 3d58738d63..e4d686ac83 100644
--- a/lisp/gnus/mm-url.el
+++ b/lisp/gnus/mm-url.el
@@ -1,6 +1,6 @@
 ;;; mm-url.el --- a wrapper of url functions/commands for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 
@@ -34,8 +34,6 @@
 (require 'gnus)
 
 (defvar url-current-object)
-(defvar url-package-name)
-(defvar url-package-version)
 
 (defgroup mm-url nil
   "A wrapper of url package and external url command for Gnus."
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index ddc228e490..31cf92e617 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -1,6 +1,6 @@
 ;;; mm-util.el --- Utility functions for Mule and low level things  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -101,9 +101,9 @@ version, you could use `autoload-coding-system' here."
   :type '(list (repeat :inline t
                       :tag "Other options"
                       (cons (symbol :tag "charset")
-                            (symbol :tag "form"))))
+                             (symbol :tag "form"))))
+  :risky t
   :group 'mime)
-(put 'mm-charset-eval-alist 'risky-local-variable t)
 
 (defvar mm-charset-override-alist)
 
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index a52613a092..9fe41f6786 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -1,6 +1,6 @@
 ;;; mm-uu.el --- Return uu stuff as mm handles  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: postscript uudecode binhex shar forward gnatsweb pgp
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index d2a6d2cf5d..b110750c09 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -1,6 +1,6 @@
 ;;; mm-view.el --- functions for viewing MIME objects  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
@@ -634,12 +634,9 @@ If MODE is not set, try to find mode automatically."
                 (context (epg-make-context 'CMS)))
             (prog1
                 (epg-verify-string context part)
-              (let ((result (car (epg-context-result-for context 'verify))))
+              (let ((result (epg-context-result-for context 'verify)))
                 (mm-sec-status
-                 'gnus-info (epg-signature-status result)
-                 'gnus-details
-                 (format "%s:%s" (epg-signature-validity result)
-                         (epg-signature-key-id result))))))))
+                 'gnus-info (epg-verify-result-to-string result)))))))
       (with-temp-buffer
        (insert "MIME-Version: 1.0\n")
        (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
@@ -659,7 +656,11 @@ If MODE is not set, try to find mode automatically."
       ;; Use EPG/gpgsm
       (let ((part (base64-decode-string (buffer-string))))
        (erase-buffer)
-       (insert (epg-decrypt-string (epg-make-context 'CMS) part)))
+       (insert
+         (let ((context (epg-make-context 'CMS)))
+           (prog1
+               (epg-decrypt-string context part)
+             (mm-sec-status 'gnus-info "OK")))))
     ;; Use openssl
     (insert "MIME-Version: 1.0\n")
     (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index f72d76ac02..2ebc44d632 100644
--- a/lisp/gnus/mml-sec.el
+++ b/lisp/gnus/mml-sec.el
@@ -1,6 +1,6 @@
 ;;; mml-sec.el --- A package with security functions for MML documents  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el
index b81dd2dae4..6c43ded24f 100644
--- a/lisp/gnus/mml-smime.el
+++ b/lisp/gnus/mml-smime.el
@@ -1,6 +1,6 @@
 ;;; mml-smime.el --- S/MIME support for MML  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: Gnus, MIME, S/MIME, MML
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index e60d777e0d..5a52602506 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -1,6 +1,6 @@
 ;;; mml.el --- A package for parsing and validating MML documents  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el
index 55ef9cf7b3..9bbe643206 100644
--- a/lisp/gnus/mml1991.el
+++ b/lisp/gnus/mml1991.el
@@ -1,6 +1,6 @@
 ;;; mml1991.el --- Old PGP message format (RFC 1991) support for MML  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Sascha Lüdecke <sascha@meta-x.de>,
 ;;     Simon Josefsson <simon@josefsson.org> (Mailcrypt interface, Gnus glue)
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 239738114b..a373b7999e 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -1,6 +1,6 @@
 ;;; mml2015.el --- MIME Security with Pretty Good Privacy (PGP)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: PGP MIME MML
diff --git a/lisp/gnus/nnagent.el b/lisp/gnus/nnagent.el
index 76a7e21567..60140a4641 100644
--- a/lisp/gnus/nnagent.el
+++ b/lisp/gnus/nnagent.el
@@ -1,6 +1,6 @@
 ;;; nnagent.el --- offline backend for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnbabyl.el b/lisp/gnus/nnbabyl.el
index 5f486f4970..ff0dea8ecd 100644
--- a/lisp/gnus/nnbabyl.el
+++ b/lisp/gnus/nnbabyl.el
@@ -1,6 +1,6 @@
 ;;; nnbabyl.el --- rmail mbox access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 133e0307a5..bd60c43f59 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1,6 +1,6 @@
 ;;; nndiary.el --- A diary back end for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author:        Didier Verna <didier@didierverna.net>
 ;; Created:       Fri Jul 16 18:55:42 1999
@@ -1308,7 +1308,7 @@ all.  This may very well take some time.")
   (let ((minute (nndiary-max (nth 0 sched)))
        (hour (nndiary-max (nth 1 sched)))
        (year (nndiary-max (nth 4 sched)))
-       (time-zone (or (and (nth 6 sched) (car (nth 6 sched)))
+       (time-zone (or (car (nth 6 sched))
                       (current-time-zone))))
     (when year
       (or minute (setq minute 59))
@@ -1405,7 +1405,7 @@ all.  This may very well take some time.")
                  t))
         (dow-list (nth 5 sched))
         (year (1- this-year))
-        (time-zone (or (and (nth 6 sched) (car (nth 6 sched)))
+        (time-zone (or (car (nth 6 sched))
                        (current-time-zone))))
     ;; Special case: an asterisk in one of the days specifications means that
     ;; only the other should be taken into account. If both are unspecified,
diff --git a/lisp/gnus/nndir.el b/lisp/gnus/nndir.el
index bfc2283658..2ca25534ce 100644
--- a/lisp/gnus/nndir.el
+++ b/lisp/gnus/nndir.el
@@ -1,6 +1,6 @@
 ;;; nndir.el --- single directory newsgroup access for Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el
index 172433ef3b..19ccce47b5 100644
--- a/lisp/gnus/nndoc.el
+++ b/lisp/gnus/nndoc.el
@@ -1,6 +1,6 @@
 ;;; nndoc.el --- single file access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nndraft.el b/lisp/gnus/nndraft.el
index 394b6fcc4f..fa88b8a87e 100644
--- a/lisp/gnus/nndraft.el
+++ b/lisp/gnus/nndraft.el
@@ -1,6 +1,6 @@
 ;;; nndraft.el --- draft article access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index d881d6ce05..829d912cb2 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -1,6 +1,6 @@
 ;;; nneething.el --- arbitrary file access for Gnus  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nnfolder.el b/lisp/gnus/nnfolder.el
index 2de5b83a7b..5dc8e5c30d 100644
--- a/lisp/gnus/nnfolder.el
+++ b/lisp/gnus/nnfolder.el
@@ -1,6 +1,6 @@
 ;;; nnfolder.el --- mail folder access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;;      ShengHuo Zhu <zsh@cs.rochester.edu> (adding NOV)
diff --git a/lisp/gnus/nngateway.el b/lisp/gnus/nngateway.el
index c10989aa1e..8b6904aa36 100644
--- a/lisp/gnus/nngateway.el
+++ b/lisp/gnus/nngateway.el
@@ -1,6 +1,6 @@
 ;;; nngateway.el --- posting news via mail gateways  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index c35e89289a..8b3718ed7e 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -1,6 +1,6 @@
 ;;; nnheader.el --- header access macros for Gnus and its backends  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1987-1990, 1993-1998, 2000-2021 Free Software
+;; Copyright (C) 1987-1990, 1993-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index b7082696b2..ab4243e867 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1,6 +1,6 @@
 ;;; nnimap.el --- IMAP interface for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;         Simon Josefsson <simon@josefsson.org>
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index bcf01cfa9e..c71627f83a 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1,6 +1,6 @@
 ;;; nnmail.el --- mail support functions for the Gnus mail backends  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el
index 92944887f4..8ca1cf0fe8 100644
--- a/lisp/gnus/nnmairix.el
+++ b/lisp/gnus/nnmairix.el
@@ -1,6 +1,6 @@
 ;;; nnmairix.el --- Mairix back end for Gnus, the Emacs newsreader  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: David Engster <deng@randomsample.de>
 ;; Keywords: mail searching
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el
index 66c22670b2..5a350aac74 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -1,6 +1,6 @@
 ;;; nnmbox.el --- mail mbox access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el
index 0923b8eff3..5d016267bc 100644
--- a/lisp/gnus/nnmh.el
+++ b/lisp/gnus/nnmh.el
@@ -1,6 +1,6 @@
 ;;; nnmh.el --- mhspool access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 18acc73aad..afdb0c780a 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -1,6 +1,6 @@
 ;;; nnml.el --- mail spool access for Gnus  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Authors: Didier Verna <didier@didierverna.net> (adding compaction)
 ;;     Simon Josefsson <simon@josefsson.org>
diff --git a/lisp/gnus/nnoo.el b/lisp/gnus/nnoo.el
index 4e8490125f..a93759721a 100644
--- a/lisp/gnus/nnoo.el
+++ b/lisp/gnus/nnoo.el
@@ -1,6 +1,6 @@
 ;;; nnoo.el --- OO Gnus Backends  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/nnregistry.el b/lisp/gnus/nnregistry.el
index 15e41e9d42..d042981ca9 100644
--- a/lisp/gnus/nnregistry.el
+++ b/lisp/gnus/nnregistry.el
@@ -1,6 +1,6 @@
 ;;; nnregistry.el --- access to articles via Gnus' message-id registry  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Ludovic Courtès <ludo@gnu.org>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index 0ac57e9e17..4ca53f108f 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -1,6 +1,6 @@
 ;;; nnrss.el --- interfacing with RSS  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: RSS
@@ -450,7 +450,7 @@ nnrss: %s: Not valid XML %s and libxml-parse-html-region 
doesn't work %s"
 This function handles the ISO 8601 date format described in
 URL `https://www.w3.org/TR/NOTE-datetime', and also the RFC 822 style
 which RSS 2.0 allows."
-  (let (case-fold-search vector year month day time zone cts given)
+  (let (case-fold-search vector year month day time zone given)
     (cond ((null date))                        ; do nothing for this case
          ;; if the date is just digits (unix time stamp):
          ((string-match "^[0-9]+$" date)
@@ -481,13 +481,13 @@ which RSS 2.0 allows."
                            0
                          (decoded-time-zone decoded))))))
     (if month
-       (progn
-         (setq cts (current-time-string (encode-time 0 0 0 day month year)))
-         (format "%s, %02d %s %04d %s%s"
-                 (substring cts 0 3) day (substring cts 4 7) year time
-                 (if zone
-                     (concat " " (format-time-string "%z" nil zone))
-                   "")))
+       (concat (let ((system-time-locale "C"))
+                 (format-time-string "%a, %d %b %Y "
+                                     (encode-time 0 0 0 day month year)))
+               time
+               (if zone
+                   (format-time-string " %z" nil zone)
+                 ""))
       (message-make-date given))))
 
 ;;; data functions
diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index 252e9f6683..9d744ea411 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -1,6 +1,6 @@
 ;;; nnselect.el --- a virtual group backend   -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrew Cohen <cohen@andy.bu.edu>
 ;; Keywords: news mail
@@ -395,8 +395,7 @@ If this variable is nil, or if the provided function 
returns nil,
            (gnus-search-run-query
             (list
              (cons 'search-query-spec
-                   (list (cons 'query `((id . ,article)))
-                         (cons 'criteria "")  (cons 'shortcut t)))
+                   (list (cons 'query (format "id:%s" article))))
              (cons 'search-group-spec servers))))
       (unless (zerop (nnselect-artlist-length artlist))
        (setq
@@ -905,7 +904,7 @@ article came from is also searched."
                ;; make sure
                (setq list
                      (sort (map-merge
-                            'list list
+                            'alist list
                             (alist-get type (gnus-info-marks group-info)))
                            (lambda (elt1 elt2)
                              (< (car elt1) (car elt2))))))
diff --git a/lisp/gnus/nnspool.el b/lisp/gnus/nnspool.el
index ce9ab3c53c..39b89abb88 100644
--- a/lisp/gnus/nnspool.el
+++ b/lisp/gnus/nnspool.el
@@ -1,6 +1,6 @@
 ;;; nnspool.el --- spool access for GNU Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1988-1990, 1993-1998, 2000-2021 Free Software
+;; Copyright (C) 1988-1990, 1993-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index 25289655bf..990bb4426f 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -1,6 +1,6 @@
 ;;; nntp.el --- nntp access for Gnus  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1987-1990, 1992-1998, 2000-2021 Free Software
+;; Copyright (C) 1987-1990, 1992-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el
index 41a2da958a..7478a2dd0a 100644
--- a/lisp/gnus/nnvirtual.el
+++ b/lisp/gnus/nnvirtual.el
@@ -1,6 +1,6 @@
 ;;; nnvirtual.el --- virtual newsgroups access for Gnus  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: David Moore <dmoore@ucsd.edu>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/gnus/nnweb.el b/lisp/gnus/nnweb.el
index f08dc47e31..23c104da77 100644
--- a/lisp/gnus/nnweb.el
+++ b/lisp/gnus/nnweb.el
@@ -1,6 +1,6 @@
 ;;; nnweb.el --- retrieving articles via web search engines  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/gnus/score-mode.el b/lisp/gnus/score-mode.el
index 5140861890..8e27e87939 100644
--- a/lisp/gnus/score-mode.el
+++ b/lisp/gnus/score-mode.el
@@ -1,6 +1,6 @@
 ;;; score-mode.el --- mode for editing Gnus score files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/smiley.el b/lisp/gnus/smiley.el
index 32283af52b..3f83b77425 100644
--- a/lisp/gnus/smiley.el
+++ b/lisp/gnus/smiley.el
@@ -1,6 +1,6 @@
 ;;; smiley.el --- displaying smiley faces  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: news mail multimedia
diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el
index e9f703e90c..ac1e081041 100644
--- a/lisp/gnus/smime.el
+++ b/lisp/gnus/smime.el
@@ -1,6 +1,6 @@
 ;;; smime.el --- S/MIME support library  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: SMIME X.509 PEM OpenSSL
diff --git a/lisp/gnus/spam-report.el b/lisp/gnus/spam-report.el
index 5fa280ea05..334204768b 100644
--- a/lisp/gnus/spam-report.el
+++ b/lisp/gnus/spam-report.el
@@ -1,6 +1,6 @@
 ;;; spam-report.el --- Reporting spam  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 ;; Keywords: network, spam, mail, gmane, report
diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el
index ab9be0da89..b0d258d67a 100644
--- a/lisp/gnus/spam-stat.el
+++ b/lisp/gnus/spam-stat.el
@@ -1,6 +1,6 @@
 ;;; spam-stat.el --- detecting spam based on statistics  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Keywords: network
diff --git a/lisp/gnus/spam-wash.el b/lisp/gnus/spam-wash.el
index bb2a1b97ad..023f646e25 100644
--- a/lisp/gnus/spam-wash.el
+++ b/lisp/gnus/spam-wash.el
@@ -1,6 +1,6 @@
 ;;; spam-wash.el --- wash spam before analysis  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrew Cohen <cohen@andy.bu.edu>
 ;; Keywords: mail
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index 508ef5424e..297576288b 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -1,6 +1,6 @@
 ;;; spam.el --- Identifying spam  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el
index 8eb397bc82..c5a9a93482 100644
--- a/lisp/help-at-pt.el
+++ b/lisp/help-at-pt.el
@@ -1,6 +1,6 @@
 ;;; help-at-pt.el --- local help through the keyboard  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Luc Teirlinck <teirllm@auburn.edu>
 ;; Keywords: help
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 32698420e1..d408efeeb9 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1,6 +1,6 @@
 ;;; help-fns.el --- Complex help functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2021 Free Software
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/help-macro.el b/lisp/help-macro.el
index cd1b51e57a..91c2a80400 100644
--- a/lisp/help-macro.el
+++ b/lisp/help-macro.el
@@ -1,6 +1,6 @@
 ;;; help-macro.el --- makes command line help such as help-for-help  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Lynn Slater <lrs@indetech.com>
 ;; Maintainer: emacs-devel@gnu.org
@@ -167,14 +167,18 @@ and then returns."
                    (let ((cursor-in-echo-area t)
                          (overriding-local-map local-map))
                      (setq key (read-key-sequence
-                                (format "Type one of the options listed%s: "
+                                (format "Type one of listed options%s: "
                                         (if (pos-visible-in-window-p
                                              (point-max))
                                             ""
                                           (concat  ", or "
                                                    
(help--key-description-fontified (kbd "<PageDown>"))
-                                                   " or "
+                                                   "/"
                                                    
(help--key-description-fontified (kbd "<PageUp>"))
+                                                   "/"
+                                                   
(help--key-description-fontified (kbd "SPC"))
+                                                   "/"
+                                                   
(help--key-description-fontified (kbd "DEL"))
                                                    " to scroll"))))
                            char (aref key 0)))
 
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 792f2e5af3..894b2a50aa 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -1,6 +1,6 @@
 ;;; help-mode.el --- `help-mode' used by *Help* buffers  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2021 Free Software
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/help.el b/lisp/help.el
index a309c10a0b..0ac5e7f9eb 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1,6 +1,6 @@
 ;;; help.el --- help commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2021 Free Software
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/hex-util.el b/lisp/hex-util.el
index 41bdc39875..0858e46ec5 100644
--- a/lisp/hex-util.el
+++ b/lisp/hex-util.el
@@ -1,6 +1,6 @@
 ;;; hex-util.el --- Functions to encode/decode hexadecimal string -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
 ;; Keywords: data
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 79dd5c40c6..7f965486ea 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -1,6 +1,6 @@
 ;;; hexl.el --- edit a file in a hex dump format using the hexl filter -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1994, 1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1989, 1994, 1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Keith Gabryelski <ag@wheaties.ai.mit.edu>
diff --git a/lisp/hfy-cmap.el b/lisp/hfy-cmap.el
index b7de65f5b7..258502bfe7 100644
--- a/lisp/hfy-cmap.el
+++ b/lisp/hfy-cmap.el
@@ -1,6 +1,6 @@
 ;;; hfy-cmap.el --- Fallback color name -> rgb mapping for `htmlfontify'  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2003, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2009-2022 Free Software Foundation, Inc.
 
 ;; Emacs Lisp Archive Entry
 ;; Package: htmlfontify
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 7d126cb558..fbd698e234 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -1,6 +1,6 @@
 ;;; hi-lock.el --- minor mode for interactive automatic highlighting  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: David M. Koppelman <koppel@ece.lsu.edu>
 ;; Keywords: faces, minor-mode, matching, display
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index d9fab6b875..10e2512e9d 100644
--- a/lisp/hilit-chg.el
+++ b/lisp/hilit-chg.el
@@ -1,6 +1,6 @@
 ;;; hilit-chg.el --- minor mode displaying buffer changes with special face  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard Sharman <rsharman@pobox.com>
 ;; Keywords: faces
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index 9720709038..9a6bfc604e 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -1,6 +1,6 @@
 ;;; hippie-exp.el --- expand text trying various ways to find its expansion  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Holst <aho@sans.kth.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index 26cfcc3f9c..8e60ddf6b0 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -1,6 +1,6 @@
 ;;; hl-line.el --- highlight the current line  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 8dc4cce323..9ea27f2465 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -1,6 +1,6 @@
 ;;; htmlfontify.el --- htmlize a buffer/source tree with optional hyperlinks 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2003, 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2009-2022 Free Software Foundation, Inc.
 
 ;; Emacs Lisp Archive Entry
 ;; Package: htmlfontify
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 2d2365dc34..30b494f573 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1,6 +1,6 @@
 ;;; ibuf-ext.el --- extensions for ibuffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <walters@verbum.org>
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el
index fcc4f9e751..5d2dd47945 100644
--- a/lisp/ibuf-macs.el
+++ b/lisp/ibuf-macs.el
@@ -1,6 +1,6 @@
 ;;; ibuf-macs.el --- macros for ibuffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <walters@verbum.org>
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index b461197abe..7cfa428e9b 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1,6 +1,6 @@
 ;;; ibuffer.el --- operate on buffers like dired  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <walters@verbum.org>
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index f909a3b177..2986aa192c 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -1,6 +1,6 @@
 ;;; icomplete.el --- minibuffer completion incremental feedback -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992-1994, 1997, 1999, 2001-2021 Free Software
+;; Copyright (C) 1992-1994, 1997, 1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail...>
diff --git a/lisp/ido.el b/lisp/ido.el
index 31b32f09dd..030bd182cd 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1,6 +1,6 @@
 ;;; ido.el --- interactively do things with buffers and files -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Based on: iswitchb by Stephen Eglen <stephen@cns.ed.ac.uk>
@@ -920,85 +920,77 @@ The fallback command is passed as an argument to the 
functions."
 
 ;;;; Keymaps
 
-(defvar ido-common-completion-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map minibuffer-local-map)
-    (define-key map "\C-a" 'ido-toggle-ignore)
-    (define-key map "\C-c" 'ido-toggle-case)
-    (define-key map "\C-e" 'ido-edit-input)
-    (define-key map "\t" 'ido-complete)
-    (define-key map " " 'ido-complete-space)
-    (define-key map "\C-j" 'ido-select-text)
-    (define-key map "\C-m" 'ido-exit-minibuffer)
-    (define-key map "\C-p" 'ido-toggle-prefix)
-    (define-key map "\C-r" 'ido-prev-match)
-    (define-key map "\C-s" 'ido-next-match)
-    (define-key map [?\C-.] 'ido-next-match)
-    (define-key map [?\C-,] 'ido-prev-match)
-    (define-key map "\C-t" 'ido-toggle-regexp)
-    (define-key map "\C-z" 'ido-undo-merge-work-directory)
-    (define-key map [(control ?\s)] 'ido-restrict-to-matches)
-    (define-key map [(meta ?\s)] 'ido-take-first-match)
-    (define-key map [(control ?@)] 'ido-restrict-to-matches)
-    (define-key map [right] 'ido-next-match)
-    (define-key map [left] 'ido-prev-match)
-    (define-key map "?" 'ido-completion-help)
-    (define-key map "\C-b" 'ido-magic-backward-char)
-    (define-key map "\C-f" 'ido-magic-forward-char)
-    (define-key map "\C-d" 'ido-magic-delete-char)
-    map)
-  "Keymap for all Ido commands.")
-
-(defvar ido-file-dir-completion-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map ido-common-completion-map)
-    (define-key map "\C-x\C-b" 'ido-enter-switch-buffer)
-    (define-key map "\C-x\C-f" 'ido-fallback-command)
-    (define-key map "\C-x\C-d" 'ido-enter-dired)
-    (define-key map [down] 'ido-next-match-dir)
-    (define-key map [up]   'ido-prev-match-dir)
-    (define-key map [(meta up)] 'ido-prev-work-directory)
-    (define-key map [(meta down)] 'ido-next-work-directory)
-    (define-key map [backspace] 'ido-delete-backward-updir)
-    (define-key map "\d"        'ido-delete-backward-updir)
-    (define-key map [remap delete-backward-char] 'ido-delete-backward-updir) ; 
BS
-    (define-key map [remap backward-kill-word] 
'ido-delete-backward-word-updir)  ; M-DEL
-    (define-key map [(control backspace)] 'ido-up-directory)
-    (define-key map "\C-l" 'ido-reread-directory)
-    (define-key map [(meta ?d)] 'ido-wide-find-dir-or-delete-dir)
-    (define-key map [(meta ?b)] 'ido-push-dir)
-    (define-key map [(meta ?v)] 'ido-push-dir-first)
-    (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir)
-    (define-key map [(meta ?k)] 'ido-forget-work-directory)
-    (define-key map [(meta ?m)] 'ido-make-directory)
-    (define-key map [(meta ?n)] 'ido-next-work-directory)
-    (define-key map [(meta ?o)] 'ido-prev-work-file)
-    (define-key map [(meta control ?o)] 'ido-next-work-file)
-    (define-key map [(meta ?p)] 'ido-prev-work-directory)
-    (define-key map [(meta ?s)] 'ido-merge-work-directories)
-    map)
-  "Keymap for Ido file and directory commands.")
-
-(defvar ido-file-completion-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map ido-file-dir-completion-map)
-    (define-key map "\C-k" 'ido-delete-file-at-head)
-    (define-key map "\C-o" 'ido-copy-current-word)
-    (define-key map "\C-w" 'ido-copy-current-file-name)
-    (define-key map [(meta ?l)] 'ido-toggle-literal)
-    map)
-  "Keymap for Ido file commands.")
-
-(defvar ido-buffer-completion-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map ido-common-completion-map)
-    (define-key map "\C-x\C-f" 'ido-enter-find-file)
-    (define-key map "\C-x\C-b" 'ido-fallback-command)
-    (define-key map "\C-k" 'ido-kill-buffer-at-head)
-    (define-key map [?\C-\S-b] 'ido-bury-buffer-at-head)
-    (define-key map "\C-o" 'ido-toggle-virtual-buffers)
-    map)
-  "Keymap for Ido buffer commands.")
+(defvar-keymap ido-common-completion-map
+  :doc "Keymap for all Ido commands."
+  :parent minibuffer-local-map
+  "C-a"     #'ido-toggle-ignore
+  "C-c"     #'ido-toggle-case
+  "C-e"     #'ido-edit-input
+  "TAB"     #'ido-complete
+  "SPC"     #'ido-complete-space
+  "C-j"     #'ido-select-text
+  "C-m"     #'ido-exit-minibuffer
+  "C-p"     #'ido-toggle-prefix
+  "C-r"     #'ido-prev-match
+  "C-s"     #'ido-next-match
+  "C-."     #'ido-next-match
+  "C-,"     #'ido-prev-match
+  "C-t"     #'ido-toggle-regexp
+  "C-z"     #'ido-undo-merge-work-directory
+  "C-SPC"   #'ido-restrict-to-matches
+  "M-SPC"   #'ido-take-first-match
+  "C-@"     #'ido-restrict-to-matches
+  "<right>" #'ido-next-match
+  "<left>"  #'ido-prev-match
+  "?"       #'ido-completion-help
+  "C-b"     #'ido-magic-backward-char
+  "C-f"     #'ido-magic-forward-char
+  "C-d"     #'ido-magic-delete-char)
+
+(defvar-keymap ido-file-dir-completion-map
+  :doc "Keymap for Ido file and directory commands."
+  :parent ido-common-completion-map
+  "C-x C-b"     #'ido-enter-switch-buffer
+  "C-x C-f"     #'ido-fallback-command
+  "C-x C-d"     #'ido-enter-dired
+  "<down>"      #'ido-next-match-dir
+  "<up>"        #'ido-prev-match-dir
+  "M-<up>"      #'ido-prev-work-directory
+  "M-<down>"    #'ido-next-work-directory
+  "<backspace>" #'ido-delete-backward-updir
+  "DEL"         #'ido-delete-backward-updir
+  "<remap> <delete-backward-char>" #'ido-delete-backward-updir
+  "<remap> <backward-kill-word>"   #'ido-delete-backward-word-updir
+  "C-<backspace>" #'ido-up-directory
+  "C-l"   #'ido-reread-directory
+  "M-d"   #'ido-wide-find-dir-or-delete-dir
+  "M-b"   #'ido-push-dir
+  "M-v"   #'ido-push-dir-first
+  "M-f"   #'ido-wide-find-file-or-pop-dir
+  "M-k"   #'ido-forget-work-directory
+  "M-m"   #'ido-make-directory
+  "M-n"   #'ido-next-work-directory
+  "M-o"   #'ido-prev-work-file
+  "C-M-o" #'ido-next-work-file
+  "M-p"   #'ido-prev-work-directory
+  "M-s"   #'ido-merge-work-directories)
+
+(defvar-keymap ido-file-completion-map
+  :doc "Keymap for Ido file commands."
+  :parent ido-file-dir-completion-map
+  "C-k" #'ido-delete-file-at-head
+  "C-o" #'ido-copy-current-word
+  "C-w" #'ido-copy-current-file-name
+  "M-l" #'ido-toggle-literal)
+
+(defvar-keymap ido-buffer-completion-map
+  :doc "Keymap for Ido buffer commands."
+  :parent ido-common-completion-map
+  "C-x C-f" #'ido-enter-find-file
+  "C-x C-b" #'ido-fallback-command
+  "C-k"     #'ido-kill-buffer-at-head
+  "C-S-b"   #'ido-bury-buffer-at-head
+  "C-o"     #'ido-toggle-virtual-buffers)
 
 ;;;; Persistent variables
 
diff --git a/lisp/ielm.el b/lisp/ielm.el
index 39820a893a..47c1792118 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -1,6 +1,6 @@
 ;;; ielm.el --- interaction mode for Emacs Lisp  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Smith <maa036@lancaster.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
@@ -148,28 +148,28 @@ such as `edebug-defun' to work with such inputs."
 This variable is buffer-local.")
 
 (defvar ielm-header
-  "*** Welcome to IELM ***  Type (describe-mode) for help.\n"
+  (substitute-command-keys
+   "*** Welcome to IELM ***  Type (describe-mode) or press \
+\\[describe-mode] for help.\n")
   "Message to display when IELM is started.")
 
 (defvaralias 'inferior-emacs-lisp-mode-map 'ielm-map)
-(defvar ielm-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\t" 'ielm-tab)
-    (define-key map "\C-m" 'ielm-return)
-    (define-key map "\e\C-m" 'ielm-return-for-effect)
-    (define-key map "\C-j" 'ielm-send-input)
-    (define-key map "\e\C-x" 'eval-defun)         ; for consistency with
-    (define-key map "\e\t" 'completion-at-point)  ; lisp-interaction-mode
-    ;; These bindings are from `lisp-mode-shared-map' -- can you inherit
-    ;; from more than one keymap??
-    (define-key map "\e\C-q" 'indent-sexp)
-    (define-key map "\177" 'backward-delete-char-untabify)
-    ;; Some convenience bindings for setting the working buffer
-    (define-key map "\C-c\C-b" 'ielm-change-working-buffer)
-    (define-key map "\C-c\C-f" 'ielm-display-working-buffer)
-    (define-key map "\C-c\C-v" 'ielm-print-working-buffer)
-    map)
-  "Keymap for IELM mode.")
+(defvar-keymap ielm-map
+  :doc "Keymap for IELM mode."
+  "TAB"     #'ielm-tab
+  "RET"     #'ielm-return
+  "M-RET"   #'ielm-return-for-effect
+  "C-j"     #'ielm-send-input
+  "C-M-x"   #'eval-defun                ; for consistency with
+  "M-TAB"   #'completion-at-point       ; lisp-interaction-mode
+  ;; These bindings are from `lisp-mode-shared-map' -- can you inherit
+  ;; from more than one keymap??
+  "C-M-q"   #'indent-sexp
+  "DEL"     #'backward-delete-char-untabify
+  ;; Some convenience bindings for setting the working buffer
+  "C-c C-b" #'ielm-change-working-buffer
+  "C-c C-f" #'ielm-display-working-buffer
+  "C-c C-v" #'ielm-print-working-buffer)
 
 (easy-menu-define ielm-menu ielm-map
   "IELM mode menu."
diff --git a/lisp/iimage.el b/lisp/iimage.el
index b18dd841fc..2fe50d3e3f 100644
--- a/lisp/iimage.el
+++ b/lisp/iimage.el
@@ -1,6 +1,6 @@
 ;;; iimage.el --- Inline image minor mode.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: KOSEKI Yoshinori <kose@meadowy.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 6ca0cd8831..536f29441a 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1,6 +1,6 @@
 ;;; image-dired.el --- use dired to browse and manipulate your images -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Version: 0.4.11
 ;; Keywords: multimedia
diff --git a/lisp/image-file.el b/lisp/image-file.el
index 6df43f737d..0ed88e8e74 100644
--- a/lisp/image-file.el
+++ b/lisp/image-file.el
@@ -1,6 +1,6 @@
 ;;; image-file.el --- support for visiting image files  -*- lexical-binding:t 
-*-
 ;;
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: multimedia
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 6ff7859c83..5bee155460 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -1,6 +1,6 @@
 ;;; image-mode.el --- support for visiting image files  -*- lexical-binding: t 
-*-
 ;;
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Richard Stallman <rms@gnu.org>
 ;; Keywords: multimedia
diff --git a/lisp/image.el b/lisp/image.el
index cedefc038f..c9165f7781 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -1,6 +1,6 @@
 ;;; image.el --- image API  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: multimedia
@@ -58,7 +58,7 @@ static \\(unsigned \\)?char \\1_bits" . xbm)
                "\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re 
"*\\)?"
                "[Ss][Vv][Gg]"))
      . svg)
-    )
+    
("\\`....ftyp\\(heic\\|heix\\|hevc\\|heim\\|heis\\|hevm\\|hevs\\|mif1\\|msf1\\)"
 . heic))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
 When the first bytes of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,
@@ -78,7 +78,7 @@ a non-nil value, TYPE is the image's type.")
     ("\\.ps\\'" . postscript)
     ("\\.tiff?\\'" . tiff)
     ("\\.svgz?\\'" . svg)
-    )
+    ("\\.hei[cf]s?\\'" . heic))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files.
 When the name of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE.")
@@ -97,7 +97,8 @@ be of image type IMAGE-TYPE.")
     (tiff . maybe)
     (svg . maybe)
     (webp . maybe)
-    (postscript . nil))
+    (postscript . nil)
+    (heic . maybe))
   "Alist of (IMAGE-TYPE . AUTODETECT) pairs used to auto-detect image files.
 \(See `image-type-auto-detected-p').
 
diff --git a/lisp/image/compface.el b/lisp/image/compface.el
index 6519615f4e..b8bb7a83bc 100644
--- a/lisp/image/compface.el
+++ b/lisp/image/compface.el
@@ -1,6 +1,6 @@
 ;;; compface.el --- functions for converting X-Face headers -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: multimedia, news
diff --git a/lisp/image/exif.el b/lisp/image/exif.el
index 372e2d2555..35666b954c 100644
--- a/lisp/image/exif.el
+++ b/lisp/image/exif.el
@@ -1,6 +1,6 @@
 ;;; exif.el --- parsing Exif data in JPEG images -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: images
diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index 87726a9b8c..78a2df72c4 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -1,6 +1,6 @@
 ;;; gravatar.el --- Get Gravatars -*- lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <julien@danjou.info>
 ;; Keywords: comm, multimedia
diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el
index 75d2e6692c..460ff16adb 100644
--- a/lisp/image/image-converter.el
+++ b/lisp/image/image-converter.el
@@ -1,6 +1,6 @@
 ;;; image-converter.el --- Converting images from exotic formats -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: images
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 22412d5f88..a87860f006 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -1,6 +1,6 @@
 ;;; imenu.el --- framework for mode-specific buffer indexes  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ake Stenhoff <etxaksf@aom.ericsson.se>
 ;;         Lars Lindberg <lli@sypro.cap.se>
diff --git a/lisp/indent.el b/lisp/indent.el
index ec01733d12..40669b3842 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -1,6 +1,6 @@
 ;;; indent.el --- indentation commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Package: emacs
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 4812035919..64f16df4dc 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -1,7 +1,7 @@
 ;;; info-look.el --- major-mode-sensitive Info index lookup facility -*- 
lexical-binding: t -*-
 ;; An older version of this was known as libc.el.
 
-;; Copyright (C) 1995-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <rs@ralph-schleicher.de>
 ;; Keywords: help languages
@@ -94,7 +94,10 @@ HELP-DATA is a HELP-TOPIC's public data set.
 
     (HELP-MODE REGEXP IGNORE-CASE DOC-SPEC PARSE-RULE OTHER-MODES)
 
-HELP-MODE is a mode's symbol.
+HELP-MODE is either a mode's symbol, or a cons cell of the
+form (HELP-MODE . SYMBOL-PREFIX), where SYMBOL-PREFIX is the
+prefix (the part up to the first dash) of names of symbols whose
+documentation is specified by DOC-SPEC.
 REGEXP is a regular expression matching those help items whose
  documentation can be looked up via DOC-SPEC.
 IGNORE-CASE is non-nil if help items are case insensitive.
@@ -159,8 +162,10 @@ KEYWORD is either `:topic', `:mode', `:regexp', 
`:ignore-case',
   doing so at load time, this is done when the user asks for info on
   the mode in question.
 
-ARGUMENT has a value as explained in the documentation of the
- variable `info-lookup-alist'.
+ARGUMENT is the value corresponding to KEYWORD.  The meaning of the values
+is explained in the documentation of the variable `info-lookup-alist': for
+example, the value corresponding to `:topic' is documented as HELP-TOPIC,
+the value of `:mode' as HELP-MODE, etc..
 
 If no topic or mode option has been specified, then the help topic defaults
 to `symbol', and the help mode defaults to the current major mode."
@@ -276,14 +281,19 @@ system."
 ;;;###autoload (put 'info-lookup-symbol 'info-file "emacs")
 ;;;###autoload
 (defun info-lookup-symbol (symbol &optional mode)
-  "Display the definition of SYMBOL, as found in the relevant manual.
-When this command is called interactively, it reads SYMBOL from the
-minibuffer.  In the minibuffer, use \\<minibuffer-local-completion-map>\
-\\[next-history-element] to yank the default argument
-value into the minibuffer so you can edit it.  The default symbol is the
-one found at point.
-
-With prefix arg MODE a query for the symbol help mode is offered."
+  "Look up and display documentation of SYMBOL in the relevant Info manual.
+SYMBOL should be an identifier: a function or method, a macro, a variable,
+a data type, a class, etc.
+
+Interactively, prompt for SYMBOL; you can use 
\\<minibuffer-local-completion-map>\\[next-history-element] in the minibuffer
+to yank the default argument value into the minibuffer so you can edit it.
+The default symbol is the one found at point.
+
+MODE is the major mode whose Info manuals to search for the documentation
+of SYMBOL.  It defaults to the current buffer's `major-mode'; if that
+mode doesn't have any Info manuals known to Emacs, the command will
+prompt for MODE to use, with completion.  With prefix arg, the command
+always prompts for MODE."
   (interactive
    (info-lookup-interactive-arguments 'symbol current-prefix-arg))
   (info-lookup 'symbol symbol mode))
@@ -291,20 +301,28 @@ With prefix arg MODE a query for the symbol help mode is 
offered."
 ;;;###autoload (put 'info-lookup-file 'info-file "emacs")
 ;;;###autoload
 (defun info-lookup-file (file &optional mode)
-  "Display the documentation of a file.
-When this command is called interactively, it reads FILE from the minibuffer.
-In the minibuffer, use \\<minibuffer-local-completion-map>\
-\\[next-history-element] to yank the default file name
-into the minibuffer so you can edit it.
+  "Look up and display documentation of FILE in the relevant Info manual.
+FILE should be the name of a file; a notable example is a standard header
+file that is part of the C or C++ standard library.
+
+Interactively, prompt for FILE; you can use 
\\<minibuffer-local-completion-map>\\[next-history-element] in the minibuffer
+to yank the default argument value into the minibuffer so you can edit it.
 The default file name is the one found at point.
 
-With prefix arg MODE a query for the file help mode is offered."
+MODE is the major mode whose Info manuals to search for the documentation
+of FILE.  It defaults to the current buffer's `major-mode'; if that
+mode doesn't have any Info manuals known to Emacs, the command will
+prompt for MODE to use, with completion.  With prefix arg, the command
+always prompts for MODE."
   (interactive
    (info-lookup-interactive-arguments 'file current-prefix-arg))
   (info-lookup 'file file mode))
 
 (defun info-lookup-interactive-arguments (topic &optional query)
-  "Read and return argument value (and help mode) for help topic TOPIC.
+  "Read and return argument value (and help mode) for help TOPIC.
+TOPIC should be any known symbol of a help topic, such as `file'
+or `symbol'.  See the documentation of HELP-TOPIC in the doc
+string of `info-lookup-alist'.
 If optional argument QUERY is non-nil, query for the help mode."
   (let* ((mode (cond (query
                      (info-lookup-change-mode topic))
@@ -347,7 +365,10 @@ If optional argument QUERY is non-nil, query for the help 
mode."
 
 (defun info-lookup-change-mode (topic)
   (let* ((completions (mapcar (lambda (arg)
-                               (cons (symbol-name (car arg)) (car arg)))
+                                (let ((mode-spec (car arg)))
+                                  (and (consp mode-spec)
+                                       (setq mode-spec (car mode-spec)))
+                                 (cons (symbol-name mode-spec) mode-spec)))
                              (info-lookup->topic-value topic)))
         (mode (completing-read
                (format "Use %s help mode: " topic)
@@ -368,7 +389,15 @@ If optional argument QUERY is non-nil, query for the help 
mode."
       mode)))
 
 (defun info-lookup (topic item mode)
-  "Display the documentation of a help item."
+  "Display the documentation of TOPIC whose name is ITEM, using MODE's manuals.
+TOPIC should be any known symbol of a help topic type, such as `file'
+or `symbol'.  See the documentation of HELP-TOPIC in the doc
+string of `info-lookup-alist'.
+ITEM is the item whose documentation to search: file name if
+TOPIC is `file', a symbol if TOPIC is `symbol', etc.
+MODE is the `major-mode' whose Info manuals to search for documentation
+of ITEM; if it's nil, the function uses `info-lookup-file-name-alist'
+and the current buffer's file name to guess the mode.."
   (or mode (setq mode (info-lookup-select-mode)))
   (setq mode (info-lookup--item-to-mode item mode))
   (if-let ((info (info-lookup->mode-value topic mode)))
diff --git a/lisp/info-xref.el b/lisp/info-xref.el
index f791927ee1..d3f603ee5b 100644
--- a/lisp/info-xref.el
+++ b/lisp/info-xref.el
@@ -1,6 +1,6 @@
 ;;; info-xref.el --- check external references in an Info document -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Kevin Ryde <user42@zip.com.au>
 ;; Keywords: docs
diff --git a/lisp/info.el b/lisp/info.el
index 559460e8d2..f4f0f9790c 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1,6 +1,6 @@
 ;;; info.el --- Info package for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1992-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help
diff --git a/lisp/informat.el b/lisp/informat.el
index b552e8532a..e7595fa541 100644
--- a/lisp/informat.el
+++ b/lisp/informat.el
@@ -1,6 +1,6 @@
 ;;; informat.el --- info support functions package for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1986, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help
diff --git a/lisp/international/ccl.el b/lisp/international/ccl.el
index 883b0b60fc..9188e3d6ae 100644
--- a/lisp/international/ccl.el
+++ b/lisp/international/ccl.el
@@ -1,6 +1,6 @@
 ;;; ccl.el --- CCL (Code Conversion Language) compiler  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/characters.el b/lisp/international/characters.el
index a2156ee01a..080e7898c4 100644
--- a/lisp/international/characters.el
+++ b/lisp/international/characters.el
@@ -1,6 +1,6 @@
 ;;; characters.el --- set syntax and category for multibyte characters  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index 5f8c358caa..264a1f09dc 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -1,6 +1,6 @@
 ;;; emoji.el --- Inserting emojis  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: fun
@@ -30,6 +30,7 @@
 (require 'cl-lib)
 (require 'cl-extra)
 (require 'transient)
+(require 'multisession)
 
 (defgroup emoji nil
   "Inserting Emojis."
@@ -59,14 +60,15 @@
 (defvar emoji--derived nil)
 (defvar emoji--names (make-hash-table :test #'equal))
 (defvar emoji--done-derived nil)
-(defvar emoji--recent (list "😀" "😖"))
+(define-multisession-variable emoji--recent (list "😀" "😖"))
 (defvar emoji--insert-buffer)
 
 ;;;###autoload
 (defun emoji-insert (&optional text)
   "Choose and insert an emoji glyph.
-If TEXT (interactively, the prefix), use a textual search instead
-of a visual interface."
+If TEXT (interactively, the prefix argument), choose the emoji
+by typing its Unicode Standard name (with completion), instead
+of selecting from emoji display."
   (interactive "*P")
   (emoji--init)
   (if text
@@ -77,17 +79,19 @@ of a visual interface."
 
 ;;;###autoload
 (defun emoji-recent ()
-  "Choose and insert a recently used emoji glyph."
+  "Choose and insert one of the recently-used emoji glyphs."
   (interactive "*")
   (emoji--init)
   (unless (fboundp 'emoji--command-Emoji)
     (emoji--define-transient))
   (funcall (emoji--define-transient
-            (cons "Recent" emoji--recent) t)))
+            (cons "Recent" (multisession-value emoji--recent)) t)))
 
 ;;;###autoload
 (defun emoji-search ()
-  "Choose and insert an emoji glyph by searching for an emoji name."
+  "Choose and insert an emoji glyph by typing its Unicode name.
+This command prompts for an emoji name, with completion, and inserts it.
+It recognizes the Unicode Standard names of emoji."
   (interactive "*")
   (emoji--init)
   (emoji--choose-emoji))
@@ -95,8 +99,9 @@ of a visual interface."
 ;;;###autoload
 (defun emoji-list ()
   "List emojis and insert the one that's selected.
-The character will be inserted into the buffer that was selected
-when the command was issued."
+Select the emoji by typing \\<emoji-list-mode-map>\\[emoji-list-select] on its 
picture.
+The glyph will be inserted into the buffer that was current
+when the command was invoked."
   (interactive "*")
   (let ((buf (current-buffer)))
     (emoji--init)
@@ -112,11 +117,13 @@ when the command was issued."
 
 ;;;###autoload
 (defun emoji-describe (glyph &optional interactive)
-  "Say what the name of the composed grapheme cluster GLYPH is.
-If it's not known, this function returns nil.
+  "Display the name of the grapheme cluster composed from GLYPH.
+GLYPH should be a string of one or more characters which together
+produce an emoji.  Interactively, GLYPH is the emoji at point (it
+could also be any character, not just emoji).
 
-Interactively, it will message what the name of the emoji (or
-character) under point is."
+If called from Lisp, return the name as a string; return nil if
+the name is not known."
   (interactive
    (list (if (eobp)
              (error "No glyph under point")
@@ -223,14 +230,14 @@ character) under point is."
                                     nil end-func)))))))
 
 (defun emoji-list-help ()
-  "Say what the emoji under point is."
+  "Display the name of the emoji at point."
   (interactive nil emoji-list-mode)
   (let ((glyph (get-text-property (point) 'emoji-glyph)))
     (unless glyph
-      (error "No emoji under point"))
+      (error "No emoji here"))
     (let ((name (emoji--name glyph)))
       (if (not name)
-          (error "Unknown name")
+          (error "Emoji name is unknown")
         (message "%s" name)))))
 
 (defun emoji--init (&optional force inhibit-adjust)
@@ -298,6 +305,7 @@ character) under point is."
     (setq emoji--names (make-hash-table :test #'equal))
     (let ((derivations (make-hash-table :test #'equal))
           (case-fold-search t)
+          (glyphs nil)
           group subgroup)
       (while (not (eobp))
         (cond
@@ -311,27 +319,40 @@ character) under point is."
           (let* ((codes (match-string 1))
                  (qualification (match-string 2))
                  (name (match-string 3))
-                 (base (emoji--base-name name derivations))
                  (glyph (mapconcat
                          (lambda (code)
                            (string (string-to-number code 16)))
                          (split-string codes))))
-            ;; Special-case flags.
-            (when (equal base "flag")
-              (setq base name))
-            ;; Register all glyphs to that we can look up their names
-            ;; later.
-            (setf (gethash glyph emoji--names) name)
-            ;; For the interface, we only care about the fully qualified
-            ;; emojis.
-            (when (equal qualification "fully-qualified")
-              (when (equal base name)
-                (emoji--add-to-group group subgroup glyph))
-              ;; Create mapping from base glyph name to name of
-              ;; derived glyphs.
-              (setf (gethash base derivations)
-                    (nconc (gethash base derivations) (list glyph)))))))
+            (push (list name qualification group subgroup glyph) glyphs))))
         (forward-line 1))
+      ;; We sort the data so that the "person foo" variant comes
+      ;; first, so that that becomes the key.
+      (setq glyphs
+            (sort (nreverse glyphs)
+                  (lambda (g1 g2)
+                    (and (equal (nth 2 g1) (nth 2 g2))
+                         (equal (nth 3 g1) (nth 3 g2))
+                         (< (emoji--score (car g1))
+                            (emoji--score (car g2)))))))
+      ;; Get the derivations.
+      (cl-loop for (name qualification group subgroup glyph) in glyphs
+               for base = (emoji--base-name name derivations)
+               do
+               ;; Special-case flags.
+               (when (equal base "flag")
+                 (setq base name))
+               ;; Register all glyphs to that we can look up their names
+               ;; later.
+               (setf (gethash glyph emoji--names) name)
+               ;; For the interface, we only care about the fully qualified
+               ;; emojis.
+               (when (equal qualification "fully-qualified")
+                 (when (equal base name)
+                   (emoji--add-to-group group subgroup glyph))
+                 ;; Create mapping from base glyph name to name of
+                 ;; derived glyphs.
+                 (setf (gethash base derivations)
+                       (nconc (gethash base derivations) (list glyph)))))
       ;; Finally create the mapping from the base glyphs to derived ones.
       (setq emoji--derived (make-hash-table :test #'equal))
       (maphash (lambda (_k v)
@@ -339,6 +360,12 @@ character) under point is."
                        (cdr v)))
                derivations))))
 
+(defun emoji--score (string)
+  (if (string-match-p "person\\|people"
+                      (replace-regexp-in-string ":.*" "" string))
+      0
+    1))
+
 (defun emoji--add-to-group (group subgroup glyph)
   ;; "People & Body" is very large; split it up.
   (cond
@@ -399,20 +426,31 @@ character) under point is."
 ;; no-update-autoloads: t
 ;; End:
 
-(provide 'emoji-labels)
+\(provide 'emoji-labels)
 
-;;; emoji-labels.el ends here\n")
+\;;; emoji-labels.el ends here\n")
     (write-region (point-min) (point-max) file)))
 
 (defun emoji--base-name (name derivations)
-  (let* ((base (replace-regexp-in-string ":.*" "" name))
-         (non-binary (replace-regexp-in-string "\\`\\(man\\|woman\\) " ""
-                                               base)))
-    ;; If we have (for instance) "person golfing", and we're adding
-    ;; "man golfing", make the latter a derivation of the former.
-    (if (or (gethash (concat "person " non-binary) derivations)
-            (gethash non-binary derivations))
-        non-binary
+  (let* ((base (replace-regexp-in-string ":.*" "" name)))
+    (catch 'found
+      ;; If we have (for instance) "person golfing", and we're adding
+      ;; "man golfing", make the latter a derivation of the former.
+      (let ((non-binary (replace-regexp-in-string
+                         "\\`\\(m[ae]n\\|wom[ae]n\\) " "" base)))
+        (dolist (prefix '("person " "people " ""))
+          (let ((key (concat prefix non-binary)))
+            (when (gethash key derivations)
+              (throw 'found key)))))
+      ;; We can also have the gender at the end of the string, like
+      ;; "merman" and "pregnant woman".
+      (let ((non-binary (replace-regexp-in-string
+                         "\\(m[ae]n\\|wom[ae]n\\|maid\\)\\'" "" base)))
+        (dolist (suffix '(" person" "person" ""))
+          (let ((key (concat non-binary suffix)))
+            (when (gethash key derivations)
+              (throw 'found key)))))
+      ;; Just return the base.
       base)))
 
 (defun emoji--split-subgroup (subgroup)
@@ -497,7 +535,7 @@ character) under point is."
                                          t end-function))
                                     ;; Insert the emoji.
                                     (lambda ()
-                                      (interactive)
+                                      (interactive nil not-a-mode)
                                       ;; Allow switching to the correct
                                       ;; buffer.
                                       (when end-function
@@ -510,7 +548,7 @@ character) under point is."
     ;; There's probably a better way to do this...
     (setf (symbol-function name)
           (lambda ()
-            (interactive)
+            (interactive nil not-a-mode)
             (transient-setup name)))
     (pcase-let ((`(,class ,slots ,suffixes ,docstr ,_body)
                  (transient--expand-define-args (list args))))
@@ -529,15 +567,18 @@ character) under point is."
   (lambda ()
     (interactive)
     (funcall (emoji--define-transient
-              (cons "Recent" emoji--recent) t end-function))))
+              (cons "Recent" (multisession-value emoji--recent))
+              t end-function))))
 
 (defun emoji--add-recent (glyph)
   "Add GLYPH to the set of recently used emojis."
-  (setq emoji--recent (delete glyph emoji--recent))
-  (push glyph emoji--recent)
-  ;; Shorten the list.
-  (when-let ((tail (nthcdr 30 emoji--recent)))
-    (setcdr tail nil)))
+  (let ((recent (multisession-value emoji--recent)))
+    (setq recent (delete glyph recent))
+    (push glyph recent)
+    ;; Shorten the list.
+    (when-let ((tail (nthcdr 30 recent)))
+      (setcdr tail nil))
+    (setf (multisession-value emoji--recent) recent)))
 
 (defun emoji--columnize (list columns)
   "Split LIST into COLUMN columns."
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 7c3a7cd1a9..a2e0838a42 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -1,6 +1,6 @@
 ;;; fontset.el --- commands for handling fontset  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el
index b890bde48d..76190b8fc0 100644
--- a/lisp/international/isearch-x.el
+++ b/lisp/international/isearch-x.el
@@ -1,6 +1,6 @@
 ;;; isearch-x.el --- extended isearch handling commands  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/iso-ascii.el b/lisp/international/iso-ascii.el
index f8cb61c08f..6fbe930334 100644
--- a/lisp/international/iso-ascii.el
+++ b/lisp/international/iso-ascii.el
@@ -1,6 +1,6 @@
 ;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1987, 1995, 1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1987, 1995, 1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Howard Gayle
diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el
index f0bfe9f682..614d42e521 100644
--- a/lisp/international/iso-cvt.el
+++ b/lisp/international/iso-cvt.el
@@ -1,7 +1,7 @@
 ;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- 
lexical-binding: t; -*-
 ;; This file was formerly called gm-lingo.el.
 
-;; Copyright (C) 1993-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
 ;; Keywords: tex, iso, latin, i18n
diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el
index aea1217917..10f8ce6efb 100644
--- a/lisp/international/iso-transl.el
+++ b/lisp/international/iso-transl.el
@@ -1,6 +1,6 @@
 ;;; iso-transl.el --- keyboard input for ISO 10646 chars -*- coding: utf-8; 
lexical-binding: t; -*-
 
-;; Copyright (C) 1987, 1993-1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1987, 1993-1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Howard Gayle
diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el
index 793508cae4..704f1a1ae6 100644
--- a/lisp/international/ja-dic-cnv.el
+++ b/lisp/international/ja-dic-cnv.el
@@ -1,6 +1,6 @@
 ;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs 
Lisp  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
diff --git a/lisp/international/kinsoku.el b/lisp/international/kinsoku.el
index 05179a98ac..6896bd4d7b 100644
--- a/lisp/international/kinsoku.el
+++ b/lisp/international/kinsoku.el
@@ -1,6 +1,6 @@
 ;;; kinsoku.el --- `Kinsoku' processing funcs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el
index 87f73897bf..0e1cec5ee7 100644
--- a/lisp/international/kkc.el
+++ b/lisp/international/kkc.el
@@ -1,6 +1,6 @@
 ;;; kkc.el --- Kana Kanji converter  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el
index 9449b3bb85..c7a2e150cd 100644
--- a/lisp/international/latexenc.el
+++ b/lisp/international/latexenc.el
@@ -1,6 +1,6 @@
 ;;; latexenc.el --- guess correct coding system in LaTeX files -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 ;; Keywords: mule, coding system, latex
diff --git a/lisp/international/latin1-disp.el 
b/lisp/international/latin1-disp.el
index b3d6a635b1..c8ff93aeb2 100644
--- a/lisp/international/latin1-disp.el
+++ b/lisp/international/latin1-disp.el
@@ -1,6 +1,6 @@
 ;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals 
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index b84d9e0823..27defef648 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1,6 +1,6 @@
 ;;; mule-cmds.el --- commands for multilingual environment  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -88,7 +88,7 @@
     (bindings--define-key map [separator-3] menu-bar-separator)
     (bindings--define-key map [set-terminal-coding-system]
       '(menu-item "For Terminal" set-terminal-coding-system
-        :enable (null (memq initial-window-system '(x w32 ns haiku)))
+        :enable (null (memq initial-window-system '(x w32 ns haiku pgtk)))
         :help "How to encode terminal output"))
     (bindings--define-key map [set-keyboard-coding-system]
       '(menu-item "For Keyboard" set-keyboard-coding-system
@@ -1874,7 +1874,7 @@ The default status is as follows:
   (set-default-coding-systems nil)
   (setq default-sendmail-coding-system 'utf-8)
   (setq default-file-name-coding-system (if (memq system-type
-                                                  '(window-nt ms-dos))
+                                                  '(windows-nt ms-dos))
                                             'iso-latin-1-unix
                                           'utf-8-unix))
   ;; Preserve eol-type from existing default-process-coding-systems.
@@ -1893,9 +1893,9 @@ The default status is as follows:
         (condition-case nil
             (coding-system-change-text-conversion
              (cdr default-process-coding-system)
-             (if (memq system-type '(window-nt ms-dos)) 'iso-latin-1 'utf-8))
+             (if (memq system-type '(windows-nt ms-dos)) 'iso-latin-1 'utf-8))
           (coding-system-error
-           (if (memq system-type '(window-nt ms-dos)) 'iso-latin-1 'utf-8)))))
+           (if (memq system-type '(windows-nt ms-dos)) 'iso-latin-1 'utf-8)))))
     (setq default-process-coding-system
          (cons output-coding input-coding)))
 
@@ -2958,8 +2958,14 @@ See also the documentation of `get-char-code-property' 
and
     (or (stringp table)
        (error "Not a char-table nor a file name: %s" table)))
   (if (stringp table) (setq table (purecopy table)))
-  (setf (alist-get name char-code-property-alist) table)
-  (put name 'char-code-property-documentation (purecopy docstring)))
+  (if (and (stringp table)
+           (char-table-p (alist-get name char-code-property-alist)))
+      ;; The table is already setup and we're apparently trying to
+      ;; undo that, probably because `charprop.el' is being re-loaded.
+      ;; Just skip it, in order to work around a recursive load (bug#52945).
+      nil
+    (setf (alist-get name char-code-property-alist) table)
+    (put name 'char-code-property-documentation (purecopy docstring))))
 
 (defvar char-code-property-table
   (make-char-table 'char-code-property-table)
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index ec027e9a93..3f3ac6064a 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1,6 +1,6 @@
 ;;; mule-conf.el --- configure multilingual environment  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 
2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index 3c53981173..bff6f9ff38 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -1,6 +1,6 @@
 ;;; mule-diag.el --- show diagnosis of multilingual environment (Mule)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index c2f91e77e7..e153c4e65a 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -1,6 +1,6 @@
 ;;; mule-util.el --- utility functions for multilingual environment (mule)  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 3e45a64dc9..0758359e15 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1,6 +1,6 @@
 ;;; mule.el --- basic commands for multilingual environment  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el
index e049832d58..ac9a213ec7 100644
--- a/lisp/international/ogonek.el
+++ b/lisp/international/ogonek.el
@@ -1,6 +1,6 @@
 ;;; ogonek.el --- change the encoding of Polish diacritics  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Włodek Bzyl
 ;;        Ryszard Kubiak
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 5cdd6d6242..14d4c383b2 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1,6 +1,6 @@
 ;;; quail.el --- provides simple input method for multilingual text  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/rfc1843.el b/lisp/international/rfc1843.el
index bd83a7a289..5050b7c030 100644
--- a/lisp/international/rfc1843.el
+++ b/lisp/international/rfc1843.el
@@ -1,6 +1,6 @@
 ;;; rfc1843.el --- HZ (rfc1843) decoding  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: news HZ HZ+ mail i18n
diff --git a/lisp/international/robin.el b/lisp/international/robin.el
index c38cd82269..4c498d7f92 100644
--- a/lisp/international/robin.el
+++ b/lisp/international/robin.el
@@ -529,10 +529,10 @@ Use the longest match method to select a rule."
       (insert (cadr tree))
       (delete-char (- end begin)))))
 
-;; for backward compatibility
-
-(fset 'robin-transliterate-region 'robin-convert-region)
-(fset 'robin-transliterate-buffer 'robin-convert-buffer)
+(define-obsolete-function-alias 'robin-transliterate-region
+  #'robin-convert-region "29.1")
+(define-obsolete-function-alias 'robin-transliterate-buffer
+  #'robin-convert-buffer "29.1")
 
 ;;; Reverse conversion
 
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index 4ac0100746..a3b6266791 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -1,6 +1,6 @@
 ;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package 
-*- coding: utf-8-emacs; lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/ucs-normalize.el 
b/lisp/international/ucs-normalize.el
index 3da47e701a..bc32b4f073 100644
--- a/lisp/international/ucs-normalize.el
+++ b/lisp/international/ucs-normalize.el
@@ -1,6 +1,6 @@
 ;;; ucs-normalize.el --- Unicode normalization NFC/NFD/NFKD/NFKC  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Taichi Kawabata <kawabata.taichi@gmail.com>
 ;; Keywords: unicode, normalization
diff --git a/lisp/international/utf-7.el b/lisp/international/utf-7.el
index dece184ffe..c503bc2442 100644
--- a/lisp/international/utf-7.el
+++ b/lisp/international/utf-7.el
@@ -1,6 +1,6 @@
 ;;; utf-7.el --- utf-7 coding system  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n, mail
diff --git a/lisp/international/utf7.el b/lisp/international/utf7.el
index d78e3975e6..ad29e7aa4d 100644
--- a/lisp/international/utf7.el
+++ b/lisp/international/utf7.el
@@ -1,6 +1,6 @@
 ;;; utf7.el --- UTF-7 encoding/decoding for Emacs   -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Jon K Hellan <hellan@acm.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 8815cb4f2d..7593a0ec98 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1,6 +1,6 @@
 ;;; isearch.el --- incremental search minor mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1997, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
 ;; Maintainer: emacs-devel@gnu.org
@@ -2063,7 +2063,7 @@ The command then executes BODY and updates the isearch 
prompt."
                        #',function))
                (setq isearch-regexp nil)))
          ,@body
-         (setq isearch-success t isearch-adjusted t)
+         (setq isearch-success t isearch-adjusted 'toggle)
          (isearch-update))
        (define-key isearch-mode-map ,key #',command-name)
        ,@(when (and function (symbolp function))
@@ -3417,7 +3417,7 @@ the word mode."
   ;; If currently failing, display no ellipsis.
   (or isearch-success (setq ellipsis nil))
   (let ((m (concat (if isearch-success "" "failing ")
-                  (if isearch-adjusted "pending " "")
+                  (if (eq isearch-adjusted t) "pending " "")
                   (if (and isearch-wrapped
                            (not isearch-wrap-function)
                            (if isearch-forward
@@ -3521,10 +3521,10 @@ Can be changed via `isearch-search-fun-function' for 
special needs."
           ;; (Bug#35802).
           (regexp
            (cond (isearch-regexp-function
-                  (let ((lax (and (not bound)
+                  (let ((lax (and (not bound) ; not lazy-highlight
                                   (isearch--lax-regexp-function-p))))
                     (when lax
-                      (setq isearch-adjusted t))
+                      (setq isearch-adjusted 'lax))
                     (if (functionp isearch-regexp-function)
                         (funcall isearch-regexp-function string lax)
                       (word-search-regexp string lax))))
diff --git a/lisp/isearchb.el b/lisp/isearchb.el
index eaf7983cbd..d11a5d2537 100644
--- a/lisp/isearchb.el
+++ b/lisp/isearchb.el
@@ -1,6 +1,6 @@
 ;;; isearchb.el --- a marriage between iswitchb and isearch  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index bb2df2b1ff..20c1202474 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -1,6 +1,6 @@
 ;;; jit-lock.el --- just-in-time fontification  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <gerd@gnu.org>
 ;; Keywords: faces files
diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el
index ed00caedb5..0cfc80fe78 100644
--- a/lisp/jka-cmpr-hook.el
+++ b/lisp/jka-cmpr-hook.el
@@ -1,6 +1,6 @@
 ;;; jka-cmpr-hook.el --- preloaded code to enable jka-compr.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 1997, 1999-2000, 2002-2021 Free Software
+;; Copyright (C) 1993-1995, 1997, 1999-2000, 2002-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Jay K. Adams <jka@ece.cmu.edu>
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 658ea44a34..8db78ebcda 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -1,6 +1,6 @@
 ;;; jka-compr.el --- reading/writing/loading compressed files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Jay K. Adams <jka@ece.cmu.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/json.el b/lisp/json.el
index 0e61e1ad90..13ec72d012 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -1,6 +1,6 @@
 ;;; json.el --- JavaScript Object Notation parser / generator -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Theresa O'Connor <ted@oconnor.cx>
 ;; Version: 1.5
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 02db199c7f..84d0ef9179 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -1,6 +1,6 @@
 ;;; jsonrpc.el --- JSON-RPC library                  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Keywords: processes, languages, extensions
diff --git a/lisp/kermit.el b/lisp/kermit.el
index 25f1f300f3..51396fbb65 100644
--- a/lisp/kermit.el
+++ b/lisp/kermit.el
@@ -1,6 +1,6 @@
 ;;; kermit.el --- additions to shell mode for use with kermit -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jeff Norden <jeff@colgate.csnet>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/keymap.el b/lisp/keymap.el
index fd91689f88..3e9189fba4 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -1,6 +1,6 @@
 ;;; keymap.el --- Keymap functions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -38,7 +38,7 @@
       (byte-compile-warn "Invalid `kbd' syntax: %S" key))))
 
 (defun keymap-set (keymap key definition)
-  "Set key sequence KEY to DEFINITION in KEYMAP.
+  "Set KEY to DEFINITION in KEYMAP.
 KEY is a string that satisfies `key-valid-p'.
 
 DEFINITION is anything that can be a key's definition:
@@ -295,9 +295,9 @@ See `kbd' for a descripion of KEYS."
         res))))
 
 (defun key-valid-p (keys)
-  "Say whether KEYS is a valid `kbd' sequence.
-A `kbd' sequence is a string consisting of one and more key
-strokes.  The key strokes are separated by a space character.
+  "Say whether KEYS is a valid key.
+A key is a string consisting of one or more key strokes.
+The key strokes are separated by single space characters.
 
 Each key stroke is either a single character, or the name of an
 event, surrounded by angle brackets.  In addition, any key stroke
@@ -452,6 +452,139 @@ If MESSAGE (and interactively), message the result."
       (message "%s is bound to %s globally" keys def))
     def))
 
+
+;;; define-keymap and defvar-keymap
+
+(defun define-keymap--compile (form &rest args)
+  ;; This compiler macro is only there for compile-time
+  ;; error-checking; it does not change the call in any way.
+  (while (and args
+              (keywordp (car args))
+              (not (eq (car args) :menu)))
+    (unless (memq (car args) '(:full :keymap :parent :suppress :name :prefix))
+      (byte-compile-warn "Invalid keyword: %s" (car args)))
+    (setq args (cdr args))
+    (when (null args)
+      (byte-compile-warn "Uneven number of keywords in %S" form))
+    (setq args (cdr args)))
+  ;; Bindings.
+  (while args
+    (let ((key (pop args)))
+      (when (and (stringp key) (not (key-valid-p key)))
+        (byte-compile-warn "Invalid `kbd' syntax: %S" key)))
+    (when (null args)
+      (byte-compile-warn "Uneven number of key bindings in %S" form))
+    (setq args (cdr args)))
+  form)
+
+(defun define-keymap (&rest definitions)
+  "Create a new keymap and define KEY/DEFINITION pairs as key bindings.
+The new keymap is returned.
+
+Options can be given as keywords before the KEY/DEFINITION
+pairs.  Available keywords are:
+
+:full      If non-nil, create a chartable alist (see `make-keymap').
+             If nil (i.e., the default), create a sparse keymap (see
+             `make-sparse-keymap').
+
+:suppress  If non-nil, the keymap will be suppressed (see `suppress-keymap').
+             If `nodigits', treat digits like other chars.
+
+:parent    If non-nil, this should be a keymap to use as the parent
+             (see `set-keymap-parent').
+
+:keymap    If non-nil, instead of creating a new keymap, the given keymap
+             will be destructively modified instead.
+
+:name      If non-nil, this should be a string to use as the menu for
+             the keymap in case you use it as a menu with `x-popup-menu'.
+
+:prefix    If non-nil, this should be a symbol to be used as a prefix
+             command (see `define-prefix-command').  If this is the case,
+             this symbol is returned instead of the map itself.
+
+KEY/DEFINITION pairs are as KEY and DEF in `keymap-set'.  KEY can
+also be the special symbol `:menu', in which case DEFINITION
+should be a MENU form as accepted by `easy-menu-define'.
+
+\(fn &key FULL PARENT SUPPRESS NAME PREFIX KEYMAP &rest [KEY DEFINITION]...)"
+  (declare (indent defun)
+           (compiler-macro define-keymap--compile))
+  (let (full suppress parent name prefix keymap)
+    ;; Handle keywords.
+    (while (and definitions
+                (keywordp (car definitions))
+                (not (eq (car definitions) :menu)))
+      (let ((keyword (pop definitions)))
+        (unless definitions
+          (error "Missing keyword value for %s" keyword))
+        (let ((value (pop definitions)))
+          (pcase keyword
+            (:full (setq full value))
+            (:keymap (setq keymap value))
+            (:parent (setq parent value))
+            (:suppress (setq suppress value))
+            (:name (setq name value))
+            (:prefix (setq prefix value))
+            (_ (error "Invalid keyword: %s" keyword))))))
+
+    (when (and prefix
+               (or full parent suppress keymap))
+      (error "A prefix keymap can't be defined with 
:full/:parent/:suppress/:keymap keywords"))
+
+    (when (and keymap full)
+      (error "Invalid combination: :keymap with :full"))
+
+    (let ((keymap (cond
+                   (keymap keymap)
+                   (prefix (define-prefix-command prefix nil name))
+                   (full (make-keymap name))
+                   (t (make-sparse-keymap name)))))
+      (when suppress
+        (suppress-keymap keymap (eq suppress 'nodigits)))
+      (when parent
+        (set-keymap-parent keymap parent))
+
+      ;; Do the bindings.
+      (while definitions
+        (let ((key (pop definitions)))
+          (unless definitions
+            (error "Uneven number of key/definition pairs"))
+          (let ((def (pop definitions)))
+            (if (eq key :menu)
+                (easy-menu-define nil keymap "" def)
+              (keymap-set keymap key def)))))
+      keymap)))
+
+(defmacro defvar-keymap (variable-name &rest defs)
+  "Define VARIABLE-NAME as a variable with a keymap definition.
+See `define-keymap' for an explanation of the keywords and KEY/DEFINITION.
+
+In addition to the keywords accepted by `define-keymap', this
+macro also accepts a `:doc' keyword, which (if present) is used
+as the variable documentation string.
+
+\(fn VARIABLE-NAME &key DOC FULL PARENT SUPPRESS NAME PREFIX KEYMAP &rest [KEY 
DEFINITION]...)"
+  (declare (indent 1))
+  (let ((opts nil)
+        doc)
+    (while (and defs
+                (keywordp (car defs))
+                (not (eq (car defs) :menu)))
+      (let ((keyword (pop defs)))
+        (unless defs
+          (error "Uneven number of keywords"))
+        (if (eq keyword :doc)
+            (setq doc (pop defs))
+          (push keyword opts)
+          (push (pop defs) opts))))
+    (unless (zerop (% (length defs) 2))
+      (error "Uneven number of key/definition pairs: %s" defs))
+    `(defvar ,variable-name
+       (define-keymap ,@(nreverse opts) ,@defs)
+       ,@(and doc (list doc)))))
+
 (provide 'keymap)
 
 ;;; keymap.el ends here
diff --git a/lisp/language/china-util.el b/lisp/language/china-util.el
index 105e7a735f..d5c6160efb 100644
--- a/lisp/language/china-util.el
+++ b/lisp/language/china-util.el
@@ -1,6 +1,6 @@
 ;;; china-util.el --- utilities for Chinese  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/chinese.el b/lisp/language/chinese.el
index 5cb8344c09..3970b0d154 100644
--- a/lisp/language/chinese.el
+++ b/lisp/language/chinese.el
@@ -1,6 +1,6 @@
 ;;; chinese.el --- support for Chinese -*- coding: utf-8; lexical-binding: t; 
-*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/cyril-util.el b/lisp/language/cyril-util.el
index e404288ddc..5482b3ea30 100644
--- a/lisp/language/cyril-util.el
+++ b/lisp/language/cyril-util.el
@@ -1,6 +1,6 @@
 ;;; cyril-util.el --- utilities for Cyrillic scripts  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Keywords: mule, multilingual, Cyrillic
 
diff --git a/lisp/language/cyrillic.el b/lisp/language/cyrillic.el
index b64a237cf7..4576373a6d 100644
--- a/lisp/language/cyrillic.el
+++ b/lisp/language/cyrillic.el
@@ -1,6 +1,6 @@
 ;;; cyrillic.el --- support for Cyrillic -*- coding: utf-8; lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/czech.el b/lisp/language/czech.el
index e449a7e927..de80b73b3f 100644
--- a/lisp/language/czech.el
+++ b/lisp/language/czech.el
@@ -1,6 +1,6 @@
 ;;; czech.el --- support for Czech -*- coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <pdm@zamazal.org>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/language/english.el b/lisp/language/english.el
index 41d56be7d4..278951121a 100644
--- a/lisp/language/english.el
+++ b/lisp/language/english.el
@@ -1,6 +1,6 @@
 ;;; english.el --- support for English  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el
index 2de6602ced..a0159679da 100644
--- a/lisp/language/ethio-util.el
+++ b/lisp/language/ethio-util.el
@@ -1,6 +1,6 @@
 ;;; ethio-util.el --- utilities for Ethiopic   -*- coding: utf-8-emacs; 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2002-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/ethiopic.el b/lisp/language/ethiopic.el
index 209dcd51c9..1faba424ba 100644
--- a/lisp/language/ethiopic.el
+++ b/lisp/language/ethiopic.el
@@ -1,6 +1,6 @@
 ;;; ethiopic.el --- support for Ethiopic       -*- coding: utf-8-emacs; 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/european.el b/lisp/language/european.el
index bcd62a14c4..8e3aac7c2e 100644
--- a/lisp/language/european.el
+++ b/lisp/language/european.el
@@ -1,6 +1,6 @@
 ;;; european.el --- support for European languages -*- coding: utf-8; 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/georgian.el b/lisp/language/georgian.el
index 321ef43f5f..a268b8c23f 100644
--- a/lisp/language/georgian.el
+++ b/lisp/language/georgian.el
@@ -1,6 +1,6 @@
 ;;; georgian.el --- language support for Georgian  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/language/greek.el b/lisp/language/greek.el
index 403a87d253..58f4fe6fc4 100644
--- a/lisp/language/greek.el
+++ b/lisp/language/greek.el
@@ -1,6 +1,6 @@
 ;;; greek.el --- support for Greek  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2002, 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2013-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/hanja-util.el b/lisp/language/hanja-util.el
index fe6323d42b..0c2419c91c 100644
--- a/lisp/language/hanja-util.el
+++ b/lisp/language/hanja-util.el
@@ -1,6 +1,6 @@
 ;;; hanja-util.el --- Korean Hanja util module  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Jihyun Cho <jihyun.jo@gmail.com>
 ;; Keywords: multilingual, input method, Korean, Hanja
diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el
index c55d23f72d..6cec9f1274 100644
--- a/lisp/language/hebrew.el
+++ b/lisp/language/hebrew.el
@@ -1,6 +1,6 @@
 ;;; hebrew.el --- support for Hebrew -*- coding: utf-8; lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el
index 6f579f2383..8b1c3d69ae 100644
--- a/lisp/language/ind-util.el
+++ b/lisp/language/ind-util.el
@@ -1,6 +1,6 @@
 ;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- 
coding: utf-8-emacs; lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Keywords: multilingual, Indian, Devanagari
 
diff --git a/lisp/language/indian.el b/lisp/language/indian.el
index 6f9d270384..614d0767e7 100644
--- a/lisp/language/indian.el
+++ b/lisp/language/indian.el
@@ -1,6 +1,6 @@
 ;;; indian.el --- Indian languages support -*- coding: utf-8; lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el
index cad34e9904..3424811755 100644
--- a/lisp/language/japan-util.el
+++ b/lisp/language/japan-util.el
@@ -1,6 +1,6 @@
 ;;; japan-util.el --- utilities for Japanese  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/japanese.el b/lisp/language/japanese.el
index d9bd42093a..666ebad62f 100644
--- a/lisp/language/japanese.el
+++ b/lisp/language/japanese.el
@@ -1,6 +1,6 @@
 ;;; japanese.el --- support for Japanese  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el
index 121a4c542e..9a6ab1b249 100644
--- a/lisp/language/korea-util.el
+++ b/lisp/language/korea-util.el
@@ -1,6 +1,6 @@
 ;;; korea-util.el --- utilities for Korean  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/korean.el b/lisp/language/korean.el
index bdf8240de9..bc68d56b24 100644
--- a/lisp/language/korean.el
+++ b/lisp/language/korean.el
@@ -1,6 +1,6 @@
 ;;; korean.el --- support for Korean -*- coding: utf-8; lexical-binding: t; -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/lao-util.el b/lisp/language/lao-util.el
index c8c3fe4f7e..51a947cc72 100644
--- a/lisp/language/lao-util.el
+++ b/lisp/language/lao-util.el
@@ -1,6 +1,6 @@
 ;;; lao-util.el --- utilities for Lao -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/lao.el b/lisp/language/lao.el
index 93849461ea..1861eff15e 100644
--- a/lisp/language/lao.el
+++ b/lisp/language/lao.el
@@ -1,6 +1,6 @@
 ;;; lao.el --- support for Lao -*- coding: utf-8; lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/romanian.el b/lisp/language/romanian.el
index 2112df7b15..972326c7a8 100644
--- a/lisp/language/romanian.el
+++ b/lisp/language/romanian.el
@@ -1,6 +1,6 @@
 ;;; romanian.el --- support for Romanian -*- coding: utf-8; lexical-binding: t 
-*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dan Nicolaescu <done@ece.arizona.edu>
 ;; Keywords: multilingual, Romanian, i18n
diff --git a/lisp/language/slovak.el b/lisp/language/slovak.el
index 2a738467d2..cc0c6e2e02 100644
--- a/lisp/language/slovak.el
+++ b/lisp/language/slovak.el
@@ -1,6 +1,6 @@
 ;;; slovak.el --- support for Slovak -*- coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Authors:    Tibor Šimko <tibor.simko@fmph.uniba.sk>,
 ;;             Milan Zamazal <pdm@zamazal.org>
diff --git a/lisp/language/tai-viet.el b/lisp/language/tai-viet.el
index 366c39202d..9029aa391f 100644
--- a/lisp/language/tai-viet.el
+++ b/lisp/language/tai-viet.el
@@ -1,6 +1,6 @@
 ;;; tai-viet.el --- support for Tai Viet -*- coding: utf-8; lexical-binding: t 
-*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
diff --git a/lisp/language/thai-util.el b/lisp/language/thai-util.el
index e11a05445c..d11daf0f83 100644
--- a/lisp/language/thai-util.el
+++ b/lisp/language/thai-util.el
@@ -1,6 +1,6 @@
 ;;; thai-util.el --- utilities for Thai -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/thai.el b/lisp/language/thai.el
index be15db49db..6a6289a44c 100644
--- a/lisp/language/thai.el
+++ b/lisp/language/thai.el
@@ -1,6 +1,6 @@
 ;;; thai.el --- support for Thai -*- coding: utf-8; lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/tibet-util.el b/lisp/language/tibet-util.el
index 1f7a1edcad..e7cb289b65 100644
--- a/lisp/language/tibet-util.el
+++ b/lisp/language/tibet-util.el
@@ -1,6 +1,6 @@
 ;;; tibet-util.el --- utilities for Tibetan   -*- coding: utf-8-emacs; 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/tibetan.el b/lisp/language/tibetan.el
index dc37fc90ac..0262798bb2 100644
--- a/lisp/language/tibetan.el
+++ b/lisp/language/tibetan.el
@@ -1,6 +1,6 @@
 ;;; tibetan.el --- support for Tibetan language -*- coding: utf-8-emacs; 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/utf-8-lang.el b/lisp/language/utf-8-lang.el
index f23b3889cc..f709f6fbd8 100644
--- a/lisp/language/utf-8-lang.el
+++ b/lisp/language/utf-8-lang.el
@@ -1,6 +1,6 @@
 ;;; utf-8-lang.el --- generic UTF-8 language environment  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/language/viet-util.el b/lisp/language/viet-util.el
index bfaf0f3b94..9751fc0e39 100644
--- a/lisp/language/viet-util.el
+++ b/lisp/language/viet-util.el
@@ -1,6 +1,6 @@
 ;;; viet-util.el --- utilities for Vietnamese  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/vietnamese.el b/lisp/language/vietnamese.el
index 7980041e2b..cd574bb5d5 100644
--- a/lisp/language/vietnamese.el
+++ b/lisp/language/vietnamese.el
@@ -1,6 +1,6 @@
 ;;; vietnamese.el --- support for Vietnamese -*- coding: utf-8; 
lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index 0fbae8508a..6d5b0d84e6 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -2723,27 +2723,6 @@ The optional argument IGNORED is not used.
 
 \(fn URL &optional IGNORED)" t nil)
 
-(autoload 'browse-url-netscape "browse-url" "\
-Ask the Netscape WWW browser to load URL.
-Default to the URL around or before point.  The strings in variable
-`browse-url-netscape-arguments' are also passed to Netscape.
-
-When called interactively, if variable `browse-url-new-window-flag' is
-non-nil, load the document in a new Netscape window, otherwise use a
-random existing one.  A non-nil interactive prefix argument reverses
-the effect of `browse-url-new-window-flag'.
-
-If `browse-url-netscape-new-window-is-tab' is non-nil, then
-whenever a document would otherwise be loaded in a new window, it
-is loaded in a new tab in an existing window instead.
-
-When called non-interactively, optional second argument NEW-WINDOW is
-used instead of `browse-url-new-window-flag'.
-
-\(fn URL &optional NEW-WINDOW)" t nil)
-
-(make-obsolete 'browse-url-netscape 'nil '"25.1")
-
 (autoload 'browse-url-mozilla "browse-url" "\
 Ask the Mozilla WWW browser to load URL.
 Default to the URL around or before point.  The strings in variable
@@ -2790,27 +2769,6 @@ The optional argument NEW-WINDOW is not used.
 
 \(fn URL &optional NEW-WINDOW)" t nil)
 
-(autoload 'browse-url-galeon "browse-url" "\
-Ask the Galeon WWW browser to load URL.
-Default to the URL around or before point.  The strings in variable
-`browse-url-galeon-arguments' are also passed to Galeon.
-
-When called interactively, if variable `browse-url-new-window-flag' is
-non-nil, load the document in a new Galeon window, otherwise use a
-random existing one.  A non-nil interactive prefix argument reverses
-the effect of `browse-url-new-window-flag'.
-
-If `browse-url-galeon-new-window-is-tab' is non-nil, then whenever a
-document would otherwise be loaded in a new window, it is loaded in a
-new tab in an existing window instead.
-
-When called non-interactively, optional second argument NEW-WINDOW is
-used instead of `browse-url-new-window-flag'.
-
-\(fn URL &optional NEW-WINDOW)" t nil)
-
-(make-obsolete 'browse-url-galeon 'nil '"25.1")
-
 (autoload 'browse-url-webpositive "browse-url" "\
 Ask the WebPositive WWW browser to load URL.
 Default to the URL around or before point.
@@ -2826,7 +2784,7 @@ currently selected window instead.
 \(fn URL &optional SAME-WINDOW)" t nil)
 
 (autoload 'browse-url-gnome-moz "browse-url" "\
-Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'.
+Ask Mozilla to load URL via the GNOME program `gnome-moz-remote'.
 Default to the URL around or before point.  The strings in variable
 `browse-url-gnome-moz-arguments' are also passed.
 
@@ -5818,7 +5776,7 @@ disabled.
 
 \(fn &optional ARG)" t nil)
 
-(register-definition-prefixes "completion" '("*c-def-regexp*" 
"*lisp-def-regexp*" "accept-completion" "add-" "cdabbrev-" 
"check-completion-length" "clear-all-completions" "cmpl-" "complet" 
"current-completion-source" "delete-completion" "enable-completion" "find-" 
"initialize-completions" "inside-locate-completion-entry" 
"interactive-completion-string-reader" "kill-" "list-all-completions" 
"load-completions-from-file" "make-c" "next-cdabbrev" "num-cmpl-sources" 
"reset-cdabbrev" "save" "s [...]
+(register-definition-prefixes "completion" '("*c-def-regexp*" 
"*lisp-def-regexp*" "accept-completion" "add-" "cdabbrev-" 
"check-completion-length" "clear-all-completions" "cmpl-" "complet" 
"current-completion-source" "delete-completion" "enable-completion" "find-" 
"inside-locate-completion-entry" "interactive-completion-string-reader" "kill-" 
"list-all-completions" "load-completions-from-file" "make-c" "next-cdabbrev" 
"num-cmpl-sources" "reset-cdabbrev" "save" "set-c" "symbol-" "use-comp [...]
 
 ;;;***
 
@@ -10533,28 +10491,34 @@ Emerge two RCS revisions of a file, with another 
revision as ancestor.
 
 (autoload 'emoji-insert "emoji" "\
 Choose and insert an emoji glyph.
-If TEXT (interactively, the prefix), use a textual search instead
-of a visual interface.
+If TEXT (interactively, the prefix argument), choose the emoji
+by typing its Unicode Standard name (with completion), instead
+of selecting from emoji display.
 
 \(fn &optional TEXT)" t nil)
 
 (autoload 'emoji-recent "emoji" "\
-Choose and insert a recently used emoji glyph." t nil)
+Choose and insert one of the recently-used emoji glyphs." t nil)
 
 (autoload 'emoji-search "emoji" "\
-Choose and insert an emoji glyph by searching for an emoji name." t nil)
+Choose and insert an emoji glyph by typing its Unicode name.
+This command prompts for an emoji name, with completion, and inserts it.
+It recognizes the Unicode Standard names of emoji." t nil)
 
 (autoload 'emoji-list "emoji" "\
 List emojis and insert the one that's selected.
-The character will be inserted into the buffer that was selected
-when the command was issued." t nil)
+Select the emoji by typing \\<emoji-list-mode-map>\\[emoji-list-select] on its 
picture.
+The glyph will be inserted into the buffer that was current
+when the command was invoked." t nil)
 
 (autoload 'emoji-describe "emoji" "\
-Say what the name of the composed grapheme cluster GLYPH is.
-If it's not known, this function returns nil.
+Display the name of the grapheme cluster composed from GLYPH.
+GLYPH should be a string of one or more characters which together
+produce an emoji.  Interactively, GLYPH is the emoji at point (it
+could also be any character, not just emoji).
 
-Interactively, it will message what the name of the emoji (or
-character) under point is.
+If called from Lisp, return the name as a string; return nil if
+the name is not known.
 
 \(fn GLYPH &optional INTERACTIVE)" t nil)
 
@@ -12379,6 +12343,12 @@ a top-level keymap, `text-scale-increase' or
 `text-scale-decrease' may be more appropriate.
 
 \(fn INC)" t nil)
+ (define-key global-map [pinch] 'text-scale-pinch)
+
+(autoload 'text-scale-pinch "face-remap" "\
+Adjust the height of the default face by the scale in the pinch event EVENT.
+
+\(fn EVENT)" t nil)
 
 (autoload 'buffer-face-mode "face-remap" "\
 Minor mode for a buffer-specific default face.
@@ -14341,6 +14311,35 @@ separators (like underscores) at places they belong to.
 
 ;;;***
 
+;;;### (autoloads nil "glyphless-mode" "textmodes/glyphless-mode.el"
+;;;;;;  (0 0 0 0))
+;;; Generated autoloads from textmodes/glyphless-mode.el
+
+(autoload 'glyphless-display-mode "glyphless-mode" "\
+Minor mode for displaying glyphless characters in the current buffer.
+If enabled, all glyphless characters will be displayed as boxes
+that display their acronyms.
+
+This is a minor mode.  If called interactively, toggle the
+`Glyphless-Display mode' mode.  If the prefix argument is positive,
+enable the mode, and if it is zero or negative, disable the mode.
+
+If called from Lisp, toggle the mode if ARG is `toggle'.  Enable the
+mode if ARG is nil, omitted, or is a positive number.  Disable the
+mode if ARG is a negative number.
+
+To check whether the minor mode is enabled in the current buffer,
+evaluate `glyphless-display-mode'.
+
+The mode's hook is called both when the mode is enabled and when it is
+disabled.
+
+\(fn &optional ARG)" t nil)
+
+(register-definition-prefixes "glyphless-mode" '("glyphless-mode-"))
+
+;;;***
+
 ;;;### (autoloads nil "gmm-utils" "gnus/gmm-utils.el" (0 0 0 0))
 ;;; Generated autoloads from gnus/gmm-utils.el
 
@@ -15212,6 +15211,13 @@ Initialize the Gnus registry." t nil)
 
 ;;;***
 
+;;;### (autoloads nil "gnus-rmail" "gnus/gnus-rmail.el" (0 0 0 0))
+;;; Generated autoloads from gnus/gnus-rmail.el
+
+(register-definition-prefixes "gnus-rmail" '("gnus-"))
+
+;;;***
+
 ;;;### (autoloads nil "gnus-salt" "gnus/gnus-salt.el" (0 0 0 0))
 ;;; Generated autoloads from gnus/gnus-salt.el
 
@@ -18684,8 +18690,8 @@ An image file is one whose name has an extension in
 
 (autoload 'image-mode "image-mode" "\
 Major mode for image files.
-You can use \\<image-mode-map>\\[image-toggle-display] or 
\\<image-mode-map>\\[image-toggle-hex-display]
-to toggle between display as an image and display as text or hex.
+You can use \\<image-mode-map>\\[image-toggle-display] or 
\\[image-toggle-hex-display] to toggle between display
+as an image and display as text or hex.
 
 Key bindings:
 \\{image-mode-map}" t nil)
@@ -22891,6 +22897,30 @@ QUALITY can be:
 
 ;;;***
 
+;;;### (autoloads nil "multisession" "emacs-lisp/multisession.el"
+;;;;;;  (0 0 0 0))
+;;; Generated autoloads from emacs-lisp/multisession.el
+
+(autoload 'define-multisession-variable "multisession" "\
+Make NAME into a multisession variable initialized from INITIAL-VALUE.
+DOC should be a doc string, and ARGS are keywords as applicable to
+`make-multisession'.
+
+\(fn NAME INITIAL-VALUE &optional DOC &rest ARGS)" nil t)
+
+(function-put 'define-multisession-variable 'lisp-indent-function 'defun)
+
+(autoload 'list-multisession-values "multisession" "\
+List all values in the \"multisession\" database.
+If CHOOSE-STORAGE (interactively, the prefix), query for the
+storage method to list.
+
+\(fn &optional CHOOSE-STORAGE)" t nil)
+
+(register-definition-prefixes "multisession" '("multisession-"))
+
+;;;***
+
 ;;;### (autoloads nil "mwheel" "mwheel.el" (0 0 0 0))
 ;;; Generated autoloads from mwheel.el
 
@@ -24176,7 +24206,7 @@ Coloring:
 
 ;;;### (autoloads nil "org" "org/org.el" (0 0 0 0))
 ;;; Generated autoloads from org/org.el
-(push (purecopy '(org 9 5 1)) package--builtin-versions)
+(push (purecopy '(org 9 5 2)) package--builtin-versions)
 
 (autoload 'org-babel-do-load-languages "org" "\
 Load the languages defined in `org-babel-load-languages'.
@@ -24850,8 +24880,6 @@ Turning on outline mode calls the value of 
`text-mode-hook' and then of
 `outline-mode-hook', if they are non-nil.
 
 \(fn)" t nil)
-(put 'outline-minor-mode-cycle 'safe-local-variable 'booleanp)
-(put 'outline-minor-mode-highlight 'safe-local-variable 'symbolp)
 
 (autoload 'outline-minor-mode "outline" "\
 Toggle Outline minor mode.
@@ -25144,7 +25172,9 @@ short description.
 Return the version number of the package in which this is used.
 Assumes it is used from an Elisp file placed inside the top-level directory
 of an installed ELPA package.
-The return value is a string (or nil in case we can't find it)." nil nil)
+The return value is a string (or nil in case we can't find it).
+It works in more cases if the call is in the file which contains
+the `Version:' header." nil nil)
 
 (function-put 'package-get-version 'pure 't)
 
@@ -27993,7 +28023,8 @@ evaluate `rectangle-mark-mode'.
 The mode's hook is called both when the mode is enabled and when it is
 disabled.
 
-Activates the region if needed.  Only lasts until the region is deactivated.
+Activates the region if it's inactive and Transient Mark mode is
+on.  Only lasts until the region is next deactivated.
 
 \(fn &optional ARG)" t nil)
 
@@ -28755,6 +28786,103 @@ Set PASSWORD to be used for retrieving mail from a 
POP or IMAP server.
 
 ;;;***
 
+;;;### (autoloads nil "rmailedit" "mail/rmailedit.el" (0 0 0 0))
+;;; Generated autoloads from mail/rmailedit.el
+
+(autoload 'rmail-edit-current-message "rmailedit" "\
+Edit the contents of this message." t nil)
+
+(register-definition-prefixes "rmailedit" '("rmail-"))
+
+;;;***
+
+;;;### (autoloads nil "rmailkwd" "mail/rmailkwd.el" (0 0 0 0))
+;;; Generated autoloads from mail/rmailkwd.el
+
+(autoload 'rmail-add-label "rmailkwd" "\
+Add LABEL to labels associated with current RMAIL message.
+Completes (see `rmail-read-label') over known labels when reading.
+LABEL may be a symbol or string.  Only one label is allowed.
+
+\(fn LABEL)" t nil)
+
+(autoload 'rmail-kill-label "rmailkwd" "\
+Remove LABEL from labels associated with current RMAIL message.
+Completes (see `rmail-read-label') over known labels when reading.
+LABEL may be a symbol or string.  Only one label is allowed.
+
+\(fn LABEL)" t nil)
+
+(autoload 'rmail-read-label "rmailkwd" "\
+Read a label with completion, prompting with PROMPT.
+Completions are chosen from `rmail-label-obarray'.  The default
+is `rmail-last-label', if that is non-nil.  Updates `rmail-last-label'
+according to the choice made, and returns a symbol.
+
+\(fn PROMPT)" nil nil)
+
+(autoload 'rmail-previous-labeled-message "rmailkwd" "\
+Show previous message with one of the labels LABELS.
+LABELS should be a comma-separated list of label names.
+If LABELS is empty, the last set of labels specified is used.
+With prefix argument N moves backward N messages with these labels.
+
+\(fn N LABELS)" t nil)
+
+(autoload 'rmail-next-labeled-message "rmailkwd" "\
+Show next message with one of the labels LABELS.
+LABELS should be a comma-separated list of label names.
+If LABELS is empty, the last set of labels specified is used.
+With prefix argument N moves forward N messages with these labels.
+
+\(fn N LABELS)" t nil)
+
+(register-definition-prefixes "rmailkwd" '("rmail-"))
+
+;;;***
+
+;;;### (autoloads nil "rmailmm" "mail/rmailmm.el" (0 0 0 0))
+;;; Generated autoloads from mail/rmailmm.el
+
+(autoload 'rmail-mime "rmailmm" "\
+Toggle the display of a MIME message.
+
+The actual behavior depends on the value of `rmail-enable-mime'.
+
+If `rmail-enable-mime' is non-nil (the default), this command toggles
+the display of a MIME message between decoded presentation form and
+raw data.  With optional prefix argument ARG, it toggles the display only
+of the MIME entity at point, if there is one.  The optional argument
+STATE forces a particular display state, rather than toggling.
+`raw' forces raw mode, any other non-nil value forces decoded mode.
+
+If `rmail-enable-mime' is nil, this creates a temporary \"*RMAIL*\"
+buffer holding a decoded copy of the message.  Inline content-types
+are handled according to `rmail-mime-media-type-handlers-alist'.
+By default, this displays text and multipart messages, and offers to
+download attachments as specified by `rmail-mime-attachment-dirs-alist'.
+The arguments ARG and STATE have no effect in this case.
+
+\(fn &optional ARG STATE)" t nil)
+
+(register-definition-prefixes "rmailmm" '("rmail-"))
+
+;;;***
+
+;;;### (autoloads nil "rmailmsc" "mail/rmailmsc.el" (0 0 0 0))
+;;; Generated autoloads from mail/rmailmsc.el
+
+(autoload 'set-rmail-inbox-list "rmailmsc" "\
+Set the inbox list of the current RMAIL file to FILE-NAME.
+You can specify one file name, or several names separated by commas.
+If FILE-NAME is empty, remove any existing inbox list.
+
+This applies only to the current session.
+
+\(fn FILE-NAME)" t nil)
+
+;;;***
+
 ;;;### (autoloads nil "rmailout" "mail/rmailout.el" (0 0 0 0))
 ;;; Generated autoloads from mail/rmailout.el
 (put 'rmail-output-file-alist 'risky-local-variable t)
@@ -28827,6 +28955,113 @@ than appending to it.  Deletes the message after 
writing if
 
 ;;;***
 
+;;;### (autoloads nil "rmailsort" "mail/rmailsort.el" (0 0 0 0))
+;;; Generated autoloads from mail/rmailsort.el
+
+(autoload 'rmail-sort-by-date "rmailsort" "\
+Sort messages of current Rmail buffer by \"Date\" header.
+If prefix argument REVERSE is non-nil, sorts in reverse order.
+
+\(fn REVERSE)" t nil)
+
+(autoload 'rmail-sort-by-subject "rmailsort" "\
+Sort messages of current Rmail buffer by \"Subject\" header.
+Ignores any \"Re: \" prefix.  If prefix argument REVERSE is
+non-nil, sorts in reverse order.
+
+\(fn REVERSE)" t nil)
+
+(autoload 'rmail-sort-by-author "rmailsort" "\
+Sort messages of current Rmail buffer by author.
+This uses either the \"From\" or \"Sender\" header, downcased.
+If prefix argument REVERSE is non-nil, sorts in reverse order.
+
+\(fn REVERSE)" t nil)
+
+(autoload 'rmail-sort-by-recipient "rmailsort" "\
+Sort messages of current Rmail buffer by recipient.
+This uses either the \"To\" or \"Apparently-To\" header, downcased.
+If prefix argument REVERSE is non-nil, sorts in reverse order.
+
+\(fn REVERSE)" t nil)
+
+(autoload 'rmail-sort-by-correspondent "rmailsort" "\
+Sort messages of current Rmail buffer by other correspondent.
+This uses either the \"From\", \"Sender\", \"To\", or
+\"Apparently-To\" header, downcased.  Uses the first header not
+excluded by `mail-dont-reply-to-names'.  If prefix argument
+REVERSE is non-nil, sorts in reverse order.
+
+\(fn REVERSE)" t nil)
+
+(autoload 'rmail-sort-by-lines "rmailsort" "\
+Sort messages of current Rmail buffer by the number of lines.
+If prefix argument REVERSE is non-nil, sorts in reverse order.
+
+\(fn REVERSE)" t nil)
+
+(autoload 'rmail-sort-by-labels "rmailsort" "\
+Sort messages of current Rmail buffer by labels.
+LABELS is a comma-separated list of labels.  The order of these
+labels specifies the order of messages: messages with the first
+label come first, messages with the second label come second, and
+so on.  Messages that have none of these labels come last.
+If prefix argument REVERSE is non-nil, sorts in reverse order.
+
+\(fn REVERSE LABELS)" t nil)
+
+(register-definition-prefixes "rmailsort" '("rmail-"))
+
+;;;***
+
+;;;### (autoloads nil "rmailsum" "mail/rmailsum.el" (0 0 0 0))
+;;; Generated autoloads from mail/rmailsum.el
+
+(autoload 'rmail-summary "rmailsum" "\
+Display a summary of all messages, one line per message." t nil)
+
+(autoload 'rmail-summary-by-labels "rmailsum" "\
+Display a summary of all messages with one or more LABELS.
+LABELS should be a string containing the desired labels, separated by commas.
+
+\(fn LABELS)" t nil)
+
+(autoload 'rmail-summary-by-recipients "rmailsum" "\
+Display a summary of all messages with the given RECIPIENTS.
+Normally checks the To, From and Cc fields of headers;
+but if PRIMARY-ONLY is non-nil (prefix arg given),
+ only look in the To and From fields.
+RECIPIENTS is a regular expression.
+
+\(fn RECIPIENTS &optional PRIMARY-ONLY)" t nil)
+
+(autoload 'rmail-summary-by-regexp "rmailsum" "\
+Display a summary of all messages according to regexp REGEXP.
+If the regular expression is found in the header of the message
+\(including in the date and other lines, as well as the subject line),
+Emacs will list the message in the summary.
+
+\(fn REGEXP)" t nil)
+
+(autoload 'rmail-summary-by-topic "rmailsum" "\
+Display a summary of all messages with the given SUBJECT.
+Normally checks just the Subject field of headers; but with prefix
+argument WHOLE-MESSAGE is non-nil, looks in the whole message.
+SUBJECT is a regular expression.
+
+\(fn SUBJECT &optional WHOLE-MESSAGE)" t nil)
+
+(autoload 'rmail-summary-by-senders "rmailsum" "\
+Display a summary of all messages whose \"From\" field matches SENDERS.
+SENDERS is a regular expression.  The default for SENDERS matches the
+sender of the current message.
+
+\(fn SENDERS)" t nil)
+
+(register-definition-prefixes "rmailsum" '("rmail-"))
+
+;;;***
+
 ;;;### (autoloads nil "rmc" "emacs-lisp/rmc.el" (0 0 0 0))
 ;;; Generated autoloads from emacs-lisp/rmc.el
 
@@ -28846,6 +29081,9 @@ the optional argument HELP-STRING.  This argument is a 
string that
 should contain a more detailed description of all of the possible
 choices.  `read-multiple-choice' will display that description in a
 help buffer if the user requests that.
+If optional argument SHOW-HELP is non-nil, show the help screen
+immediately, before any user input.  If SHOW-HELP is a string,
+use it as the name of the help buffer.
 
 This function translates user input into responses by consulting
 the bindings in `query-replace-map'; see the documentation of
@@ -28872,7 +29110,9 @@ Usage example:
                         (?s \"session only\")
                         (?n \"no\")))
 
-\(fn PROMPT CHOICES &optional HELP-STRING)" nil nil)
+\(fn PROMPT CHOICES &optional HELP-STRING SHOW-HELP)" nil nil)
+
+(register-definition-prefixes "rmc" '("rmc--"))
 
 ;;;***
 
@@ -32277,6 +32517,25 @@ Run vsql as an inferior process.
 
 ;;;***
 
+;;;### (autoloads nil "sqlite" "sqlite.el" (0 0 0 0))
+;;; Generated autoloads from sqlite.el
+
+(register-definition-prefixes "sqlite" '("with-sqlite-transaction"))
+
+;;;***
+
+;;;### (autoloads nil "sqlite-mode" "sqlite-mode.el" (0 0 0 0))
+;;; Generated autoloads from sqlite-mode.el
+
+(autoload 'sqlite-mode-open-file "sqlite-mode" "\
+Browse the contents of an sqlite file.
+
+\(fn FILE)" t nil)
+
+(register-definition-prefixes "sqlite-mode" '("sqlite-"))
+
+;;;***
+
 ;;;### (autoloads nil "srecode" "cedet/srecode.el" (0 0 0 0))
 ;;; Generated autoloads from cedet/srecode.el
 (push (purecopy '(srecode 1 2)) package--builtin-versions)
@@ -32907,6 +33166,32 @@ The variable `tab-width' controls the spacing of tab 
stops.
 ;;;### (autoloads nil "table" "textmodes/table.el" (0 0 0 0))
 ;;; Generated autoloads from textmodes/table.el
 
+(autoload 'table-fixed-width-mode "table" "\
+Cell width is fixed when this is non-nil.
+Normally it should be nil for allowing automatic cell width expansion
+that widens a cell when it is necessary.  When non-nil, typing in a
+cell does not automatically expand the cell width.  A word that is too
+long to fit in a cell is chopped into multiple lines.  The chopped
+location is indicated by `table-word-continuation-char'.  This
+variable's value can be toggled by \\[table-fixed-width-mode] at
+run-time.
+
+This is a minor mode.  If called interactively, toggle the
+`Table-Fixed-Width mode' mode.  If the prefix argument is positive,
+enable the mode, and if it is zero or negative, disable the mode.
+
+If called from Lisp, toggle the mode if ARG is `toggle'.  Enable the
+mode if ARG is nil, omitted, or is a positive number.  Disable the
+mode if ARG is a negative number.
+
+To check whether the minor mode is enabled in the current buffer,
+evaluate `table-fixed-width-mode'.
+
+The mode's hook is called both when the mode is enabled and when it is
+disabled.
+
+\(fn &optional ARG)" t nil)
+
 (autoload 'table-insert "table" "\
 Insert an editable text table.
 Insert a table of specified number of COLUMNS and ROWS.  Optional
@@ -33235,32 +33520,6 @@ or `top', `middle', `bottom' or `none' for vertical.
 
 \(fn JUSTIFY)" t nil)
 
-(autoload 'table-fixed-width-mode "table" "\
-Cell width is fixed when this is non-nil.
-Normally it should be nil for allowing automatic cell width expansion
-that widens a cell when it is necessary.  When non-nil, typing in a
-cell does not automatically expand the cell width.  A word that is too
-long to fit in a cell is chopped into multiple lines.  The chopped
-location is indicated by `table-word-continuation-char'.  This
-variable's value can be toggled by \\[table-fixed-width-mode] at
-run-time.
-
-This is a minor mode.  If called interactively, toggle the
-`Table-Fixed-Width mode' mode.  If the prefix argument is positive,
-enable the mode, and if it is zero or negative, disable the mode.
-
-If called from Lisp, toggle the mode if ARG is `toggle'.  Enable the
-mode if ARG is nil, omitted, or is a positive number.  Disable the
-mode if ARG is a negative number.
-
-To check whether the minor mode is enabled in the current buffer,
-evaluate `table-fixed-width-mode'.
-
-The mode's hook is called both when the mode is enabled and when it is
-disabled.
-
-\(fn &optional ARG)" t nil)
-
 (autoload 'table-query-dimension "table" "\
 Return the dimension of the current cell and the current table.
 The result is a list (cw ch tw th c r cells) where cw is the cell
@@ -34222,10 +34481,6 @@ Possibilities include `symbol', `list', `sexp', 
`defun',
 When the optional argument NO-PROPERTIES is non-nil,
 strip text properties from the return value.
 
-If the current buffer uses fields (see Info node `(elisp)Fields'),
-this function will narrow to the field before identifying the
-thing at point.
-
 See the file `thingatpt.el' for documentation on how to define
 a symbol as a valid THING.
 
@@ -35192,7 +35447,7 @@ Discard Tramp from loading remote files." (interactive) 
(ignore-errors (unload-f
 (defvar tramp-archive-enabled (featurep 'dbusbind) "\
 Non-nil when file archive support is available.")
 
-(defconst tramp-archive-suffixes '("7z" "apk" "ar" "cab" "CAB" "cpio" "deb" 
"depot" "exe" "iso" "jar" "lzh" "LZH" "msu" "MSU" "mtree" "odb" "odf" "odg" 
"odp" "ods" "odt" "pax" "rar" "rpm" "shar" "tar" "tbz" "tgz" "tlz" "txz" "tzst" 
"warc" "xar" "xpi" "xps" "zip" "ZIP") "\
+(defconst tramp-archive-suffixes '("7z" "apk" "ar" "cab" "CAB" "cpio" "crate" 
"deb" "depot" "exe" "iso" "jar" "lzh" "LZH" "msu" "MSU" "mtree" "odb" "odf" 
"odg" "odp" "ods" "odt" "pax" "rar" "rpm" "shar" "tar" "tbz" "tgz" "tlz" "txz" 
"tzst" "warc" "xar" "xpi" "xps" "zip" "ZIP") "\
 List of suffixes which indicate a file archive.
 It must be supported by libarchive(3).")
 
@@ -35235,7 +35490,7 @@ Add archive file name handler to 
`file-name-handler-alist'." (when tramp-archive
 ;;;;;;  0))
 ;;; Generated autoloads from net/tramp-compat.el
 
-(register-definition-prefixes "tramp-compat" '("tramp-compat-"))
+(register-definition-prefixes "tramp-compat" '("tramp-"))
 
 ;;;***
 
@@ -37143,7 +37398,7 @@ case, and the process object in the asynchronous case.
         (load "vc-git" nil t)
         (vc-git-registered file))))
 
-(register-definition-prefixes "vc-git" '("vc-git-"))
+(register-definition-prefixes "vc-git" '("vc-"))
 
 ;;;***
 
@@ -39642,6 +39897,13 @@ Interactively, URL defaults to the string looking like 
a url around point.
 
 \(fn URL &optional NEW-SESSION)" t nil)
 
+(autoload 'xwidget-webkit-bookmark-jump-handler "xwidget" "\
+Jump to the web page bookmarked by the bookmark record BOOKMARK.
+If `xwidget-webkit-bookmark-jump-new-session' is non-nil, create
+a new xwidget-webkit session, otherwise use an existing session.
+
+\(fn BOOKMARK)" nil nil)
+
 (register-definition-prefixes "xwidget" '("xwidget-"))
 
 ;;;***
@@ -39707,23 +39969,24 @@ Zone out, completely." t nil)
 
 ;;;### (autoloads nil nil ("abbrev.el" "bindings.el" "buff-menu.el"
 ;;;;;;  "button.el" "calc/calc-aent.el" "calc/calc-embed.el" 
"calc/calc-misc.el"
-;;;;;;  "calc/calc-yank.el" "case-table.el" "cedet/ede/cpp-root.el"
-;;;;;;  "cedet/ede/custom.el" "cedet/ede/dired.el" "cedet/ede/emacs.el"
-;;;;;;  "cedet/ede/files.el" "cedet/ede/generic.el" "cedet/ede/linux.el"
-;;;;;;  "cedet/ede/locate.el" "cedet/ede/make.el" "cedet/ede/speedbar.el"
-;;;;;;  "cedet/ede/system.el" "cedet/ede/util.el" "cedet/semantic/analyze.el"
-;;;;;;  "cedet/semantic/analyze/complete.el" "cedet/semantic/analyze/refs.el"
-;;;;;;  "cedet/semantic/bovine.el" "cedet/semantic/bovine/c-by.el"
-;;;;;;  "cedet/semantic/bovine/c.el" "cedet/semantic/bovine/el.el"
-;;;;;;  "cedet/semantic/bovine/gcc.el" "cedet/semantic/bovine/make-by.el"
-;;;;;;  "cedet/semantic/bovine/make.el" "cedet/semantic/bovine/scm-by.el"
-;;;;;;  "cedet/semantic/bovine/scm.el" "cedet/semantic/complete.el"
-;;;;;;  "cedet/semantic/ctxt.el" "cedet/semantic/db-file.el" 
"cedet/semantic/db-find.el"
-;;;;;;  "cedet/semantic/db-global.el" "cedet/semantic/db-mode.el"
-;;;;;;  "cedet/semantic/db-typecache.el" "cedet/semantic/db.el" 
"cedet/semantic/debug.el"
-;;;;;;  "cedet/semantic/decorate/include.el" "cedet/semantic/decorate/mode.el"
-;;;;;;  "cedet/semantic/dep.el" "cedet/semantic/doc.el" 
"cedet/semantic/edit.el"
-;;;;;;  "cedet/semantic/find.el" "cedet/semantic/format.el" 
"cedet/semantic/grammar-wy.el"
+;;;;;;  "calc/calc-yank.el" "case-table.el" "cedet/ede/base.el" 
"cedet/ede/config.el"
+;;;;;;  "cedet/ede/cpp-root.el" "cedet/ede/custom.el" "cedet/ede/dired.el"
+;;;;;;  "cedet/ede/emacs.el" "cedet/ede/files.el" "cedet/ede/generic.el"
+;;;;;;  "cedet/ede/linux.el" "cedet/ede/locate.el" "cedet/ede/make.el"
+;;;;;;  "cedet/ede/shell.el" "cedet/ede/speedbar.el" "cedet/ede/system.el"
+;;;;;;  "cedet/ede/util.el" "cedet/semantic/analyze.el" 
"cedet/semantic/analyze/complete.el"
+;;;;;;  "cedet/semantic/analyze/refs.el" "cedet/semantic/bovine.el"
+;;;;;;  "cedet/semantic/bovine/c-by.el" "cedet/semantic/bovine/c.el"
+;;;;;;  "cedet/semantic/bovine/el.el" "cedet/semantic/bovine/gcc.el"
+;;;;;;  "cedet/semantic/bovine/make-by.el" "cedet/semantic/bovine/make.el"
+;;;;;;  "cedet/semantic/bovine/scm-by.el" "cedet/semantic/bovine/scm.el"
+;;;;;;  "cedet/semantic/complete.el" "cedet/semantic/ctxt.el" 
"cedet/semantic/db-file.el"
+;;;;;;  "cedet/semantic/db-find.el" "cedet/semantic/db-global.el"
+;;;;;;  "cedet/semantic/db-mode.el" "cedet/semantic/db-typecache.el"
+;;;;;;  "cedet/semantic/db.el" "cedet/semantic/debug.el" 
"cedet/semantic/decorate/include.el"
+;;;;;;  "cedet/semantic/decorate/mode.el" "cedet/semantic/dep.el"
+;;;;;;  "cedet/semantic/doc.el" "cedet/semantic/edit.el" 
"cedet/semantic/find.el"
+;;;;;;  "cedet/semantic/format.el" "cedet/semantic/grammar-wy.el"
 ;;;;;;  "cedet/semantic/grm-wy-boot.el" "cedet/semantic/html.el"
 ;;;;;;  "cedet/semantic/ia-sb.el" "cedet/semantic/ia.el" 
"cedet/semantic/idle.el"
 ;;;;;;  "cedet/semantic/imenu.el" "cedet/semantic/lex-spp.el" 
"cedet/semantic/lex.el"
@@ -39742,78 +40005,65 @@ Zone out, completely." t nil)
 ;;;;;;  "cedet/srecode/insert.el" "cedet/srecode/java.el" 
"cedet/srecode/map.el"
 ;;;;;;  "cedet/srecode/mode.el" "cedet/srecode/srt-wy.el" 
"cedet/srecode/srt.el"
 ;;;;;;  "cedet/srecode/template.el" "cedet/srecode/texi.el" "composite.el"
-;;;;;;  "cus-face.el" "cus-load.el" "cus-start.el" "custom.el" "dired-aux.el"
-;;;;;;  "dired-x.el" "electric.el" "emacs-lisp/backquote.el" 
"emacs-lisp/byte-run.el"
+;;;;;;  "cus-face.el" "cus-start.el" "custom.el" "dired-aux.el" "dired-x.el"
+;;;;;;  "electric.el" "emacs-lisp/backquote.el" "emacs-lisp/byte-run.el"
 ;;;;;;  "emacs-lisp/cl-extra.el" "emacs-lisp/cl-macs.el" 
"emacs-lisp/cl-preloaded.el"
-;;;;;;  "emacs-lisp/cl-seq.el" "emacs-lisp/easymenu.el" 
"emacs-lisp/eieio-compat.el"
-;;;;;;  "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-opt.el" 
"emacs-lisp/float-sup.el"
-;;;;;;  "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" "emacs-lisp/macroexp.el"
-;;;;;;  "emacs-lisp/map-ynp.el" "emacs-lisp/nadvice.el" 
"emacs-lisp/shorthands.el"
-;;;;;;  "emacs-lisp/syntax.el" "emacs-lisp/timer.el" "env.el" "epa-hook.el"
-;;;;;;  "erc/erc-autoaway.el" "erc/erc-button.el" "erc/erc-capab.el"
-;;;;;;  "erc/erc-compat.el" "erc/erc-dcc.el" "erc/erc-desktop-notifications.el"
-;;;;;;  "erc/erc-ezbounce.el" "erc/erc-fill.el" "erc/erc-identd.el"
-;;;;;;  "erc/erc-imenu.el" "erc/erc-join.el" "erc/erc-list.el" "erc/erc-log.el"
-;;;;;;  "erc/erc-match.el" "erc/erc-menu.el" "erc/erc-netsplit.el"
-;;;;;;  "erc/erc-notify.el" "erc/erc-page.el" "erc/erc-pcomplete.el"
-;;;;;;  "erc/erc-replace.el" "erc/erc-ring.el" "erc/erc-services.el"
-;;;;;;  "erc/erc-sound.el" "erc/erc-speedbar.el" "erc/erc-spelling.el"
-;;;;;;  "erc/erc-stamp.el" "erc/erc-status-sidebar.el" "erc/erc-track.el"
-;;;;;;  "erc/erc-truncate.el" "erc/erc-xdcc.el" "eshell/em-alias.el"
-;;;;;;  "eshell/em-banner.el" "eshell/em-basic.el" "eshell/em-cmpl.el"
-;;;;;;  "eshell/em-dirs.el" "eshell/em-glob.el" "eshell/em-hist.el"
-;;;;;;  "eshell/em-ls.el" "eshell/em-pred.el" "eshell/em-prompt.el"
-;;;;;;  "eshell/em-rebind.el" "eshell/em-script.el" "eshell/em-smart.el"
-;;;;;;  "eshell/em-term.el" "eshell/em-tramp.el" "eshell/em-unix.el"
-;;;;;;  "eshell/em-xtra.el" "eshell/esh-groups.el" "faces.el" "files.el"
-;;;;;;  "finder-inf.el" "font-core.el" "font-lock.el" "format.el"
+;;;;;;  "emacs-lisp/cl-seq.el" "emacs-lisp/easymenu.el" 
"emacs-lisp/eieio-custom.el"
+;;;;;;  "emacs-lisp/eieio-opt.el" "emacs-lisp/float-sup.el" 
"emacs-lisp/lisp-mode.el"
+;;;;;;  "emacs-lisp/lisp.el" "emacs-lisp/macroexp.el" "emacs-lisp/map-ynp.el"
+;;;;;;  "emacs-lisp/nadvice.el" "emacs-lisp/shorthands.el" 
"emacs-lisp/syntax.el"
+;;;;;;  "emacs-lisp/timer.el" "env.el" "epa-hook.el" "erc/erc-autoaway.el"
+;;;;;;  "erc/erc-button.el" "erc/erc-capab.el" "erc/erc-compat.el"
+;;;;;;  "erc/erc-dcc.el" "erc/erc-desktop-notifications.el" 
"erc/erc-ezbounce.el"
+;;;;;;  "erc/erc-fill.el" "erc/erc-identd.el" "erc/erc-imenu.el"
+;;;;;;  "erc/erc-join.el" "erc/erc-list.el" "erc/erc-log.el" "erc/erc-match.el"
+;;;;;;  "erc/erc-menu.el" "erc/erc-netsplit.el" "erc/erc-notify.el"
+;;;;;;  "erc/erc-page.el" "erc/erc-pcomplete.el" "erc/erc-replace.el"
+;;;;;;  "erc/erc-ring.el" "erc/erc-services.el" "erc/erc-sound.el"
+;;;;;;  "erc/erc-speedbar.el" "erc/erc-spelling.el" "erc/erc-stamp.el"
+;;;;;;  "erc/erc-status-sidebar.el" "erc/erc-track.el" "erc/erc-truncate.el"
+;;;;;;  "erc/erc-xdcc.el" "eshell/em-alias.el" "eshell/em-banner.el"
+;;;;;;  "eshell/em-basic.el" "eshell/em-cmpl.el" "eshell/em-dirs.el"
+;;;;;;  "eshell/em-glob.el" "eshell/em-hist.el" "eshell/em-ls.el"
+;;;;;;  "eshell/em-pred.el" "eshell/em-prompt.el" "eshell/em-rebind.el"
+;;;;;;  "eshell/em-script.el" "eshell/em-smart.el" "eshell/em-term.el"
+;;;;;;  "eshell/em-tramp.el" "eshell/em-unix.el" "eshell/em-xtra.el"
+;;;;;;  "faces.el" "files.el" "font-core.el" "font-lock.el" "format.el"
 ;;;;;;  "frame.el" "help.el" "hfy-cmap.el" "ibuf-ext.el" "indent.el"
-;;;;;;  "international/characters.el" "international/charprop.el"
-;;;;;;  "international/charscript.el" "international/cp51932.el"
-;;;;;;  "international/emoji-labels.el" "international/emoji-zwj.el"
-;;;;;;  "international/eucjp-ms.el" "international/iso-transl.el"
-;;;;;;  "international/mule-cmds.el" "international/mule-conf.el"
-;;;;;;  "international/mule.el" "international/uni-bidi.el" 
"international/uni-brackets.el"
-;;;;;;  "international/uni-category.el" "international/uni-combining.el"
-;;;;;;  "international/uni-comment.el" "international/uni-decimal.el"
-;;;;;;  "international/uni-decomposition.el" "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-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" "keymap.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/cham.el" "leim/quail/compose.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"
-;;;;;;  "minibuffer.el" "mouse.el" "newcomment.el" "obarray.el" 
"org/ob-core.el"
+;;;;;;  "international/characters.el" "international/charscript.el"
+;;;;;;  "international/cp51932.el" "international/emoji-zwj.el" 
"international/eucjp-ms.el"
+;;;;;;  "international/iso-transl.el" "international/mule-cmds.el"
+;;;;;;  "international/mule-conf.el" "international/mule.el" "isearch.el"
+;;;;;;  "jit-lock.el" "jka-cmpr-hook.el" "keymap.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/cham.el" "leim/quail/compose.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/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el" "minibuffer.el"
+;;;;;;  "mouse.el" "newcomment.el" "obarray.el" "org/ob-core.el"
 ;;;;;;  "org/ob-lob.el" "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el"
 ;;;;;;  "org/ol-bbdb.el" "org/ol-irc.el" "org/ol.el" "org/org-archive.el"
 ;;;;;;  "org/org-attach.el" "org/org-clock.el" "org/org-colview.el"
diff --git a/lisp/leim/quail/arabic.el b/lisp/leim/quail/arabic.el
index e5bd62b909..8d13538ce9 100644
--- a/lisp/leim/quail/arabic.el
+++ b/lisp/leim/quail/arabic.el
@@ -1,6 +1,6 @@
 ;;; arabic.el --- Quail package for inputting Arabic   -*- coding: utf-8; 
lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Cloos <cloos@jhcloos.com>
 ;; Keywords: mule, input method, Arabic
diff --git a/lisp/leim/quail/cham.el b/lisp/leim/quail/cham.el
index d12ae6cddf..0ee437e027 100644
--- a/lisp/leim/quail/cham.el
+++ b/lisp/leim/quail/cham.el
@@ -1,6 +1,6 @@
 ;;; cham.el --- Quail package for inputting Cham characters  -*- coding: 
utf-8; lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <eliz@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/compose.el b/lisp/leim/quail/compose.el
index 264a9b479b..2aa8ae78fe 100644
--- a/lisp/leim/quail/compose.el
+++ b/lisp/leim/quail/compose.el
@@ -1,6 +1,6 @@
 ;;; compose.el --- Quail package for Multi_key character composition 
-*-coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@linkov.net>
 ;; Keywords: multilingual, input method, i18n
diff --git a/lisp/leim/quail/croatian.el b/lisp/leim/quail/croatian.el
index 7402b81a8c..a6ec937cdc 100644
--- a/lisp/leim/quail/croatian.el
+++ b/lisp/leim/quail/croatian.el
@@ -1,6 +1,6 @@
 ;;; croatian.el --- Quail package for inputting Croatian  -*-coding: utf-8; 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Nikšić <hrvoje.niksic@avl.com>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/cyril-jis.el b/lisp/leim/quail/cyril-jis.el
index 689f738f5e..2674b5a6aa 100644
--- a/lisp/leim/quail/cyril-jis.el
+++ b/lisp/leim/quail/cyril-jis.el
@@ -1,6 +1,6 @@
 ;;; cyril-jis.el --- Quail package for inputting JISX0208 Cyrillic letters  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el
index 3654aca192..9f85bc1823 100644
--- a/lisp/leim/quail/cyrillic.el
+++ b/lisp/leim/quail/cyrillic.el
@@ -1,6 +1,6 @@
 ;;; cyrillic.el --- Quail package for inputting Cyrillic characters  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/czech.el b/lisp/leim/quail/czech.el
index 78b5011722..257bf5a929 100644
--- a/lisp/leim/quail/czech.el
+++ b/lisp/leim/quail/czech.el
@@ -1,6 +1,6 @@
 ;;; czech.el --- Quail package for inputting Czech -*-coding: utf-8; 
lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <pdm@zamazal.org>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/leim/quail/georgian.el b/lisp/leim/quail/georgian.el
index 2389d8138a..58b0ee7bcd 100644
--- a/lisp/leim/quail/georgian.el
+++ b/lisp/leim/quail/georgian.el
@@ -1,6 +1,6 @@
 ;;; georgian.el --- Quail package for inputting Georgian characters  -*- 
coding: utf-8; lexical-binding:t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/greek.el b/lisp/leim/quail/greek.el
index 89ebd44747..4d0e468d5d 100644
--- a/lisp/leim/quail/greek.el
+++ b/lisp/leim/quail/greek.el
@@ -1,6 +1,6 @@
 ;;; greek.el --- Quail package for inputting Greek -*- coding: utf-8; 
lexical-binding:t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/hangul.el b/lisp/leim/quail/hangul.el
index d069b5b68e..0ef5b2d5c7 100644
--- a/lisp/leim/quail/hangul.el
+++ b/lisp/leim/quail/hangul.el
@@ -1,6 +1,6 @@
 ;;; hangul.el --- Korean Hangul input method  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Jihyun Cho <jihyun.jo@gmail.com>
 ;; Keywords: multilingual, input method, Korean, Hangul
diff --git a/lisp/leim/quail/hanja.el b/lisp/leim/quail/hanja.el
index 7095bcf38a..e3db65b84b 100644
--- a/lisp/leim/quail/hanja.el
+++ b/lisp/leim/quail/hanja.el
@@ -1,6 +1,6 @@
 ;;; hanja.el --- Quail-package for Korean Hanja (KSC5601)  -*-coding: utf-8; 
lexical-binding: t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/hanja3.el b/lisp/leim/quail/hanja3.el
index 080ba0e0fd..50e5df3018 100644
--- a/lisp/leim/quail/hanja3.el
+++ b/lisp/leim/quail/hanja3.el
@@ -1,6 +1,6 @@
 ;;; hanja3.el --- Quail-package for Korean Hanja (KSC5601)  -*-coding: utf-8; 
lexical-binding: t -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Koaunghi Un <koaunghi.un@zdv.uni-tuebingen.de>
 ;; Keywords: mule, quail, multilingual, input method, Korean, Hanja
diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el
index 251b18c988..23204c0cd3 100644
--- a/lisp/leim/quail/indian.el
+++ b/lisp/leim/quail/indian.el
@@ -1,6 +1,6 @@
 ;;; indian.el --- Quail packages for inputting Indian  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: KAWABATA, Taichi <kawabata@m17n.org>
 
diff --git a/lisp/leim/quail/ipa-praat.el b/lisp/leim/quail/ipa-praat.el
index 1a95395fd7..3f0bd9f17c 100644
--- a/lisp/leim/quail/ipa-praat.el
+++ b/lisp/leim/quail/ipa-praat.el
@@ -1,6 +1,6 @@
 ;;; ipa-praat.el --- Inputting IPA characters with the conventions of Praat  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Oliver Scholz <epameinondas@gmx.de>
 ;; Keywords: multilingual, input method, IPA
diff --git a/lisp/leim/quail/ipa.el b/lisp/leim/quail/ipa.el
index ba6ea93842..1eb2255f6c 100644
--- a/lisp/leim/quail/ipa.el
+++ b/lisp/leim/quail/ipa.el
@@ -1,6 +1,6 @@
 ;;; ipa.el --- Quail package for inputting IPA characters  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/japanese.el b/lisp/leim/quail/japanese.el
index 6a2bcdc9ed..df080fc0e8 100644
--- a/lisp/leim/quail/japanese.el
+++ b/lisp/leim/quail/japanese.el
@@ -1,6 +1,6 @@
 ;;; japanese.el --- Quail package for inputting Japanese  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-alt.el b/lisp/leim/quail/latin-alt.el
index 0db952b67c..10e2050d08 100644
--- a/lisp/leim/quail/latin-alt.el
+++ b/lisp/leim/quail/latin-alt.el
@@ -1,6 +1,6 @@
 ;;; latin-alt.el --- Quail package for inputting various European characters 
-*-coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-ltx.el b/lisp/leim/quail/latin-ltx.el
index 2146304f15..1dfeb79c17 100644
--- a/lisp/leim/quail/latin-ltx.el
+++ b/lisp/leim/quail/latin-ltx.el
@@ -1,6 +1,6 @@
 ;;; latin-ltx.el --- Quail package for TeX-style input -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
 ;;   2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-post.el b/lisp/leim/quail/latin-post.el
index 0e1afba1a3..acb3ef8ede 100644
--- a/lisp/leim/quail/latin-post.el
+++ b/lisp/leim/quail/latin-post.el
@@ -1,6 +1,6 @@
 ;;; latin-post.el --- Quail packages for inputting various European characters 
 -*-coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-pre.el b/lisp/leim/quail/latin-pre.el
index 3492de5fba..b6a26e0b2c 100644
--- a/lisp/leim/quail/latin-pre.el
+++ b/lisp/leim/quail/latin-pre.el
@@ -1,6 +1,6 @@
 ;;; latin-pre.el --- Quail packages for inputting various European characters  
-*-coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/lrt.el b/lisp/leim/quail/lrt.el
index 68eaeb58ec..a926ebec42 100644
--- a/lisp/leim/quail/lrt.el
+++ b/lisp/leim/quail/lrt.el
@@ -1,6 +1,6 @@
 ;;; lrt.el --- Quail package for inputting Lao characters by LRT method  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/persian.el b/lisp/leim/quail/persian.el
index d058cfa61c..61428c94f0 100644
--- a/lisp/leim/quail/persian.el
+++ b/lisp/leim/quail/persian.el
@@ -1,6 +1,6 @@
 ;;; persian.el --- Quail package for inputting Persian/Farsi keyboard  -*- 
coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Mohsen BANAN <libre@mohsen.1.banan.byname.net>
 ;; URL: http://mohsen.1.banan.byname.net/contact
diff --git a/lisp/leim/quail/programmer-dvorak.el 
b/lisp/leim/quail/programmer-dvorak.el
index 9e1e23c04b..d8260f8982 100644
--- a/lisp/leim/quail/programmer-dvorak.el
+++ b/lisp/leim/quail/programmer-dvorak.el
@@ -1,6 +1,6 @@
 ;;; programmer-dvorak.el --- Quail package for the programmer Dvorak layout  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Joakim Jalap <joakim.jalap@fastmail.com>
 
diff --git a/lisp/leim/quail/py-punct.el b/lisp/leim/quail/py-punct.el
index 2a61795a13..8a0b32c330 100644
--- a/lisp/leim/quail/py-punct.el
+++ b/lisp/leim/quail/py-punct.el
@@ -1,6 +1,6 @@
 ;;; py-punct.el --- Quail packages for Chinese (pinyin + extra symbols)  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/rfc1345.el b/lisp/leim/quail/rfc1345.el
index a07208294f..e33d52592d 100644
--- a/lisp/leim/quail/rfc1345.el
+++ b/lisp/leim/quail/rfc1345.el
@@ -1,6 +1,6 @@
 ;;; rfc1345.el --- Quail method for RFC 1345 mnemonics -*- coding: utf-8; 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/sami.el b/lisp/leim/quail/sami.el
index 0f0bae9eca..13ae6590c9 100644
--- a/lisp/leim/quail/sami.el
+++ b/lisp/leim/quail/sami.el
@@ -1,6 +1,6 @@
 ;;; sami.el --- Quail package for inputting Sámi  -*-coding: utf-8; 
lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Wojciech S. Gac <wojciech.s.gac@gmail.com>
 ;; Keywords: i18n, multilingual, input method, Sámi
diff --git a/lisp/leim/quail/sgml-input.el b/lisp/leim/quail/sgml-input.el
index 68add78e29..720f2ebd7f 100644
--- a/lisp/leim/quail/sgml-input.el
+++ b/lisp/leim/quail/sgml-input.el
@@ -1,6 +1,6 @@
 ;;; sgml-input.el --- Quail method for Unicode entered as SGML entities -*- 
coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/sisheng.el b/lisp/leim/quail/sisheng.el
index aa35bb0574..6468b117fc 100644
--- a/lisp/leim/quail/sisheng.el
+++ b/lisp/leim/quail/sisheng.el
@@ -1,6 +1,6 @@
 ;;; sisheng.el --- sisheng input method for Chinese pinyin transliteration  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Werner LEMBERG <wl@gnu.org>
 
diff --git a/lisp/leim/quail/slovak.el b/lisp/leim/quail/slovak.el
index 53780cfd4a..acde11d02a 100644
--- a/lisp/leim/quail/slovak.el
+++ b/lisp/leim/quail/slovak.el
@@ -1,6 +1,6 @@
 ;;; slovak.el --- Quail package for inputting Slovak  -*-coding: utf-8; 
lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Authors: Tibor Šimko <tibor.simko@fmph.uniba.sk>
 ;;     Milan Zamazal <pdm@zamazal.org>
diff --git a/lisp/leim/quail/symbol-ksc.el b/lisp/leim/quail/symbol-ksc.el
index 0583d64c2b..042465697a 100644
--- a/lisp/leim/quail/symbol-ksc.el
+++ b/lisp/leim/quail/symbol-ksc.el
@@ -1,6 +1,6 @@
 ;;; symbol-ksc.el --- Quail-package for Korean Symbol (KSC5601) -*-coding: 
utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/tamil-dvorak.el b/lisp/leim/quail/tamil-dvorak.el
index b2d48afa0a..08e5b1e05a 100644
--- a/lisp/leim/quail/tamil-dvorak.el
+++ b/lisp/leim/quail/tamil-dvorak.el
@@ -1,6 +1,6 @@
 ;;; tamil-dvorak.el --- Quail package for Tamil input with Dvorak keyboard  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Shakthi Kannan <author@shakthimaan.com>
 
diff --git a/lisp/leim/quail/tibetan.el b/lisp/leim/quail/tibetan.el
index 33cc6f5965..ca44f7022d 100644
--- a/lisp/leim/quail/tibetan.el
+++ b/lisp/leim/quail/tibetan.el
@@ -1,6 +1,6 @@
 ;;; tibetan.el --- Quail package for inputting Tibetan characters -*-coding: 
utf-8-emacs; lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/uni-input.el b/lisp/leim/quail/uni-input.el
index bfe4ce6f12..36d8e6a840 100644
--- a/lisp/leim/quail/uni-input.el
+++ b/lisp/leim/quail/uni-input.el
@@ -1,6 +1,6 @@
 ;;; uni-input.el --- Hex Unicode input method  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
diff --git a/lisp/leim/quail/vntelex.el b/lisp/leim/quail/vntelex.el
index 22d23d4747..c48f947fcd 100644
--- a/lisp/leim/quail/vntelex.el
+++ b/lisp/leim/quail/vntelex.el
@@ -1,6 +1,6 @@
 ;;; vntelex.el --- Quail package for Vietnamese by Telex method  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Werner Lemberg <wl@gnu.org>
 ;; Keywords: multilingual, input method, Vietnamese
diff --git a/lisp/leim/quail/vnvni.el b/lisp/leim/quail/vnvni.el
index 57e0dfd820..52c8222b25 100644
--- a/lisp/leim/quail/vnvni.el
+++ b/lisp/leim/quail/vnvni.el
@@ -1,6 +1,6 @@
 ;;; vnvni.el --- Quail package for Vietnamese by VNI method  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author:   Werner Lemberg <wl@gnu.org>
 ;;           Nguyen Thai Ngoc Duy <pclouds@gmail.com>
diff --git a/lisp/leim/quail/welsh.el b/lisp/leim/quail/welsh.el
index f521d1464e..e02b1120ad 100644
--- a/lisp/leim/quail/welsh.el
+++ b/lisp/leim/quail/welsh.el
@@ -1,6 +1,6 @@
 ;;; welsh.el --- Quail package for inputting Welsh characters  -*- coding: 
utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
diff --git a/lisp/linum.el b/lisp/linum.el
index 1e029e508e..e121618b69 100644
--- a/lisp/linum.el
+++ b/lisp/linum.el
@@ -1,6 +1,6 @@
 ;;; linum.el --- display line numbers in the left margin -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Markus Triska <markus.triska@gmx.at>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 4a7946a212..48058f4053 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -1,6 +1,6 @@
 ;;; loadhist.el --- lisp functions for working with feature groups  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1995, 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 154f831ead..ec1644f2fc 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -1,6 +1,6 @@
 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994, 2001-2021 Free Software
+;; Copyright (C) 1985-1986, 1992, 1994, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -340,6 +340,13 @@
         (load "international/mule-util")
         (load "international/ucs-normalize")
         (load "term/ns-win"))))
+(if (featurep 'pgtk)
+    (progn
+      (load "term/common-win")
+      ;; Don't load ucs-normalize.el unless uni-*.el files were
+      ;; already produced, because it needs uni-*.el files that might
+      ;; not be built early enough during bootstrap.
+      (load "term/pgtk-win")))
 (if (fboundp 'x-create-frame)
     ;; Do it after loading term/foo-win.el since the value of the
     ;; mouse-wheel-*-event vars depends on those files being loaded or not.
diff --git a/lisp/locate.el b/lisp/locate.el
index 6190fc6302..95b66f275a 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -1,6 +1,6 @@
 ;;; locate.el --- interface to the locate command  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996, 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Keywords: unix files
diff --git a/lisp/lpr.el b/lisp/lpr.el
index 29a0fd8d72..01617ef912 100644
--- a/lisp/lpr.el
+++ b/lisp/lpr.el
@@ -1,6 +1,6 @@
 ;;; lpr.el --- print Emacs buffer on line printer  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2021 Free Software
+;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 25d196392a..e7118a2a37 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -1,6 +1,6 @@
 ;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
 ;; Modified by: Francis J. Wright <F.J.Wright@maths.qmw.ac.uk>
diff --git a/lisp/macros.el b/lisp/macros.el
index cc0079adac..e2f5435441 100644
--- a/lisp/macros.el
+++ b/lisp/macros.el
@@ -1,6 +1,6 @@
 ;;; macros.el --- non-primitive commands for keyboard macros -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1992, 1994-1995, 2001-2021 Free Software
+;; Copyright (C) 1985-1987, 1992, 1994-1995, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el
index af327442c2..ad6ce19a95 100644
--- a/lisp/mail/binhex.el
+++ b/lisp/mail/binhex.el
@@ -1,6 +1,6 @@
 ;;; binhex.el --- decode BinHex-encoded text  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: binhex news
diff --git a/lisp/mail/blessmail.el b/lisp/mail/blessmail.el
index 23fddfd167..f7cebd5595 100644
--- a/lisp/mail/blessmail.el
+++ b/lisp/mail/blessmail.el
@@ -1,6 +1,6 @@
 ;;; blessmail.el --- decide whether movemail needs special privileges -*- 
no-byte-compile: t; lexical-binding: t; -*-
 
-;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 7c3f6ba5e6..f5559e39f6 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -1,6 +1,6 @@
 ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1994, 1997-1998, 2000-2021 Free Software
+;; Copyright (C) 1985, 1994, 1997-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el
index 5319ab994c..4802e2c418 100644
--- a/lisp/mail/flow-fill.el
+++ b/lisp/mail/flow-fill.el
@@ -1,6 +1,6 @@
 ;;; flow-fill.el --- interpret RFC2646 "flowed" text  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <jas@pdc.kth.se>
 ;; Keywords: mail
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index ef040ca90b..a985a21255 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -1,6 +1,6 @@
 ;;; footnote.el --- footnote support for message mode  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Steven L Baur <steve@xemacs.org> (1997-2011)
 ;;         Boruch Baum <boruch_baum@gmx.com> (2017-)
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el
index b4889eec46..b343a017e3 100644
--- a/lisp/mail/hashcash.el
+++ b/lisp/mail/hashcash.el
@@ -1,6 +1,6 @@
 ;;; hashcash.el --- Add hashcash payments to email  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Written by: Paul Foley <mycroft@actrix.gen.nz> (1997-2002)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el
index b1682cf78a..4a07959189 100644
--- a/lisp/mail/ietf-drums.el
+++ b/lisp/mail/ietf-drums.el
@@ -1,6 +1,6 @@
 ;;; ietf-drums.el --- Functions for parsing RFC 2822 headers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el
index 24d8311f64..50ba04ccc1 100644
--- a/lisp/mail/mail-extr.el
+++ b/lisp/mail/mail-extr.el
@@ -1,6 +1,6 @@
 ;;; mail-extr.el --- extract full name and address from email header  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1991-1994, 1997, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1991-1994, 1997, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Joe Wells <jbw@cs.bu.edu>
diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el
index 239b386ff8..e02d4218dd 100644
--- a/lisp/mail/mail-hist.el
+++ b/lisp/mail/mail-hist.el
@@ -1,6 +1,6 @@
 ;;; mail-hist.el --- headers and message body history for outgoing mail  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <kfogel@red-bean.com>
 ;; Created: March, 1994
diff --git a/lisp/mail/mail-parse.el b/lisp/mail/mail-parse.el
index 212fadf382..23894e59b7 100644
--- a/lisp/mail/mail-parse.el
+++ b/lisp/mail/mail-parse.el
@@ -1,6 +1,6 @@
 ;;; mail-parse.el --- Interface functions for parsing mail  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mail-prsvr.el b/lisp/mail/mail-prsvr.el
index a9b5a4422d..573975c9fb 100644
--- a/lisp/mail/mail-prsvr.el
+++ b/lisp/mail/mail-prsvr.el
@@ -1,6 +1,6 @@
 ;;; mail-prsvr.el --- Interface variables for parsing mail  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index f1b0590bec..952970d07c 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -1,6 +1,6 @@
 ;;; mail-utils.el --- utility functions used both by rmail and rnews  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mail, news
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index 62d9b12bb2..e4061bd2f1 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -1,6 +1,6 @@
 ;;; mailabbrev.el --- abbrev-expansion of mail aliases  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1985-1987, 1992-1993, 1996-1997, 2000-2021 Free
+;; Copyright (C) 1985-1987, 1992-1993, 1996-1997, 2000-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com; now jwz@jwz.org>
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index 5a5488b2ec..ba7cf58d38 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -1,6 +1,6 @@
 ;;; mailalias.el --- expand and complete mailing address aliases -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1995-1997, 2001-2021 Free Software
+;; Copyright (C) 1985, 1987, 1995-1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el
index e6833806d9..f0d312fd9a 100644
--- a/lisp/mail/mailclient.el
+++ b/lisp/mail/mailclient.el
@@ -1,6 +1,6 @@
 ;;; mailclient.el --- mail sending via system's mail client.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: David Reitter <david.reitter@gmail.com>
 ;; Keywords: mail
diff --git a/lisp/mail/mailheader.el b/lisp/mail/mailheader.el
index 0443279be8..b813fa7825 100644
--- a/lisp/mail/mailheader.el
+++ b/lisp/mail/mailheader.el
@@ -1,6 +1,6 @@
 ;;; mailheader.el --- mail header parsing, merging, formatting  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Erik Naggum <erik@naggum.no>
 ;; Keywords: tools, mail, news
diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el
index a36ccd98dc..2c3851f835 100644
--- a/lisp/mail/mspools.el
+++ b/lisp/mail/mspools.el
@@ -1,6 +1,6 @@
 ;;; mspools.el --- show mail spools waiting to be read  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Stephen Eglen <stephen@gnu.org>
 ;; Created: 22 Jan 1997
diff --git a/lisp/mail/qp.el b/lisp/mail/qp.el
index 02a371a844..dc6fe6091c 100644
--- a/lisp/mail/qp.el
+++ b/lisp/mail/qp.el
@@ -1,6 +1,6 @@
 ;;; qp.el --- Quoted-Printable functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail, extensions
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el
index 2983a11d74..324165a8ff 100644
--- a/lisp/mail/reporter.el
+++ b/lisp/mail/reporter.el
@@ -1,6 +1,6 @@
 ;;; reporter.el --- customizable bug reporting of lisp programs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author:          1993-1998 Barry A. Warsaw
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/rfc2045.el b/lisp/mail/rfc2045.el
index c0672f18a9..d7cdc77e7f 100644
--- a/lisp/mail/rfc2045.el
+++ b/lisp/mail/rfc2045.el
@@ -1,6 +1,6 @@
 ;;; rfc2045.el --- Functions for decoding rfc2045 headers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el
index c442913d28..b3c45100f6 100644
--- a/lisp/mail/rfc2047.el
+++ b/lisp/mail/rfc2047.el
@@ -1,6 +1,6 @@
 ;;; rfc2047.el --- functions for encoding and decoding rfc2047 messages  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el
index a398ce0e9c..0f64fad260 100644
--- a/lisp/mail/rfc2231.el
+++ b/lisp/mail/rfc2231.el
@@ -1,6 +1,6 @@
 ;;; rfc2231.el --- Functions for decoding rfc2231 headers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/rfc6068.el b/lisp/mail/rfc6068.el
index 34fd7b5df4..54035b6698 100644
--- a/lisp/mail/rfc6068.el
+++ b/lisp/mail/rfc6068.el
@@ -1,6 +1,6 @@
 ;;; rfc6068.el --- support for rfc6068  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Keywords: mail
 
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index 2e97226662..525e6d5b58 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -1,6 +1,6 @@
 ;;; rfc822.el --- hairy RFC 822 (or later) parser for mail, news, etc.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1986-1987, 1990, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1986-1987, 1990, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Richard Mlynarik <mly@eddie.mit.edu>
diff --git a/lisp/mail/rmail-spam-filter.el b/lisp/mail/rmail-spam-filter.el
index 75a6c72369..193d6095e4 100644
--- a/lisp/mail/rmail-spam-filter.el
+++ b/lisp/mail/rmail-spam-filter.el
@@ -1,6 +1,6 @@
 ;;; rmail-spam-filter.el --- spam filter for Rmail, the Emacs mail reader  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 ;; Keywords: email, spam, filter, rmail
 ;; Author: Eli Tziperman <eli AT deas.harvard.edu>
 ;; Package: rmail
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index afcb7f39bf..55921eca68 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1,6 +1,6 @@
 ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1988, 1993-1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1988, 1993-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -41,8 +41,6 @@
 (require 'rfc2047)
 (require 'auth-source)
 
-(require 'rmail-loaddefs)
-
 (declare-function compilation--message->loc "compile" (cl-x) t)
 (declare-function epa--find-coding-system-for-mime-charset "epa" 
(mime-charset))
 
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el
index fd24bdcecc..79bd02fd67 100644
--- a/lisp/mail/rmailedit.el
+++ b/lisp/mail/rmailedit.el
@@ -1,6 +1,6 @@
 ;;; rmailedit.el --- "RMAIL edit mode"  Edit the current message  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mail
@@ -484,8 +484,4 @@ HEADER-DIFF should be a return value from 
`rmail-edit-diff-headers'."
 
 (provide 'rmailedit)
 
-;; Local Variables:
-;; generated-autoload-file: "rmail-loaddefs.el"
-;; End:
-
 ;;; rmailedit.el ends here
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index d8fcc1c0a9..6535d68456 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -1,6 +1,6 @@
 ;;; rmailkwd.el --- part of the "RMAIL" mail reader for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1988, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985, 1988, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -188,8 +188,4 @@ With prefix argument N moves forward N messages with these 
labels."
 
 (provide 'rmailkwd)
 
-;; Local Variables:
-;; generated-autoload-file: "rmail-loaddefs.el"
-;; End:
-
 ;;; rmailkwd.el ends here
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 66a1e9a4db..76a32724c0 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -1,6 +1,6 @@
 ;;; rmailmm.el --- MIME decoding and display stuff for RMAIL  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexander Pohoyda
 ;;     Alex Schroeder
@@ -1569,8 +1569,4 @@ This is the usual value of 
`rmail-insert-mime-forwarded-message-function'."
 
 (provide 'rmailmm)
 
-;; Local Variables:
-;; generated-autoload-file: "rmail-loaddefs.el"
-;; End:
-
 ;;; rmailmm.el ends here
diff --git a/lisp/mail/rmailmsc.el b/lisp/mail/rmailmsc.el
index 673b2c5a7e..93463af46c 100644
--- a/lisp/mail/rmailmsc.el
+++ b/lisp/mail/rmailmsc.el
@@ -1,6 +1,6 @@
 ;;; rmailmsc.el --- miscellaneous support functions for the RMAIL mail reader  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mail
@@ -54,8 +54,4 @@ This applies only to the current session."
       (setq rmail-inbox-list inbox-list)))
   (rmail-show-message-1 rmail-current-message))
 
-;; Local Variables:
-;; generated-autoload-file: "rmail-loaddefs.el"
-;; End:
-
 ;;; rmailmsc.el ends here
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index 1f5bb2d9f1..c1371308d4 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -1,6 +1,6 @@
 ;;; rmailout.el --- "RMAIL" mail reader for Emacs: output message to a file  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1987, 1993-1994, 2001-2021 Free Software
+;; Copyright (C) 1985, 1987, 1993-1994, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el
index 1669c8cd7b..c203cf858e 100644
--- a/lisp/mail/rmailsort.el
+++ b/lisp/mail/rmailsort.el
@@ -1,6 +1,6 @@
 ;;; rmailsort.el --- Rmail: sort messages  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1990, 1993-1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1990, 1993-1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
@@ -250,8 +250,4 @@ Numeric keys are sorted numerically, all others as strings."
 
 (provide 'rmailsort)
 
-;; Local Variables:
-;; generated-autoload-file: "rmail-loaddefs.el"
-;; End:
-
 ;;; rmailsort.el ends here
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 8fc3fc095c..59c2e578d3 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -1,6 +1,6 @@
 ;;; rmailsum.el --- make summary buffers for the mail reader  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1993-1996, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1985, 1993-1996, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -1877,8 +1877,4 @@ the summary is only showing a subset of messages."
 
 (provide 'rmailsum)
 
-;; Local Variables:
-;; generated-autoload-file: "rmail-loaddefs.el"
-;; End:
-
 ;;; rmailsum.el ends here
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 0c3e17ee86..98678c3b06 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -1,6 +1,6 @@
 ;;; sendmail.el --- mail sending commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1992-1996, 1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1986, 1992-1996, 1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index bd8aa611e9..8ac0cd7e7c 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -1,6 +1,6 @@
 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index b3080ac416..5dc5ee38ff 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -1,6 +1,6 @@
 ;;; supercite.el --- minor mode for citing mail and news replies  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw <bwarsaw@python.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/uce.el b/lisp/mail/uce.el
index 4347ff1402..2672cfca1f 100644
--- a/lisp/mail/uce.el
+++ b/lisp/mail/uce.el
@@ -1,6 +1,6 @@
 ;;; uce.el --- facilitate reply to unsolicited commercial email  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996, 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: stanislav shalunov <shalunov@mccme.ru>
 ;; Created: 10 Dec 1996
diff --git a/lisp/mail/undigest.el b/lisp/mail/undigest.el
index 0760a47729..03e77a83ce 100644
--- a/lisp/mail/undigest.el
+++ b/lisp/mail/undigest.el
@@ -1,6 +1,6 @@
 ;;; undigest.el --- digest-cracking support for the RMAIL mail reader  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1994, 1996, 2001-2021 Free Software
+;; Copyright (C) 1985-1986, 1994, 1996, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el
index 5b1abd54c6..8ce5afa962 100644
--- a/lisp/mail/unrmail.el
+++ b/lisp/mail/unrmail.el
@@ -1,6 +1,6 @@
 ;;; unrmail.el --- convert Rmail Babyl files to mbox files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mail
diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el
index 026356efe9..1c6bfe157d 100644
--- a/lisp/mail/uudecode.el
+++ b/lisp/mail/uudecode.el
@@ -1,6 +1,6 @@
 ;;; uudecode.el --- elisp native uudecode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: uudecode news
diff --git a/lisp/mail/yenc.el b/lisp/mail/yenc.el
index 0ab6d85da8..5cc987eccd 100644
--- a/lisp/mail/yenc.el
+++ b/lisp/mail/yenc.el
@@ -1,6 +1,6 @@
 ;;; yenc.el --- elisp native yenc decoder  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Jesper Harder <harder@ifa.au.dk>
 ;; Keywords: yenc news
diff --git a/lisp/makesum.el b/lisp/makesum.el
index a7e88dbaa2..4084358ca9 100644
--- a/lisp/makesum.el
+++ b/lisp/makesum.el
@@ -1,6 +1,6 @@
 ;;; makesum.el --- generate key binding summary for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help
diff --git a/lisp/man.el b/lisp/man.el
index fff31baa5f..adf244a11a 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1,6 +1,6 @@
 ;;; man.el --- browse UNIX manual pages -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 1996-1997, 2001-2021 Free Software
+;; Copyright (C) 1993-1994, 1996-1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <bwarsaw@cen.com>
diff --git a/lisp/master.el b/lisp/master.el
index 3dcee50c5e..da7f85d1a6 100644
--- a/lisp/master.el
+++ b/lisp/master.el
@@ -1,6 +1,6 @@
 ;;; master.el --- make a buffer the master over another buffer  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Old-Version: 1.0.2
diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el
index 88003afb40..a4b6e2bffa 100644
--- a/lisp/mb-depth.el
+++ b/lisp/mb-depth.el
@@ -1,6 +1,6 @@
 ;;; mb-depth.el --- Indicate minibuffer-depth in prompt -*- lexical-binding: t 
-*-
 ;;
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: convenience
diff --git a/lisp/md4.el b/lisp/md4.el
index 771d9f9f0d..73e5d3474d 100644
--- a/lisp/md4.el
+++ b/lisp/md4.el
@@ -1,6 +1,6 @@
 ;;; md4.el --- MD4 Message Digest Algorithm. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2001, 2004, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Taro Kawagishi <tarok@transpulse.org>
 ;; Keywords: MD4
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 8c04e35a51..e0cf6c588c 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1,6 +1,6 @@
 ;;; menu-bar.el --- define a default menu bar  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard M. Stallman
 ;; Maintainer: emacs-devel@gnu.org
@@ -2539,6 +2539,7 @@ See `menu-bar-mode' for more information."
 
 (declare-function x-menu-bar-open "term/x-win" (&optional frame))
 (declare-function w32-menu-bar-open "term/w32-win" (&optional frame))
+(declare-function pgtk-menu-bar-open "term/pgtk-win" (&optional frame))
 (declare-function haiku-menu-bar-open "haikumenu.c" (&optional frame))
 
 (defun lookup-key-ignore-too-long (map key)
@@ -2678,6 +2679,7 @@ If FRAME is nil or not given, use the selected frame."
      ((eq type 'x) (x-menu-bar-open frame))
      ((eq type 'w32) (w32-menu-bar-open frame))
      ((eq type 'haiku) (haiku-menu-bar-open frame))
+     ((eq type 'pgtk) (pgtk-menu-bar-open frame))
      ((and (null tty-menu-open-use-tmm)
           (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0))))
       ;; Make sure the menu bar is up to date.  One situation where
diff --git a/lisp/mh-e/ChangeLog.1 b/lisp/mh-e/ChangeLog.1
index 2201ce22a2..00e52df2bb 100644
--- a/lisp/mh-e/ChangeLog.1
+++ b/lisp/mh-e/ChangeLog.1
@@ -11419,7 +11419,7 @@
        (dist): Leave release in current directory.
 
 
-  Copyright (C) 2003-2021 Free Software Foundation, Inc.
+  Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/mh-e/ChangeLog.2 b/lisp/mh-e/ChangeLog.2
index b6b16f7d79..5f2dd299f8 100644
--- a/lisp/mh-e/ChangeLog.2
+++ b/lisp/mh-e/ChangeLog.2
@@ -3673,7 +3673,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-  Copyright (C) 2005-2021 Free Software Foundation, Inc.
+  Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index 25fff6a8e1..805b0820b0 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -1,6 +1,6 @@
 ;;; mh-acros.el --- macros used in MH-E  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el
index d266621100..f39caac893 100644
--- a/lisp/mh-e/mh-alias.el
+++ b/lisp/mh-e/mh-alias.el
@@ -1,6 +1,6 @@
 ;;; mh-alias.el --- MH-E mail alias completion and expansion  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <psg@debian.org>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-buffers.el b/lisp/mh-e/mh-buffers.el
index ef21fdb2f9..f21b57663b 100644
--- a/lisp/mh-e/mh-buffers.el
+++ b/lisp/mh-e/mh-buffers.el
@@ -1,6 +1,6 @@
 ;;; mh-buffers.el --- MH-E buffer constants and utilities  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el
index a47a6f9cca..a9f6274e9d 100644
--- a/lisp/mh-e/mh-comp.el
+++ b/lisp/mh-e/mh-comp.el
@@ -1,6 +1,6 @@
 ;;; mh-comp.el --- MH-E functions for composing and sending messages  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el
index 23dc48a574..7a09429e4e 100644
--- a/lisp/mh-e/mh-compat.el
+++ b/lisp/mh-e/mh-compat.el
@@ -1,6 +1,6 @@
 ;;; mh-compat.el --- make MH-E compatible with various versions of Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Keywords: mail
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 17faff0716..872f0d79d2 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -1,6 +1,6 @@
 ;;; mh-e.el --- GNU Emacs interface to the MH mail system  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2021 Free
+;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el
index 132ac33d26..09df0465ed 100644
--- a/lisp/mh-e/mh-folder.el
+++ b/lisp/mh-e/mh-folder.el
@@ -1,6 +1,6 @@
 ;;; mh-folder.el --- MH-Folder mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Keywords: mail
diff --git a/lisp/mh-e/mh-funcs.el b/lisp/mh-e/mh-funcs.el
index 0c73aae0d7..ef0a76b9a4 100644
--- a/lisp/mh-e/mh-funcs.el
+++ b/lisp/mh-e/mh-funcs.el
@@ -1,6 +1,6 @@
 ;;; mh-funcs.el --- MH-E functions not everyone will use right away  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Keywords: mail
diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el
index 0e1bde71f2..c341b09683 100644
--- a/lisp/mh-e/mh-gnus.el
+++ b/lisp/mh-e/mh-gnus.el
@@ -1,6 +1,6 @@
 ;;; mh-gnus.el --- make MH-E compatible with various versions of Gnus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el
index 994ab71391..43eaeb7aa0 100644
--- a/lisp/mh-e/mh-identity.el
+++ b/lisp/mh-e/mh-identity.el
@@ -1,6 +1,6 @@
 ;;; mh-identity.el --- multiple identify support for MH-E  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <psg@debian.org>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-inc.el b/lisp/mh-e/mh-inc.el
index 83cfe4f99f..2c29ec3223 100644
--- a/lisp/mh-e/mh-inc.el
+++ b/lisp/mh-e/mh-inc.el
@@ -1,6 +1,6 @@
 ;;; mh-inc.el --- MH-E "inc" and separate mail spool handling  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <psg@debian.org>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-junk.el b/lisp/mh-e/mh-junk.el
index 2097bcbe1e..1f773b878a 100644
--- a/lisp/mh-e/mh-junk.el
+++ b/lisp/mh-e/mh-junk.el
@@ -1,6 +1,6 @@
 ;;; mh-junk.el --- MH-E interface to anti-spam measures  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>,
 ;;         Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el
index ebe94a7af8..4e3e101231 100644
--- a/lisp/mh-e/mh-letter.el
+++ b/lisp/mh-e/mh-letter.el
@@ -1,6 +1,6 @@
 ;;; mh-letter.el --- MH-Letter mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-limit.el b/lisp/mh-e/mh-limit.el
index a00252284a..a2ea761013 100644
--- a/lisp/mh-e/mh-limit.el
+++ b/lisp/mh-e/mh-limit.el
@@ -1,6 +1,6 @@
 ;;; mh-limit.el --- MH-E display limits  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2003, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <psg@debian.org>
 ;; Keywords: mail
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index 714bf029bb..98a20b7bb4 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -1,6 +1,6 @@
 ;;; mh-mime.el --- MH-E MIME support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Keywords: mail
diff --git a/lisp/mh-e/mh-print.el b/lisp/mh-e/mh-print.el
index 2074ff6f8f..2eec8d9160 100644
--- a/lisp/mh-e/mh-print.el
+++ b/lisp/mh-e/mh-print.el
@@ -1,6 +1,6 @@
 ;;; mh-print.el --- MH-E printing support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Jeffrey C Honig <jch@honig.net>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-scan.el b/lisp/mh-e/mh-scan.el
index 9ac251e8b7..06381a2e0e 100644
--- a/lisp/mh-e/mh-scan.el
+++ b/lisp/mh-e/mh-scan.el
@@ -1,6 +1,6 @@
 ;;; mh-scan.el --- MH-E scan line constants and utilities  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index 8012e624f1..c5519eba0a 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -1,6 +1,6 @@
 ;;; mh-search.el --- MH-Search mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Indexed search by Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el
index 077e289c01..a95c7c03d1 100644
--- a/lisp/mh-e/mh-seq.el
+++ b/lisp/mh-e/mh-seq.el
@@ -1,6 +1,6 @@
 ;;; mh-seq.el --- MH-E sequences support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Keywords: mail
diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el
index 16489bf017..cc76b8d7e6 100644
--- a/lisp/mh-e/mh-show.el
+++ b/lisp/mh-e/mh-show.el
@@ -1,6 +1,6 @@
 ;;; mh-show.el --- MH-Show mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el
index d9909a034d..a7e9c9bd67 100644
--- a/lisp/mh-e/mh-speed.el
+++ b/lisp/mh-e/mh-speed.el
@@ -1,6 +1,6 @@
 ;;; mh-speed.el --- MH-E speedbar support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el
index 1be2185ecd..139e9b74cb 100644
--- a/lisp/mh-e/mh-thread.el
+++ b/lisp/mh-e/mh-thread.el
@@ -1,6 +1,6 @@
 ;;; mh-thread.el --- MH-E threading support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el
index d451ae34d2..17df075cfa 100644
--- a/lisp/mh-e/mh-tool-bar.el
+++ b/lisp/mh-e/mh-tool-bar.el
@@ -1,6 +1,6 @@
 ;;; mh-tool-bar.el --- MH-E tool bar support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index b75025d6a4..d7a92be5b5 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -1,6 +1,6 @@
 ;;; mh-utils.el --- MH-E general utilities  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el
index 8350f3d0fb..b144c58d69 100644
--- a/lisp/mh-e/mh-xface.el
+++ b/lisp/mh-e/mh-xface.el
@@ -1,6 +1,6 @@
 ;;; mh-xface.el --- MH-E X-Face and Face header field display  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Keywords: mail
diff --git a/lisp/midnight.el b/lisp/midnight.el
index 51173e7429..3e309a5c88 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -1,6 +1,6 @@
 ;;; midnight.el --- run something every midnight, e.g., kill old buffers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Sam Steingold <sds@gnu.org>
 ;; Created: 1998-05-18
diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el
index f67ec353c8..3f04a3e921 100644
--- a/lisp/minibuf-eldef.el
+++ b/lisp/minibuf-eldef.el
@@ -1,6 +1,6 @@
 ;;; minibuf-eldef.el --- Only show defaults in prompts when applicable  -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: convenience
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 28bd1df59a..ab760a42d1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1,6 +1,6 @@
 ;;; minibuffer.el --- Minibuffer and completion functions -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Package: emacs
@@ -900,7 +900,7 @@ If the value is `lazy', the *Completions* buffer is only 
displayed after
 the second failed attempt to complete."
   :type '(choice (const nil) (const t) (const lazy)))
 
-(defconst completion-styles-alist
+(defvar completion-styles-alist
   '((emacs21
      completion-emacs21-try-completion completion-emacs21-all-completions
      "Simple prefix-based completion.
@@ -1076,9 +1076,10 @@ This overrides the defaults specified in 
`completion-category-defaults'."
          (result-and-style
           (completion--some
            (lambda (style)
-             (let ((probe (funcall (nth n (assq style
-                                                completion-styles-alist))
-                                   string table pred point)))
+             (let ((probe (funcall
+                           (or (nth n (assq style completion-styles-alist))
+                               (error "Invalid completion style %s" style))
+                           string table pred point)))
                (and probe (cons probe style))))
            (completion--styles md)))
          (adjust-fn (get (cdr result-and-style) 'completion--adjust-metadata)))
@@ -1379,14 +1380,18 @@ scroll the window of possible completions."
    ;; and this command is repeated, scroll that window.
    ((and (window-live-p minibuffer-scroll-window)
          (eq t (frame-visible-p (window-frame minibuffer-scroll-window))))
-    (let ((window minibuffer-scroll-window))
+    (let ((window minibuffer-scroll-window)
+          (reverse (equal (this-command-keys) [backtab])))
       (with-current-buffer (window-buffer window)
-        (if (pos-visible-in-window-p (point-max) window)
-            ;; If end is in view, scroll up to the beginning.
-            (set-window-start window (point-min) nil)
+        (if (pos-visible-in-window-p (if reverse (point-min) (point-max)) 
window)
+            ;; If end or beginning is in view, scroll up to the
+            ;; beginning or end respectively.
+            (if reverse
+                (set-window-point window (point-max))
+              (set-window-start window (point-min) nil))
           ;; Else scroll down one screen.
           (with-selected-window window
-           (scroll-up)))
+            (if reverse (scroll-down) (scroll-up))))
         nil)))
    ;; If we're cycling, keep on cycling.
    ((and completion-cycling completion-all-sorted-completions)
@@ -2444,14 +2449,12 @@ Also respects the obsolete wrapper hook 
`completion-in-region-functions'.
         (completion-in-region-mode 1))
       (completion--in-region-1 start end))))
 
-(defvar completion-in-region-mode-map
-  (let ((map (make-sparse-keymap)))
-    ;; FIXME: Only works if completion-in-region-mode was activated via
-    ;; completion-at-point called directly.
-    (define-key map "\M-?" 'completion-help-at-point)
-    (define-key map "\t" 'completion-at-point)
-    map)
-  "Keymap activated during `completion-in-region'.")
+(defvar-keymap completion-in-region-mode-map
+  :doc "Keymap activated during `completion-in-region'."
+  ;; FIXME: Only works if completion-in-region-mode was activated via
+  ;; completion-at-point called directly.
+  "M-?" #'completion-help-at-point
+  "TAB" #'completion-at-point)
 
 ;; It is difficult to know when to exit completion-in-region-mode (i.e. hide
 ;; the *Completions*).  Here's how previous packages did it:
@@ -2647,48 +2650,41 @@ The completion method is determined by 
`completion-at-point-functions'."
   (define-key map "\n" 'exit-minibuffer)
   (define-key map "\r" 'exit-minibuffer))
 
-(defvar minibuffer-local-completion-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map minibuffer-local-map)
-    (define-key map "\t" 'minibuffer-complete)
-    ;; M-TAB is already abused for many other purposes, so we should find
-    ;; another binding for it.
-    ;; (define-key map "\e\t" 'minibuffer-force-complete)
-    (define-key map " " 'minibuffer-complete-word)
-    (define-key map "?" 'minibuffer-completion-help)
-    (define-key map [prior] 'switch-to-completions)
-    (define-key map "\M-v"  'switch-to-completions)
-    (define-key map "\M-g\M-c"  'switch-to-completions)
-    map)
-  "Local keymap for minibuffer input with completion.")
-
-(defvar minibuffer-local-must-match-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map minibuffer-local-completion-map)
-    (define-key map "\r" 'minibuffer-complete-and-exit)
-    (define-key map "\n" 'minibuffer-complete-and-exit)
-    map)
-  "Local keymap for minibuffer input with completion, for exact match.")
-
-(defvar minibuffer-local-filename-completion-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map " " nil)
-    map)
-  "Local keymap for minibuffer input with completion for filenames.
+(defvar-keymap minibuffer-local-completion-map
+  :doc "Local keymap for minibuffer input with completion."
+  :parent minibuffer-local-map
+  "TAB"       #'minibuffer-complete
+  "<backtab>" #'minibuffer-complete
+  ;; M-TAB is already abused for many other purposes, so we should find
+  ;; another binding for it.
+  ;; "M-TAB"  #'minibuffer-force-complete
+  "SPC"       #'minibuffer-complete-word
+  "?"         #'minibuffer-completion-help
+  "<prior>"   #'switch-to-completions
+  "M-v"       #'switch-to-completions
+  "M-g M-c"   #'switch-to-completions)
+
+(defvar-keymap minibuffer-local-must-match-map
+  :doc "Local keymap for minibuffer input with completion, for exact match."
+  :parent minibuffer-local-completion-map
+  "RET" #'minibuffer-complete-and-exit
+  "C-j" #'minibuffer-complete-and-exit)
+
+(defvar-keymap minibuffer-local-filename-completion-map
+  :doc "Local keymap for minibuffer input with completion for filenames.
 Gets combined either with `minibuffer-local-completion-map' or
-with `minibuffer-local-must-match-map'.")
+with `minibuffer-local-must-match-map'."
+  "SPC" nil)
 
 (defvar minibuffer-local-filename-must-match-map (make-sparse-keymap))
 (make-obsolete-variable 'minibuffer-local-filename-must-match-map nil "24.1")
 
-(defvar minibuffer-local-ns-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map minibuffer-local-map)
-    (define-key map " "  #'exit-minibuffer)
-    (define-key map "\t" #'exit-minibuffer)
-    (define-key map "?"  #'self-insert-and-exit)
-    map)
-  "Local keymap for the minibuffer when spaces are not allowed.")
+(defvar-keymap minibuffer-local-ns-map
+  :doc "Local keymap for the minibuffer when spaces are not allowed."
+  :parent minibuffer-local-map
+  "SPC" #'exit-minibuffer
+  "TAB" #'exit-minibuffer
+  "?"   #'self-insert-and-exit)
 
 (defun read-no-blanks-input (prompt &optional initial inherit-input-method)
   "Read a string from the terminal, not allowing blanks.
@@ -2709,24 +2705,23 @@ If `inhibit-interaction' is non-nil, this function will 
signal an
 
 ;;; Major modes for the minibuffer
 
-(defvar minibuffer-inactive-mode-map
-  (let ((map (make-keymap)))
-    (suppress-keymap map)
-    (define-key map "e" 'find-file-other-frame)
-    (define-key map "f" 'find-file-other-frame)
-    (define-key map "b" 'switch-to-buffer-other-frame)
-    (define-key map "i" 'info)
-    (define-key map "m" 'mail)
-    (define-key map "n" 'make-frame)
-    (define-key map [mouse-1] 'view-echo-area-messages)
-    ;; So the global down-mouse-1 binding doesn't clutter the execution of the
-    ;; above mouse-1 binding.
-    (define-key map [down-mouse-1] #'ignore)
-    map)
-  "Keymap for use in the minibuffer when it is not active.
+(defvar-keymap minibuffer-inactive-mode-map
+  :doc "Keymap for use in the minibuffer when it is not active.
 The non-mouse bindings in this keymap can only be used in minibuffer-only
 frames, since the minibuffer can normally not be selected when it is
-not active.")
+not active."
+  :full t
+  :suppress t
+  "e" #'find-file-other-frame
+  "f" #'find-file-other-frame
+  "b" #'switch-to-buffer-other-frame
+  "i" #'info
+  "m" #'mail
+  "n" #'make-frame
+  "<mouse-1>"      #'view-echo-area-messages
+  ;; So the global down-mouse-1 binding doesn't clutter the execution of the
+  ;; above mouse-1 binding.
+  "<down-mouse-1>" #'ignore)
 
 (define-derived-mode minibuffer-inactive-mode nil "InactiveMinibuffer"
   :abbrev-table nil          ;abbrev.el is not loaded yet during dump.
diff --git a/lisp/misc.el b/lisp/misc.el
index 39ec9497d7..d85f889ffd 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -1,6 +1,6 @@
 ;;; misc.el --- some nonstandard editing and utility commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: convenience
diff --git a/lisp/misearch.el b/lisp/misearch.el
index 7f3e981bb0..9aef7c30a4 100644
--- a/lisp/misearch.el
+++ b/lisp/misearch.el
@@ -1,6 +1,6 @@
 ;;; misearch.el --- isearch extensions for multi-buffer search  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@jurta.org>
 ;; Keywords: matching
diff --git a/lisp/mouse-copy.el b/lisp/mouse-copy.el
index 38c85064f3..5c70c02578 100644
--- a/lisp/mouse-copy.el
+++ b/lisp/mouse-copy.el
@@ -1,6 +1,6 @@
 ;;; mouse-copy.el --- one-click text copy and move  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: John Heidemann <johnh@ISI.EDU>
 ;; Keywords: mouse
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index 0cdba6b4d0..f515cc8aac 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -1,6 +1,6 @@
 ;;; mouse-drag.el --- use mouse-2 to do a new style of scrolling  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: John Heidemann <johnh@ISI.EDU>
 ;; Keywords: mouse
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 11fdd3f639..1a76b9a0b6 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1,6 +1,6 @@
 ;;; mouse.el --- window system-independent mouse support  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1993-1995, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1999-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: hardware, mouse
@@ -329,21 +329,29 @@ the function `context-menu-filter-function'."
 
     ;; Remove duplicate separators as well as ones at the beginning or
     ;; end of the menu.
-    (let ((l menu) saw-first-item)
+    (let ((l menu) (last-saw-separator t))
       (while (and (consp l)
                   (consp (cdr l)))
-        ;; If the next item is a separator, remove it if 1) we haven't
-        ;; seen any other items yet, or 2) it's followed by either
-        ;; another separator or the end of the list.
-        (if (and (equal (cdr-safe (cadr l)) menu-bar-separator)
-                 (or (not saw-first-item)
-                     (null (caddr l))
-                     (equal (cdr-safe (caddr l)) menu-bar-separator)))
-            (setcdr l (cddr l))
-          ;; The "first item" is any cons cell; this excludes the
-          ;; `keymap' symbol and the menu name.
-          (when (consp (cadr l)) (setq saw-first-item t))
-          (setq l (cdr l)))))
+        (if (equal (cdr-safe (cadr l)) menu-bar-separator)
+            (progn
+              ;; The next item is a separator.  Remove it if the last
+              ;; item we saw was a separator too.
+              (if last-saw-separator
+                  (setcdr l (cddr l))
+                ;; If we didn't delete this separator, update the last
+                ;; separator we saw to this one.
+                (setq last-saw-separator l
+                      l (cdr l))))
+          ;; If the next item is a cons cell, we found a non-separator
+          ;; item.  Don't remove the next separator we see.  We
+          ;; specifically check for cons cells to avoid treating the
+          ;; overall prompt string as a menu item.
+          (when (consp (cadr l))
+            (setq last-saw-separator nil))
+          (setq l (cdr l))))
+      ;; If the last item we saw was a separator, remove it.
+      (when (consp last-saw-separator)
+        (setcdr last-saw-separator (cddr last-saw-separator))))
 
     (when (functionp context-menu-filter-function)
       (setq menu (funcall context-menu-filter-function menu click)))
diff --git a/lisp/mpc.el b/lisp/mpc.el
index c47d4336e5..dc61ce78bd 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1,6 +1,6 @@
 ;;; mpc.el --- A client for the Music Player Daemon   -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: multimedia
diff --git a/lisp/msb.el b/lisp/msb.el
index 1f05e9db58..6e1d03ac27 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -1,6 +1,6 @@
 ;;; msb.el --- customizable buffer-selection with multiple menus  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Lindberg <lars.lindberg@home.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 9d303b7ee3..55d3c7a5d8 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -1,6 +1,6 @@
 ;;; mwheel.el --- Mouse wheel support  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 ;; Keywords: mouse
 ;; Package: emacs
 
@@ -56,7 +56,7 @@
 
 (defcustom mouse-wheel-down-event
   (if (or (featurep 'w32-win) (featurep 'ns-win)
-          (featurep 'haiku-win))
+          (featurep 'haiku-win) (featurep 'pgtk-win))
       'wheel-up
     'mouse-4)
   "Event used for scrolling down."
@@ -77,7 +77,7 @@
 
 (defcustom mouse-wheel-up-event
   (if (or (featurep 'w32-win) (featurep 'ns-win)
-          (featurep 'haiku-win))
+          (featurep 'haiku-win) (featurep 'pgtk-win))
       'wheel-down
     'mouse-5)
   "Event used for scrolling up."
@@ -246,7 +246,7 @@ Also see `mouse-wheel-tilt-scroll'."
 
 (defvar mouse-wheel-left-event
   (if (or (featurep 'w32-win) (featurep 'ns-win)
-          (featurep 'haiku-win))
+          (featurep 'haiku-win) (featurep 'pgtk-win))
       'wheel-left
     'mouse-6)
   "Event used for scrolling left.")
@@ -260,7 +260,7 @@ Also see `mouse-wheel-tilt-scroll'."
 
 (defvar mouse-wheel-right-event
   (if (or (featurep 'w32-win) (featurep 'ns-win)
-          (featurep 'haiku-win))
+          (featurep 'haiku-win) (featurep 'pgtk-win))
       'wheel-right
     'mouse-7)
   "Event used for scrolling right.")
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index a6c256eeba..a6904fc07e 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1,6 +1,6 @@
 ;;; ange-ftp.el --- transparent FTP support for GNU Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1989-1996, 1998, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1989-1996, 1998, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Andy Norman (ange@hplb.hpl.hp.com)
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 2be9c7c025..e4c485eccd 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -1,6 +1,6 @@
 ;;; browse-url.el --- pass a URL to a WWW browser  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Denis Howe <dbh@doc.ic.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
@@ -701,8 +701,10 @@ interactively.  Turn the filename into a URL with function
          (cond ((not (buffer-modified-p)))
                (browse-url-save-file (save-buffer))
                (t (message "%s modified since last save" file))))))
-  (when (file-remote-p file)
-    (setq file (file-local-copy file)))
+  (when (and (file-remote-p file)
+             (not browse-url-temp-file-name))
+    (setq browse-url-temp-file-name (file-local-copy file)
+          file browse-url-temp-file-name))
   (browse-url (browse-url-file-url file))
   (run-hooks 'browse-url-of-file-hook))
 
@@ -787,6 +789,8 @@ See `browse-url' for details."
 
 ;; A generic command to call the current browse-url-browser-function
 
+(declare-function pgtk-backend-display-class "pgtkfns.c" (&optional terminal))
+
 ;;;###autoload
 (defun browse-url (url &rest args)
   "Open URL using a configurable method.
@@ -824,8 +828,17 @@ If ARGS are omitted, the default is to pass
     ;; When connected to various displays, be careful to use the display of
     ;; the currently selected frame, rather than the original start display,
     ;; which may not even exist any more.
-    (if (stringp (frame-parameter nil 'display))
-        (setenv "DISPLAY" (frame-parameter nil 'display)))
+    (let ((dpy (frame-parameter nil 'display))
+          classname)
+      (if (stringp dpy)
+        (cond
+         ((featurep 'pgtk)
+          (setq classname (pgtk-backend-display-class))
+          (if (equal classname "GdkWaylandDisplay")
+              (setenv "WAYLAND_DISPLAY" dpy)
+            (setenv "DISPLAY" dpy)))
+         (t
+          (setenv "DISPLAY" dpy)))))
     (if (functionp function)
         (apply function url args)
       (error "No suitable browser for URL %s" url))))
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 411249767f..6a8bf87967 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -1,6 +1,6 @@
 ;;; dbus.el --- Elisp bindings for D-Bus. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, hardware
@@ -36,6 +36,7 @@
 ;; Declare used subroutines and variables.
 (declare-function dbus-message-internal "dbusbind.c")
 (declare-function dbus--init-bus "dbusbind.c")
+(declare-function libxml-parse-xml-region "xml.c")
 (defvar dbus-message-type-invalid)
 (defvar dbus-message-type-method-call)
 (defvar dbus-message-type-method-return)
diff --git a/lisp/net/dictionary-connection.el 
b/lisp/net/dictionary-connection.el
index b874c488a8..aef3c4efc7 100644
--- a/lisp/net/dictionary-connection.el
+++ b/lisp/net/dictionary-connection.el
@@ -1,6 +1,6 @@
 ;;; dictionary-connection.el --- TCP-based client connection for dictionary  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Torsten Hilbrich <torsten.hilbrich@gmx.net>
 ;; Keywords: network
diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 1d07989ef5..507363cc0f 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -1,6 +1,6 @@
 ;;; dictionary.el --- Client for rfc2229 dictionary servers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Torsten Hilbrich <torsten.hilbrich@gmx.net>
 ;; Keywords: interface, dictionary
diff --git a/lisp/net/dig.el b/lisp/net/dig.el
index 4f0b0df2b7..f7f1500454 100644
--- a/lisp/net/dig.el
+++ b/lisp/net/dig.el
@@ -1,6 +1,6 @@
 ;;; dig.el --- Domain Name System dig interface  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: DNS BIND dig comm
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index 1086bab946..8680fab7c3 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -1,6 +1,6 @@
 ;;; dns.el --- Domain Name Service lookups  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: network comm
diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el
index 7ad92b22af..6a2cd13dd0 100644
--- a/lisp/net/eudc-bob.el
+++ b/lisp/net/eudc-bob.el
@@ -1,6 +1,6 @@
 ;;; eudc-bob.el --- Binary Objects Support for EUDC  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el
index 66db7814ad..3f7d9c0060 100644
--- a/lisp/net/eudc-export.el
+++ b/lisp/net/eudc-export.el
@@ -1,6 +1,6 @@
 ;;; eudc-export.el --- functions to export EUDC query results  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index 43c1a2886f..26afd76805 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -1,6 +1,6 @@
 ;;; eudc-hotlist.el --- hotlist management for EUDC  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el
index b80801717f..3122b26cd8 100644
--- a/lisp/net/eudc-vars.el
+++ b/lisp/net/eudc-vars.el
@@ -1,6 +1,6 @@
 ;;; eudc-vars.el --- Emacs Unified Directory Client  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 14e5c28b2d..6831c4ffe3 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -1,6 +1,6 @@
 ;;; eudc.el --- Emacs Unified Directory Client  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
@@ -46,16 +46,9 @@
 ;;; Code:
 
 (require 'wid-edit)
-
 (require 'cl-lib)
-
-(unless (fboundp 'custom-menu-create)
-  (autoload 'custom-menu-create "cus-edit"))
-
 (require 'eudc-vars)
 
-
-
 ;;{{{      Internal cooking
 
 ;;{{{      Internal variables and compatibility tricks
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index e241a1c2fa..60a3adbc34 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -1,6 +1,6 @@
 ;;; eudcb-bbdb.el --- Emacs Unified Directory Client - BBDB Backend  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el
index fc48656726..365dace961 100644
--- a/lisp/net/eudcb-ldap.el
+++ b/lisp/net/eudcb-ldap.el
@@ -1,6 +1,6 @@
 ;;; eudcb-ldap.el --- Emacs Unified Directory Client - LDAP Backend  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/net/eudcb-mab.el b/lisp/net/eudcb-mab.el
index 732881f75a..b1235cce70 100644
--- a/lisp/net/eudcb-mab.el
+++ b/lisp/net/eudcb-mab.el
@@ -1,6 +1,6 @@
 ;;; eudcb-mab.el --- Emacs Unified Directory Client - AddressBook backend  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@newartisans.com>
 ;; Maintainer: Thomas Fitzsimmons <fitzsim@fitzsim.org>
diff --git a/lisp/net/eudcb-macos-contacts.el b/lisp/net/eudcb-macos-contacts.el
index 18c8958c16..c02b5689e7 100644
--- a/lisp/net/eudcb-macos-contacts.el
+++ b/lisp/net/eudcb-macos-contacts.el
@@ -1,6 +1,6 @@
 ;;; eudcb-macos-contacts.el --- EUDC - macOS Contacts backend  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexander Adolf
 
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e86d21f889..eaa5c11938 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1,6 +1,6 @@
 ;;; eww.el --- Emacs Web Wowser  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: html
@@ -239,7 +239,7 @@ parameter, and should return the (possibly) transformed 
URL."
   :version "29.1")
 
 (defface eww-form-submit
-  '((((type x w32 ns haiku) (class color))     ; Like default mode line
+  '((((type x w32 ns haiku pgtk) (class color))        ; Like default mode line
      :box (:line-width 2 :style released-button)
      :background "#808080" :foreground "black"))
   "Face for eww buffer buttons."
@@ -247,7 +247,7 @@ parameter, and should return the (possibly) transformed 
URL."
   :group 'eww)
 
 (defface eww-form-file
-  '((((type x w32 ns haiku) (class color))     ; Like default mode line
+  '((((type x w32 ns haiku pgtk) (class color))        ; Like default mode line
      :box (:line-width 2 :style released-button)
      :background "#808080" :foreground "black"))
   "Face for eww buffer buttons."
@@ -255,7 +255,7 @@ parameter, and should return the (possibly) transformed 
URL."
   :group 'eww)
 
 (defface eww-form-checkbox
-  '((((type x w32 ns haiku) (class color))     ; Like default mode line
+  '((((type x w32 ns haiku pgtk) (class color))        ; Like default mode line
      :box (:line-width 2 :style released-button)
      :background "lightgrey" :foreground "black"))
   "Face for eww buffer buttons."
@@ -263,7 +263,7 @@ parameter, and should return the (possibly) transformed 
URL."
   :group 'eww)
 
 (defface eww-form-select
-  '((((type x w32 ns haiku) (class color))     ; Like default mode line
+  '((((type x w32 ns haiku pgtk) (class color))        ; Like default mode line
      :box (:line-width 2 :style released-button)
      :background "lightgrey" :foreground "black"))
   "Face for eww buffer buttons."
@@ -710,7 +710,7 @@ The renaming scheme is performed in accordance with
         (shr-target-id
          (goto-char (point-min))
           (let ((match (text-property-search-forward
-                        'shr-target-id shr-target-id t)))
+                        'shr-target-id shr-target-id #'member)))
             (when match
               (goto-char (prop-match-beginning match)))))
         (t
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index 7b1ea2e765..6e3845aec1 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -1,6 +1,6 @@
 ;;; gnutls.el --- Support SSL/TLS connections through GnuTLS  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 ;; Keywords: comm, tls, ssl, encryption
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index 848bad3b0d..99ed14ca8b 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -1,6 +1,6 @@
 ;;; goto-addr.el --- click to browse URL or to send to e-mail address  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Ding <ericding@alum.mit.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/net/hmac-def.el b/lisp/net/hmac-def.el
index 5778857ff8..0c8a29cc39 100644
--- a/lisp/net/hmac-def.el
+++ b/lisp/net/hmac-def.el
@@ -1,6 +1,6 @@
 ;;; hmac-def.el --- A macro for defining HMAC functions.  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1999, 2001, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
 ;; Keywords: HMAC, RFC2104
diff --git a/lisp/net/hmac-md5.el b/lisp/net/hmac-md5.el
index 85a8c51de2..188e6f4d6f 100644
--- a/lisp/net/hmac-md5.el
+++ b/lisp/net/hmac-md5.el
@@ -1,6 +1,6 @@
 ;;; hmac-md5.el --- Compute HMAC-MD5.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999, 2001, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
 ;; Keywords: HMAC, RFC2104, HMAC-MD5, MD5, KEYED-MD5, CRAM-MD5
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index 6ca76f1f99..ac24efdccb 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1,6 +1,6 @@
 ;;; imap.el --- imap library  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: mail
diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el
index 8b35a2d8e1..ce6c270e0b 100644
--- a/lisp/net/ldap.el
+++ b/lisp/net/ldap.el
@@ -1,6 +1,6 @@
 ;;; ldap.el --- client interface to LDAP for Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index 14d49251f5..bf3c8edd1e 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -1,6 +1,6 @@
 ;;; mailcap.el --- MIME media types configuration -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: William M. Perry <wmperry@aventail.com>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index 3feb089ad0..d84763b162 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -1,6 +1,6 @@
 ;;; mairix.el --- Mairix interface for Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: David Engster <dengste@eml.cc>
 ;; Keywords: mail searching
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 6f44d9844e..411b6ed413 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -1,6 +1,6 @@
 ;;; net-utils.el --- network functions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Sun Mar 16 1997
diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el
index 9473c821a1..c272c07e4c 100644
--- a/lisp/net/netrc.el
+++ b/lisp/net/netrc.el
@@ -1,6 +1,6 @@
 ;;; netrc.el --- .netrc parsing functionality  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index 1983688cef..38a5e14c94 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -1,6 +1,6 @@
 ;;; network-stream.el --- open network processes, possibly with encryption -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: network
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index d51f8c0189..a62a7bd8b7 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -1,6 +1,6 @@
 ;;; newst-backend.el --- Retrieval backend for newsticker  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Filename:    newst-backend.el
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index 82977b000b..df574dfa2f 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -1,6 +1,6 @@
 ;;; newst-plainview.el --- Single buffer frontend for newsticker.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Filename:    newst-plainview.el
diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el
index b228ea9a60..7e00ac93e7 100644
--- a/lisp/net/newst-reader.el
+++ b/lisp/net/newst-reader.el
@@ -1,6 +1,6 @@
 ;;; newst-reader.el --- Generic RSS reader functions.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Filename:    newst-reader.el
diff --git a/lisp/net/newst-ticker.el b/lisp/net/newst-ticker.el
index 068b862b69..ef0fe83803 100644
--- a/lisp/net/newst-ticker.el
+++ b/lisp/net/newst-ticker.el
@@ -1,6 +1,6 @@
 ;;; newst-ticker.el --- mode line ticker for newsticker.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Filename:    newst-ticker.el
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index d524e6dd17..80d9fd1cef 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1,6 +1,6 @@
 ;;; newst-treeview.el --- Treeview frontend for newsticker.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Filename:    newst-treeview.el
diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el
index 52576c936a..525cae2140 100644
--- a/lisp/net/newsticker.el
+++ b/lisp/net/newsticker.el
@@ -1,6 +1,6 @@
 ;;; newsticker.el --- A Newsticker for Emacs. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Filename:    newsticker.el
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el
index b067b23f8f..3146189be6 100644
--- a/lisp/net/nsm.el
+++ b/lisp/net/nsm.el
@@ -1,6 +1,6 @@
 ;;; nsm.el --- Network Security Manager  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: encryption, security, network
diff --git a/lisp/net/ntlm.el b/lisp/net/ntlm.el
index 0e0146df96..b58f0abb56 100644
--- a/lisp/net/ntlm.el
+++ b/lisp/net/ntlm.el
@@ -1,6 +1,6 @@
 ;;; ntlm.el --- NTLM (NT LanManager) authentication support  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2001, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Taro Kawagishi <tarok@transpulse.org>
 ;; Maintainer: Thomas Fitzsimmons <fitzsim@fitzsim.org>
@@ -102,9 +102,7 @@ is not given."
   (let ((request-ident (concat "NTLMSSP" (make-string 1 0)))
        (request-msgType (concat (make-string 1 1) (make-string 3 0)))
                                        ;0x01 0x00 0x00 0x00
-       (request-flags (concat (make-string 1 7) (make-string 1 130)
-                              (make-string 1 8) (make-string 1 0)))
-                                       ;0x07 0x82 0x08 0x00
+       (request-flags (unibyte-string #x07 #x82 #x08 #x00))
        )
     (when (and user (string-match "@" user))
       (unless domain
@@ -245,9 +243,7 @@ by PASSWORD-HASHES.  PASSWORD-HASHES should be a return 
value of
         ;;(msgType (substring rchallenge 8 12))        ;msgType, 4 bytes
         (uDomain (substring rchallenge 12 20)) ;uDomain, 8 bytes
         ;; match default setting in `ntlm-build-auth-request'
-        (request-flags (concat (make-string 1 7) (make-string 1 130)
-                               (make-string 1 8) (make-string 1 0)))
-                                       ;0x07 0x82 0x08 0x00
+        (request-flags (unibyte-string #x07 #x82 #x08 #x00))
         (flags (substring rchallenge 20 24))   ;flags, 4 bytes
         (challengeData (substring rchallenge 24 32)) ;challengeData, 8 bytes
          ;; Extract domain string from challenge string.
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el
index a267ac319b..0f6dfb6ad4 100644
--- a/lisp/net/pop3.el
+++ b/lisp/net/pop3.el
@@ -1,6 +1,6 @@
 ;;; pop3.el --- Post Office Protocol (RFC 1460) interface  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index c1833ffdb0..3a276791ab 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -1,6 +1,6 @@
 ;;; puny.el --- translate non-ASCII domain names to ASCII  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail, net
diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el
index ed7d7e53a9..598a7da071 100644
--- a/lisp/net/quickurl.el
+++ b/lisp/net/quickurl.el
@@ -1,6 +1,6 @@
 ;;; quickurl.el --- insert a URL based on text at point in buffer  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Pearson <davep@davep.org>
 ;; Created: 1999-05-28
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 2375b14cca..62e6281e03 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1,6 +1,6 @@
 ;;; rcirc.el --- default, simple IRC client          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Ryan Yeske <rcyeske@gmail.com>
 ;; Maintainers: Ryan Yeske <rcyeske@gmail.com>,
diff --git a/lisp/net/rfc2104.el b/lisp/net/rfc2104.el
index c03ac5a87b..d1535aa700 100644
--- a/lisp/net/rfc2104.el
+++ b/lisp/net/rfc2104.el
@@ -1,6 +1,6 @@
 ;;; rfc2104.el --- RFC2104 Hashed Message Authentication Codes  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <jas@pdc.kth.se>
 ;; Keywords: mail
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el
index a7001c1310..98b660dcc4 100644
--- a/lisp/net/rlogin.el
+++ b/lisp/net/rlogin.el
@@ -1,6 +1,6 @@
 ;;; rlogin.el --- remote login interface  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-1995, 1997-1998, 2001-2021 Free Software
+;; Copyright (C) 1992-1995, 1997-1998, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Noah Friedman <friedman@splode.com>
diff --git a/lisp/net/sasl-cram.el b/lisp/net/sasl-cram.el
index 2427f4976e..ef5699ddc6 100644
--- a/lisp/net/sasl-cram.el
+++ b/lisp/net/sasl-cram.el
@@ -1,6 +1,6 @@
 ;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@gnu.org>
 ;;     Kenichi OKADA <okada@opaopa.org>
diff --git a/lisp/net/sasl-digest.el b/lisp/net/sasl-digest.el
index 3696f526b5..b78beb292c 100644
--- a/lisp/net/sasl-digest.el
+++ b/lisp/net/sasl-digest.el
@@ -1,6 +1,6 @@
 ;;; sasl-digest.el --- DIGEST-MD5 module for the SASL client framework  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;;     Kenichi OKADA <okada@opaopa.org>
diff --git a/lisp/net/sasl-ntlm.el b/lisp/net/sasl-ntlm.el
index 9a5bba5b29..d4c35fc66f 100644
--- a/lisp/net/sasl-ntlm.el
+++ b/lisp/net/sasl-ntlm.el
@@ -1,6 +1,6 @@
 ;;; sasl-ntlm.el --- NTLM (NT Lan Manager) module for the SASL client 
framework  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Taro Kawagishi <tarok@transpulse.org>
 ;; Keywords: SASL, NTLM
diff --git a/lisp/net/sasl-scram-rfc.el b/lisp/net/sasl-scram-rfc.el
index 91d76663ef..ee52ed6e07 100644
--- a/lisp/net/sasl-scram-rfc.el
+++ b/lisp/net/sasl-scram-rfc.el
@@ -1,6 +1,6 @@
 ;;; sasl-scram-rfc.el --- SCRAM-SHA-1 module for the SASL client framework  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Magnus Henoch <magnus.henoch@gmail.com>
 ;; Package: sasl
@@ -90,6 +90,8 @@
                     (sasl-mechanism-name (sasl-client-mechanism client))
                     (sasl-client-name client))))
           (salt (base64-decode-string salt-base64))
+           (string-xor (lambda (a b)
+                         (apply #'unibyte-string (cl-mapcar #'logxor a b))))
           (salted-password
            ;; Hi(str, salt, i):
            (let ((digest (concat salt (string 0 0 0 1)))
@@ -98,7 +100,7 @@
                (setq digest (funcall hmac-fun digest password))
                (setq xored (if (null xored)
                                digest
-                             (cl-map 'string 'logxor xored digest))))))
+                              (funcall string-xor xored digest))))))
           (client-key
            (funcall hmac-fun "Client Key" salted-password))
           (stored-key (decode-hex-string (funcall hash-fun client-key)))
@@ -108,7 +110,7 @@
             step-data ","
             client-final-message-without-proof))
           (client-signature (funcall hmac-fun (encode-coding-string 
auth-message 'utf-8) stored-key))
-          (client-proof (cl-map 'string 'logxor client-key client-signature))
+          (client-proof (funcall string-xor client-key client-signature))
           (client-final-message
            (concat client-final-message-without-proof ","
                    "p=" (base64-encode-string client-proof))))
diff --git a/lisp/net/sasl-scram-sha256.el b/lisp/net/sasl-scram-sha256.el
index c1df988a36..7bd98f200c 100644
--- a/lisp/net/sasl-scram-sha256.el
+++ b/lisp/net/sasl-scram-sha256.el
@@ -1,6 +1,6 @@
 ;;; sasl-scram-sha256.el --- SCRAM-SHA-256 module for the SASL client 
framework  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Package: sasl
diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el
index 0a3ecf9f53..e0def55ad9 100644
--- a/lisp/net/sasl.el
+++ b/lisp/net/sasl.el
@@ -1,6 +1,6 @@
 ;;; sasl.el --- SASL client framework  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@gnu.org>
 ;; Keywords: SASL
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
index 4217c219ad..d8341774e4 100644
--- a/lisp/net/secrets.el
+++ b/lisp/net/secrets.el
@@ -1,6 +1,6 @@
 ;;; secrets.el --- Client interface to gnome-keyring and kwallet. -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm password passphrase
@@ -77,15 +77,17 @@
 ;;   (secrets-delete-collection "my collection")
 ;;   (secrets-create-collection "my collection")
 
-;; There exists a special collection called "session", which has the
-;; lifetime of the corresponding client session (aka Emacs's
-;; lifetime).  It is created automatically when Emacs uses the Secret
-;; Service interface, and it is deleted when Emacs is killed.
+;; With GNOME Keyring, there exists a special collection called
+;; "session", which has the lifetime of the user being logged in.  Its
+;; data are not stored on disk and go away when the user logs out.
 ;; Therefore, it can be used to store and retrieve secret items
-;; temporarily.  This shall be preferred over creation of a persistent
-;; collection, when the information shall not live longer than Emacs.
-;; The session collection can be addressed either by the string
-;; "session", or by nil, whenever a collection parameter is needed.
+;; temporarily.  The "session" collection can be addressed either by
+;; the string "session", or by nil, whenever a collection parameter is
+;; needed.
+
+;; However, other Secret Service provider don't create this temporary
+;; "session" collection.  You shall check first that this collection
+;; exists, before you use it.
 
 ;; As already said, a collection is a group of secret items.  A secret
 ;; item has a label, the "secret" (which is a string), and a set of
@@ -98,8 +100,7 @@
 ;;    => ("this item" "another item")
 
 ;; Secret items can be added or deleted to a collection.  In the
-;; following examples, we use the special collection "session", which
-;; is bound to Emacs's lifetime.
+;; following examples, we use the special collection "session".
 ;;
 ;;   (secrets-delete-item "session" "my item")
 ;;   (secrets-create-item "session" "my item" "geheim"
@@ -137,7 +138,7 @@
 ;; It has been tested with GNOME Keyring 2.29.92.  An implementation
 ;; for KWallet will be available at
 ;; svn://anonsvn.kde.org/home/kde/trunk/playground/base/ksecretservice;
-;; not tested yet.
+;; not tested yet.  This package has also been tested with KeePassXC 2.6.6.
 
 ;; Pacify byte-compiler.  D-Bus support in the Emacs core can be
 ;; disabled with configuration option "--without-dbus".  Declare used
@@ -263,6 +264,7 @@ It returns t if not."
 ;;   </signal>
 ;; </interface>
 
+;; This exist only for GNOME Keyring.
 (defconst secrets-session-collection-path
   "/org/freedesktop/secrets/collection/session"
   "The D-Bus temporary session collection object path.")
@@ -311,43 +313,8 @@ It returns t if not."
 (defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic"
   "The default item type we are using.")
 
-;; We cannot use introspection, because some servers, like
-;; mate-keyring-daemon, don't provide relevant data.  Once the dust
-;; has settled, we shall assume the new interface, and get rid of the test.
-(defconst secrets-struct-secret-content-type
-  (ignore-errors
-    (let ((content-type "text/plain")
-         (path (cadr
-                (dbus-call-method
-                 :session secrets-service secrets-path
-                 secrets-interface-service
-                 "OpenSession" "plain" '(:variant ""))))
-         result)
-      ;; Create a dummy item.
-      (setq result
-           (dbus-call-method
-            :session secrets-service secrets-session-collection-path
-            secrets-interface-collection "CreateItem"
-            ;; Properties.
-            `(:array
-              (:dict-entry ,(concat secrets-interface-item ".Label")
-                           (:variant " ")))
-            ;; Secret.
-            `(:struct :object-path ,path
-                      (:array :signature "y")
-                      ,(dbus-string-to-byte-array " ")
-                      :string ,content-type)
-            ;; Don't replace.
-            nil))
-      ;; Remove it.
-      (dbus-call-method
-       :session secrets-service (car result)
-       secrets-interface-item "Delete")
-      ;; Result.
-      `(,content-type)))
-  "The content_type of a secret struct.
-It must be wrapped as list, because we add it via `append'.  This
-is an interface introduced in 2011.")
+(defconst secrets-struct-secret-content-type "text/plain"
+  "The content_type of a secret struct.")
 
 (defconst secrets-interface-session "org.freedesktop.Secret.Session"
   "A session tracks state between the service and a client application.")
@@ -696,13 +663,10 @@ The object path of the created item is returned."
                `((:dict-entry ,(concat secrets-interface-item ".Attributes")
                               (:variant ,(append '(:array) props))))))
             ;; Secret.
-            (append
-             `(:struct :object-path ,secrets-session-path
-                       (:array :signature "y") ;; No parameters.
-                       ,(dbus-string-to-byte-array password))
-             ;; We add the content_type.  In backward compatibility
-             ;; mode, nil is appended, which means nothing.
-             secrets-struct-secret-content-type)
+            `(:struct :object-path ,secrets-session-path
+                      (:array :signature "y") ;; No parameters.
+                      ,(dbus-string-to-byte-array password)
+                       ,secrets-struct-secret-content-type)
             ;; Do not replace. Replace does not seem to work.
             nil))
       (secrets-prompt (cadr result))
@@ -943,7 +907,7 @@ to their attributes."
    secrets-interface-service "CollectionDeleted"
    'secrets-collection-handler)
 
-  ;; We shall inform, whether the secret service is enabled on this
+  ;; We shall inform, that the secret service is enabled on this
   ;; machine.
   (setq secrets-enabled t))
 
@@ -954,6 +918,7 @@ to their attributes."
 ;; * secrets-debug should be structured like auth-source-debug to
 ;;   prevent leaking sensitive information.  Right now I don't see
 ;;   anything sensitive though.
+
 ;; * Check, whether the dh-ietf1024-aes128-cbc-pkcs7 algorithm can be
 ;;   used for the transfer of the secrets.  Currently, we use the
 ;;   plain algorithm.
diff --git a/lisp/net/shr-color.el b/lisp/net/shr-color.el
index aa92c365f8..e68e4a6933 100644
--- a/lisp/net/shr-color.el
+++ b/lisp/net/shr-color.el
@@ -1,6 +1,6 @@
 ;;; shr-color.el --- Simple HTML Renderer color management  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <julien@danjou.info>
 ;; Keywords: html
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 5f31f03430..7363874cf3 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1,6 +1,6 @@
 ;;; shr.el --- Simple HTML Renderer -*- lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: html
@@ -57,8 +57,15 @@ fit these criteria."
   :version "24.1"
   :type 'float)
 
+(defcustom shr-allowed-images nil
+  "If non-nil, only images that match this regexp are displayed.
+If nil, all URLs are allowed.  Also see `shr-blocked-images'."
+  :version "29.1"
+  :type '(choice (const nil) regexp))
+
 (defcustom shr-blocked-images nil
-  "Images that have URLs matching this regexp will be blocked."
+  "Images that have URLs matching this regexp will be blocked.
+If nil, no images are blocked.  Also see `shr-allowed-images'."
   :version "24.1"
   :type '(choice (const nil) regexp))
 
@@ -255,6 +262,7 @@ and other things:
 
 (defvar shr-target-id nil
   "Target fragment identifier anchor.")
+(defvar shr--link-targets nil)
 
 (defvar-keymap shr-map
   "a" #'shr-show-alt-text
@@ -347,6 +355,7 @@ DOM should be a parse tree as generated by
               (* shr-width (frame-char-width)))
            (shr--window-width)))
         (max-specpdl-size max-specpdl-size)
+        (shr--link-targets nil)
         ;; `bidi-display-reordering' is supposed to be only used for
         ;; debugging purposes, but Shr's naïve filling algorithm
         ;; cannot cope with the complexity of RTL text in an LTR
@@ -370,9 +379,22 @@ DOM should be a parse tree as generated by
     (shr-descend dom)
     (shr-fill-lines start (point))
     (shr--remove-blank-lines-at-the-end start (point))
+    (shr--set-target-ids shr--link-targets)
     (when shr-warning
       (message "%s" shr-warning))))
 
+(defun shr--set-target-ids (ids)
+  ;; If the buffer is empty, there's no point in setting targets.
+  (unless (zerop (buffer-size))
+    ;; We may have several targets in the same place (if you have
+    ;; several <span id='foo'> things after one another).  So group
+    ;; them by position.
+    (dolist (group (seq-group-by #'cdr ids))
+      (let ((point (min (1- (point-max)) (car group))))
+        (put-text-property point (1+ point)
+                           'shr-target-id
+                           (mapcar #'car (cdr group)))))))
+
 (defun shr--remove-blank-lines-at-the-end (start end)
   (save-restriction
     (save-excursion
@@ -552,6 +574,12 @@ size, and full-buffer size."
        (shr-insert sub)
       (shr-descend sub))))
 
+(defun shr-image-blocked-p (url)
+  (or (and shr-blocked-images
+           (string-match shr-blocked-images url))
+      (and shr-allowed-images
+           (not (string-match shr-allowed-images url)))))
+
 (defun shr-indirect-call (tag-name dom &rest args)
   (let ((function (intern (concat "shr-tag-" (symbol-name tag-name)) obarray))
        ;; Allow other packages to override (or provide) rendering
@@ -601,16 +629,8 @@ size, and full-buffer size."
                (funcall function dom))
               (t
                (shr-generic dom)))
-        (when-let* ((id (dom-attr dom 'id)))
-         ;; If the element was empty, we don't have anything to put the
-         ;; anchor on.  So just insert a dummy character.
-         (when (= start (point))
-            (if (not (bolp))
-                (insert ? )
-              (insert ? )
-              (shr-mark-fill start))
-            (put-text-property (1- (point)) (point) 'display ""))
-          (put-text-property (1- (point)) (point) 'shr-target-id id))
+        (when-let ((id (dom-attr dom 'id)))
+          (push (cons id (point)) shr--link-targets))
        ;; If style is set, then this node has set the color.
        (when style
          (shr-colorize-region
@@ -837,9 +857,9 @@ size, and full-buffer size."
          shr-base))
   (when (zerop (length url))
     (setq url nil))
-  ;; Strip leading whitespace
-  (and url (string-match "\\`\\s-+" url)
-       (setq url (substring url (match-end 0))))
+  ;; Strip leading/trailing whitespace.
+  (when url
+    (setq url (string-trim url)))
   (cond ((zerop (length url))
          (nth 3 base))
         ((or (not base)
@@ -880,22 +900,6 @@ size, and full-buffer size."
               (looking-at " *$")))
        ;; We're already at a new paragraph; do nothing.
        )
-       ((and (not (bolp))
-             (save-excursion
-               (beginning-of-line)
-               (looking-at " *$"))
-            (save-excursion
-              (forward-line -1)
-              (looking-at " *$"))
-             ;; Check all chars on the current line and see whether
-             ;; they're all placeholders.
-             (cl-loop for pos from (line-beginning-position) upto (1- (point))
-                      unless (get-text-property pos 'shr-target-id)
-                      return nil
-                      finally return t))
-       ;; We have some invisible markers from <div id="foo"></div>;
-       ;; do nothing.
-       )
        ((and prefix
             (= prefix (- (point) (line-beginning-position))))
        ;; Do nothing; we're at the start of a <li>.
@@ -1165,7 +1169,7 @@ Return a string with image data."
     ;; SVG images may contain references to further images that we may
     ;; want to block.  So special-case these by parsing the XML data
     ;; and remove anything that looks like a blocked bit.
-    (when (and shr-blocked-images
+    (when (and (or shr-allowed-images shr-blocked-images)
                (eq content-type 'image/svg+xml))
       (setq data
             ;; Note that libxml2 doesn't parse everything perfectly,
@@ -1344,8 +1348,7 @@ ones, in case fg and bg are nil."
        ((or (not (eq (dom-tag elem) 'image))
            ;; Filter out blocked elements inside the SVG image.
            (not (setq url (dom-attr elem ':xlink:href)))
-           (not shr-blocked-images)
-           (not (string-match-p shr-blocked-images url)))
+           (not (shr-image-blocked-p url)))
        (insert " ")
        (shr-dom-print elem)))))
   (insert (format "</%s>" (dom-tag dom))))
@@ -1460,13 +1463,9 @@ ones, in case fg and bg are nil."
        (start (point))
        shr-start)
     (shr-generic dom)
-    (when-let* ((id (unless (dom-attr dom 'id) ; Handled by `shr-descend'.
-                      (dom-attr dom 'name))))  ; Obsolete since HTML5.
-      ;; We have an empty element, so just insert... something.
-      (when (= start (point))
-        (insert ?\s)
-        (put-text-property (1- (point)) (point) 'display ""))
-      (put-text-property start (1+ start) 'shr-target-id id))
+    (when-let* ((id (and (not (dom-attr dom 'id)) ; Handled by `shr-descend'.
+                         (dom-attr dom 'name)))) ; Obsolete since HTML5.
+      (push (cons id (point)) shr--link-targets))
     (when url
       (shr-urlify (or shr-start start) (shr-expand-url url) title))))
 
@@ -1651,8 +1650,7 @@ The preference is a float determined from 
`shr-prefer-media-type'."
              (funcall shr-put-image-function image alt
                        (list :width width :height height)))))
         ((or shr-inhibit-images
-             (and shr-blocked-images
-                  (string-match-p shr-blocked-images url)))
+             (shr-image-blocked-p url))
          (setq shr-start (point))
           (shr-insert alt))
         ((and (not shr-ignore-cache)
@@ -2459,6 +2457,7 @@ flags that control whether to collect or render objects."
          (style (dom-attr dom 'style))
          (shr-stylesheet shr-stylesheet)
          (max-width 0)
+          (shr--link-targets nil)
          natural-width)
       (when style
        (setq style (and (string-search "color" style)
@@ -2500,6 +2499,7 @@ flags that control whether to collect or render objects."
         (end-of-line)
         (point)))
       (goto-char (point-min))
+      (shr--set-target-ids shr--link-targets)
       (list max-width
            natural-width
            (count-lines (point-min) (point-max))
diff --git a/lisp/net/sieve-manage.el b/lisp/net/sieve-manage.el
index 64544bcf15..468bc90a9d 100644
--- a/lisp/net/sieve-manage.el
+++ b/lisp/net/sieve-manage.el
@@ -1,6 +1,6 @@
 ;;; sieve-manage.el --- Implementation of the managesieve protocol in elisp  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;;         Albert Krewinkel <tarleb@moltkeplatz.de>
diff --git a/lisp/net/sieve-mode.el b/lisp/net/sieve-mode.el
index 70cebd3039..58fd41d899 100644
--- a/lisp/net/sieve-mode.el
+++ b/lisp/net/sieve-mode.el
@@ -1,6 +1,6 @@
 ;;; sieve-mode.el --- Sieve code editing commands for Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el
index 99bc0a7acd..630ea04070 100644
--- a/lisp/net/sieve.el
+++ b/lisp/net/sieve.el
@@ -1,6 +1,6 @@
 ;;; sieve.el --- Utilities to manage sieve scripts  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
diff --git a/lisp/net/snmp-mode.el b/lisp/net/snmp-mode.el
index 10892ebf61..de84b4f8dd 100644
--- a/lisp/net/snmp-mode.el
+++ b/lisp/net/snmp-mode.el
@@ -1,6 +1,6 @@
 ;;; snmp-mode.el --- SNMP & SNMPv2 MIB major mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1995, 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Paul D. Smith <psmith@BayNetworks.com>
 ;; Keywords: data
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index b4aed27981..d2092633d8 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -1,6 +1,6 @@
 ;;; soap-client.el --- Access SOAP web services       -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
 ;; Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
@@ -718,10 +718,9 @@ representing leap seconds."
                 second)
               minute hour day month year second-fraction datatype time-zone)
       (let ((time
-             (apply
-              #'encode-time (list
-                             (if new-decode-time new-decode-time-second second)
-                             minute hour day month year nil nil time-zone))))
+            (encode-time (list
+                          (if new-decode-time new-decode-time-second second)
+                          minute hour day month year nil nil time-zone))))
         (if new-decode-time
             (with-no-warnings (decode-time time nil t))
           (decode-time time))))))
diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el
index eca338eb22..85fd7a71dc 100644
--- a/lisp/net/soap-inspect.el
+++ b/lisp/net/soap-inspect.el
@@ -1,6 +1,6 @@
 ;;; soap-inspect.el --- Interactive WSDL inspector    -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
 ;; Created: October 2010
diff --git a/lisp/net/socks.el b/lisp/net/socks.el
index be299603a8..8df0773e1d 100644
--- a/lisp/net/socks.el
+++ b/lisp/net/socks.el
@@ -1,6 +1,6 @@
 ;;; socks.el --- A Socks v5 Client for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2000, 2002, 2007-2021 Free Software Foundation,
+;; Copyright (C) 1996-2000, 2002, 2007-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: William M. Perry <wmperry@gnu.org>
diff --git a/lisp/net/telnet.el b/lisp/net/telnet.el
index 1cf07a5cce..0d54d2220b 100644
--- a/lisp/net/telnet.el
+++ b/lisp/net/telnet.el
@@ -1,6 +1,6 @@
 ;;; telnet.el --- run a telnet session from within an Emacs buffer  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2021 Free Software
+;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: William F. Schelter
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 341357d404..ed73a86ef0 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1,6 +1,6 @@
 ;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Jürgen Hötzel <juergen@archlinux.org>
 ;; Keywords: comm, processes
@@ -415,6 +415,8 @@ Emacs dired can't find files."
 (defun tramp-adb-ls-output-time-less-p (a b)
   "Sort \"ls\" output by time, descending."
   (let (time-a time-b)
+    ;; Once we can assume Emacs 27 or later, the two calls
+    ;; (apply #'encode-time X) can be replaced by (encode-time X).
     (string-match tramp-adb-ls-date-regexp a)
     (setq time-a (apply #'encode-time (parse-time-string (match-string 0 a))))
     (string-match tramp-adb-ls-date-regexp b)
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index b44a4e86aa..8a88057d38 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -1,6 +1,6 @@
 ;;; tramp-archive.el --- Tramp archive manager  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -575,9 +575,8 @@ offered."
    preserve-uid-gid preserve-extended-attributes)
   "Like `copy-file' for file archives."
   (when (tramp-archive-file-name-p newname)
-    (tramp-error
-     (tramp-archive-dissect-file-name newname) 'file-error
-      "Permission denied: %s" newname))
+    (tramp-compat-permission-denied
+     (tramp-archive-dissect-file-name newname) newname))
   (copy-file
    (tramp-archive-gvfs-file-name filename) newname ok-if-already-exists
    keep-date preserve-uid-gid preserve-extended-attributes))
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index b909c5706d..715b537247 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -1,6 +1,6 @@
 ;;; tramp-cache.el --- file information caching for Tramp  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2000, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pittman <daniel@inanna.danann.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 2eaebebed9..c18ab4972d 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -1,6 +1,6 @@
 ;;; tramp-cmds.el --- Interactive commands for Tramp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 627ff1edae..0a45b12a04 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -1,6 +1,6 @@
 ;;; tramp-compat.el --- Tramp compatibility functions  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -272,6 +272,17 @@ CONDITION can also be a list of error conditions."
                          (car components))
                 (cdr components)))))))
 
+;; `permission-denied' is introduced in Emacs 29.1.
+(defconst tramp-permission-denied
+  (if (get 'permission-denied 'error-conditions) 'permission-denied 
'file-error)
+  "The error symbol for the `permission-denied' error.")
+
+(defsubst tramp-compat-permission-denied (vec file)
+  "Emit the `permission-denied' error."
+  (if (get 'permission-denied 'error-conditions)
+      (tramp-error vec tramp-permission-denied file)
+    (tramp-error vec tramp-permission-denied "Permission denied: %s" file)))
+
 (dolist (elt (all-completions "tramp-compat-" obarray 'functionp))
   (put (intern elt) 'tramp-suppress-trace t))
 
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 4ff8e6bbf1..36443e0983 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -1,6 +1,6 @@
 ;;; tramp-crypt.el --- Tramp crypt utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -323,7 +323,7 @@ connection if a previous connection has died for some 
reason."
           tramp-crypt-encfs-config (tramp-crypt-get-remote-dir vec)))
         (local-config (tramp-crypt-config-file-name vec)))
     ;; There is no local encfs6 config file.
-    (when (not (file-exists-p local-config))
+    (unless (file-exists-p local-config)
       (if (and tramp-crypt-save-encfs-config-remote
               (file-exists-p remote-config))
          ;; Copy remote encfs6 config file if possible.
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index f78c08ec41..ff8caa570c 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -1,6 +1,6 @@
 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el
index cb270be68f..2a73d5aa02 100644
--- a/lisp/net/tramp-fuse.el
+++ b/lisp/net/tramp-fuse.el
@@ -1,6 +1,6 @@
 ;;; tramp-fuse.el --- Tramp access functions for FUSE mounts  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 6b0299aa09..221ee547a2 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1,6 +1,6 @@
 ;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -1524,8 +1524,10 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
       (when (or size free)
        (list (and size (string-to-number size))
              (and free (string-to-number free))
-             (and size used
-                  (- (string-to-number size) (string-to-number used))))))))
+             ;; "mtp" connections do not return "filesystem::used".
+             (or (and size used
+                      (- (string-to-number size) (string-to-number used)))
+                 (and free (string-to-number free))))))))
 
 (defun tramp-gvfs-handle-make-directory (dir &optional parents)
   "Like `make-directory' for Tramp files."
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 238abd3423..03a2c2457a 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -1,6 +1,6 @@
 ;;; tramp-integration.el --- Tramp integration into other packages  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 71ec2607a3..259e85a04a 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -1,6 +1,6 @@
 ;;; tramp-rclone.el --- Tramp access functions to cloud storages  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 72eb63d392..72b1ebb3e0 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1,6 +1,6 @@
 ;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; (copyright statements below in code to be updated with the above notice)
 
@@ -741,7 +741,7 @@ characters need to be doubled.")
 (defconst tramp-perl-encode
   "%p -e '
 # This script contributed by Juanma Barranquero <lektu@terra.es>.
-# Copyright (C) 2002-2021 Free Software Foundation, Inc.
+# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 use strict;
 
 my %%trans = do {
@@ -780,7 +780,7 @@ characters need to be doubled.")
 (defconst tramp-perl-decode
   "%p -e '
 # This script contributed by Juanma Barranquero <lektu@terra.es>.
-# Copyright (C) 2002-2021 Free Software Foundation, Inc.
+# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 use strict;
 
 my %%trans = do {
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 34203076b2..c5f423fa3f 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1,6 +1,6 @@
 ;;; tramp-smb.el --- Tramp access functions for SMB servers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index ef1f302546..0a5bf2f43b 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -1,6 +1,6 @@
 ;;; tramp-sshfs.el --- Tramp access functions via sshfs  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 88e8c43534..a68d4b3e36 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -1,6 +1,6 @@
 ;;; tramp-sudoedit.el --- Functions for accessing under root permissions  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 5171b9d181..e849c36d13 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,6 +1,6 @@
 ;;; tramp-uu.el --- uuencode in Lisp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6b05dadc0e..adde443fdd 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1,6 +1,6 @@
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
@@ -1874,8 +1874,9 @@ version, the function does nothing."
 
 (defsubst tramp-get-buffer-string (&optional buffer)
   "Return contents of BUFFER.
-If BUFFER is not a buffer, return the contents of `current-buffer'."
-  (with-current-buffer (if (bufferp buffer) buffer (current-buffer))
+If BUFFER is not a buffer or a buffer name, return the contents
+of `current-buffer'."
+  (with-current-buffer (or buffer (current-buffer))
     (substring-no-properties (buffer-string))))
 
 (put #'tramp-get-buffer-string 'tramp-suppress-trace t)
@@ -3362,8 +3363,8 @@ User is always nil."
             (if (file-directory-p filename)
                 #'file-accessible-directory-p #'file-readable-p)
             filename)
-         (tramp-error
-          v 'file-error (format "%s: Permission denied, %s" string filename)))
+         (tramp-compat-permission-denied
+          v (format "%s: Permission denied, %s" string filename)))
       (tramp-error
        v 'file-missing
        (format "%s: No such file or directory, %s" string filename)))))
@@ -3964,7 +3965,7 @@ Return nil when there is no lockfile."
 
 (defvar tramp-lock-pid nil
   "A random nunber local for every connection.
-Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'")
+Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
 
 (defun tramp-get-lock-pid (file)
   "Determine pid for lockfile of FILE."
@@ -3985,9 +3986,11 @@ Do not set it manually, it is used buffer-local in 
`tramp-get-lock-pid'")
   "Like `file-locked-p' for Tramp files."
   (when-let ((info (tramp-get-lock-file file))
             (match (string-match tramp-lock-file-info-regexp info)))
-    (or (and (string-equal (match-string 1 info) (user-login-name))
+    (or ; Locked by me.
+        (and (string-equal (match-string 1 info) (user-login-name))
             (string-equal (match-string 2 info) (system-name))
             (string-equal (match-string 3 info) (tramp-get-lock-pid file)))
+       ; User name.
        (match-string 1 info))))
 
 (defun tramp-handle-lock-file (file)
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 6dc5da229c..e3bcd568d7 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -1,7 +1,7 @@
 ;;; trampver.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 ;;; lisp/trampver.el.  Generated from trampver.el.in by configure.
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el
index d14d382aac..b2ef47898c 100644
--- a/lisp/net/webjump.el
+++ b/lisp/net/webjump.el
@@ -1,6 +1,6 @@
 ;;; webjump.el --- programmable Web hotlist  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author:     Neil W. Van Dyke <nwv@acm.org>
 ;; Maintainer: emacs-devel@gnu.org
@@ -61,6 +61,13 @@
 
 ;;; Code:
 
+;; TODO:
+;; - Add a menu bar and tool bar for this library.
+;; - Add commands to create/delete link from the hotlist.
+;; - Add something like a bookmark folder in modern browsers.
+;;    - Add a command that can open/follow all links in a folder.
+;; - Add tags for Web sites in the hotlist.
+
 ;;-------------------------------------------------------- Package Dependencies
 
 (require 'browse-url)
diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el
index 98be0e0158..8345748cba 100644
--- a/lisp/net/zeroconf.el
+++ b/lisp/net/zeroconf.el
@@ -1,6 +1,6 @@
 ;;; zeroconf.el --- Service browser using Avahi.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, hardware
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 52e7f09b69..95adf9f90a 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1,6 +1,6 @@
 ;;; newcomment.el --- (un)comment regions of buffers -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: code extracted from Emacs-20's simple.el
 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
diff --git a/lisp/notifications.el b/lisp/notifications.el
index c1b83dc155..5ad64ff73b 100644
--- a/lisp/notifications.el
+++ b/lisp/notifications.el
@@ -1,6 +1,6 @@
 ;;; notifications.el --- Client interface to desktop notifications.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <julien@danjou.info>
 ;; Keywords: comm desktop notifications
diff --git a/lisp/novice.el b/lisp/novice.el
index 16766c253c..3a3596e30f 100644
--- a/lisp/novice.el
+++ b/lisp/novice.el
@@ -1,6 +1,6 @@
 ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -43,71 +43,65 @@ If nil, the feature is disabled, i.e., all commands work 
normally.")
 ;; because we won't get called otherwise.
 ;;;###autoload
 (defun disabled-command-function (&optional cmd keys)
-  (unless cmd (setq cmd this-command))
-  (unless keys (setq keys (this-command-keys)))
-  (let (char)
-    (save-window-excursion
-      (with-output-to-temp-buffer "*Disabled Command*" ;; (help-buffer)
-        (if (or (eq (aref keys 0)
-                    (if (stringp keys)
-                        (aref "\M-x" 0)
-                      ?\M-x))
-                (and (>= (length keys) 2)
-                     (eq (aref keys 0) meta-prefix-char)
-                     (eq (aref keys 1) ?x)))
-           (princ (format "You have invoked the disabled command %s.\n" cmd))
-          (princ (format "You have typed %s, invoking disabled command %s.\n"
-                        (key-description keys) cmd)))
-       ;; Print any special message saying why the command is disabled.
-       (if (stringp (get cmd 'disabled))
-           (princ (get cmd 'disabled))
-        (princ "It is disabled because new users often find it confusing.\n")
-        (princ (substitute-command-keys
-                "Here's the first part of its description:\n\n"))
-        ;; Keep only the first paragraph of the documentation.
-          (with-current-buffer "*Disabled Command*" ;; standard-output
-          (goto-char (point-max))
-          (let ((start (point)))
-            (save-excursion
-              (princ (or (condition-case ()
-                              (documentation cmd)
-                           (error nil))
-                         "<< not documented >>")))
-            (if (search-forward "\n\n" nil t)
-                (delete-region (match-beginning 0) (point-max)))
-            (goto-char (point-max))
-            (indent-rigidly start (point) 3))))
-       (princ "\n\nDo you want to use this command anyway?\n\n")
-       (princ (substitute-command-keys "You can now type
-y   to try it and enable it (no questions if you use it again).
-n   to cancel--don't try the command, and it remains disabled.
-SPC to try the command just this once, but leave it disabled.
-!   to try it, and enable all disabled commands for this session only."))
-        ;; Redundant since with-output-to-temp-buffer will do it anyway.
-        ;; (with-current-buffer standard-output
-        ;;   (help-mode))
-        )
-     (fit-window-to-buffer (get-buffer-window "*Disabled Command*"))
-     (message "Type y, n, ! or SPC (the space bar): ")
-     (let ((cursor-in-echo-area t))
-       (while (progn (setq char (read-event))
-                    (or (not (numberp char))
-                        (not (memq (downcase char)
-                                   '(?! ?y ?n ?\s ?\C-g)))))
-        (ding)
-        (message "Please type y, n, ! or SPC (the space bar): "))))
-    (setq char (downcase char))
+  (let* ((cmd (or cmd this-command))
+         (keys (or keys (this-command-keys)))
+         (help-string
+          (concat
+           (if (or (eq (aref keys 0)
+                       (if (stringp keys)
+                           (aref "\M-x" 0)
+                         ?\M-x))
+                   (and (>= (length keys) 2)
+                        (eq (aref keys 0) meta-prefix-char)
+                        (eq (aref keys 1) ?x)))
+               (format "You have invoked the disabled command %s.\n" cmd)
+             (substitute-command-keys
+              (format "You have typed \\`%s', invoking disabled command %s.\n"
+                      (key-description keys) cmd)))
+           ;; Any special message saying why the command is disabled.
+           (if (stringp (get cmd 'disabled))
+               (get cmd 'disabled)
+             (concat
+              "It is disabled because new users often find it confusing.\n"
+              (substitute-command-keys
+               "Here's the first part of its description:\n\n")
+              ;; Keep only the first paragraph of the documentation.
+              (with-temp-buffer
+                (insert (condition-case ()
+                            (documentation cmd)
+                          (error "<< not documented >>")))
+                (goto-char (point-min))
+                (when (search-forward "\n\n" nil t)
+                  (delete-region (match-beginning 0) (point-max)))
+                (indent-rigidly (point-min) (point-max) 3)
+                (buffer-string))))
+           (substitute-command-keys "\n
+Do you want to use this command anyway?
+
+You can now type:
+ \\`y'    to try it and enable it (no questions if you use it again).
+ \\`n'    to cancel--don't try the command, and it remains disabled.
+ \\`SPC'  to try the command just this once, but leave it disabled.
+ \\`!'    to try it, and enable all disabled commands for this session 
only.")))
+         (char
+          (car (read-multiple-choice "Use this command?"
+                                     '((?y "yes")
+                                       (?n "no")
+                                       (?! "yes; enable for session")
+                                       (?\s "(space bar) yes; once"))
+                                     help-string
+                                     "*Disabled Command*"))))
     (pcase char
-     (?\C-g (setq quit-flag t))
-     (?! (setq disabled-command-function nil))
-     (?y
-       (if (and user-init-file
-                (not (string= "" user-init-file))
-                (y-or-n-p "Enable command for future editing sessions also? "))
-         (enable-command cmd)
-       (put cmd 'disabled nil))))
-    (or (char-equal char ?n)
-        (call-interactively cmd))))
+      (?\C-g (setq quit-flag t))
+      (?! (setq disabled-command-function nil))
+      (?y
+       (if (and user-init-file
+                (not (string= "" user-init-file))
+                (y-or-n-p "Enable command for future editing sessions also? "))
+           (enable-command cmd)
+         (put cmd 'disabled nil))))
+    (unless (char-equal char ?n)
+      (call-interactively cmd))))
 
 (defun en/disable-command (command disable)
   (unless (commandp command)
diff --git a/lisp/nxml/nxml-enc.el b/lisp/nxml/nxml-enc.el
index abdc2e4ab2..493808fcdb 100644
--- a/lisp/nxml/nxml-enc.el
+++ b/lisp/nxml/nxml-enc.el
@@ -1,6 +1,6 @@
 ;;; nxml-enc.el --- XML encoding auto-detection  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-maint.el b/lisp/nxml/nxml-maint.el
index 24a3c5c6db..974deef406 100644
--- a/lisp/nxml/nxml-maint.el
+++ b/lisp/nxml/nxml-maint.el
@@ -1,6 +1,6 @@
 ;;; nxml-maint.el --- commands for maintainers of nxml-*.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 98ce1d6993..b8f6cb5ad3 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -1,6 +1,6 @@
 ;;; nxml-mode.el --- a new XML mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-ns.el b/lisp/nxml/nxml-ns.el
index 93ffb215fb..509d88c7b1 100644
--- a/lisp/nxml/nxml-ns.el
+++ b/lisp/nxml/nxml-ns.el
@@ -1,6 +1,6 @@
 ;;; nxml-ns.el --- XML namespace processing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index 681b297b48..928338a6af 100644
--- a/lisp/nxml/nxml-outln.el
+++ b/lisp/nxml/nxml-outln.el
@@ -1,6 +1,6 @@
 ;;; nxml-outln.el --- outline support for nXML mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el
index d2eb4f1feb..ff9eda3fd2 100644
--- a/lisp/nxml/nxml-parse.el
+++ b/lisp/nxml/nxml-parse.el
@@ -1,6 +1,6 @@
 ;;; nxml-parse.el --- XML parser, sharing infrastructure with nxml-mode  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index fa127da874..553ac57cc3 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -1,6 +1,6 @@
 ;;; nxml-rap.el --- low-level support for random access parsing for nXML mode  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-util.el b/lisp/nxml/nxml-util.el
index 022d6c5f29..662d43842e 100644
--- a/lisp/nxml/nxml-util.el
+++ b/lisp/nxml/nxml-util.el
@@ -1,6 +1,6 @@
 ;;; nxml-util.el --- utility functions for nxml-*.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el
index 1476aa0e5a..453c2b736d 100644
--- a/lisp/nxml/rng-cmpct.el
+++ b/lisp/nxml/rng-cmpct.el
@@ -1,6 +1,6 @@
 ;;; rng-cmpct.el --- parsing of RELAX NG Compact Syntax schemas  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-dt.el b/lisp/nxml/rng-dt.el
index 25d838ce44..b88653f79e 100644
--- a/lisp/nxml/rng-dt.el
+++ b/lisp/nxml/rng-dt.el
@@ -1,6 +1,6 @@
 ;;; rng-dt.el --- datatype library interface for RELAX NG  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el
index c8b19e8c22..0fa455cbb5 100644
--- a/lisp/nxml/rng-loc.el
+++ b/lisp/nxml/rng-loc.el
@@ -1,6 +1,6 @@
 ;;; rng-loc.el --- Locate the schema to use for validation  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el
index 82d716d95c..3b4593760b 100644
--- a/lisp/nxml/rng-maint.el
+++ b/lisp/nxml/rng-maint.el
@@ -1,6 +1,6 @@
 ;;; rng-maint.el --- commands for RELAX NG maintainers  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el
index 7a2739c061..e767a9333b 100644
--- a/lisp/nxml/rng-match.el
+++ b/lisp/nxml/rng-match.el
@@ -1,6 +1,6 @@
 ;;; rng-match.el --- matching of RELAX NG patterns against XML events  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-nxml.el b/lisp/nxml/rng-nxml.el
index 35faae3062..ccbf4d8de2 100644
--- a/lisp/nxml/rng-nxml.el
+++ b/lisp/nxml/rng-nxml.el
@@ -1,6 +1,6 @@
 ;;; rng-nxml.el --- make nxml-mode take advantage of rng-validate-mode  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-parse.el b/lisp/nxml/rng-parse.el
index f72f33282e..76cb94b144 100644
--- a/lisp/nxml/rng-parse.el
+++ b/lisp/nxml/rng-parse.el
@@ -1,6 +1,6 @@
 ;;; rng-parse.el --- parse an XML file and validate it against a schema  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-pttrn.el b/lisp/nxml/rng-pttrn.el
index 034671feeb..614b59f807 100644
--- a/lisp/nxml/rng-pttrn.el
+++ b/lisp/nxml/rng-pttrn.el
@@ -1,6 +1,6 @@
 ;;; rng-pttrn.el --- RELAX NG patterns  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index 24f4d2ec44..77fed8c32d 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -1,6 +1,6 @@
 ;;; rng-uri.el --- URI parsing and manipulation  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el
index 67e2ee9f1e..74f405410a 100644
--- a/lisp/nxml/rng-util.el
+++ b/lisp/nxml/rng-util.el
@@ -1,6 +1,6 @@
 ;;; rng-util.el --- utility functions for RELAX NG library  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 9df20a16b1..56ff3b66c0 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -1,6 +1,6 @@
 ;;; rng-valid.el --- real-time validation of XML using RELAX NG  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-xsd.el b/lisp/nxml/rng-xsd.el
index e4c76b220a..bca432d92b 100644
--- a/lisp/nxml/rng-xsd.el
+++ b/lisp/nxml/rng-xsd.el
@@ -1,6 +1,6 @@
 ;;; rng-xsd.el --- W3C XML Schema datatypes library for RELAX NG  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el
index ecad501a64..ecdf510782 100644
--- a/lisp/nxml/xmltok.el
+++ b/lisp/nxml/xmltok.el
@@ -1,6 +1,6 @@
 ;;; xmltok.el --- XML tokenization  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/xsd-regexp.el b/lisp/nxml/xsd-regexp.el
index d6eaf7cc4b..003410577a 100644
--- a/lisp/nxml/xsd-regexp.el
+++ b/lisp/nxml/xsd-regexp.el
@@ -1,6 +1,6 @@
 ;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, regexp
diff --git a/lisp/obarray.el b/lisp/obarray.el
index ef2ddb3989..dd62de01a8 100644
--- a/lisp/obarray.el
+++ b/lisp/obarray.el
@@ -1,6 +1,6 @@
 ;;; obarray.el --- obarray functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: obarray functions
diff --git a/lisp/obsolete/abbrevlist.el b/lisp/obsolete/abbrevlist.el
index c9c0956903..ca508a1554 100644
--- a/lisp/obsolete/abbrevlist.el
+++ b/lisp/obsolete/abbrevlist.el
@@ -1,6 +1,6 @@
 ;;; abbrevlist.el --- list one abbrev table alphabetically ordered  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1986, 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1992, 2001-2022 Free Software Foundation, Inc.
 ;; Suggested by a previous version by Gildea.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/assoc.el b/lisp/obsolete/assoc.el
index cb5809b717..76fcb4b78b 100644
--- a/lisp/obsolete/assoc.el
+++ b/lisp/obsolete/assoc.el
@@ -1,6 +1,6 @@
 ;;; assoc.el --- insert/delete functions on association lists  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <bwarsaw@cen.com>
 ;; Keywords: extensions
diff --git a/lisp/obsolete/bruce.el b/lisp/obsolete/bruce.el
index 1c3581f7d0..465cf429e9 100644
--- a/lisp/obsolete/bruce.el
+++ b/lisp/obsolete/bruce.el
@@ -1,7 +1,7 @@
 ;;; bruce.el --- bruce phrase utility for overloading the Communications  -*- 
lexical-binding: t; -*-
 ;;; Decency Act snoops, if any.
 
-;; Copyright (C) 1988, 1993, 1997, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1988, 1993, 1997, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/cc-compat.el b/lisp/obsolete/cc-compat.el
index 2c383d31c8..19068e4bf2 100644
--- a/lisp/obsolete/cc-compat.el
+++ b/lisp/obsolete/cc-compat.el
@@ -1,6 +1,6 @@
 ;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    1998- Martin Stjernholm
 ;;            1994-1999 Barry A. Warsaw
diff --git a/lisp/obsolete/cl-compat.el b/lisp/obsolete/cl-compat.el
index 0dba366192..e58f475d1c 100644
--- a/lisp/obsolete/cl-compat.el
+++ b/lisp/obsolete/cl-compat.el
@@ -1,6 +1,6 @@
 ;;; cl-compat.el --- Common Lisp extensions for GNU Emacs Lisp (compatibility) 
 -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Version: 2.02
diff --git a/lisp/obsolete/cl.el b/lisp/obsolete/cl.el
index a892ed7c76..93f9dee4b4 100644
--- a/lisp/obsolete/cl.el
+++ b/lisp/obsolete/cl.el
@@ -1,6 +1,6 @@
 ;;; cl.el --- Compatibility aliases for the old CL library.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Deprecated-since: 27.1
diff --git a/lisp/obsolete/complete.el b/lisp/obsolete/complete.el
index 2d3be2dd9a..1b4c39b159 100644
--- a/lisp/obsolete/complete.el
+++ b/lisp/obsolete/complete.el
@@ -1,6 +1,6 @@
 ;;; complete.el --- partial completion mechanism plus other goodies  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1990-1993, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: abbrev convenience
diff --git a/lisp/obsolete/crisp.el b/lisp/obsolete/crisp.el
index ccf9aaa2b6..8424c42b69 100644
--- a/lisp/obsolete/crisp.el
+++ b/lisp/obsolete/crisp.el
@@ -1,6 +1,6 @@
 ;;; crisp.el --- CRiSP/Brief Emacs emulator  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Gary D. Foster <Gary.Foster@Corp.Sun.COM>
 ;; Keywords: emulations brief crisp
diff --git a/lisp/obsolete/cust-print.el b/lisp/obsolete/cust-print.el
index 897b401588..80ded08654 100644
--- a/lisp/obsolete/cust-print.el
+++ b/lisp/obsolete/cust-print.el
@@ -1,6 +1,6 @@
 ;;; cust-print.el --- handles print-level and print-circle  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
 ;; Adapted-By: ESR
diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/obsolete/eieio-compat.el
similarity index 99%
rename from lisp/emacs-lisp/eieio-compat.el
rename to lisp/obsolete/eieio-compat.el
index 60b0638c63..8d8211b849 100644
--- a/lisp/emacs-lisp/eieio-compat.el
+++ b/lisp/obsolete/eieio-compat.el
@@ -1,6 +1,6 @@
 ;;; eieio-compat.el --- Compatibility with Older EIEIO versions  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995-1996, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: OO, lisp
diff --git a/lisp/obsolete/erc-hecomplete.el b/lisp/obsolete/erc-hecomplete.el
index 36b08d56f7..79ccf80440 100644
--- a/lisp/obsolete/erc-hecomplete.el
+++ b/lisp/obsolete/erc-hecomplete.el
@@ -1,6 +1,6 @@
 ;;; erc-hecomplete.el --- Provides Nick name completion for ERC  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation,
+;; Copyright (C) 2001-2002, 2004, 2006-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
diff --git a/lisp/obsolete/eudcb-ph.el b/lisp/obsolete/eudcb-ph.el
index 51a6780d90..8f3928d564 100644
--- a/lisp/obsolete/eudcb-ph.el
+++ b/lisp/obsolete/eudcb-ph.el
@@ -1,6 +1,6 @@
 ;;; eudcb-ph.el --- Emacs Unified Directory Client - CCSO PH/QI Backend  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
diff --git a/lisp/obsolete/fast-lock.el b/lisp/obsolete/fast-lock.el
index 1dee7120c0..1614935f03 100644
--- a/lisp/obsolete/fast-lock.el
+++ b/lisp/obsolete/fast-lock.el
@@ -1,6 +1,6 @@
 ;;; fast-lock.el --- automagic text properties caching for fast Font Lock mode 
 -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <simon@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/gs.el b/lisp/obsolete/gs.el
index 5a82c6b05f..971e7d2640 100644
--- a/lisp/obsolete/gs.el
+++ b/lisp/obsolete/gs.el
@@ -1,6 +1,6 @@
 ;;; gs.el --- interface to Ghostscript  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/obsolete/gulp.el b/lisp/obsolete/gulp.el
index 6ec2f4f772..b7002cd870 100644
--- a/lisp/obsolete/gulp.el
+++ b/lisp/obsolete/gulp.el
@@ -1,6 +1,6 @@
 ;;; gulp.el --- ask for updates for Lisp packages  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Sam Shteingold <shteingd@math.ucla.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/html2text.el b/lisp/obsolete/html2text.el
index be0553cb3a..62b2697396 100644
--- a/lisp/obsolete/html2text.el
+++ b/lisp/obsolete/html2text.el
@@ -1,6 +1,6 @@
 ;;; html2text.el --- a simple html to plain text converter -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Joakim Hove <hove@phys.ntnu.no>
 ;; Obsolete-since: 26.1
diff --git a/lisp/obsolete/info-edit.el b/lisp/obsolete/info-edit.el
index 19958979a8..6c1be1078f 100644
--- a/lisp/obsolete/info-edit.el
+++ b/lisp/obsolete/info-edit.el
@@ -1,6 +1,6 @@
 ;;; info-edit.el --- Editing info files  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1992-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help
diff --git a/lisp/obsolete/inversion.el b/lisp/obsolete/inversion.el
index ac7749af5e..33eab910db 100644
--- a/lisp/obsolete/inversion.el
+++ b/lisp/obsolete/inversion.el
@@ -1,6 +1,6 @@
 ;;; inversion.el --- When you need something in version XX.XX  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2002-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 1.3
diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el
index 807f5485d5..2825ea1136 100644
--- a/lisp/obsolete/iswitchb.el
+++ b/lisp/obsolete/iswitchb.el
@@ -1,6 +1,6 @@
 ;;; iswitchb.el --- switch between buffers using substrings  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Stephen Eglen <stephen@gnu.org>
 ;; Keywords: completion convenience
@@ -467,9 +467,7 @@ interfere with other minibuffer usage.")
                  (switch-to-buffer-other-window . iswitchb-buffer-other-window)
                  (switch-to-buffer-other-frame . iswitchb-buffer-other-frame)
                  (display-buffer . iswitchb-display-buffer)))
-      (if (fboundp 'command-remapping)
-          (define-key map (vector 'remap (car b)) (cdr b))
-        (substitute-key-definition (car b) (cdr b) map global-map)))
+      (define-key map (vector 'remap (car b)) (cdr b)))
     map)
   "Global keymap for `iswitchb-mode'.")
 
diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el
index 16c41c76ad..29d069f48c 100644
--- a/lisp/obsolete/landmark.el
+++ b/lisp/obsolete/landmark.el
@@ -1,6 +1,6 @@
 ;;; landmark.el --- Neural-network robot that learns landmarks  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Terrence Brannon <metaperl@gmail.com>
 ;; Created: December 16, 1996 - first release to usenet
diff --git a/lisp/obsolete/lazy-lock.el b/lisp/obsolete/lazy-lock.el
index 13f14aad6d..5c35cb3212 100644
--- a/lisp/obsolete/lazy-lock.el
+++ b/lisp/obsolete/lazy-lock.el
@@ -1,6 +1,6 @@
 ;;; lazy-lock.el --- lazy demand-driven fontification for fast Font Lock mode  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <simon@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/longlines.el b/lisp/obsolete/longlines.el
index 9bf6845682..731f47794c 100644
--- a/lisp/obsolete/longlines.el
+++ b/lisp/obsolete/longlines.el
@@ -1,6 +1,6 @@
 ;;; longlines.el --- automatically wrap long lines   -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2000-2001, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2004-2022 Free Software Foundation, Inc.
 
 ;; Authors:    Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 ;;             Alex Schroeder <alex@gnu.org>
diff --git a/lisp/obsolete/mantemp.el b/lisp/obsolete/mantemp.el
index 97e70f2984..f57361f9f8 100644
--- a/lisp/obsolete/mantemp.el
+++ b/lisp/obsolete/mantemp.el
@@ -1,6 +1,6 @@
 ;;; mantemp.el --- create manual template instantiations from g++ 2.7.2 output 
 -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Houlder <thoulder@icor.fr>
 ;; Created: 10 Dec 1996
diff --git a/lisp/obsolete/messcompat.el b/lisp/obsolete/messcompat.el
index be252395e4..ca246ba60f 100644
--- a/lisp/obsolete/messcompat.el
+++ b/lisp/obsolete/messcompat.el
@@ -1,6 +1,6 @@
 ;;; messcompat.el --- making message mode compatible with mail mode  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail, news
diff --git a/lisp/obsolete/metamail.el b/lisp/obsolete/metamail.el
index 72237239dd..ee53110bcd 100644
--- a/lisp/obsolete/metamail.el
+++ b/lisp/obsolete/metamail.el
@@ -1,6 +1,6 @@
 ;;; metamail.el --- Metamail interface for GNU Emacs  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1993, 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
 ;; Keywords: mail, news, mime, multimedia
diff --git a/lisp/obsolete/mouse-sel.el b/lisp/obsolete/mouse-sel.el
index 36d9dc658c..a9d6bfee60 100644
--- a/lisp/obsolete/mouse-sel.el
+++ b/lisp/obsolete/mouse-sel.el
@@ -1,6 +1,6 @@
 ;;; mouse-sel.el --- multi-click selection support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Mike Williams <mdub@bigfoot.com>
 ;; Keywords: mouse
diff --git a/lisp/obsolete/nnir.el b/lisp/obsolete/nnir.el
index 9aab1e7c9f..4e24cf39a8 100644
--- a/lisp/obsolete/nnir.el
+++ b/lisp/obsolete/nnir.el
@@ -1,6 +1,6 @@
 ;;; nnir.el --- Search mail with various search engines  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <grossjohann@ls6.cs.uni-dortmund.de>
 ;; Swish-e and Swish++ backends by:
diff --git a/lisp/obsolete/old-emacs-lock.el b/lisp/obsolete/old-emacs-lock.el
index ce4c60e6a1..70123e7537 100644
--- a/lisp/obsolete/old-emacs-lock.el
+++ b/lisp/obsolete/old-emacs-lock.el
@@ -1,6 +1,6 @@
 ;;; old-emacs-lock.el --- prevents you from exiting Emacs if a buffer is 
locked  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994, 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Wurgler <twurgler@goodyear.com>
 ;; Created: 12/8/94
diff --git a/lisp/obsolete/otodo-mode.el b/lisp/obsolete/otodo-mode.el
index a71d2b82e4..82017f4dbc 100644
--- a/lisp/obsolete/otodo-mode.el
+++ b/lisp/obsolete/otodo-mode.el
@@ -1,6 +1,6 @@
 ;;; otodo-mode.el --- major mode for editing TODO list files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <privat@os10000.net>
 ;; Maintainer: Stephen Berman <stephen.berman@gmx.net>
diff --git a/lisp/obsolete/pc-mode.el b/lisp/obsolete/pc-mode.el
index cf0bc28b11..4c4bfb5b9c 100644
--- a/lisp/obsolete/pc-mode.el
+++ b/lisp/obsolete/pc-mode.el
@@ -1,6 +1,6 @@
 ;;; pc-mode.el --- emulate certain key bindings used on PCs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: emulations
diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el
index f999f50797..922358bcd6 100644
--- a/lisp/obsolete/pc-select.el
+++ b/lisp/obsolete/pc-select.el
@@ -2,7 +2,7 @@
 ;;;                 (or MAC GUI or MS-windoze (bah)) look-and-feel
 ;;;                 including key bindings.
 
-;; Copyright (C) 1995-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE>
 ;; Keywords: convenience emulations
diff --git a/lisp/obsolete/pgg-def.el b/lisp/obsolete/pgg-def.el
index 4d30e32614..020fba36f5 100644
--- a/lisp/obsolete/pgg-def.el
+++ b/lisp/obsolete/pgg-def.el
@@ -1,6 +1,6 @@
 ;;; pgg-def.el --- functions/macros for defining PGG functions  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
diff --git a/lisp/obsolete/pgg-gpg.el b/lisp/obsolete/pgg-gpg.el
index d06a485b97..8d5015e01f 100644
--- a/lisp/obsolete/pgg-gpg.el
+++ b/lisp/obsolete/pgg-gpg.el
@@ -1,6 +1,6 @@
 ;;; pgg-gpg.el --- GnuPG support for PGG.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Symmetric encryption and gpg-agent support added by:
diff --git a/lisp/obsolete/pgg-parse.el b/lisp/obsolete/pgg-parse.el
index 3e4c216abe..5542e995c0 100644
--- a/lisp/obsolete/pgg-parse.el
+++ b/lisp/obsolete/pgg-parse.el
@@ -1,6 +1,6 @@
 ;;; pgg-parse.el --- OpenPGP packet parsing  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/10/28
diff --git a/lisp/obsolete/pgg-pgp.el b/lisp/obsolete/pgg-pgp.el
index 665be0b2e2..5b56e9001f 100644
--- a/lisp/obsolete/pgg-pgp.el
+++ b/lisp/obsolete/pgg-pgp.el
@@ -1,6 +1,6 @@
 ;;; pgg-pgp.el --- PGP 2.* and 6.* support for PGG.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1999-2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
diff --git a/lisp/obsolete/pgg-pgp5.el b/lisp/obsolete/pgg-pgp5.el
index d952317241..f04b5865b8 100644
--- a/lisp/obsolete/pgg-pgp5.el
+++ b/lisp/obsolete/pgg-pgp5.el
@@ -1,6 +1,6 @@
 ;;; pgg-pgp5.el --- PGP 5.* support for PGG.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
diff --git a/lisp/obsolete/pgg.el b/lisp/obsolete/pgg.el
index 127e1dc15c..16ca4e1431 100644
--- a/lisp/obsolete/pgg.el
+++ b/lisp/obsolete/pgg.el
@@ -1,6 +1,6 @@
 ;;; pgg.el --- glue for the various PGP implementations.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1999-2000, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Symmetric encryption added by: Sascha Wilde <wilde@sha-bang.de>
diff --git a/lisp/obsolete/rcompile.el b/lisp/obsolete/rcompile.el
index c8fb9f2098..fbfc0c6bbc 100644
--- a/lisp/obsolete/rcompile.el
+++ b/lisp/obsolete/rcompile.el
@@ -1,6 +1,6 @@
 ;;; rcompile.el --- run a compilation on a remote machine  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Alon Albert <alon@milcse.rtsg.mot.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/rfc2368.el b/lisp/obsolete/rfc2368.el
index 8a842b0cf3..5e7320a793 100644
--- a/lisp/obsolete/rfc2368.el
+++ b/lisp/obsolete/rfc2368.el
@@ -1,6 +1,6 @@
 ;;; rfc2368.el --- support for rfc2368  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Sen Nagata <sen@eccosys.com>
 ;; Keywords: mail
diff --git a/lisp/obsolete/s-region.el b/lisp/obsolete/s-region.el
index 4d4c39e9b1..9dfc9831f4 100644
--- a/lisp/obsolete/s-region.el
+++ b/lisp/obsolete/s-region.el
@@ -1,6 +1,6 @@
 ;;; s-region.el --- set region using shift key  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
 ;; Keywords: terminals
diff --git a/lisp/obsolete/sb-image.el b/lisp/obsolete/sb-image.el
index fc9e03eae6..c6f2cfb588 100644
--- a/lisp/obsolete/sb-image.el
+++ b/lisp/obsolete/sb-image.el
@@ -1,7 +1,7 @@
 ;;; sb-image.el --- Image management for speedbar  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2003, 2005-2019, 2021 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1999-2003, 2005-2019, 2021-2022 Free Software
+;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
diff --git a/lisp/obsolete/sregex.el b/lisp/obsolete/sregex.el
index 371dcbf849..f8722f6129 100644
--- a/lisp/obsolete/sregex.el
+++ b/lisp/obsolete/sregex.el
@@ -1,6 +1,6 @@
 ;;; sregex.el --- symbolic regular expressions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Bob Glickstein <bobg+sregex@zanshin.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/starttls.el b/lisp/obsolete/starttls.el
index 926248db9a..6f0685d3dd 100644
--- a/lisp/obsolete/starttls.el
+++ b/lisp/obsolete/starttls.el
@@ -1,6 +1,6 @@
 ;;; starttls.el --- STARTTLS functions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Author: Simon Josefsson <simon@josefsson.org>
diff --git a/lisp/obsolete/sup-mouse.el b/lisp/obsolete/sup-mouse.el
index 4e312e968b..44854dd976 100644
--- a/lisp/obsolete/sup-mouse.el
+++ b/lisp/obsolete/sup-mouse.el
@@ -1,6 +1,6 @@
 ;;; sup-mouse.el --- supdup mouse support for lisp machines  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Rupprecht
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el
index fa89b586a0..d8d0da4efb 100644
--- a/lisp/obsolete/terminal.el
+++ b/lisp/obsolete/terminal.el
@@ -1,6 +1,6 @@
 ;;; terminal.el --- terminal emulator for GNU Emacs  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1986-1989, 1993-1994, 2001-2021 Free Software
+;; Copyright (C) 1986-1989, 1993-1994, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Richard Mlynarik <mly@eddie.mit.edu>
diff --git a/lisp/obsolete/tls.el b/lisp/obsolete/tls.el
index ff01008613..f2515baef8 100644
--- a/lisp/obsolete/tls.el
+++ b/lisp/obsolete/tls.el
@@ -1,6 +1,6 @@
 ;;; tls.el --- TLS/SSL support via wrapper around GnuTLS  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1996-1999, 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: comm, tls, gnutls, ssl
diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el
index b59fb8c868..8c4ec8f7e0 100644
--- a/lisp/obsolete/tpu-edt.el
+++ b/lisp/obsolete/tpu-edt.el
@@ -1,6 +1,6 @@
 ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Version: 4.5
diff --git a/lisp/obsolete/tpu-extras.el b/lisp/obsolete/tpu-extras.el
index f375e05d8a..76338cdd24 100644
--- a/lisp/obsolete/tpu-extras.el
+++ b/lisp/obsolete/tpu-extras.el
@@ -1,6 +1,6 @@
 ;;; tpu-extras.el --- scroll margins and free cursor mode for TPU-edt  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Keywords: emulations
diff --git a/lisp/obsolete/tpu-mapper.el b/lisp/obsolete/tpu-mapper.el
index 02ba363250..17aa73697b 100644
--- a/lisp/obsolete/tpu-mapper.el
+++ b/lisp/obsolete/tpu-mapper.el
@@ -1,6 +1,6 @@
 ;;; tpu-mapper.el --- create a TPU-edt X-windows keymap file  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Keywords: emulations
diff --git a/lisp/obsolete/url-ns.el b/lisp/obsolete/url-ns.el
index 6cd6693fc4..0dee2864fc 100644
--- a/lisp/obsolete/url-ns.el
+++ b/lisp/obsolete/url-ns.el
@@ -1,6 +1,6 @@
 ;;; url-ns.el --- Various netscape-ish functions for proxy definitions  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 ;; Obsolete-since: 27.1
diff --git a/lisp/obsolete/vc-arch.el b/lisp/obsolete/vc-arch.el
index 1dffd36f0e..537d65c658 100644
--- a/lisp/obsolete/vc-arch.el
+++ b/lisp/obsolete/vc-arch.el
@@ -1,6 +1,6 @@
 ;;; vc-arch.el --- VC backend for the Arch version-control system  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el
index 2fa8c95153..d7518b1001 100644
--- a/lisp/obsolete/vip.el
+++ b/lisp/obsolete/vip.el
@@ -1,6 +1,6 @@
 ;;; vip.el --- a VI Package for GNU Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1986-1988, 1992-1993, 1998, 2001-2021 Free Software
+;; Copyright (C) 1986-1988, 1992-1993, 1998, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masahiko Sato <ms@sail.stanford.edu>
diff --git a/lisp/obsolete/ws-mode.el b/lisp/obsolete/ws-mode.el
index 235a1d7e43..c1e7392d24 100644
--- a/lisp/obsolete/ws-mode.el
+++ b/lisp/obsolete/ws-mode.el
@@ -1,6 +1,6 @@
 ;;; ws-mode.el --- WordStar emulation mode for GNU Emacs -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1991, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Juergen Nickelsen <nickel@cs.tu-berlin.de>
 ;; Version: 0.7
diff --git a/lisp/obsolete/yow.el b/lisp/obsolete/yow.el
index ca8de4f922..88191b35a0 100644
--- a/lisp/obsolete/yow.el
+++ b/lisp/obsolete/yow.el
@@ -1,6 +1,6 @@
 ;;; yow.el --- quote random zippyisms  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard Mlynarik
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1
index d350a3117b..7e08d1a3c9 100644
--- a/lisp/org/ChangeLog.1
+++ b/lisp/org/ChangeLog.1
@@ -32833,7 +32833,7 @@
 ;; add-log-time-zone-rule: t
 ;; End:
 
-       Copyright (C) 2008-2021 Free Software Foundation, Inc.
+       Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el
index 842e0d3e8e..2be5e28dc8 100644
--- a/lisp/org/ob-C.el
+++ b/lisp/org/ob-C.el
@@ -1,6 +1,6 @@
 ;;; ob-C.el --- Babel Functions for C and Similar Languages -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;;      Thierry Banel
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el
index 169e1d6d6c..cd822ef837 100644
--- a/lisp/org/ob-R.el
+++ b/lisp/org/ob-R.el
@@ -1,6 +1,6 @@
 ;;; ob-R.el --- Babel Functions for R                -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;;     Dan Davison
diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el
index 28e9d32757..1d5a6f24eb 100644
--- a/lisp/org/ob-awk.el
+++ b/lisp/org/ob-awk.el
@@ -1,6 +1,6 @@
 ;;; ob-awk.el --- Babel Functions for Awk            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Tyler Smith <tyler@plantarum.ca>
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el
index 5962d38761..9cf16a04c3 100644
--- a/lisp/org/ob-calc.el
+++ b/lisp/org/ob-calc.el
@@ -1,6 +1,6 @@
 ;;; ob-calc.el --- Babel Functions for Calc          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Tom Gillespie <tgbugs@gmail.com>
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el
index 3b995d94ce..5a44b64875 100644
--- a/lisp/org/ob-clojure.el
+++ b/lisp/org/ob-clojure.el
@@ -1,6 +1,6 @@
 ;;; ob-clojure.el --- Babel Functions for Clojure    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
 ;; Maintainer: Bastien Guerry <bzg@gnu.org>
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
index 20ae76fadc..427aba3415 100644
--- a/lisp/org/ob-comint.el
+++ b/lisp/org/ob-comint.el
@@ -1,6 +1,6 @@
 ;;; ob-comint.el --- Babel Functions for Interaction with Comint Buffers -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 06a2a88cd4..23ef162a7f 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -1,6 +1,6 @@
 ;;; ob-core.el --- Working with Code Blocks          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;     Dan Davison
diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el
index 8ad70d44d0..51efbb7d94 100644
--- a/lisp/org/ob-css.el
+++ b/lisp/org/ob-css.el
@@ -1,6 +1,6 @@
 ;;; ob-css.el --- Babel Functions for CSS            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el
index 249c8c899e..20b5ce1fdb 100644
--- a/lisp/org/ob-ditaa.el
+++ b/lisp/org/ob-ditaa.el
@@ -1,6 +1,6 @@
 ;;; ob-ditaa.el --- Babel Functions for ditaa        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el
index 8e05a59f20..b82a079b4c 100644
--- a/lisp/org/ob-dot.el
+++ b/lisp/org/ob-dot.el
@@ -1,6 +1,6 @@
 ;;; ob-dot.el --- Babel Functions for dot            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Justin Abrahms
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el
index d03151f13e..730eff69e8 100644
--- a/lisp/org/ob-emacs-lisp.el
+++ b/lisp/org/ob-emacs-lisp.el
@@ -1,6 +1,6 @@
 ;;; ob-emacs-lisp.el --- Babel Functions for Emacs-lisp Code -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-eshell.el b/lisp/org/ob-eshell.el
index d74c4fc43f..135deb4a4b 100644
--- a/lisp/org/ob-eshell.el
+++ b/lisp/org/ob-eshell.el
@@ -1,6 +1,6 @@
 ;;; ob-eshell.el --- Babel Functions for Eshell      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: stardiviner <numbchild@gmail.com>
 ;; Maintainer: stardiviner <numbchild@gmail.com>
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index cfd8022255..be1ba54912 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -1,6 +1,6 @@
 ;;; ob-eval.el --- Babel Functions for External Code Evaluation -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index d10d228eba..d41c40c8da 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -1,6 +1,6 @@
 ;;; ob-exp.el --- Exportation of Babel Source Blocks -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;     Dan Davison
diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el
index 74dbc02170..53088b0706 100644
--- a/lisp/org/ob-forth.el
+++ b/lisp/org/ob-forth.el
@@ -1,6 +1,6 @@
 ;;; ob-forth.el --- Babel Functions for Forth        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, forth
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 2e55498003..9c49aa887c 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -1,6 +1,6 @@
 ;;; ob-fortran.el --- Babel Functions for Fortran    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Authors: Sergey Litvinov
 ;;       Eric Schulte
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
index 8c4a5957b9..69a5f5f91b 100644
--- a/lisp/org/ob-gnuplot.el
+++ b/lisp/org/ob-gnuplot.el
@@ -1,6 +1,6 @@
 ;;; ob-gnuplot.el --- Babel Functions for Gnuplot    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Ihor Radchenko <yantar92@gmail.com>
@@ -284,14 +284,25 @@ then create one.  Return the initialized session.  The 
current
 (defun org-babel-gnuplot-table-to-data (table data-file params)
   "Export TABLE to DATA-FILE in a format readable by gnuplot.
 Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
+  (require 'ox-org)
   (with-temp-file data-file
     (insert (let ((org-babel-gnuplot-timestamp-fmt
                   (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")))
-             (orgtbl-to-generic
-              table
-              (org-combine-plists
-               '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t 
:backend ascii)
-               params)))))
+              (replace-regexp-in-string
+               ;; org export backend adds "|" at the beginning/end of
+               ;; the table lines.  Strip those.
+               "^|\\(.+\\)|$"
+               "\\1"
+              (orgtbl-to-generic
+               table
+               (org-combine-plists
+                '( :sep "\t" :fmt org-babel-gnuplot-quote-tsv-field
+                    ;; Two setting below are needed to make :fmt work.
+                    :raw t
+                    ;; Use `org', not `ascii' because `ascii' may
+                    ;; sometimes mishandle quoted strings.
+                    :backend org)
+                params))))))
   data-file)
 
 (provide 'ob-gnuplot)
diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el
index b3ff34aac3..e0e2f2cd2e 100644
--- a/lisp/org/ob-groovy.el
+++ b/lisp/org/ob-groovy.el
@@ -1,6 +1,6 @@
 ;;; ob-groovy.el --- Babel Functions for Groovy      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Miro Bezjak
 ;; Maintainer: Palak Mathur
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index 971e1ce6af..45f70fa878 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -1,6 +1,6 @@
 ;;; ob-haskell.el --- Babel Functions for Haskell    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Lawrence Bottorff <borgauf@gmail.com>
diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el
index dd3538743d..0f6faf446f 100644
--- a/lisp/org/ob-java.el
+++ b/lisp/org/ob-java.el
@@ -1,6 +1,6 @@
 ;;; ob-java.el --- org-babel functions for java evaluation -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;          Dan Davison
diff --git a/lisp/org/ob-js.el b/lisp/org/ob-js.el
index 5d1be61176..4bb379b0b8 100644
--- a/lisp/org/ob-js.el
+++ b/lisp/org/ob-js.el
@@ -1,6 +1,6 @@
 ;;; ob-js.el --- Babel Functions for Javascript      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, js
diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el
index 3176baf370..abddca3613 100644
--- a/lisp/org/ob-julia.el
+++ b/lisp/org/ob-julia.el
@@ -1,6 +1,6 @@
 ;;; ob-julia.el --- org-babel functions for julia code evaluation  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 ;; Authors: G. Jay Kerns
 ;; Maintainer: Pedro Bruel <pedro.bruel@gmail.com>
 ;; Keywords: literate programming, reproducible research, scientific computing
diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el
index 7c65256976..7253803af9 100644
--- a/lisp/org/ob-latex.el
+++ b/lisp/org/ob-latex.el
@@ -1,6 +1,6 @@
 ;;; ob-latex.el --- Babel Functions for LaTeX        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el
index 410d53ba60..15538b5037 100644
--- a/lisp/org/ob-lilypond.el
+++ b/lisp/org/ob-lilypond.el
@@ -1,6 +1,6 @@
 ;;; ob-lilypond.el --- Babel Functions for Lilypond  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Martyn Jago
 ;; Keywords: babel language, literate programming
diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el
index b32b122cdb..f9d5fed0c8 100644
--- a/lisp/org/ob-lisp.el
+++ b/lisp/org/ob-lisp.el
@@ -1,6 +1,6 @@
 ;;; ob-lisp.el --- Babel Functions for Common Lisp   -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Joel Boehland
 ;;      Eric Schulte
diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el
index 903dabfbd5..eecb5c402a 100644
--- a/lisp/org/ob-lob.el
+++ b/lisp/org/ob-lob.el
@@ -1,6 +1,6 @@
 ;;; ob-lob.el --- Functions Supporting the Library of Babel -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el
index a4a964afc4..48de0dbad0 100644
--- a/lisp/org/ob-lua.el
+++ b/lisp/org/ob-lua.el
@@ -1,6 +1,6 @@
 ;;; ob-lua.el --- Org Babel functions for Lua evaluation -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2014, 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016-2022 Free Software Foundation, Inc.
 
 ;; Authors: Dieter Schoen
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-makefile.el b/lisp/org/ob-makefile.el
index eae64cf4a9..142e760ea2 100644
--- a/lisp/org/ob-makefile.el
+++ b/lisp/org/ob-makefile.el
@@ -1,6 +1,6 @@
 ;;; ob-makefile.el --- Babel Functions for Makefile  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;;        Thomas S. Dye
diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el
index 45ec5c5437..4ee090e4ac 100644
--- a/lisp/org/ob-matlab.el
+++ b/lisp/org/ob-matlab.el
@@ -1,6 +1,6 @@
 ;;; ob-matlab.el --- Babel support for Matlab        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Dan Davison
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el
index 7b49bb07a0..6bc3427eaf 100644
--- a/lisp/org/ob-maxima.el
+++ b/lisp/org/ob-maxima.el
@@ -1,6 +1,6 @@
 ;;; ob-maxima.el --- Babel Functions for Maxima      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric S Fraga
 ;;     Eric Schulte
diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el
index faf117c407..80df79581f 100644
--- a/lisp/org/ob-ocaml.el
+++ b/lisp/org/ob-ocaml.el
@@ -1,6 +1,6 @@
 ;;; ob-ocaml.el --- Babel Functions for Ocaml        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el
index bfe3e2aeec..bbbda5bb1e 100644
--- a/lisp/org/ob-octave.el
+++ b/lisp/org/ob-octave.el
@@ -1,6 +1,6 @@
 ;;; ob-octave.el --- Babel Functions for Octave and Matlab -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Dan Davison
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el
index e29cbb5b76..965b0984ec 100644
--- a/lisp/org/ob-org.el
+++ b/lisp/org/ob-org.el
@@ -1,6 +1,6 @@
 ;;; ob-org.el --- Babel Functions for Org Code Blocks -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el
index 4d405a8b6a..f01feaf294 100644
--- a/lisp/org/ob-perl.el
+++ b/lisp/org/ob-perl.el
@@ -1,6 +1,6 @@
 ;;; ob-perl.el --- Babel Functions for Perl          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Dan Davison
 ;;      Eric Schulte
diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el
index fc621600c4..ced00fbdda 100644
--- a/lisp/org/ob-plantuml.el
+++ b/lisp/org/ob-plantuml.el
@@ -1,6 +1,6 @@
 ;;; ob-plantuml.el --- Babel Functions for Plantuml  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Zhang Weize
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-processing.el b/lisp/org/ob-processing.el
index 84fd6a2964..f961a99076 100644
--- a/lisp/org/ob-processing.el
+++ b/lisp/org/ob-processing.el
@@ -1,6 +1,6 @@
 ;;; ob-processing.el --- Babel functions for processing -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Jarmo Hurri (adapted from ob-asymptote.el written by Eric Schulte)
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 3c095ad463..3e9049e73f 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -1,6 +1,6 @@
 ;;; ob-python.el --- Babel Functions for Python      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
index a7ab299b27..21076b67b2 100644
--- a/lisp/org/ob-ref.el
+++ b/lisp/org/ob-ref.el
@@ -1,6 +1,6 @@
 ;;; ob-ref.el --- Babel Functions for Referencing External Data -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el
index b2483f1aa6..d35b55ca59 100644
--- a/lisp/org/ob-ruby.el
+++ b/lisp/org/ob-ruby.el
@@ -1,6 +1,6 @@
 ;;; ob-ruby.el --- Babel Functions for Ruby          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el
index c8762cabae..c0f63a9b66 100644
--- a/lisp/org/ob-sass.el
+++ b/lisp/org/ob-sass.el
@@ -1,6 +1,6 @@
 ;;; ob-sass.el --- Babel Functions for the Sass CSS generation language -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..72d2e029e1 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -1,6 +1,6 @@
 ;;; ob-scheme.el --- Babel Functions for Scheme      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;         Michael Gauland
diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el
index 7793825b60..1fc1a34fdf 100644
--- a/lisp/org/ob-screen.el
+++ b/lisp/org/ob-screen.el
@@ -1,6 +1,6 @@
 ;;; ob-screen.el --- Babel Support for Interactive Terminal -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Benjamin Andresen
 ;; Maintainer: Ken Mankoff
diff --git a/lisp/org/ob-sed.el b/lisp/org/ob-sed.el
index 4d3eeee616..02c2a01742 100644
--- a/lisp/org/ob-sed.el
+++ b/lisp/org/ob-sed.el
@@ -1,6 +1,6 @@
 ;;; ob-sed.el --- Babel Functions for Sed Scripts    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Bjarte Johansen
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-shell.el b/lisp/org/ob-shell.el
index 3eed0c1640..c25941a44d 100644
--- a/lisp/org/ob-shell.el
+++ b/lisp/org/ob-shell.el
@@ -1,6 +1,6 @@
 ;;; ob-shell.el --- Babel Functions for Shell Evaluation -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index f512d2952c..5f7c0de000 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -1,6 +1,6 @@
 ;;; ob-sql.el --- Babel Functions for SQL            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el
index 7bfb66cf68..aeda6faaa3 100644
--- a/lisp/org/ob-sqlite.el
+++ b/lisp/org/ob-sqlite.el
@@ -1,6 +1,6 @@
 ;;; ob-sqlite.el --- Babel Functions for SQLite Databases -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Nick Savage
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el
index e081708701..2f092998d8 100644
--- a/lisp/org/ob-table.el
+++ b/lisp/org/ob-table.el
@@ -1,6 +1,6 @@
 ;;; ob-table.el --- Support for Calling Babel Functions from Tables -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
index 2dd1d031cb..cf307aa0cb 100644
--- a/lisp/org/ob-tangle.el
+++ b/lisp/org/ob-tangle.el
@@ -1,6 +1,6 @@
 ;;; ob-tangle.el --- Extract Source Code From Org Files -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
@@ -179,15 +179,14 @@ source code blocks by languages matching a regular 
expression.
 
 Return a list whose CAR is the tangled file name."
   (interactive "fFile to tangle: \nP")
-  (let ((visited-p (find-buffer-visiting (expand-file-name file)))
-       to-be-removed)
+  (let* ((visited (find-buffer-visiting file))
+         (buffer (or visited (find-file-noselect file))))
     (prog1
-       (save-window-excursion
-         (find-file file)
-         (setq to-be-removed (current-buffer))
-         (mapcar #'expand-file-name (org-babel-tangle nil target-file 
lang-re)))
-      (unless visited-p
-       (kill-buffer to-be-removed)))))
+        (with-current-buffer buffer
+          (org-with-wide-buffer
+           (mapcar #'expand-file-name
+                   (org-babel-tangle nil target-file lang-re))))
+      (unless visited (kill-buffer buffer)))))
 
 (defun org-babel-tangle-publish (_ filename pub-dir)
   "Tangle FILENAME and place the results in PUB-DIR."
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index 1e89b02aed..785eccf964 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -1,6 +1,6 @@
 ;;; ob.el --- Working with Code Blocks in Org        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index 7c83bdc27c..d82406affb 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -1,6 +1,6 @@
 ;;; oc-basic.el --- basic back-end for citations  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el
index e985963816..3cc157ec93 100644
--- a/lisp/org/oc-biblatex.el
+++ b/lisp/org/oc-biblatex.el
@@ -1,6 +1,6 @@
 ;;; oc-biblatex.el --- biblatex citation processor for Org  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index a92ea8a63e..82a9b8afce 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -1,6 +1,6 @@
 ;;; oc-csl.el --- csl citation processor for Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el
index bf086f36df..2193a070eb 100644
--- a/lisp/org/oc-natbib.el
+++ b/lisp/org/oc-natbib.el
@@ -1,6 +1,6 @@
 ;;; oc-natbib.el --- Citation processor using natbib LaTeX package  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index a77daa7e12..eb5f519cb6 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -1,6 +1,6 @@
 ;;; oc.el --- Org Cite library                  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/ol-bbdb.el b/lisp/org/ol-bbdb.el
index f697f1f82b..ffca438480 100644
--- a/lisp/org/ol-bbdb.el
+++ b/lisp/org/ol-bbdb.el
@@ -1,6 +1,6 @@
 ;;; ol-bbdb.el --- Links to BBDB entries             -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Authors: Carsten Dominik <carsten.dominik@gmail.com>
 ;;       Thomas Baumann <thomas dot baumann at ch dot tum dot de>
diff --git a/lisp/org/ol-bibtex.el b/lisp/org/ol-bibtex.el
index 476095d3e0..41443d7959 100644
--- a/lisp/org/ol-bibtex.el
+++ b/lisp/org/ol-bibtex.el
@@ -1,6 +1,6 @@
 ;;; ol-bibtex.el --- Links to BibTeX entries        -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 ;;
 ;; Authors: Bastien Guerry <bzg@gnu.org>
 ;;       Carsten Dominik <carsten dot dominik at gmail dot com>
diff --git a/lisp/org/ol-docview.el b/lisp/org/ol-docview.el
index 7ab67de809..6ea224c76c 100644
--- a/lisp/org/ol-docview.el
+++ b/lisp/org/ol-docview.el
@@ -1,6 +1,6 @@
 ;;; ol-docview.el --- Links to Docview mode buffers  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Böcker <jan.boecker at jboecker dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el
index d2d16b27d5..94585e4c3e 100644
--- a/lisp/org/ol-doi.el
+++ b/lisp/org/ol-doi.el
@@ -1,6 +1,6 @@
 ;;; ol-doi.el --- DOI links support in Org           -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el
index a7550e3769..1ca2aa2b28 100644
--- a/lisp/org/ol-eshell.el
+++ b/lisp/org/ol-eshell.el
@@ -1,6 +1,6 @@
 ;;; ol-eshell.el --- Links to Working Directories in Eshell  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Konrad Hinsen <konrad.hinsen AT fastmail.net>
 
@@ -46,7 +46,7 @@ followed by a colon."
          (eshell-buffer-name (car buffer-and-command))
          (command (cadr buffer-and-command)))
     (if (get-buffer eshell-buffer-name)
-       (pop-to-buffer-same-window eshell-buffer-name)
+       (pop-to-buffer eshell-buffer-name display-comint-buffer-action)
       (eshell))
     (goto-char (point-max))
     (eshell-kill-input)
diff --git a/lisp/org/ol-eww.el b/lisp/org/ol-eww.el
index e9ffee6e56..69bf1ba62d 100644
--- a/lisp/org/ol-eww.el
+++ b/lisp/org/ol-eww.el
@@ -1,6 +1,6 @@
 ;;; ol-eww.el --- Store URL and kill from Eww mode    -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Marco Wahl <marcowahlsoft>a<gmailcom>
 ;; Keywords: link, eww
diff --git a/lisp/org/ol-gnus.el b/lisp/org/ol-gnus.el
index 72bdd7310a..3a3857fbf9 100644
--- a/lisp/org/ol-gnus.el
+++ b/lisp/org/ol-gnus.el
@@ -1,6 +1,6 @@
 ;;; ol-gnus.el --- Links to Gnus Groups and Messages -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;         Tassilo Horn <tassilo at member dot fsf dot org>
diff --git a/lisp/org/ol-info.el b/lisp/org/ol-info.el
index a535ea581a..3730ff5ad4 100644
--- a/lisp/org/ol-info.el
+++ b/lisp/org/ol-info.el
@@ -1,6 +1,6 @@
 ;;; ol-info.el --- Links to Info Nodes               -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ol-irc.el b/lisp/org/ol-irc.el
index df62dd0625..ed8bad5a50 100644
--- a/lisp/org/ol-irc.el
+++ b/lisp/org/ol-irc.el
@@ -1,6 +1,6 @@
 ;;; ol-irc.el --- Links to IRC Sessions              -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Philip Jackson <emacs@shellarchive.co.uk>
 ;; Keywords: erc, irc, link, org
diff --git a/lisp/org/ol-man.el b/lisp/org/ol-man.el
index 0d9ac7c8c7..beed216acf 100644
--- a/lisp/org/ol-man.el
+++ b/lisp/org/ol-man.el
@@ -1,6 +1,6 @@
 ;;; ol-man.el --- Links to man pages -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Maintainer: Bastien Guerry <bzg@gnu.org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -8,12 +8,12 @@
 ;;
 ;; This file is part of GNU Emacs.
 ;;
-;; This program is free software; you can redistribute it and/or modify
+;; 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, or (at your option)
-;; any later version.
+;; 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,
+;; 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.
diff --git a/lisp/org/ol-mhe.el b/lisp/org/ol-mhe.el
index 37147a33ac..49104d392a 100644
--- a/lisp/org/ol-mhe.el
+++ b/lisp/org/ol-mhe.el
@@ -1,6 +1,6 @@
 ;;; ol-mhe.el --- Links to MH-E Messages             -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ol-rmail.el b/lisp/org/ol-rmail.el
index 2593ebdf02..8a28d720bb 100644
--- a/lisp/org/ol-rmail.el
+++ b/lisp/org/ol-rmail.el
@@ -1,6 +1,6 @@
 ;;; ol-rmail.el --- Links to Rmail Messages          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ol-w3m.el b/lisp/org/ol-w3m.el
index 9e03269e11..517329889c 100644
--- a/lisp/org/ol-w3m.el
+++ b/lisp/org/ol-w3m.el
@@ -1,6 +1,6 @@
 ;;; ol-w3m.el --- Copy and Paste From W3M            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index aa1849715c..2951c3def1 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -1,6 +1,6 @@
 ;;; ol.el --- Org links library                      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1575,7 +1575,7 @@ non-nil."
          (setq link
                (format-time-string
                 (car org-time-stamp-formats)
-                (apply 'encode-time
+                (encode-time
                        (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
                              nil nil nil))))
          (org-link-store-props :type "calendar" :date cd)))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 354f408679..fed36ac9b6 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -1,6 +1,6 @@
 ;;; org-agenda.el --- Dynamic task and appointment lists for Org  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -6765,7 +6765,7 @@ Any match of REMOVE-RE will be removed from TXT."
            (setq duration (- (org-duration-to-minutes s2)
                              (org-duration-to-minutes s1))))
           ;; Format S1 and S2 for display.
-         (when s1 (setq s1 (org-get-time-of-day s1 'overtime)))
+         (when s1 (setq s1 (format "%5s" (org-get-time-of-day s1 'overtime))))
          (when s2 (setq s2 (org-get-time-of-day s2 'overtime))))
        (when (string-match org-tag-group-re txt)
          ;; Tags are in the string
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index 0943869a88..c490e4b48f 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -1,6 +1,6 @@
 ;;; org-archive.el --- Archiving for Org             -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-attach-git.el b/lisp/org/org-attach-git.el
index 4c6bdc9023..ddb2ee97a0 100644
--- a/lisp/org/org-attach-git.el
+++ b/lisp/org/org-attach-git.el
@@ -1,6 +1,6 @@
 ;;; org-attach-git.el --- Automatic git commit extension to org-attach -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Original Author: John Wiegley <johnw@newartisans.com>
 ;; Restructurer: Gustav Wikström <gustav@whil.se>
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 75db69c9cc..36c21b7021 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -1,6 +1,6 @@
 ;;; org-attach.el --- Manage file attachments to Org outlines -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@newartisans.com>
 ;; Keywords: org data attachment
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 1756b34fc5..d3c5094b46 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1,6 +1,6 @@
 ;;; org-capture.el --- Fast note taking in Org       -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 12a4c2b7b7..ddae182791 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1,6 +1,6 @@
 ;;; org-clock.el --- The time clocking code for Org mode -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1746,7 +1746,7 @@ Optional argument N tells to change by that many units."
   (org-clock-timestamps-change 'up n))
 
 (defun org-clock-timestamps-down (&optional n)
-  "Increase CLOCK timestamps at cursor.
+  "Decrease CLOCK timestamps at cursor.
 Optional argument N tells to change by that many units."
   (interactive "P")
   (org-clock-timestamps-change 'down n))
@@ -1904,11 +1904,11 @@ PROPNAME lets you set a custom text property instead of 
:org-clock-minutes."
           ((match-end 2)
            ;; Two time stamps.
            (let* ((ts (float-time
-                       (apply #'encode-time
+                       (encode-time
                               (save-match-data
                                 (org-parse-time-string (match-string 2))))))
                   (te (float-time
-                       (apply #'encode-time
+                       (encode-time
                               (org-parse-time-string (match-string 3)))))
                   (dt (- (if tend (min te tend) te)
                          (if tstart (max ts tstart) ts))))
@@ -2837,7 +2837,7 @@ a number of clock tables."
           (pcase (if range (car range) (plist-get params :tstart))
             ((and (pred numberp) n)
              (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
-               (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
+              (encode-time 0 0 org-extend-today-until d m y)))
             (timestamp
             (seconds-to-time
              (org-matcher-time (or timestamp
@@ -2847,7 +2847,7 @@ a number of clock tables."
           (pcase (if range (nth 1 range) (plist-get params :tend))
             ((and (pred numberp) n)
              (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
-               (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
+              (encode-time 0 0 org-extend-today-until d m y)))
             (timestamp (seconds-to-time (org-matcher-time timestamp))))))
     (while (time-less-p start end)
       (unless (bolp) (insert "\n"))
@@ -3042,9 +3042,9 @@ Otherwise, return nil."
          (setq ts (match-string 1)
                te (match-string 3))
          (setq s (- (float-time
-                     (apply #'encode-time (org-parse-time-string te)))
+                     (encode-time (org-parse-time-string te)))
                     (float-time
-                     (apply #'encode-time (org-parse-time-string ts))))
+                     (encode-time (org-parse-time-string ts))))
                neg (< s 0)
                s (abs s)
                h (floor (/ s 3600))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 9794382d8a..371889432d 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -1,6 +1,6 @@
 ;;; org-colview.el --- Column View in Org            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -782,7 +782,7 @@ around it."
       (setq time-after (copy-sequence time))
       (setf (nth 3 time-before) (1- (nth 3 time)))
       (setf (nth 3 time-after) (1+ (nth 3 time)))
-      (mapcar (lambda (x) (format-time-string fmt (apply #'encode-time x)))
+      (mapcar (lambda (x) (format-time-string fmt (encode-time x)))
              (list time-before time time-after)))))
 
 (defun org-columns-open-link (&optional arg)
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index b140df7622..cfccc2c052 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -1,6 +1,6 @@
 ;;; org-compat.el --- Compatibility Code for Older Emacsen -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index 48f76b79fd..41813cb184 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -1,6 +1,6 @@
 ;;; org-crypt.el --- Public Key Encryption for Org Entries -*- 
lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index 7876c6ef75..6fc97ca399 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -1,6 +1,6 @@
 ;;; org-ctags.el --- Integrate Emacs "tags" Facility with Org -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Paul Sexton <eeeickythump@gmail.com>
 ;; Keywords: org, wp
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index 74442b038a..30f5f99aea 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -1,6 +1,6 @@
 ;;; org-datetree.el --- Create date entries in a tree -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index e627d0936a..6d55ba8840 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -1,6 +1,6 @@
 ;;; org-duration.el --- Library handling durations   -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index f8334ccbc6..7952786607 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -1,6 +1,6 @@
 ;;; org-element.el --- Parser for Org Syntax         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el
index 9c5f626ab7..b2dbccd40c 100644
--- a/lisp/org/org-entities.el
+++ b/lisp/org/org-entities.el
@@ -1,6 +1,6 @@
 ;;; org-entities.el --- Support for Special Entities -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>,
 ;;         Ulf Stegemann <ulf at zeitform dot de>
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index b151045a95..1db36bc72b 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -1,6 +1,6 @@
 ;;; org-faces.el --- Face definitions -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index 5df3b69766..a5fea08882 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -1,6 +1,6 @@
 ;;; org-feed.el --- Add RSS feed items to Org files  -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index fcc7579bad..112d6504fe 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -1,6 +1,6 @@
 ;;; org-footnote.el --- Footnote support in Org      -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-goto.el b/lisp/org/org-goto.el
index 352bf9f2e5..860b0a3de4 100644
--- a/lisp/org/org-goto.el
+++ b/lisp/org/org-goto.el
@@ -1,6 +1,6 @@
 ;;; org-goto.el --- Fast navigation in an Org buffer  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index a355d8e5fa..bc5175b163 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -1,6 +1,6 @@
 ;;; org-habit.el --- The habit tracking code for Org -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -428,7 +428,8 @@ current time."
     (save-excursion
       (goto-char (if line (point-at-bol) (point-min)))
       (while (not (eobp))
-       (let ((habit (get-text-property (point) 'org-habit-p)))
+       (let ((habit (get-text-property (point) 'org-habit-p))
+              (invisible-prop (get-text-property (point) 'invisible)))
          (when habit
            (move-to-column org-habit-graph-column t)
            (delete-char (min (+ 1 org-habit-preceding-days
@@ -439,7 +440,12 @@ current time."
              habit
              (time-subtract moment (days-to-time org-habit-preceding-days))
              moment
-             (time-add moment (days-to-time org-habit-following-days))))))
+             (time-add moment (days-to-time org-habit-following-days))))
+            ;; Inherit invisible state of hidden entries.
+            (when invisible-prop
+              (put-text-property
+               (- (point) org-habit-graph-column) (point)
+               'invisible invisible-prop))))
        (forward-line)))))
 
 (defun org-habit-toggle-habits ()
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index bd7e73905f..7334050b8b 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -1,6 +1,6 @@
 ;;; org-id.el --- Global identifiers for Org entries -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index e0cb69780e..fd19b14db6 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -1,6 +1,6 @@
 ;;; org-indent.el --- Dynamic indentation for Org    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 3379a2e460..581370bb53 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -1,6 +1,6 @@
 ;;; org-inlinetask.el --- Tasks Independent of Outline Hierarchy -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el
index a3d9576827..b3ba5dc85b 100644
--- a/lisp/org/org-keys.el
+++ b/lisp/org/org-keys.el
@@ -1,6 +1,6 @@
 ;;; org-keys.el --- Key bindings for Org mode        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 
diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el
index da5e6ae799..0894951b65 100644
--- a/lisp/org/org-lint.el
+++ b/lisp/org/org-lint.el
@@ -1,6 +1,6 @@
 ;;; org-lint.el --- Linting for Org documents        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 2bd9dc4d9e..0dd8139a97 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -1,6 +1,6 @@
 ;;; org-list.el --- Plain lists for Org              -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;        Bastien Guerry <bzg@gnu.org>
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index c0287a25a5..bb8a95065b 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -1,6 +1,6 @@
 ;;; org-macro.el --- Macro Replacement Code for Org  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -378,7 +378,7 @@ Return value as a string."
                                  (buffer-substring
                                   (point) (line-end-position)))))
                       (when (cl-some #'identity time)
-                        (setq date (apply #'encode-time time))))))))
+                        (setq date (encode-time time))))))))
              (let ((proc (get-buffer-process buf)))
                (while (and proc (accept-process-output proc .5 nil t)))))
          (kill-buffer buf))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 0779c3a82c..6f038f026b 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -1,6 +1,6 @@
 ;;; org-macs.el --- Top-level Definitions for Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1185,7 +1185,7 @@ nil, just return 0."
    ((numberp s) s)
    ((stringp s)
     (condition-case nil
-       (float-time (apply #'encode-time (org-parse-time-string s)))
+       (float-time (encode-time (org-parse-time-string s)))
       (error 0)))
    (t 0)))
 
@@ -1252,7 +1252,7 @@ following special strings: \"<now>\", \"<today>\",
 \"<tomorrow>\", and \"<yesterday>\".
 
 Return 0. if S is not recognized as a valid value."
-  (let ((today (float-time (apply #'encode-time
+  (let ((today (float-time (encode-time
                                  (append '(0 0 0) (nthcdr 3 (decode-time)))))))
     (save-match-data
       (cond
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index e51258af05..5cfaa7fe0a 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -1,5 +1,5 @@
 ;;; org-mobile.el --- Code for Asymmetric Sync With a Mobile Device -*- 
lexical-binding: t; -*-
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index a35a19bca6..8d5be42545 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -1,6 +1,6 @@
 ;;; org-mouse.el --- Better mouse support for Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
 ;; Maintainer: Carsten Dominik <carsten.dominik@gmail.com>
diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el
index f00e6c463b..4de62630e9 100644
--- a/lisp/org/org-num.el
+++ b/lisp/org/org-num.el
@@ -1,6 +1,6 @@
 ;;; org-num.el --- Dynamic Headlines Numbering  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el
index b31dc333fd..d1172d8988 100644
--- a/lisp/org/org-pcomplete.el
+++ b/lisp/org/org-pcomplete.el
@@ -1,6 +1,6 @@
 ;;; org-pcomplete.el --- In-buffer Completion Code -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;         John Wiegley <johnw at gnu dot org>
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index 4f14c7d4c3..bf84c99e04 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -1,6 +1,6 @@
 ;;; org-plot.el --- Support for Plotting from Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
 ;; Maintainer: TEC <tecosaur@gmail.com>
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index ca3249dda5..7c4de03bc2 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -1,6 +1,6 @@
 ;;; org-protocol.el --- Intercept Calls from Emacsclient to Trigger Custom 
Actions -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 ;;
 ;; Authors: Bastien Guerry <bzg@gnu.org>
 ;;       Daniel M German <dmg AT uvic DOT org>
diff --git a/lisp/org/org-refile.el b/lisp/org/org-refile.el
index 73eaad6bf5..8e1ab7439e 100644
--- a/lisp/org/org-refile.el
+++ b/lisp/org/org-refile.el
@@ -1,6 +1,6 @@
 ;;; org-refile.el --- Refile Org Subtrees             -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 8d02cf4345..54f901252f 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -1,6 +1,6 @@
 ;;; org-src.el --- Source code examples in Org       -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;        Bastien Guerry <bzg@gnu.org>
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index e34872fb49..58707eae44 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -1,6 +1,6 @@
 ;;; org-table.el --- The Table Editor for Org        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -2606,7 +2606,7 @@ location of point."
                     (format-time-string
                      (org-time-stamp-format
                       (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))
-                     (apply #'encode-time
+                     (encode-time
                             (save-match-data (org-parse-time-string ts))))))
                 form t t))
 
diff --git a/lisp/org/org-tempo.el b/lisp/org/org-tempo.el
index c121b8e7ac..b34007bf78 100644
--- a/lisp/org/org-tempo.el
+++ b/lisp/org/org-tempo.el
@@ -1,6 +1,6 @@
 ;;; org-tempo.el --- Template expansion for Org structures -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Rasmus Pank Roulund <emacs at pank dot eu>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index bfcea443c3..4c9c1ba276 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -1,6 +1,6 @@
 ;;; org-timer.el --- Timer code for Org mode         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index b009b9691f..1053bbe22c 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -5,13 +5,13 @@
 (defun org-release ()
   "The release version of Org.
 Inserted by installing Org mode or when a release is made."
-   (let ((org-release "9.5.1"))
+   (let ((org-release "9.5.2"))
      org-release))
 ;;;###autoload
 (defun org-git-version ()
   "The Git version of Org mode.
 Inserted by installing Org or when a release is made."
-   (let ((org-git-version "release_9.5.1-25-g9ca3bc"))
+   (let ((org-git-version "release_9.5.2-3-geb9f34"))
      org-git-version))
 
 (provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 00bbc07688..fba45caabe 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -1,7 +1,7 @@
 ;;; org.el --- Outline-based notes management and organizer -*- 
lexical-binding: t; -*-
 
 ;; Carstens outline-mode for keeping track of everything.
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Maintainer: Bastien Guerry <bzg@gnu.org>
@@ -9,7 +9,7 @@
 ;; Homepage: https://orgmode.org
 ;; Package-Requires: ((emacs "25.1"))
 
-;; Version: 9.5.1
+;; Version: 9.5.2
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -5114,7 +5114,6 @@ stacked delimiters is N.  Escaping delimiters is not 
possible."
                                     '(invisible t))
                (add-text-properties (match-beginning 3) (match-end 3)
                                     '(invisible t)))
-              (goto-char (match-end 0))
              (throw :exit t))))))))
 
 (defun org-emphasize (&optional char)
@@ -6905,7 +6904,7 @@ frame is not changed."
       (setq beg (point)
            heading (org-get-heading 'no-tags))
       (org-end-of-subtree t t)
-      (when (org-at-heading-p) (backward-char 1))
+      (when (and (not (eobp)) (org-at-heading-p)) (backward-char 1))
       (setq end (point)))
     (when (and (buffer-live-p org-last-indirect-buffer)
               (not (eq org-indirect-buffer-display 'new-frame))
@@ -13987,7 +13986,7 @@ user."
     (when (< (nth 2 org-defdecode) org-extend-today-until)
       (setf (nth 2 org-defdecode) -1)
       (setf (nth 1 org-defdecode) 59)
-      (setq org-def (apply #'encode-time org-defdecode))
+      (setq org-def (encode-time org-defdecode))
       (setq org-defdecode (decode-time org-def)))
     (let* ((timestr (format-time-string
                     (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d")
@@ -14471,7 +14470,7 @@ The command returns the inserted time stamp."
          time (org-fix-decoded-time t1)
          str (org-add-props
                  (format-time-string
-                  (substring tf 1 -1) (apply 'encode-time time))
+                  (substring tf 1 -1) (encode-time time))
                  nil 'mouse-face 'highlight))
     (put-text-property beg end 'display str)))
 
@@ -14726,7 +14725,7 @@ days in order to avoid rounding problems."
 
 (defun org-time-string-to-time (s)
   "Convert timestamp string S into internal time."
-  (apply #'encode-time (org-parse-time-string s)))
+  (encode-time (org-parse-time-string s)))
 
 (defun org-time-string-to-seconds (s)
   "Convert a timestamp string S into a number of seconds."
@@ -15156,7 +15155,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
          (setcar time0 (or (car time0) 0))
          (setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
          (setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
-         (setq time (apply 'encode-time time0))))
+         (setq time (encode-time time0))))
       ;; Insert the new time-stamp, and ensure point stays in the same
       ;; category as before (i.e. not after the last position in that
       ;; category).
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index 78e6fb4988..c22bb13b6d 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -1,6 +1,6 @@
 ;;; ox-ascii.el --- ASCII Back-End for Org Export Engine -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el
index 77de0aa5bf..a70f6e4a0f 100644
--- a/lisp/org/ox-beamer.el
+++ b/lisp/org/ox-beamer.el
@@ -1,6 +1,6 @@
 ;;; ox-beamer.el --- Beamer Back-End for Org Export Engine -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;;         Nicolas Goaziou <n.goaziou AT gmail DOT com>
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index a150b1fdb8..5de0b5d675 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -1,6 +1,6 @@
 ;;; ox-html.el --- HTML Back-End for Org Export Engine -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;      Jambunathan K <kjambunathan at gmail dot com>
diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el
index 16c3dc9a02..a3fe31d7b8 100644
--- a/lisp/org/ox-icalendar.el
+++ b/lisp/org/ox-icalendar.el
@@ -1,6 +1,6 @@
 ;;; ox-icalendar.el --- iCalendar Back-End for Org Export Engine -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;      Nicolas Goaziou <n dot goaziou at gmail dot com>
@@ -824,8 +824,7 @@ as a communication channel."
    (if (not (plist-get info :with-author)) ""
      (org-export-data (plist-get info :author) info))
    ;; Timezone.
-   (if (org-string-nw-p org-icalendar-timezone) org-icalendar-timezone
-     (cadr (current-time-zone)))
+   (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
    ;; Description.
    (org-export-data (plist-get info :title) info)
    contents))
@@ -972,7 +971,7 @@ This function assumes major mode for current buffer is
        (org-icalendar--vcalendar
        org-icalendar-combined-name
        user-full-name
-       (or (org-string-nw-p org-icalendar-timezone) (cadr (current-time-zone)))
+       (or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
        org-icalendar-combined-description
        contents)))
     (run-hook-with-args 'org-icalendar-after-save-hook file)))
@@ -995,7 +994,7 @@ FILES is a list of files to build the calendar from."
              user-full-name
              ;; Timezone.
              (or (org-string-nw-p org-icalendar-timezone)
-                 (cadr (current-time-zone)))
+                 (format-time-string "Z"))
              ;; Description.
              org-icalendar-combined-description
              ;; Contents.
diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el
index 978e4e41f5..5f62cd1c04 100644
--- a/lisp/org/ox-koma-letter.el
+++ b/lisp/org/ox-koma-letter.el
@@ -1,6 +1,6 @@
 ;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou AT gmail DOT com>
 ;;         Alan Schmitt <alan.schmitt AT polytechnique DOT org>
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index c45dc98a09..e4e146bc5f 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -1,6 +1,6 @@
 ;;; ox-latex.el --- LaTeX Back-End for Org Export Engine -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el
index 9a1f00f352..e808edcdfc 100644
--- a/lisp/org/ox-man.el
+++ b/lisp/org/ox-man.el
@@ -1,6 +1,6 @@
 ;;; ox-man.el --- Man Back-End for Org Export Engine -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;;      Luis R Anaya <papoanaya aroba hot mail punto com>
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el
index 348b6d01dc..ad684d8033 100644
--- a/lisp/org/ox-md.el
+++ b/lisp/org/ox-md.el
@@ -1,6 +1,6 @@
 ;;; ox-md.el --- Markdown Back-End for Org Export Engine -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
 ;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index f186ebb16a..7f2e8ba47f 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -1,6 +1,6 @@
 ;;; ox-odt.el --- OpenDocument Text Exporter for Org Mode -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el
index fcf876854f..0613ede317 100644
--- a/lisp/org/ox-org.el
+++ b/lisp/org/ox-org.el
@@ -1,6 +1,6 @@
 ;;; ox-org.el --- Org Back-End for Org Export Engine -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
 ;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index bc9b17ab3e..636bd0d2ae 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -1,5 +1,5 @@
 ;;; ox-publish.el --- Publish Related Org Mode Files as a Website -*- 
lexical-binding: t; -*-
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: David O'Toole <dto@gnu.org>
 ;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index 46077ece4b..9a8217583e 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -1,6 +1,6 @@
 ;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 ;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
 ;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 80202b0850..afea529f64 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -1,6 +1,6 @@
 ;;; ox.el --- Export Framework for Org Mode          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
diff --git a/lisp/outline.el b/lisp/outline.el
index 2ede4e23ea..0304d2334c 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1,6 +1,6 @@
 ;;; outline.el --- outline mode commands for Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1986, 1993-1995, 1997, 2000-2021 Free Software
+;; Copyright (C) 1986, 1993-1995, 1997, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -283,6 +283,7 @@ buffers (yet) -- that will be amended in a future version.
 The `outline-minor-mode-buttons' variable specifies how the
 buttons should look."
   :type 'boolean
+  :safe #'booleanp
   :version "29.1")
 
 (defcustom outline-minor-mode-buttons
@@ -376,8 +377,8 @@ When point is on a heading line, then typing `TAB' cycles 
between `hide all',
 a heading line cycles the whole buffer (`outline-cycle-buffer').
 Typing these keys anywhere outside heading lines uses their default bindings."
   :type 'boolean
+  :safe #'booleanp
   :version "28.1")
-;;;###autoload(put 'outline-minor-mode-cycle 'safe-local-variable 'booleanp)
 
 (defcustom outline-minor-mode-highlight nil
   "Highlight headings in `outline-minor-mode' using font-lock keywords.
@@ -391,8 +392,8 @@ faces to major mode's faces."
                  (const :tag "Overwrite major mode faces" override)
                  (const :tag "Append outline faces to major mode faces" append)
                  (const :tag "Highlight separately from major mode faces" t))
+  :safe #'symbolp
   :version "28.1")
-;;;###autoload(put 'outline-minor-mode-highlight 'safe-local-variable 'symbolp)
 
 (defun outline-minor-mode-highlight-buffer ()
   ;; Fallback to overlays when font-lock is unsupported.
diff --git a/lisp/paren.el b/lisp/paren.el
index 7e7cf6c262..a1f74f2097 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -1,6 +1,6 @@
 ;;; paren.el --- highlight matching paren  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1993, 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: rms@gnu.org
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index 83a2572519..7840ea0a8a 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -1,6 +1,6 @@
 ;;; password-cache.el --- Read passwords, possibly using a password cache.  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2000, 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Created: 2003-12-21
diff --git a/lisp/pcmpl-cvs.el b/lisp/pcmpl-cvs.el
index 588a5e725a..2fcd3d14a8 100644
--- a/lisp/pcmpl-cvs.el
+++ b/lisp/pcmpl-cvs.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-cvs.el --- functions for dealing with cvs completions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Package: pcomplete
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el
index 6c68645eb2..d0ae9390e3 100644
--- a/lisp/pcmpl-gnu.el
+++ b/lisp/pcmpl-gnu.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-gnu.el --- completions for GNU project tools -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-linux.el b/lisp/pcmpl-linux.el
index 39d4add2be..7c072f3d40 100644
--- a/lisp/pcmpl-linux.el
+++ b/lisp/pcmpl-linux.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-linux.el --- functions for dealing with GNU/Linux completions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-rpm.el b/lisp/pcmpl-rpm.el
index 39f700cb36..f7925d9d9e 100644
--- a/lisp/pcmpl-rpm.el
+++ b/lisp/pcmpl-rpm.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-rpm.el --- functions for dealing with rpm completions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el
index 49dc2d2fc6..0074722be7 100644
--- a/lisp/pcmpl-unix.el
+++ b/lisp/pcmpl-unix.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-unix.el --- standard UNIX completions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el
index d9479edf6a..261a3d4e27 100644
--- a/lisp/pcmpl-x.el
+++ b/lisp/pcmpl-x.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-x.el --- completion for miscellaneous tools  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <sdl.web@gmail.com>
 ;; Keywords: processes, tools, convenience
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 64acc416c2..289312e0bb 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -1,6 +1,6 @@
 ;;; pcomplete.el --- programmable completion -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: processes abbrev
@@ -680,8 +680,8 @@ user actually typed in."
        (match-string which arg)
       (throw 'pcompleted nil))))
 
-(defalias 'pcomplete-match-beginning 'match-beginning)
-(defalias 'pcomplete-match-end 'match-end)
+(define-obsolete-function-alias 'pcomplete-match-beginning #'match-beginning 
"29.1")
+(define-obsolete-function-alias 'pcomplete-match-end #'match-end "29.1")
 
 (defsubst pcomplete--test (pred arg)
   "Perform a programmable completion predicate match."
@@ -1006,7 +1006,7 @@ Arguments NO-GANGING and ARGS-FOLLOW are currently 
ignored."
                             ((eq arg-char ?*) (pcomplete-executables))
                             ((eq arg-char ??) nil)
                             ((eq arg-char ?.) (pcomplete-entries))
-                            ((eq arg-char ?\() (eval result))))))
+                            ((eq arg-char ?\() (eval result t))))))
            (setq index (1+ index))))))))
 
 (defun pcomplete--here (&optional form stub paring form-only)
@@ -1040,7 +1040,7 @@ See the documentation for `pcomplete-here'."
                (funcall form)
              ;; Old calling convention, might still be used by files
              ;; byte-compiled with the older code.
-             (eval form)))))
+             (eval form t)))))
 
 
 (defmacro pcomplete-here* (&optional form stub form-only)
@@ -1062,9 +1062,9 @@ See the documentation for `pcomplete-here'."
        pcomplete-window-restore-timer nil))
 
 (define-obsolete-function-alias 'pcomplete-event-matches-key-specifier-p
-  'eq "27.1")
+  #'eq "27.1")
 
-(define-obsolete-function-alias 'pcomplete-read-event 'read-event "27.1")
+(define-obsolete-function-alias 'pcomplete-read-event #'read-event "27.1")
 
 (defun pcomplete-show-completions (completions)
   "List in help buffer sorted COMPLETIONS.
@@ -1244,7 +1244,7 @@ If specific documentation can't be given, be generic."
                    (fboundp 'Info-goto-node))
               (listp pcomplete-help)))
       (if (listp pcomplete-help)
-         (message "%s" (eval pcomplete-help))
+         (message "%s" (eval pcomplete-help t))
        (save-window-excursion (info))
        (declare-function Info-goto-node
                          "info" (nodename &optional fork strict-case))
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 0e22ef2a6a..e8b637ba1a 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -1,6 +1,6 @@
 ;;; pixel-scroll.el --- Scroll a line smoothly  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 ;; Author: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
 ;; Keywords: mouse
 ;; Package: emacs
@@ -96,9 +96,32 @@ is always with pixel resolution.")
 
 (defvar pixel-scroll-precision-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [wheel-down] #'pixel-scroll-precision)
-    (define-key map [wheel-up] #'pixel-scroll-precision)
-    (define-key map [touch-end] #'pixel-scroll-start-momentum)
+    (define-key map [wheel-down] 'pixel-scroll-precision)
+    (define-key map [wheel-up] 'pixel-scroll-precision)
+    (define-key map [touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [mode-line wheel-down] 'pixel-scroll-precision)
+    (define-key map [mode-line wheel-up] 'pixel-scroll-precision)
+    (define-key map [mode-line touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [header-line wheel-down] 'pixel-scroll-precision)
+    (define-key map [header-line wheel-up] 'pixel-scroll-precision)
+    (define-key map [header-line touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [vertical-scroll-bar wheel-down] 'pixel-scroll-precision)
+    (define-key map [vertical-scroll-bar wheel-up] 'pixel-scroll-precision)
+    (define-key map [vertical-scroll-bar touch-end] 
'pixel-scroll-start-momentum)
+    (define-key map [left-margin wheel-down] 'pixel-scroll-precision)
+    (define-key map [left-margin wheel-up] 'pixel-scroll-precision)
+    (define-key map [left-margin touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [right-margin wheel-down] 'pixel-scroll-precision)
+    (define-key map [right-margin wheel-up] 'pixel-scroll-precision)
+    (define-key map [right-margin touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [left-fringe wheel-down] 'pixel-scroll-precision)
+    (define-key map [left-fringe wheel-up] 'pixel-scroll-precision)
+    (define-key map [left-fringe touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [right-fringe wheel-down] 'pixel-scroll-precision)
+    (define-key map [right-fringe wheel-up] 'pixel-scroll-precision)
+    (define-key map [right-fringe touch-end] 'pixel-scroll-start-momentum)
+    (define-key map [next] 'pixel-scroll-interpolate-down)
+    (define-key map [prior] 'pixel-scroll-interpolate-up)
     map)
   "The key map used by `pixel-scroll-precision-mode'.")
 
@@ -127,7 +150,7 @@ This is only effective if supported by your mouse or 
touchpad."
   :type 'float
   :version "29.1")
 
-(defcustom pixel-scroll-precision-initial-velocity-factor 0.25
+(defcustom pixel-scroll-precision-initial-velocity-factor (/ 0.0335 4)
   "Factor applied to the initial velocity before momentum scrolling begins."
   :group 'mouse
   :type 'float
@@ -159,6 +182,13 @@ Nil means to not interpolate such scrolls."
   :type 'float
   :version "29.1")
 
+(defcustom pixel-scroll-precision-interpolate-page nil
+  "Whether or not to interpolate scrolling via the Page Down and Page Up keys.
+This is only effective when `pixel-scroll-precision-mode' is enabled."
+  :group 'scrolling
+  :type 'boolean
+  :version "29.1")
+
 (defun pixel-scroll-in-rush-p ()
   "Return non-nil if next scroll should be non-smooth.
 When scrolling request is delivered soon after the previous one,
@@ -416,6 +446,13 @@ window, and the pixel height of that line."
     ;; restore initial position
     (set-window-start nil pos0 t)
     (set-window-vscroll nil vscroll0 t)
+    (when (and line-height
+               (> (car (posn-x-y (posn-at-point pos0)))
+                  (line-number-display-width t)))
+      (setq line-height (- line-height
+                           (save-excursion
+                             (goto-char pos0)
+                             (line-pixel-height)))))
     (cons pos line-height)))
 
 (defun pixel-point-at-unseen-line ()
@@ -452,7 +489,13 @@ the height of the current window."
          (next-pos (save-excursion
                      (goto-char desired-start)
                      (when (zerop (vertical-motion (1+ scroll-margin)))
+                       (set-window-start nil desired-start)
                        (signal 'end-of-buffer nil))
+                     (while (when-let ((posn (posn-at-point)))
+                              (< (cdr (posn-x-y posn)) delta))
+                       (when (zerop (vertical-motion 1))
+                         (set-window-start nil desired-start)
+                         (signal 'end-of-buffer nil)))
                      (point)))
          (scroll-preserve-screen-position nil)
          (auto-window-vscroll nil))
@@ -509,22 +552,24 @@ the height of the current window."
                        usable-height))))
         (goto-char up-point)))
     (let ((current-vscroll (window-vscroll nil t)))
-      (if (<= delta current-vscroll)
-          (set-window-vscroll nil (- current-vscroll delta) t)
-        (setq delta (- delta current-vscroll))
-        (set-window-vscroll nil 0 t)
-        (while (> delta 0)
-          (let ((position (pixel-point-and-height-at-unseen-line)))
-            (unless (cdr position)
-              (signal 'beginning-of-buffer nil))
-            (set-window-start nil (car position) t)
-            ;; If the line above is taller than the window height (i.e. there's
-            ;; a very tall image), keep point on it.
-            (when (> (cdr position) usable-height)
-              (goto-char (car position)))
-            (setq delta (- delta (cdr position)))))
-        (when (< delta 0)
-          (set-window-vscroll nil (- delta) t))))))
+      (setq delta (- delta current-vscroll))
+      (set-window-vscroll nil 0 t)
+      (when (> delta 0)
+        (let* ((start (window-start))
+               (dims (window-text-pixel-size nil (cons start (- delta))
+                                             start nil nil nil t))
+               (height (nth 1 dims))
+               (position (nth 2 dims)))
+          (set-window-start nil position t)
+          ;; If the line above is taller than the window height (i.e. there's
+          ;; a very tall image), keep point on it.
+          (when (> height usable-height)
+            (goto-char position))
+          (when (or (not position) (eq position start))
+            (signal 'beginning-of-buffer nil))
+          (setq delta (- delta height))))
+      (when (< delta 0)
+        (set-window-vscroll nil (- delta) t)))))
 
 (defun pixel-scroll-precision-interpolate (delta)
   "Interpolate a scroll of DELTA pixels.
@@ -617,7 +662,7 @@ wheel."
                                     (ring-empty-p ring)))))
                     (progn
                       (let ((kin-state (pixel-scroll-kinetic-state)))
-                        (aset kin-state 0 (make-ring 10))
+                        (aset kin-state 0 (make-ring 30))
                         (aset kin-state 1 nil))
                       (pixel-scroll-precision-interpolate delta))
                   (condition-case nil
@@ -635,10 +680,10 @@ wheel."
 
 (defun pixel-scroll-kinetic-state ()
   "Return the kinetic scroll state of the current window.
-It is a vector of the form [ VELOCITY TIME ]."
+It is a vector of the form [ VELOCITY TIME SIGN ]."
   (or (window-parameter nil 'kinetic-state)
       (set-window-parameter nil 'kinetic-state
-                            (vector (make-ring 10) nil))))
+                            (vector (make-ring 30) nil nil))))
 
 (defun pixel-scroll-accumulate-velocity (delta)
   "Accumulate DELTA into the current window's kinetic scroll state."
@@ -648,9 +693,9 @@ It is a vector of the form [ VELOCITY TIME ]."
     (when (or (and time (> (- (float-time) time) 0.5))
               (and (not (ring-empty-p ring))
                    (not (eq (< delta 0)
-                            (< (cdr (ring-ref ring 0))
-                               0)))))
-      (aset state 0 (make-ring 10)))
+                            (aref state 2)))))
+      (aset state 0 (make-ring 30)))
+    (aset state 2 (< delta 0))
     (ring-insert (aref state 0)
                  (cons (aset state 1 (float-time))
                        delta))))
@@ -662,8 +707,8 @@ It is a vector of the form [ VELOCITY TIME ]."
          (total 0))
     (dolist (tem elts)
       (setq total (+ total (cdr tem))))
-    (/ total (* (- (float-time) (caar elts))
-                100))))
+    (* (/ total (- (float-time) (caar (last elts))))
+       pixel-scroll-precision-initial-velocity-factor)))
 
 (defun pixel-scroll-start-momentum (event)
   "Start kinetic scrolling for the touch event EVENT."
@@ -675,45 +720,63 @@ It is a vector of the form [ VELOCITY TIME ]."
         (setq state (pixel-scroll-kinetic-state))
         (when (and (aref state 1)
                    (listp (aref state 0)))
-          (while-no-input
-            (unwind-protect (progn
-                              (aset state 0 (pixel-scroll-calculate-velocity 
state))
-                              (when (> (abs (aref state 0))
-                                       
pixel-scroll-precision-momentum-min-velocity)
-                                (let* ((velocity (* (aref state 0)
-                                                    
pixel-scroll-precision-initial-velocity-factor))
-                                       (original-velocity velocity)
-                                       (time-spent 0))
-                                  (if (> velocity 0)
-                                      (while (and (> velocity 0)
+          (condition-case nil
+              (while-no-input
+                (unwind-protect (progn
+                                  (aset state 0 
(pixel-scroll-calculate-velocity state))
+                                  (when (> (abs (aref state 0))
+                                           
pixel-scroll-precision-momentum-min-velocity)
+                                    (let* ((velocity (aref state 0))
+                                           (original-velocity velocity)
+                                           (time-spent 0))
+                                      (if (> velocity 0)
+                                          (while (and (> velocity 0)
+                                                      (<= time-spent
+                                                          
pixel-scroll-precision-momentum-seconds))
+                                            (when (> (round velocity) 0)
+                                              
(pixel-scroll-precision-scroll-up (round velocity)))
+                                            (setq velocity (- velocity
+                                                              (/ 
original-velocity
+                                                                 (/ 
pixel-scroll-precision-momentum-seconds
+                                                                    
pixel-scroll-precision-momentum-tick))))
+                                            (redisplay t)
+                                            (sit-for 
pixel-scroll-precision-momentum-tick)
+                                            (setq time-spent (+ time-spent
+                                                                
pixel-scroll-precision-momentum-tick))))
+                                      (while (and (< velocity 0)
                                                   (<= time-spent
                                                       
pixel-scroll-precision-momentum-seconds))
-                                        (when (> (round velocity) 0)
-                                          (pixel-scroll-precision-scroll-up 
(round velocity)))
-                                        (setq velocity (- velocity
-                                                          (/ original-velocity
+                                        (when (> (round (abs velocity)) 0)
+                                          (pixel-scroll-precision-scroll-down 
(round
+                                                                               
(abs velocity))))
+                                        (setq velocity (+ velocity
+                                                          (/ (abs 
original-velocity)
                                                              (/ 
pixel-scroll-precision-momentum-seconds
                                                                 
pixel-scroll-precision-momentum-tick))))
                                         (redisplay t)
                                         (sit-for 
pixel-scroll-precision-momentum-tick)
                                         (setq time-spent (+ time-spent
-                                                            
pixel-scroll-precision-momentum-tick))))
-                                  (while (and (< velocity 0)
-                                              (<= time-spent
-                                                  
pixel-scroll-precision-momentum-seconds))
-                                    (when (> (round (abs velocity)) 0)
-                                      (pixel-scroll-precision-scroll-down 
(round
-                                                                           
(abs velocity))))
-                                    (setq velocity (+ velocity
-                                                      (/ (abs 
original-velocity)
-                                                         (/ 
pixel-scroll-precision-momentum-seconds
-                                                            
pixel-scroll-precision-momentum-tick))))
-                                    (redisplay t)
-                                    (sit-for 
pixel-scroll-precision-momentum-tick)
-                                    (setq time-spent (+ time-spent
-                                                        
pixel-scroll-precision-momentum-tick))))))
-              (aset state 0 (make-ring 10))
-              (aset state 1 nil))))))))
+                                                            
pixel-scroll-precision-momentum-tick))))))
+                  (aset state 0 (make-ring 30))
+                  (aset state 1 nil)))
+            (beginning-of-buffer
+             (message (error-message-string '(beginning-of-buffer))))
+            (end-of-buffer
+             (message (error-message-string '(end-of-buffer))))))))))
+
+(defun pixel-scroll-interpolate-down ()
+  "Interpolate a scroll downwards by one page."
+  (interactive)
+  (if pixel-scroll-precision-interpolate-page
+      (pixel-scroll-precision-interpolate (- (window-text-height nil t)))
+    (scroll-up)))
+
+(defun pixel-scroll-interpolate-up ()
+  "Interpolate a scroll upwards by one page."
+  (interactive)
+  (if pixel-scroll-precision-interpolate-page
+      (pixel-scroll-precision-interpolate (window-text-height nil t))
+    (scroll-down)))
 
 ;;;###autoload
 (define-minor-mode pixel-scroll-precision-mode
diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el
index 085c97f5d8..8fe72ddf59 100644
--- a/lisp/play/5x5.el
+++ b/lisp/play/5x5.el
@@ -1,6 +1,6 @@
 ;;; 5x5.el --- simple little puzzle game  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Pearson <davep@davep.org>
 ;; Created: 1998-10-03
@@ -107,39 +107,37 @@
 (defvar 5x5-buffer-name "*5x5*"
   "Name of the 5x5 play buffer.")
 
-(defvar 5x5-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map t)
-    (define-key map "?"                       #'describe-mode)
-    (define-key map "\r"                      #'5x5-flip-current)
-    (define-key map " "                       #'5x5-flip-current)
-    (define-key map [up]                      #'5x5-up)
-    (define-key map [down]                    #'5x5-down)
-    (define-key map [left]                    #'5x5-left)
-    (define-key map [tab]                     #'5x5-right)
-    (define-key map [right]                   #'5x5-right)
-    (define-key map [(control a)]             #'5x5-bol)
-    (define-key map [(control e)]             #'5x5-eol)
-    (define-key map [(control p)]             #'5x5-up)
-    (define-key map [(control n)]             #'5x5-down)
-    (define-key map [(control b)]             #'5x5-left)
-    (define-key map [(control f)]             #'5x5-right)
-    (define-key map [home]                    #'5x5-bol)
-    (define-key map [end]                     #'5x5-eol)
-    (define-key map [prior]                   #'5x5-first)
-    (define-key map [next]                    #'5x5-last)
-    (define-key map "r"                       #'5x5-randomize)
-    (define-key map [(control c) (control r)] #'5x5-crack-randomly)
-    (define-key map [(control c) (control c)] #'5x5-crack-mutating-current)
-    (define-key map [(control c) (control b)] #'5x5-crack-mutating-best)
-    (define-key map [(control c) (control x)] #'5x5-crack-xor-mutate)
-    (define-key map "n"                       #'5x5-new-game)
-    (define-key map "s"                       #'5x5-solve-suggest)
-    (define-key map "<"                       #'5x5-solve-rotate-left)
-    (define-key map ">"                       #'5x5-solve-rotate-right)
-    (define-key map "q"                       #'5x5-quit-game)
-    map)
-  "Local keymap for the 5x5 game.")
+(defvar-keymap 5x5-mode-map
+  :doc "Local keymap for the 5x5 game."
+  :suppress 'nodigits
+  "?"       #'describe-mode
+  "RET"     #'5x5-flip-current
+  "SPC"     #'5x5-flip-current
+  "<up>"    #'5x5-up
+  "<down>"  #'5x5-down
+  "<left>"  #'5x5-left
+  "<tab>"   #'5x5-right
+  "<right>" #'5x5-right
+  "C-a"     #'5x5-bol
+  "C-e"     #'5x5-eol
+  "C-p"     #'5x5-up
+  "C-n"     #'5x5-down
+  "C-b"     #'5x5-left
+  "C-f"     #'5x5-right
+  "<home>"  #'5x5-bol
+  "<end>"   #'5x5-eol
+  "<prior>" #'5x5-first
+  "<next>"  #'5x5-last
+  "r"       #'5x5-randomize
+  "C-c C-r" #'5x5-crack-randomly
+  "C-c C-c" #'5x5-crack-mutating-current
+  "C-c C-b" #'5x5-crack-mutating-best
+  "C-c C-x" #'5x5-crack-xor-mutate
+  "n"       #'5x5-new-game
+  "s"       #'5x5-solve-suggest
+  "<"       #'5x5-solve-rotate-left
+  ">"       #'5x5-solve-rotate-right
+  "q"       #'5x5-quit-game)
 
 (defvar-local 5x5-solver-output nil
   "List that is the output of an arithmetic solver.
diff --git a/lisp/play/animate.el b/lisp/play/animate.el
index 54ee9dc84e..4f4c936cd6 100644
--- a/lisp/play/animate.el
+++ b/lisp/play/animate.el
@@ -1,6 +1,6 @@
 ;;; animate.el --- make text dance  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Richard Stallman <rms@gnu.org>
 ;; Keywords: games
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index 13bcdcc859..8db24c9127 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -1,6 +1,6 @@
 ;;; blackbox.el --- blackbox game in Emacs Lisp  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1992, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: F. Thomas May <uw-nsr!uw-warp!tom@beaver.cs.washington.edu>
@@ -85,32 +85,21 @@
 (defvar bb-balls-placed nil
   "List of already placed balls.")
 
-;; This is used below to remap existing bindings for cursor motion to
-;; blackbox-specific bindings in blackbox-mode-map.  This is so that
-;; users who prefer non-default key bindings for cursor motion don't
-;; lose that when they play Blackbox.
-(defun blackbox-redefine-key (map oldfun newfun)
-  "Redefine keys that run the function OLDFUN to run NEWFUN instead."
-  (define-key map (vector 'remap oldfun) newfun))
-
-
-(defvar blackbox-mode-map
-  (let ((map (make-keymap)))
-    (suppress-keymap map t)
-    (blackbox-redefine-key map 'backward-char 'bb-left)
-    (blackbox-redefine-key map 'left-char 'bb-left)
-    (blackbox-redefine-key map 'forward-char 'bb-right)
-    (blackbox-redefine-key map 'right-char 'bb-right)
-    (blackbox-redefine-key map 'previous-line 'bb-up)
-    (blackbox-redefine-key map 'next-line 'bb-down)
-    (blackbox-redefine-key map 'move-end-of-line 'bb-eol)
-    (blackbox-redefine-key map 'move-beginning-of-line 'bb-bol)
-    (define-key map " " 'bb-romp)
-    (define-key map "q" 'bury-buffer)
-    (define-key map [insert] 'bb-romp)
-    (define-key map [return] 'bb-done)
-    (blackbox-redefine-key map 'newline 'bb-done)
-    map))
+(defvar-keymap blackbox-mode-map
+  :suppress 'nodigits
+  "SPC"      #'bb-romp
+  "q"        #'bury-buffer
+  "<insert>" #'bb-romp
+  "<return>" #'bb-done
+  "<remap> <backward-char>"          #'bb-left
+  "<remap> <left-char>"              #'bb-left
+  "<remap> <forward-char>"           #'bb-right
+  "<remap> <right-char>"             #'bb-right
+  "<remap> <previous-line>"          #'bb-up
+  "<remap> <next-line>"              #'bb-down
+  "<remap> <move-end-of-line>"       #'bb-eol
+  "<remap> <move-beginning-of-line>" #'bb-bol
+  "<remap> <newline>"                #'bb-done)
 
 ;; Blackbox mode is suitable only for specially formatted data.
 
@@ -426,6 +415,11 @@ a reflection."
     (insert c)
     (backward-char 1)))
 
+(defun blackbox-redefine-key (map oldfun newfun)
+  "Redefine keys that run the function OLDFUN to run NEWFUN instead."
+  (declare (obsolete define-key "29.1"))
+  (define-key map (vector 'remap oldfun) newfun))
+
 (provide 'blackbox)
 
 ;;; blackbox.el ends here
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index e695a75e08..93fbc3b51b 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -1,6 +1,6 @@
 ;;; bubbles.el --- Puzzle game for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; URL:         http://ulf.epplejasper.de/
@@ -809,22 +809,21 @@ static char * dot3d_xpm[] = {
   (bubbles--update-faces-or-images))
 
 
-(defvar bubbles-mode-map
-  (let ((map (make-sparse-keymap 'bubbles-mode-map)))
-    ;; (suppress-keymap map t)
-    (define-key map "q" 'bubbles-quit)
-    (define-key map "\n" 'bubbles-plop)
-    (define-key map " " 'bubbles-plop)
-    (define-key map [double-down-mouse-1] 'bubbles-plop)
-    (define-key map [mouse-2] 'bubbles-plop)
-    (define-key map "\C-m" 'bubbles-plop)
-    (define-key map "u" 'bubbles-undo)
-    (define-key map "p" 'previous-line)
-    (define-key map "n" 'next-line)
-    (define-key map "f" 'forward-char)
-    (define-key map "b" 'backward-char)
-    map)
-  "Mode map for `bubbles'.")
+(defvar-keymap bubbles-mode-map
+  :doc "Mode map for `bubbles'."
+  :name 'bubbles-mode-map
+  "q"   #'bubbles-quit
+  "C-j" #'bubbles-plop
+  "SPC" #'bubbles-plop
+  "C-m" #'bubbles-plop
+  "u"   #'bubbles-undo
+  "p"   #'previous-line
+  "n"   #'next-line
+  "f"   #'forward-char
+  "b"   #'backward-char
+
+  "<double-down-mouse-1>" #'bubbles-plop
+  "<mouse-2>"             #'bubbles-plop)
 
 (easy-menu-define bubbles-menu bubbles-mode-map
   "Menu for `bubbles'."
diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el
index d1bf45ed51..fcdd2a7ce9 100644
--- a/lisp/play/cookie1.el
+++ b/lisp/play/cookie1.el
@@ -1,6 +1,6 @@
 ;;; cookie1.el --- retrieve random phrases from fortune cookie files  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index 5431d7f068..7f821bf4cf 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -1,6 +1,6 @@
 ;;; decipher.el --- cryptanalyze monoalphabetic substitution ciphers  -*- 
lexical-binding: t; -*-
 ;;
-;; Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Christopher J. Madsen <chris_madsen@geocities.com>
 ;; Keywords: games
@@ -138,36 +138,31 @@ the tail of the list."
      (2 font-lock-string-face)))
   "Font Lock keywords for Decipher mode.")
 
-(defvar decipher-mode-map
-  (let ((map (make-keymap)))
-    (suppress-keymap map)
-    (define-key map "A" #'decipher-show-alphabet)
-    (define-key map "C" #'decipher-complete-alphabet)
-    (define-key map "D" #'decipher-digram-list)
-    (define-key map "F" #'decipher-frequency-count)
-    (define-key map "M" #'decipher-make-checkpoint)
-    (define-key map "N" #'decipher-adjacency-list)
-    (define-key map "R" #'decipher-restore-checkpoint)
-    (define-key map "U" #'decipher-undo)
-    (define-key map " " #'decipher-keypress)
-    (define-key map [remap undo] #'decipher-undo)
-    (define-key map [remap advertised-undo] #'decipher-undo)
-    (let ((key ?a))
-      (while (<= key ?z)
-       (define-key map (vector key) #'decipher-keypress)
-       (cl-incf key)))
-    map)
-  "Keymap for Decipher mode.")
-
-
-(defvar decipher-stats-mode-map
-  (let ((map (make-keymap)))
-    (suppress-keymap map)
-    (define-key map "D" #'decipher-digram-list)
-    (define-key map "F" #'decipher-frequency-count)
-    (define-key map "N" #'decipher-adjacency-list)
-    map)
-  "Keymap for Decipher-Stats mode.")
+(defvar-keymap decipher-mode-map
+  :doc "Keymap for Decipher mode."
+  :suppress t
+  "A"   #'decipher-show-alphabet
+  "C"   #'decipher-complete-alphabet
+  "D"   #'decipher-digram-list
+  "F"   #'decipher-frequency-count
+  "M"   #'decipher-make-checkpoint
+  "N"   #'decipher-adjacency-list
+  "R"   #'decipher-restore-checkpoint
+  "U"   #'decipher-undo
+  "SPC" #'decipher-keypress
+  "<remap> <undo>" #'decipher-undo
+  "<remap> <advertised-undo>" #'decipher-undo)
+(let ((key ?a))
+  (while (<= key ?z)
+    (keymap-set decipher-mode-map (char-to-string key) #'decipher-keypress)
+    (cl-incf key)))
+
+(defvar-keymap decipher-stats-mode-map
+  :doc "Keymap for Decipher-Stats mode."
+  :suppress t
+  "D" #'decipher-digram-list
+  "F" #'decipher-frequency-count
+  "N" #'decipher-adjacency-list)
 
 
 (defvar decipher-mode-syntax-table
diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el
index a1cc4727b5..1606e6ae9f 100644
--- a/lisp/play/dissociate.el
+++ b/lisp/play/dissociate.el
@@ -1,6 +1,6 @@
 ;;; dissociate.el --- scramble text amusingly for Emacs  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: games
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el
index 33fecaa188..b93d768cbe 100644
--- a/lisp/play/doctor.el
+++ b/lisp/play/doctor.el
@@ -1,6 +1,6 @@
 ;;; doctor.el --- psychological help for frustrated users  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2021 Free Software
+;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -126,11 +126,9 @@
     (set what ww)
     first))
 
-(defvar doctor-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\n" 'doctor-read-print)
-    (define-key map "\r" 'doctor-ret-or-read)
-    map))
+(defvar-keymap doctor-mode-map
+  "C-j" #'doctor-read-print
+  "RET" #'doctor-ret-or-read)
 
 (define-derived-mode doctor-mode text-mode "Doctor"
   "Major mode for running the Doctor (Eliza) program.
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 706c1be81e..07f27374df 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -1,6 +1,6 @@
 ;;; dunnet.el --- text adventure for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ron Schnell <ronnie@driver-aces.com>
 ;; Created: 25 Jul 1992
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index f13302525b..3bc51f6d68 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -1,6 +1,6 @@
 ;;; fortune.el --- use fortune to create signatures  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Holger Schauer <Holger.Schauer@gmx.de>
 ;; Keywords: games utils mail
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index 49a0c9ee02..256b4e19ce 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -1,6 +1,6 @@
 ;;; gamegrid.el --- library for implementing grid-based games on Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Glynn Clements <glynn@sensei.co.uk>
 ;; Old-Version: 1.02
diff --git a/lisp/play/gametree.el b/lisp/play/gametree.el
index cc9a6b7a4f..6a0dc6a623 100644
--- a/lisp/play/gametree.el
+++ b/lisp/play/gametree.el
@@ -1,6 +1,6 @@
 ;;; gametree.el --- manage game analysis trees in Emacs  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ian T Zimmerman <itz@rahul.net>
 ;; Created: Wed Dec 10 07:41:46 PST 1997
@@ -554,54 +554,55 @@ buffer, it is replaced by the new value.  See the 
documentation for
     (gametree-hack-file-layout))
   nil)
 
-;;;; Key bindings
-(defvar gametree-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c\C-j" 'gametree-break-line-here)
-    (define-key map "\C-c\C-v" 'gametree-insert-new-leaf)
-    (define-key map "\C-c\C-m" 'gametree-merge-line)
-    (define-key map "\C-c\C-r " 'gametree-layout-to-register)
-    (define-key map "\C-c\C-r/" 'gametree-layout-to-register)
-    (define-key map "\C-c\C-rj" 'gametree-apply-register-layout)
-    (define-key map "\C-c\C-y" 'gametree-save-and-hack-layout)
-    (define-key map "\C-c;" 'gametree-insert-score)
-    (define-key map "\C-c^" 'gametree-compute-and-insert-score)
-    map))
-
-(define-derived-mode gametree-mode outline-mode "GameTree"
-  "Major mode for managing game analysis trees.
-Useful to postal and email chess (and, it is hoped, also checkers, go,
-shogi, etc.) players, it is a slightly modified version of Outline mode.
-
-\\{gametree-mode-map}"
-  (auto-fill-mode 0)
-  (add-hook 'write-contents-functions 'gametree-save-and-hack-layout nil t))
+
+;;;; Mouse commands
 
-;;;; Goodies for mousing users
 (defun gametree-mouse-break-line-here (event)
   (interactive "e")
   (mouse-set-point event)
   (gametree-break-line-here))
+
 (defun gametree-mouse-show-children-and-entry (event)
   (interactive "e")
   (mouse-set-point event)
   (gametree-show-children-and-entry))
+
 (defun gametree-mouse-show-subtree (event)
   (interactive "e")
   (mouse-set-point event)
   (outline-show-subtree))
+
 (defun gametree-mouse-hide-subtree (event)
   (interactive "e")
   (mouse-set-point event)
   (outline-hide-subtree))
-(define-key gametree-mode-map [M-down-mouse-2 M-mouse-2]
-  'gametree-mouse-break-line-here)
-(define-key gametree-mode-map [S-down-mouse-1 S-mouse-1]
-  'gametree-mouse-show-children-and-entry)
-(define-key gametree-mode-map [S-down-mouse-2 S-mouse-2]
-  'gametree-mouse-show-subtree)
-(define-key gametree-mode-map [S-down-mouse-3 S-mouse-3]
-  'gametree-mouse-hide-subtree)
+
+
+;;;; Key bindings
+
+(defvar-keymap gametree-mode-map
+  "C-c C-j"     #'gametree-break-line-here
+  "C-c C-v"     #'gametree-insert-new-leaf
+  "C-c C-m"     #'gametree-merge-line
+  "C-c C-r SPC" #'gametree-layout-to-register
+  "C-c C-r /"   #'gametree-layout-to-register
+  "C-c C-r j"   #'gametree-apply-register-layout
+  "C-c C-y"     #'gametree-save-and-hack-layout
+  "C-c ;"       #'gametree-insert-score
+  "C-c ^"       #'gametree-compute-and-insert-score
+  "M-<down-mouse-2> M-<mouse-2>" #'gametree-mouse-break-line-here
+  "S-<down-mouse-1> S-<mouse-1>" #'gametree-mouse-show-children-and-entry
+  "S-<down-mouse-2> S-<mouse-2>" #'gametree-mouse-show-subtree
+  "S-<down-mouse-3> S-<mouse-3>" #'gametree-mouse-hide-subtree)
+
+(define-derived-mode gametree-mode outline-mode "GameTree"
+  "Major mode for managing game analysis trees.
+Useful to postal and email chess (and, it is hoped, also checkers, go,
+shogi, etc.) players, it is a slightly modified version of Outline mode.
+
+\\{gametree-mode-map}"
+  (auto-fill-mode 0)
+  (add-hook 'write-contents-functions 'gametree-save-and-hack-layout nil t))
 
 (provide 'gametree)
 
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index 0a45885b87..f8822c30db 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -1,6 +1,6 @@
 ;;; gomoku.el --- Gomoku game between you and Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988, 1994, 1996, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1988, 1994, 1996, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr>
@@ -100,65 +100,61 @@ SHOULD be at least 2 (MUST BE at least 1).")
   "Number of lines between the Gomoku board and the top of the window.")
 
 
-(defvar gomoku-mode-map
-  (let ((map (make-sparse-keymap)))
-
-    ;; Key bindings for cursor motion.
-    (define-key map "y" 'gomoku-move-nw)                   ; y
-    (define-key map "u" 'gomoku-move-ne)                   ; u
-    (define-key map "b" 'gomoku-move-sw)                   ; b
-    (define-key map "n" 'gomoku-move-se)                   ; n
-    (define-key map "h" 'gomoku-move-left)                 ; h
-    (define-key map "l" 'gomoku-move-right)                ; l
-    (define-key map "j" 'gomoku-move-down)                 ; j
-    (define-key map "k" 'gomoku-move-up)                   ; k
-
-    (define-key map [kp-7] 'gomoku-move-nw)
-    (define-key map [kp-9] 'gomoku-move-ne)
-    (define-key map [kp-1] 'gomoku-move-sw)
-    (define-key map [kp-3] 'gomoku-move-se)
-    (define-key map [kp-4] 'gomoku-move-left)
-    (define-key map [kp-6] 'gomoku-move-right)
-    (define-key map [kp-2] 'gomoku-move-down)
-    (define-key map [kp-8] 'gomoku-move-up)
-
-    (define-key map "\C-b" 'gomoku-move-left)              ; C-b
-    (define-key map "\C-f" 'gomoku-move-right)             ; C-f
-    (define-key map "\C-n" 'gomoku-move-down)              ; C-n
-    (define-key map "\C-p" 'gomoku-move-up)                ; C-p
-
-    ;; Key bindings for entering Human moves.
-    (define-key map "X" 'gomoku-human-plays)               ; X
-    (define-key map "x" 'gomoku-human-plays)               ; x
-    (define-key map " " 'gomoku-human-plays)               ; SPC
-    (define-key map "\C-m" 'gomoku-human-plays)                    ; RET
-    (define-key map "\C-c\C-p" 'gomoku-human-plays)        ; C-c C-p
-    (define-key map "\C-c\C-b" 'gomoku-human-takes-back)    ; C-c C-b
-    (define-key map "\C-c\C-r" 'gomoku-human-resigns)      ; C-c C-r
-    (define-key map "\C-c\C-e" 'gomoku-emacs-plays)        ; C-c C-e
-
-    (define-key map [kp-enter] 'gomoku-human-plays)
-    (define-key map [insert] 'gomoku-human-plays)
-    (define-key map [down-mouse-1] 'gomoku-click)
-    (define-key map [drag-mouse-1] 'gomoku-click)
-    (define-key map [mouse-1] 'gomoku-click)
-    (define-key map [down-mouse-2] 'gomoku-click)
-    (define-key map [mouse-2] 'gomoku-mouse-play)
-    (define-key map [drag-mouse-2] 'gomoku-mouse-play)
-
-    (define-key map [remap backward-char] 'gomoku-move-left)
-    (define-key map [remap left-char] 'gomoku-move-left)
-    (define-key map [remap forward-char] 'gomoku-move-right)
-    (define-key map [remap right-char] 'gomoku-move-right)
-    (define-key map [remap previous-line] 'gomoku-move-up)
-    (define-key map [remap next-line] 'gomoku-move-down)
-    (define-key map [remap move-beginning-of-line] 'gomoku-beginning-of-line)
-    (define-key map [remap move-end-of-line] 'gomoku-end-of-line)
-    (define-key map [remap undo] 'gomoku-human-takes-back)
-    (define-key map [remap advertised-undo] 'gomoku-human-takes-back)
-    map)
-
-  "Local keymap to use in Gomoku mode.")
+(defvar-keymap gomoku-mode-map
+  :doc "Local keymap to use in Gomoku mode."
+  ;; Key bindings for cursor motion.
+  "y"       #'gomoku-move-nw
+  "u"       #'gomoku-move-ne
+  "b"       #'gomoku-move-sw
+  "n"       #'gomoku-move-se
+  "h"       #'gomoku-move-left
+  "l"       #'gomoku-move-right
+  "j"       #'gomoku-move-down
+  "k"       #'gomoku-move-up
+
+  "<kp-7>"  #'gomoku-move-nw
+  "<kp-9>"  #'gomoku-move-ne
+  "<kp-1>"  #'gomoku-move-sw
+  "<kp-3>"  #'gomoku-move-se
+  "<kp-4>"  #'gomoku-move-left
+  "<kp-6>"  #'gomoku-move-right
+  "<kp-2>"  #'gomoku-move-down
+  "<kp-8>"  #'gomoku-move-up
+
+  "C-b"     #'gomoku-move-left
+  "C-f"     #'gomoku-move-right
+  "C-n"     #'gomoku-move-down
+  "C-p"     #'gomoku-move-up
+
+  ;; Key bindings for entering Human moves.
+  "X"       #'gomoku-human-plays
+  "x"       #'gomoku-human-plays
+  "SPC"     #'gomoku-human-plays
+  "RET"     #'gomoku-human-plays
+  "C-c C-p" #'gomoku-human-plays
+  "C-c C-b" #'gomoku-human-takes-back
+  "C-c C-r" #'gomoku-human-resigns
+  "C-c C-e" #'gomoku-emacs-plays
+
+  "<kp-enter>"     #'gomoku-human-plays
+  "<insert>"       #'gomoku-human-plays
+  "<down-mouse-1>" #'gomoku-click
+  "<drag-mouse-1>" #'gomoku-click
+  "<mouse-1>"      #'gomoku-click
+  "<down-mouse-2>" #'gomoku-click
+  "<mouse-2>"      #'gomoku-mouse-play
+  "<drag-mouse-2>" #'gomoku-mouse-play
+
+  "<remap> <backward-char>"          #'gomoku-move-left
+  "<remap> <left-char>"              #'gomoku-move-left
+  "<remap> <forward-char>"           #'gomoku-move-right
+  "<remap> <right-char>"             #'gomoku-move-right
+  "<remap> <previous-line>"          #'gomoku-move-up
+  "<remap> <next-line>"              #'gomoku-move-down
+  "<remap> <move-beginning-of-line>" #'gomoku-beginning-of-line
+  "<remap> <move-end-of-line>"       #'gomoku-end-of-line
+  "<remap> <undo>"                   #'gomoku-human-takes-back
+  "<remap> <advertised-undo>"        #'gomoku-human-takes-back)
 
 
 (defvar gomoku-emacs-won ()
diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el
index d59352c352..14624ddce2 100644
--- a/lisp/play/handwrite.el
+++ b/lisp/play/handwrite.el
@@ -1,6 +1,6 @@
 ;;; handwrite.el --- turns your emacs buffer into a handwritten document  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Danny Roozendaal (was: <danny@tvs.kun.nl>)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/play/life.el b/lisp/play/life.el
index 2bf7292772..8c66c0e8a9 100644
--- a/lisp/play/life.el
+++ b/lisp/play/life.el
@@ -1,6 +1,6 @@
 ;;; life.el --- John Horton Conway's Game of Life  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Kyle Jones <kyleuunet.uu.net>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/play/morse.el b/lisp/play/morse.el
index bfb25ba1d5..974e9fbc49 100644
--- a/lisp/play/morse.el
+++ b/lisp/play/morse.el
@@ -1,6 +1,6 @@
 ;;; morse.el --- convert text to morse code and back  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Rick Farnbach <rick_farnbach@MENTORG.COM>
 ;; Keywords: games
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el
index df2b6fc867..1cacf01a20 100644
--- a/lisp/play/mpuz.el
+++ b/lisp/play/mpuz.el
@@ -1,6 +1,6 @@
 ;;; mpuz.el --- multiplication puzzle for GNU Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1990, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr>
 ;; Overhauled: Daniel Pfeiffer <occitan@esperanto.org>
@@ -76,17 +76,12 @@ The value t means never ding, and `error' means only ding 
on wrong input."
   "Hook to run upon entry to mpuz."
   :type 'hook)
 
-(defvar mpuz-mode-map
-  (let ((map (make-sparse-keymap)))
-    (mapc (lambda (ch)
-            (define-key map (char-to-string ch) 'mpuz-try-letter))
-          "abcdefghijABCDEFGHIJ")
-    (define-key map "\C-g" 'mpuz-offer-abort)
-    (define-key map "?" 'describe-mode)
-    map)
-  "Local keymap to use in Mult Puzzle.")
-
-
+(defvar-keymap mpuz-mode-map
+  :doc "Local keymap to use in Mult Puzzle."
+  "C-g" #'mpuz-offer-abort
+  "?"   #'describe-mode)
+(dolist (ch (mapcar #'char-to-string "abcdefghijABCDEFGHIJ"))
+  (keymap-set mpuz-mode-map ch #'mpuz-try-letter))
 
 (define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle"
   :interactive nil
diff --git a/lisp/play/pong.el b/lisp/play/pong.el
index b8545dfa82..79beeb72e2 100644
--- a/lisp/play/pong.el
+++ b/lisp/play/pong.el
@@ -1,6 +1,6 @@
 ;;; pong.el --- classical implementation of pong  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Benjamin Drieu <bdrieu@april.org>
 ;; Keywords: games
@@ -173,23 +173,23 @@
 
 ;;; Initialize maps
 
-(defvar pong-mode-map
-  (let ((map (make-sparse-keymap 'pong-mode-map)))
-    (define-key map [left]      'pong-move-left)
-    (define-key map [right]     'pong-move-right)
-    (define-key map [up]                'pong-move-up)
-    (define-key map [down]      'pong-move-down)
-    (define-key map pong-left-key  'pong-move-left)
-    (define-key map pong-right-key 'pong-move-right)
-    (define-key map pong-up-key         'pong-move-up)
-    (define-key map pong-down-key  'pong-move-down)
-    (define-key map pong-quit-key  'pong-quit)
-    (define-key map pong-pause-key 'pong-pause)
-    map)
-  "Modemap for pong-mode.")
-
-(defvar pong-null-map
-  (make-sparse-keymap 'pong-null-map) "Null map for pong-mode.")
+(defvar-keymap pong-mode-map
+  :doc "Modemap for pong-mode."
+  :name 'pong-mode-map
+  "<left>"       #'pong-move-left
+  "<right>"      #'pong-move-right
+  "<up>"         #'pong-move-up
+  "<down>"       #'pong-move-down
+  pong-left-key  #'pong-move-left
+  pong-right-key #'pong-move-right
+  pong-up-key    #'pong-move-up
+  pong-down-key  #'pong-move-down
+  pong-quit-key  #'pong-quit
+  pong-pause-key #'pong-pause)
+
+(defvar-keymap pong-null-map
+  :doc "Null map for pong-mode."
+  :name 'pong-null-map)
 
 
 
diff --git a/lisp/play/snake.el b/lisp/play/snake.el
index dbdecde973..d8074edfc4 100644
--- a/lisp/play/snake.el
+++ b/lisp/play/snake.el
@@ -1,6 +1,6 @@
 ;;; snake.el --- implementation of Snake for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Glynn Clements <glynn@sensei.co.uk>
 ;; Created: 1997-09-10
diff --git a/lisp/play/solitaire.el b/lisp/play/solitaire.el
index bc1a0e44cb..3c6d85b409 100644
--- a/lisp/play/solitaire.el
+++ b/lisp/play/solitaire.el
@@ -1,6 +1,6 @@
 ;;; solitaire.el --- game of solitaire in Emacs Lisp  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Schormann <Jan.Schormann@rechen-gilde.de>
 ;; Created: Fri afternoon, Jun  3,  1994
@@ -40,48 +40,46 @@
   "Hook to run upon entry to Solitaire."
   :type 'hook)
 
-(defvar solitaire-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map special-mode-map)
-
-    (define-key map "\C-f" 'solitaire-right)
-    (define-key map "\C-b" 'solitaire-left)
-    (define-key map "\C-p" 'solitaire-up)
-    (define-key map "\C-n" 'solitaire-down)
-    (define-key map "\r" 'solitaire-move)
-    (define-key map [remap undo] 'solitaire-undo)
-    (define-key map " " 'solitaire-do-check)
-
-    (define-key map [right] 'solitaire-right)
-    (define-key map [left] 'solitaire-left)
-    (define-key map [up] 'solitaire-up)
-    (define-key map [down] 'solitaire-down)
-
-    (define-key map [S-right] 'solitaire-move-right)
-    (define-key map [S-left]  'solitaire-move-left)
-    (define-key map [S-up]    'solitaire-move-up)
-    (define-key map [S-down]  'solitaire-move-down)
-
-    (define-key map [kp-6] 'solitaire-right)
-    (define-key map [kp-4] 'solitaire-left)
-    (define-key map [kp-8] 'solitaire-up)
-    (define-key map [kp-2] 'solitaire-down)
-    (define-key map [kp-5] 'solitaire-center-point)
-
-    (define-key map [S-kp-6] 'solitaire-move-right)
-    (define-key map [S-kp-4] 'solitaire-move-left)
-    (define-key map [S-kp-8] 'solitaire-move-up)
-    (define-key map [S-kp-2] 'solitaire-move-down)
-
-    (define-key map [kp-enter] 'solitaire-move)
-    (define-key map [kp-0] 'solitaire-undo)
-
-    ;; spoil it with s ;)
-    (define-key map [?s] 'solitaire-solve)
-
-    ;;  (define-key map [kp-0] 'solitaire-hint) - Not yet provided ;)
-    map)
-  "Keymap for playing Solitaire.")
+(defvar-keymap solitaire-mode-map
+  :doc "Keymap for playing Solitaire."
+  :parent special-mode-map
+  "C-f"        #'solitaire-right
+  "C-b"        #'solitaire-left
+  "C-p"        #'solitaire-up
+  "C-n"        #'solitaire-down
+  "RET"        #'solitaire-move
+  "SPC"        #'solitaire-do-check
+
+  "<right>"    #'solitaire-right
+  "<left>"     #'solitaire-left
+  "<up>"       #'solitaire-up
+  "<down>"     #'solitaire-down
+
+  "S-<right>"  #'solitaire-move-right
+  "S-<left>"   #'solitaire-move-left
+  "S-<up>"     #'solitaire-move-up
+  "S-<down>"   #'solitaire-move-down
+
+  "<kp-6>"     #'solitaire-right
+  "<kp-4>"     #'solitaire-left
+  "<kp-8>"     #'solitaire-up
+  "<kp-2>"     #'solitaire-down
+  "<kp-5>"     #'solitaire-center-point
+
+  "S-<kp-6>"   #'solitaire-move-right
+  "S-<kp-4>"   #'solitaire-move-left
+  "S-<kp-8>"   #'solitaire-move-up
+  "S-<kp-2>"   #'solitaire-move-down
+
+  "<kp-enter>" #'solitaire-move
+  "<kp-0>"     #'solitaire-undo
+  "<remap> <undo>" #'solitaire-undo
+
+  ;; spoil it with s ;)
+  "s"          #'solitaire-solve
+
+  ;; "[kp-0]" #'solitaire-hint - Not yet provided ;)
+  )
 
 ;; Solitaire mode is suitable only for specially formatted data.
 (put 'solitaire-mode 'mode-class 'special)
diff --git a/lisp/play/spook.el b/lisp/play/spook.el
index 69f444994f..f2bdba1c2a 100644
--- a/lisp/play/spook.el
+++ b/lisp/play/spook.el
@@ -1,6 +1,6 @@
 ;;; spook.el --- spook phrase utility for overloading the NSA line eater  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1988, 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: games
diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el
index 693bfe4935..8ce2453c75 100644
--- a/lisp/play/tetris.el
+++ b/lisp/play/tetris.el
@@ -1,6 +1,6 @@
 ;;; tetris.el --- implementation of Tetris for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Glynn Clements <glynn@sensei.co.uk>
 ;; Old-Version: 2.01
diff --git a/lisp/play/zone.el b/lisp/play/zone.el
index a5d4ac9dc6..34523fef05 100644
--- a/lisp/play/zone.el
+++ b/lisp/play/zone.el
@@ -1,6 +1,6 @@
 ;;; zone.el --- idle display hacks  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Victor Zandy <zandy@cs.wisc.edu>
 ;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org>
diff --git a/lisp/plstore.el b/lisp/plstore.el
index bcca637e00..b37d39ce1b 100644
--- a/lisp/plstore.el
+++ b/lisp/plstore.el
@@ -1,6 +1,6 @@
 ;;; plstore.el --- secure plist store -*- lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@gnu.org>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/printing.el b/lisp/printing.el
index dfa5a6ef76..b9bc3581c4 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -1,6 +1,6 @@
 ;;; printing.el --- printing utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2001, 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, print, PostScript
diff --git a/lisp/proced.el b/lisp/proced.el
index 9e9793abec..c1d599afc4 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1,6 +1,6 @@
 ;;; proced.el --- operate on system processes like dired  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Roland Winkler <winkler@gnu.org>
 ;; Keywords: Processes, Unix
diff --git a/lisp/profiler.el b/lisp/profiler.el
index fa74fe8de2..94c24c62aa 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -1,6 +1,6 @@
 ;;; profiler.el --- UI and helper functions for Emacs's native profiler -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Tomohiro Matsuyama <tomo@cx4a.org>
 ;; Keywords: lisp
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 0b7945430d..4bc6de0c75 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -1,6 +1,6 @@
 ;;; antlr-mode.el --- major mode for ANTLR grammar files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Christoph Wedler <Christoph.Wedler@sap.com>
 ;; Keywords: languages, ANTLR, code generator
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index 2f7d7bf796..370fb1b80b 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -1,6 +1,6 @@
 ;;; asm-mode.el --- mode for editing assembler code  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1991, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el
index 78148ccf85..d0acd36f4b 100644
--- a/lisp/progmodes/autoconf.el
+++ b/lisp/progmodes/autoconf.el
@@ -1,6 +1,6 @@
 ;;; autoconf.el --- mode for editing Autoconf configure.ac files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: languages
diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el
index 2cc8dfce66..7ef2500e46 100644
--- a/lisp/progmodes/bat-mode.el
+++ b/lisp/progmodes/bat-mode.el
@@ -1,6 +1,6 @@
 ;;; bat-mode.el --- Major mode for editing DOS/Windows scripts  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Arni Magnusson <arnima@hafro.is>
 ;; Keywords: languages
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index d7092a37d4..06242a4cba 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -1,6 +1,6 @@
 ;;; bug-reference.el --- buttonize bug references  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;; Created: 21 Mar 2007
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index a26c1d5bff..8298d5fef0 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -1,6 +1,6 @@
 ;;; cc-align.el --- custom indentation functions for CC Mode -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2004- Alan Mackenzie
 ;;             1998- Martin Stjernholm
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index ea99101750..188d5a8a83 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -1,6 +1,6 @@
 ;;; cc-awk.el --- AWK specific code within cc-mode. -*- lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1994, 1996, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1988, 1994, 1996, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el)
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el
index b6805898b0..4b8154dafe 100644
--- a/lisp/progmodes/cc-bytecomp.el
+++ b/lisp/progmodes/cc-bytecomp.el
@@ -1,6 +1,6 @@
 ;;; cc-bytecomp.el --- compile time setup for proper compilation -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author:     Martin Stjernholm
 ;; Maintainer: bug-cc-mode@gnu.org
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 5024972804..e9237bb01e 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1,6 +1,6 @@
 ;;; cc-cmds.el --- user level commands for CC Mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 12e10c26ee..a127024355 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1,6 +1,6 @@
 ;;; cc-defs.el --- compile time definitions for CC Mode -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d37a50997a..ebc1ef4301 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1,6 +1,6 @@
 ;;; cc-engine.el --- core syntax guessing engine for CC mode -*- 
lexical-binding:t; coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2001- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -6139,7 +6139,7 @@ comment at the start of cc-engine.el for more info."
          (setq s (cons -1 (cdr s))))
         ((and (equal match ",")
               (eq (car s) -1)))        ; at "," in "class foo : bar, ..."
-        ((member match '(";" "," ")"))
+        ((member match '(";" "*" "," "("))
          (when (and s (cdr s) (<= (car s) 0))
            (setq s (cdr s))))
         ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds)
@@ -9937,6 +9937,10 @@ This function might do hidden buffer changes."
        ;; Set when we have encountered a keyword (e.g. "extern") which
        ;; causes the following declaration to be treated as though top-level.
        make-top
+       ;; A list of found types in this declaration.  This is an association
+       ;; list, the car being the buffer position, the cdr being the
+       ;; identifier.
+       found-type-list
        ;; Save `c-record-type-identifiers' and
        ;; `c-record-ref-identifiers' since ranges are recorded
        ;; speculatively and should be thrown away if it turns out
@@ -10006,10 +10010,17 @@ This function might do hidden buffer changes."
                ;; If the previous identifier is a found type we
                ;; record it as a real one; it might be some sort of
                ;; alias for a prefix like "unsigned".
-               (save-excursion
-                 (goto-char type-start)
-                 (let ((c-promote-possible-types t))
-                   (c-forward-type))))
+               ;; We postpone entering the new found type into c-found-types
+               ;; until we are sure of it, thus preventing rapid alternation
+               ;; of the fontification of the token throughout the buffer.
+               (push (cons type-start
+                           (buffer-substring-no-properties
+                            type-start
+                            (save-excursion
+                              (goto-char type-start)
+                              (c-end-of-token)
+                              (point))))
+                     found-type-list))
 
              ;; Signal a type declaration for "struct foo {".
              (when (and backup-at-type-decl
@@ -10255,13 +10266,10 @@ This function might do hidden buffer changes."
                   (when (eq at-type 'found)
                     ;; Remove the ostensible type from the found types list.
                     (when type-start
-                      (c-unfind-type
-                       (buffer-substring-no-properties
-                        type-start
-                        (save-excursion
-                          (goto-char type-start)
-                          (c-end-of-token)
-                          (point)))))
+                      (let ((discard-t (assq type-start found-type-list)))
+                        (when discard-t
+                          (setq found-type-list
+                                (remq discard-t found-type-list)))))
                     t))
               ;; The token which we assumed to be a type is actually the
               ;; identifier, and we have no explicit type.
@@ -10875,6 +10883,14 @@ This function might do hidden buffer changes."
        ;; interactive refontification.
        (c-put-c-type-property (point) 'c-decl-arg-start))
 
+      ;; Enter all the found types into `c-found-types'.
+      (when found-type-list
+       (save-excursion
+         (let ((c-promote-possible-types t))
+           (dolist (ft found-type-list)
+             (goto-char (car ft))
+             (c-forward-type)))))
+
       ;; Record the type's coordinates in `c-record-type-identifiers' for
       ;; later fontification.
       (when (and c-record-type-identifiers at-type ;; (not (eq at-type t))
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 967464ac14..230d39efee 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1,6 +1,6 @@
 ;;; cc-fonts.el --- font lock support for CC Mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             2002- Martin Stjernholm
@@ -93,14 +93,10 @@
 (cc-bytecomp-defvar c-preprocessor-face-name)
 (cc-bytecomp-defvar c-reference-face-name)
 (cc-bytecomp-defvar c-block-comment-flag)
-(cc-bytecomp-defvar c-type-finder-pos)
-(cc-bytecomp-defvar c-inhibit-type-finder)
-(cc-bytecomp-defvar c-type-finder-timer)
 (cc-bytecomp-defun c-fontify-recorded-types-and-refs)
 (cc-bytecomp-defun c-font-lock-declarators)
 (cc-bytecomp-defun c-font-lock-objc-method)
 (cc-bytecomp-defun c-font-lock-invalid-string)
-(cc-bytecomp-defun c-before-context-fl-expand-region)
 (cc-bytecomp-defun c-font-lock-fontify-region)
 
 
@@ -1603,175 +1599,6 @@ casts and declarations are fontified.  Used on level 2 
and higher."
 
        nil))))
 
-(defun c-find-types-background (start limit)
-  ;; Find any "found types" between START and LIMIT.  Allow any such types to
-  ;; be entered into `c-found-types' by the action of `c-forward-name' or
-  ;; `c-forward-type' called from this function.  This process also causes
-  ;; occurrences of the type to be prepared for fontification throughout the
-  ;; buffer.
-  ;;
-  ;; Return POINT at the end of the function.  This should be at or after
-  ;; LIMIT, and not later than the next decl-spot after LIMIT.
-  ;;
-  ;; This function is called from the timer `c-type-finder-timer'.  It may do
-  ;; hidden buffer changes.
-  (save-excursion
-    (save-restriction
-      (widen)
-      (goto-char start)
-      ;; If we're in a (possibly large) literal, skip over it.
-      (let ((lit-bounds (nth 2 (c-full-pp-to-literal (point)))))
-       (if lit-bounds
-           (goto-char (cdr lit-bounds))))
-      (when (< (point) limit)
-       (let (;; o - 'decl if we're in an arglist containing declarations
-             ;;   (but if `c-recognize-paren-inits' is set it might also be
-             ;;   an initializer arglist);
-             ;; o - '<> if the arglist is of angle bracket type;
-             ;; o - 'arglist if it's some other arglist;
-             ;; o - nil, if not in an arglist at all.  This includes the
-             ;;   parenthesized condition which follows "if", "while", etc.
-             context
-             ;; A list of starting positions of possible type declarations, or 
of
-             ;; the typedef preceding one, if any.
-             last-cast-end
-             ;; The result from `c-forward-decl-or-cast-1'.
-             decl-or-cast
-             ;; The maximum of the end positions of all the checked type
-             ;; decl expressions in the successfully identified
-             ;; declarations.  The position might be either before or
-             ;; after the syntactic whitespace following the last token
-             ;; in the type decl expression.
-             (max-type-decl-end 0)
-             ;; Same as `max-type-decl-*', but used when we're before
-             ;; `token-pos'.
-             (max-type-decl-end-before-token 0)
-             )
-         (goto-char start)
-         (c-find-decl-spots
-          limit
-          c-decl-start-re
-          nil                          ; (eval c-maybe-decl-faces)
-
-          (lambda (match-pos inside-macro &optional toplev)
-            ;; Note to maintainers: don't use `limit' inside this lambda form;
-            ;; c-find-decl-spots sometimes narrows to less than `limit'.
-            (if (and c-macro-with-semi-re
-                     (looking-at c-macro-with-semi-re))
-                ;; Don't do anything more if we're looking at something that
-                ;; can't start a declaration.
-                t
-
-              ;; Set `context' and `c-restricted-<>-arglists'.  Look for
-              ;; "<" for the sake of C++-style template arglists.
-              ;; "Ignore "(" when it's part of a control flow construct
-              ;; (e.g. "for (").
-              (let ((got-context
-                     (c-get-fontification-context
-                      match-pos
-                      (< match-pos (if inside-macro
-                                       max-type-decl-end-before-token
-                                     max-type-decl-end))
-                      toplev)))
-                (setq context (car got-context)
-                      c-restricted-<>-arglists (cdr got-context)))
-
-              ;; In QT, "more" is an irritating keyword that expands to 
nothing.
-              ;; We skip over it to prevent recognition of "more slots: 
<symbol>"
-              ;; as a bitfield declaration.
-              (when (and (c-major-mode-is 'c++-mode)
-                         (looking-at
-                          (concat "\\(more\\)\\([^" c-symbol-chars 
"]\\|$\\)")))
-                (goto-char (match-end 1))
-                (c-forward-syntactic-ws))
-
-              ;; Now analyze the construct.  This analysis will cause
-              ;; `c-forward-name' and `c-forward-type' to call `c-add-type',
-              ;; triggering the desired recognition and fontification of
-              ;; these found types.
-              (when (not (eq context 'not-decl))
-                (setq decl-or-cast
-                      (c-forward-decl-or-cast-1
-                       match-pos context last-cast-end))
-
-                (cond
-                 ((eq decl-or-cast 'cast)
-                  ;; Save the position after the previous cast so we can feed
-                  ;; it to `c-forward-decl-or-cast-1' in the next round.  That
-                  ;; helps it discover cast chains like "(a) (b) c".
-                  (setq last-cast-end (point))
-                  nil)
-                 (decl-or-cast
-                  ;; We've found a declaration.
-
-                  ;; Set `max-type-decl-end' or 
`max-type-decl-end-before-token'
-                  ;; under the assumption that we're after the first type decl
-                  ;; expression in the declaration now.  That's not really 
true;
-                  ;; we could also be after a parenthesized initializer
-                  ;; expression in C++, but this is only used as a last resort
-                  ;; to slant ambiguous expression/declarations, and overall
-                  ;; it's worth the risk to occasionally fontify an expression
-                  ;; as a declaration in an initializer expression compared to
-                  ;; getting ambiguous things in normal function prototypes
-                  ;; fontified as expressions.
-                  (if inside-macro
-                      (when (> (point) max-type-decl-end-before-token)
-                        (setq max-type-decl-end-before-token (point)))
-                    (when (> (point) max-type-decl-end)
-                      (setq max-type-decl-end (point)))))
-                 (t t))))))))
-      (point))))
-
-(defun c-type-finder-timer-func ()
-  ;; A CC Mode idle timer function for finding "found types".  It triggers
-  ;; every `c-type-finder-repeat-time' seconds and processes buffer chunks of
-  ;; size around `c-type-finder-chunk-size' characters, and runs for (a little
-  ;; over) `c-type-finder-time-slot' seconds.  The types it finds are inserted
-  ;; into `c-found-types', and their occurrences throughout the buffer are
-  ;; prepared for fontification.
-  (when (and c-type-finder-time-slot
-            (boundp 'font-lock-support-mode)
-            (eq font-lock-support-mode 'jit-lock-mode))
-    (if c-inhibit-type-finder ; No processing immediately after a GC operation.
-       (setq c-inhibit-type-finder nil)
-      (let* ((stop-time (+ (float-time) c-type-finder-time-slot))
-            (buf-list (buffer-list)))
-       ;; One CC Mode buffer needing processing each time around this loop.
-       (while (and buf-list
-                   (< (float-time) stop-time))
-         ;; Cdr through BUF-LIST to find the next buffer needing processing.
-         (while (and buf-list
-                     (not (with-current-buffer (car buf-list) 
c-type-finder-pos)))
-           (setq buf-list (cdr buf-list)))
-         (when buf-list
-           (with-current-buffer (car buf-list)
-             ;; (message "%s" (current-buffer)) ; Useful diagnostic.
-             (save-restriction
-               (widen)
-               ;; Process one `c-type-finder-chunk-size' chunk each time
-               ;; around this loop.
-               (while (and c-type-finder-pos
-                           (< (float-time) stop-time))
-                 ;; Process one chunk per iteration.
-                 (save-match-data
-                   (c-save-buffer-state
-                       (case-fold-search
-                        (beg (marker-position c-type-finder-pos))
-                        (end (min (+ beg c-type-finder-chunk-size) 
(point-max)))
-                        (region (c-before-context-fl-expand-region beg end)))
-                     (setq beg (car region)
-                           end (cdr region))
-                     (setq beg (max (c-find-types-background beg end) end))
-                     (move-marker c-type-finder-pos
-                                  (if (save-excursion (goto-char beg) (eobp))
-                                      nil
-                                    beg))
-                     (when (not (marker-position c-type-finder-pos))
-                       (setq c-type-finder-pos nil))))))))))))
-  ;; Set the timer to run again.
-  (setq c-type-finder-timer
-       (run-at-time c-type-finder-repeat-time nil #'c-type-finder-timer-func)))
-
 (defun c-font-lock-enum-body (limit)
   ;; Fontify the identifiers of each enum we find by searching forward.
   ;;
diff --git a/lisp/progmodes/cc-guess.el b/lisp/progmodes/cc-guess.el
index 8f46b17c54..ea5dd48986 100644
--- a/lisp/progmodes/cc-guess.el
+++ b/lisp/progmodes/cc-guess.el
@@ -1,6 +1,6 @@
 ;;; cc-guess.el --- guess indentation values by scanning existing code -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2006, 2011-2021 Free Software
+;; Copyright (C) 1985, 1987, 1992-2006, 2011-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author:     1994-1995 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 53f6206a82..68070cd058 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1,6 +1,6 @@
 ;;; cc-langs.el --- language specific settings for CC Mode -*- 
lexical-binding: t; coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -3180,8 +3180,8 @@ Note that Java specific rules are currently applied to 
tell this from
       (append
        (c-lang-const c-flat-decl-block-kwds)
        (if (c-lang-const c-recognize-<>-arglists)
-          '("{" "}" ";" "," ")" ":" "<")
-        '("{" "}" ";" "," ")" ":")))))
+          '("{" "}" ";" "*" "," ")" ":" "<")
+        '("{" "}" ";" "*" "," ")" ":")))))
 (c-lang-defvar c-brace-stack-thing-key (c-lang-const c-brace-stack-thing-key))
 
 (c-lang-defconst c-brace-stack-no-semi-key
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index 52b47a5873..51d7f4f5ca 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -1,6 +1,6 @@
 ;;; cc-menus.el --- imenu support for CC Mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    1998- Martin Stjernholm
 ;;             1992-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index f9435c9cee..3a3413dc36 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1,6 +1,6 @@
 ;;; cc-mode.el --- major mode for editing C and similar languages -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -129,16 +129,6 @@
 ;   '
 (require 'cc-fonts) ;)
 
-(defvar c-type-finder-timer nil)
-;; The variable which holds the repeating idle timer which triggers off the
-;; background type finding search.
-
-(defvar c-inhibit-type-finder nil)
-;; When non-nil (set by `c-post-gc-hook') don't perform the type finding
-;; activities the next time `c-type-finder-timer' triggers.  This ensures
-;; keyboard/mouse input will be dealt with when garbage collection is taking a
-;; large portion of CPU time.
-
 ;; The following three really belong to cc-fonts.el, but they are required
 ;; even when cc-fonts.el hasn't been loaded (this happens in XEmacs when
 ;; font-lock-mode is nil).
@@ -197,10 +187,7 @@
                       c-buffer-is-cc-mode))
                (throw 'found nil)))
          (remove-hook 'post-command-hook 'c-post-command)
-         (remove-hook 'post-gc-hook 'c-post-gc-hook)
-         (and c-type-finder-timer
-              (progn (cancel-timer c-type-finder-timer)
-                     (setq c-type-finder-timer nil)))))
+         (remove-hook 'post-gc-hook 'c-post-gc-hook)))
       (c-save-buffer-state ()
        (c-clear-char-properties (point-min) (point-max) 'category)
        (c-clear-char-properties (point-min) (point-max) 'syntax-table)
@@ -596,12 +583,6 @@ preferably use the `c-mode-menu' language constant 
directly."
 ;; currently no such text property.
 (make-variable-buffer-local 'c-max-syn-tab-mkr)
 
-;; `c-type-finder-pos' is a marker marking the current place in a CC Mode
-;; buffer which is due to be searched next for "found types", or nil if the
-;; searching is complete.
-(defvar c-type-finder-pos nil)
-(make-variable-buffer-local 'c-type-finder-pos)
-
 (defun c-basic-common-init (mode default-style)
   "Initialize the syntax handling routines and the line breaking/filling code.
 Intended to be used by other packages that embed CC Mode.
@@ -774,17 +755,6 @@ that requires a literal mode spec at compile time."
   ;; c-after-font-lock-init.
   (add-hook 'after-change-functions 'c-after-change nil t)
   (add-hook 'post-command-hook 'c-post-command)
-  (setq c-type-finder-pos
-       (save-restriction
-         (widen)
-         (move-marker (make-marker) (point-min))))
-
-  ;; Install the functionality for seeking "found types" at mode startup:
-  (or c-type-finder-timer
-      (setq c-type-finder-timer
-           (run-at-time
-            c-type-finder-repeat-time nil #'c-type-finder-timer-func)))
-  (add-hook 'post-gc-hook #'c-post-gc-hook)
 
   (when (boundp 'font-lock-extend-after-change-region-function)
     (set (make-local-variable 'font-lock-extend-after-change-region-function)
@@ -2028,9 +1998,6 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
          c-new-id-end nil
          c-new-id-is-type nil)))
 
-(defun c-post-gc-hook (&optional _stats) ; For XEmacs.
-  (setq c-inhibit-type-finder t))
-
 (defun c-before-change (beg end)
   ;; Function to be put on `before-change-functions'.  Primarily, this calls
   ;; the language dependent `c-get-state-before-change-functions'.  It is
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 4d518838d1..8fe8402b1d 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -1,6 +1,6 @@
 ;;; cc-styles.el --- support for styles in CC Mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2004- Alan Mackenzie
 ;;             1998- Martin Stjernholm
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 40a43c32ed..e0f5a7ee02 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1,6 +1,6 @@
 ;;; cc-vars.el --- user customization variables for CC Mode -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -1524,39 +1524,6 @@ working due to this change."
   :type 'boolean
   :group 'c)
 
-(defcustom c-type-finder-time-slot 0.05
-  "The length in seconds of a background type search time slot.
-
-In CC Mode modes, \"found types\" wouldn't always get cleanly
-fontified without the background searching for them which happens
-in the seconds after starting Emacs or initializing the major
-mode.
-
-This background searching can be disabled by setting this option
-to nil."
-  :type '(choice (const :tag "disabled" nil)
-                number)
-  :group 'c)
-
-(defcustom c-type-finder-repeat-time 0.1
-  "The interval, in seconds, at which background type searches occur.
-
-This interval must be greater than `c-type-finder-time-slot'."
-  :type 'number
-  :group 'c)
-
-(defcustom c-type-finder-chunk-size 1000
-  "The size, in characters, of a chunk for background type search.
-
-Chunks of this size are searched atomically for \"found types\"
-just after starting Emacs or initializing the major mode.
-
-This chunk size is a balance between efficiency (with larger
-values) and responsiveness of the keyboard (with smaller values).
-See also `c-type-finder-time-slot'."
-  :type 'integer
-  :group 'c)
-
 (define-widget 'c-extra-types-widget 'radio
   "Internal CC Mode widget for the `*-font-lock-extra-types' variables."
   :args '((const :tag "none" nil)
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index 53914616cd..6fc898d95b 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -1,6 +1,6 @@
 ;;; cfengine.el --- mode for editing Cfengine files  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
diff --git a/lisp/progmodes/cl-font-lock.el b/lisp/progmodes/cl-font-lock.el
index f602c3e13f..595027642b 100644
--- a/lisp/progmodes/cl-font-lock.el
+++ b/lisp/progmodes/cl-font-lock.el
@@ -1,5 +1,5 @@
 ;;; cl-font-lock.el --- Pretty Common Lisp font locking -*- lexical-binding: 
t; -*-
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Yue Daian <sheepduke@gmail.com>
 ;; Maintainer: Spenser Truex <web@spensertruex.com>
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el
index 07648ac623..7fe529615f 100644
--- a/lisp/progmodes/cmacexp.el
+++ b/lisp/progmodes/cmacexp.el
@@ -1,6 +1,6 @@
 ;;; cmacexp.el --- expand C macros in a region  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: Francesco Potortì <pot@gnu.org>
 ;; Adapted-By: ESR
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 6e3589df7a..e75a44b653 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1,6 +1,6 @@
 ;;; compile.el --- run compiler as inferior of Emacs, parse error messages  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1993-1999, 2001-2021 Free Software
+;; Copyright (C) 1985-1987, 1993-1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Authors: Roland McGrath <roland@gnu.org>,
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index a23505a9d3..8f33b3e3b7 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1,6 +1,6 @@
 ;;; cperl-mode.el --- Perl code editing commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Ilya Zakharevich
 ;;     Bob Olson
@@ -1019,15 +1019,9 @@ Unless KEEP, removes the old indentation."
       (define-key map [(control ?c) (control ?h) ?v]
        ;;(concat (char-to-string help-char) "v") ; does not work
        'cperl-get-help))
-    (substitute-key-definition
-     'indent-sexp 'cperl-indent-exp
-     map global-map)
-    (substitute-key-definition
-     'indent-region 'cperl-indent-region
-     map global-map)
-    (substitute-key-definition
-     'indent-for-comment 'cperl-indent-for-comment
-     map global-map)
+    (define-key map [remap indent-sexp]        #'cperl-indent-exp)
+    (define-key map [remap indent-region]      #'cperl-indent-region)
+    (define-key map [remap indent-for-comment] #'cperl-indent-for-comment)
     map)
   "Keymap used in CPerl mode.")
 
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index baee72b332..f4584b6311 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -1,6 +1,6 @@
 ;;; cpp.el --- highlight or hide text according to cpp conditionals -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: c, faces, tools
diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el
index 7fd592fb2e..971e3f6174 100644
--- a/lisp/progmodes/cwarn.el
+++ b/lisp/progmodes/cwarn.el
@@ -1,6 +1,6 @@
 ;;; cwarn.el --- highlight suspicious C and C++ constructions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: c, languages, faces
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index b74b558f8d..8f79cdaaab 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -1,6 +1,6 @@
 ;;; dcl-mode.el --- major mode for editing DCL command files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Odd Gripenstam <gripenstamol@decus.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/ebnf-abn.el b/lisp/progmodes/ebnf-abn.el
index c3b240ad8b..5470346efc 100644
--- a/lisp/progmodes/ebnf-abn.el
+++ b/lisp/progmodes/ebnf-abn.el
@@ -1,6 +1,6 @@
 ;;; ebnf-abn.el --- parser for ABNF (Augmented BNF)  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf-bnf.el b/lisp/progmodes/ebnf-bnf.el
index e6717cbdf0..3a041057d5 100644
--- a/lisp/progmodes/ebnf-bnf.el
+++ b/lisp/progmodes/ebnf-bnf.el
@@ -1,6 +1,6 @@
 ;;; ebnf-bnf.el --- parser for EBNF  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf-dtd.el b/lisp/progmodes/ebnf-dtd.el
index d4bfdaa995..f49f676976 100644
--- a/lisp/progmodes/ebnf-dtd.el
+++ b/lisp/progmodes/ebnf-dtd.el
@@ -1,6 +1,6 @@
 ;;; ebnf-dtd.el --- parser for DTD (Data Type Description for XML)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf-ebx.el b/lisp/progmodes/ebnf-ebx.el
index ae48881ee9..8d44afffc3 100644
--- a/lisp/progmodes/ebnf-ebx.el
+++ b/lisp/progmodes/ebnf-ebx.el
@@ -1,6 +1,6 @@
 ;;; ebnf-ebx.el --- parser for EBNF used to specify XML (EBNFX)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf-iso.el b/lisp/progmodes/ebnf-iso.el
index b4532c7625..4fc09d7ef7 100644
--- a/lisp/progmodes/ebnf-iso.el
+++ b/lisp/progmodes/ebnf-iso.el
@@ -1,6 +1,6 @@
 ;;; ebnf-iso.el --- parser for ISO EBNF  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf-otz.el b/lisp/progmodes/ebnf-otz.el
index 84e59cc0a5..30d2ae1565 100644
--- a/lisp/progmodes/ebnf-otz.el
+++ b/lisp/progmodes/ebnf-otz.el
@@ -1,6 +1,6 @@
 ;;; ebnf-otz.el --- syntactic chart OpTimiZer  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el
index 84950e45f5..16e15c2d37 100644
--- a/lisp/progmodes/ebnf-yac.el
+++ b/lisp/progmodes/ebnf-yac.el
@@ -1,6 +1,6 @@
 ;;; ebnf-yac.el --- parser for Yacc/Bison  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index 21ab48b110..96cbcba9be 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -1,6 +1,6 @@
 ;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: wp, ebnf, PostScript
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 0713370da3..17cc537e38 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -1,6 +1,6 @@
 ;;; ebrowse.el --- Emacs C++ class browser & tags facility  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <gerd@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 7da93a351a..0dfff32f20 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1,6 +1,6 @@
 ;;; elisp-mode.el --- Emacs Lisp mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1999-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: lisp, languages
@@ -45,15 +45,13 @@ It has `lisp-mode-abbrev-table' as its parent."
     table)
   "Syntax table used in `emacs-lisp-mode'.")
 
-(defvar emacs-lisp-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map lisp-mode-shared-map)
-    (define-key map "\e\t" 'completion-at-point)
-    (define-key map "\e\C-x" 'eval-defun)
-    (define-key map "\e\C-q" 'indent-pp-sexp)
-    map)
-  "Keymap for Emacs Lisp mode.
-All commands in `lisp-mode-shared-map' are inherited by this map.")
+(defvar-keymap emacs-lisp-mode-map
+  :doc "Keymap for Emacs Lisp mode.
+All commands in `lisp-mode-shared-map' are inherited by this map."
+  :parent lisp-mode-shared-map
+  "M-TAB" #'completion-at-point
+  "C-M-x" #'eval-defun
+  "C-M-q" #'indent-pp-sexp)
 
 (easy-menu-define emacs-lisp-mode-menu emacs-lisp-mode-map
   "Menu for Emacs Lisp mode."
@@ -270,10 +268,8 @@ Comments in the form will be lost."
       (setq-local lexical-binding t)
       (add-file-local-variable-prop-line 'lexical-binding t interactive))))
 
-(defvar elisp--dynlex-modeline-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [mode-line mouse-1] 'elisp-enable-lexical-binding)
-    map))
+(defvar-keymap elisp--dynlex-modeline-map
+  "<mode-line> <mouse-1>" #'elisp-enable-lexical-binding)
 
 ;;;###autoload
 (define-derived-mode emacs-lisp-mode lisp-data-mode
@@ -1200,16 +1196,14 @@ namespace but with lower confidence."
 
 ;;; Elisp Interaction mode
 
-(defvar lisp-interaction-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map lisp-mode-shared-map)
-    (define-key map "\e\C-x" 'eval-defun)
-    (define-key map "\e\C-q" 'indent-pp-sexp)
-    (define-key map "\e\t" 'completion-at-point)
-    (define-key map "\n" 'eval-print-last-sexp)
-    map)
-  "Keymap for Lisp Interaction mode.
-All commands in `lisp-mode-shared-map' are inherited by this map.")
+(defvar-keymap lisp-interaction-mode-map
+  :doc "Keymap for Lisp Interaction mode.
+All commands in `lisp-mode-shared-map' are inherited by this map."
+  :parent lisp-mode-shared-map
+  "C-M-x" #'eval-defun
+  "C-M-q" #'indent-pp-sexp
+  "M-TAB" #'completion-at-point
+  "C-j"   #'eval-print-last-sexp)
 
 (easy-menu-define lisp-interaction-mode-menu lisp-interaction-mode-map
   "Menu for Lisp Interaction mode."
diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el
index a12c964c25..31a8bded8a 100644
--- a/lisp/progmodes/erts-mode.el
+++ b/lisp/progmodes/erts-mode.el
@@ -1,6 +1,6 @@
 ;;; erts-mode.el --- major mode to edit erts files  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Keywords: tools
 
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index d7dbaa0650..e1b1e67dbc 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1,6 +1,6 @@
 ;;; etags.el --- etags facility for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2021 Free
+;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
@@ -2088,14 +2088,15 @@ file name, add `tag-partial-file-name-match-p' to the 
list value.")
         (definitions (etags--xref-find-definitions symbol))
         same-file-definitions)
     (when (and etags-xref-prefer-current-file file)
-      (cl-delete-if
-       (lambda (definition)
-         (when (equal file
-                      (xref-location-group
-                       (xref-item-location definition)))
-           (push definition same-file-definitions)
-           t))
-       definitions)
+      (setq definitions
+            (cl-delete-if
+             (lambda (definition)
+               (when (equal file
+                            (xref-location-group
+                             (xref-item-location definition)))
+                 (push definition same-file-definitions)
+                 t))
+             definitions))
       (setq definitions (nconc (nreverse same-file-definitions)
                                definitions)))
     definitions))
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index 0d8b09c33c..d7c093444e 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -1,6 +1,6 @@
 ;;; executable.el --- base functionality for executable interpreter scripts  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1996, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Keywords: languages, unix
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index eb6da20ff7..263cd0ef29 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1,6 +1,6 @@
 ;;; f90.el --- Fortran-90 mode (free format)  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1995-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Torbjörn Einarsson <Torbjorn.Einarsson@era.ericsson.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/flymake-cc.el b/lisp/progmodes/flymake-cc.el
index 3ae3fcb9fe..49e36f4280 100644
--- a/lisp/progmodes/flymake-cc.el
+++ b/lisp/progmodes/flymake-cc.el
@@ -1,6 +1,6 @@
 ;;; flymake-cc.el --- Flymake support for GNU tools for C/C++     -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Keywords: languages, c
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 7f2aa0f469..eebfa70e34 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -1,6 +1,6 @@
 ;;; flymake-proc.el --- Flymake backend for external tools  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com>
 ;; Maintainer: João Távora <joaotavora@gmail.com>
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 72199b33a4..0c16ddedcb 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1,6 +1,6 @@
 ;;; flymake.el --- A universal on-the-fly syntax checker  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com>
 ;; Maintainer: João Távora <joaotavora@gmail.com>
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 8732e398fa..e4794525a9 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -1,6 +1,6 @@
 ;;; fortran.el --- Fortran mode for GNU Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1993-1995, 1997-2021 Free Software Foundation,
+;; Copyright (C) 1986, 1993-1995, 1997-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Michael D. Prange <prange@erl.mit.edu>
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 409ff940d9..ddccbe80e7 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1,6 +1,6 @@
 ;;; gdb-mi.el --- User Interface for running GDB  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Nick Roberts <nickrob@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/glasses.el b/lisp/progmodes/glasses.el
index cd92175bd6..f760ccf368 100644
--- a/lisp/progmodes/glasses.el
+++ b/lisp/progmodes/glasses.el
@@ -1,6 +1,6 @@
 ;;; glasses.el --- make cantReadThis readable  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <pdm@zamazal.org>
 ;; Keywords: tools
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 70c55c01dd..ccc58e6773 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -1,6 +1,6 @@
 ;;; grep.el --- run `grep' and display the results  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1993-1999, 2001-2021 Free Software
+;; Copyright (C) 1985-1987, 1993-1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index d5bd265517..b1bef82842 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -1,6 +1,6 @@
 ;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers 
 -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-1996, 1998, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1992-1996, 1998, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 87732c1048..ba2c573748 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -1,6 +1,6 @@
 ;;; hideif.el --- hides selected code within ifdef  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Brian Marick
 ;;     Daniel LaLiberte <liberte@holonexus.org>
@@ -181,30 +181,24 @@ Effective only if `hide-ifdef-expand-reinclusion-guard' 
is t."
   :type 'regexp
   :version "25.1")
 
-(defvar hide-ifdef-mode-submap
+(defvar-keymap hide-ifdef-mode-submap
+  :doc "Keymap used by `hide-ifdef-mode' under `hide-ifdef-mode-prefix-key'."
   ;; Set up the submap that goes after the prefix key.
-  (let ((map (make-sparse-keymap)))
-    (define-key map "d" 'hide-ifdef-define)
-    (define-key map "u" 'hide-ifdef-undef)
-    (define-key map "D" 'hide-ifdef-set-define-alist)
-    (define-key map "U" 'hide-ifdef-use-define-alist)
-
-    (define-key map "h" 'hide-ifdefs)
-    (define-key map "s" 'show-ifdefs)
-    (define-key map "\C-d" 'hide-ifdef-block)
-    (define-key map "\C-s" 'show-ifdef-block)
-    (define-key map "e" 'hif-evaluate-macro)
-    (define-key map "C" 'hif-clear-all-ifdef-defined)
-
-    (define-key map "\C-q" 'hide-ifdef-toggle-read-only)
-    (define-key map "\C-w" 'hide-ifdef-toggle-shadowing)
-    (substitute-key-definition
-     'read-only-mode 'hide-ifdef-toggle-outside-read-only map)
-    ;; `toggle-read-only' is obsoleted by `read-only-mode'.
-    (substitute-key-definition
-     'toggle-read-only 'hide-ifdef-toggle-outside-read-only map)
-    map)
-  "Keymap used by `hide-ifdef-mode' under `hide-ifdef-mode-prefix-key'.")
+  "d"   #'hide-ifdef-define
+  "u"   #'hide-ifdef-undef
+  "D"   #'hide-ifdef-set-define-alist
+  "U"   #'hide-ifdef-use-define-alist
+  "h"   #'hide-ifdefs
+  "s"   #'show-ifdefs
+  "C-d" #'hide-ifdef-block
+  "C-s" #'show-ifdef-block
+  "e"   #'hif-evaluate-macro
+  "C"   #'hif-clear-all-ifdef-defined
+  "C-q" #'hide-ifdef-toggle-read-only
+  "C-w" #'hide-ifdef-toggle-shadowing
+  "<remap> <read-only-mode>" #'hide-ifdef-toggle-outside-read-only
+  ;; `toggle-read-only' is obsoleted by `read-only-mode'.
+  "<remap> <toggle-read-only>" #'hide-ifdef-toggle-outside-read-only)
 
 (defcustom hide-ifdef-mode-prefix-key "\C-c@"
   "Prefix key for all Hide-Ifdef mode commands."
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index e2ad480281..f574ec84fb 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -1,6 +1,6 @@
 ;;; hideshow.el --- minor mode cmds to selectively display code/comment blocks 
 -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Thien-Thi Nguyen <ttn@gnu.org>
 ;;      Dan Nicolaescu <dann@ics.uci.edu>
diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el
index e9a21d4a0c..e1ee9efc54 100644
--- a/lisp/progmodes/icon.el
+++ b/lisp/progmodes/icon.el
@@ -1,6 +1,6 @@
 ;;; icon.el --- mode for editing Icon code  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Chris Smith <csmith@convex.com>
 ;; Created: 15 Feb 89
diff --git a/lisp/progmodes/idlw-complete-structtag.el 
b/lisp/progmodes/idlw-complete-structtag.el
index bf49c92552..fab1439103 100644
--- a/lisp/progmodes/idlw-complete-structtag.el
+++ b/lisp/progmodes/idlw-complete-structtag.el
@@ -1,6 +1,6 @@
 ;;; idlw-complete-structtag.el --- Completion of structure tags.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@astro.uva.nl>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el
index df04a43d3f..a19abf77e5 100644
--- a/lisp/progmodes/idlw-help.el
+++ b/lisp/progmodes/idlw-help.el
@@ -1,6 +1,6 @@
 ;;; idlw-help.el --- HTML Help code for IDLWAVE  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 ;;
 ;; Authors: JD Smith <jd.smith@utoledo.edu>
 ;;          Carsten Dominik <dominik@science.uva.nl>
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index ded3a9c463..b606352136 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -1,6 +1,6 @@
 ;;; idlw-shell.el --- run IDL as an inferior process of Emacs.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Authors: JD Smith <jd.smith@utoledo.edu>
 ;;          Carsten Dominik <dominik@astro.uva.nl>
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el
index c3ffcd18ce..00de3d16c8 100644
--- a/lisp/progmodes/idlw-toolbar.el
+++ b/lisp/progmodes/idlw-toolbar.el
@@ -1,6 +1,6 @@
 ;;; idlw-toolbar.el --- a debugging toolbar for IDLWAVE  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@astro.uva.nl>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 9aaabd8a0e..e3985db64a 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -1,6 +1,6 @@
 ;;; idlwave.el --- IDL editing mode for GNU Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Authors: JD Smith <jd.smith@utoledo.edu>
 ;;          Carsten Dominik <dominik@science.uva.nl>
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index e69a9ff394..b9042e66c6 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -1,6 +1,6 @@
 ;;; inf-lisp.el --- an inferior-lisp mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1988-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988-2022 Free Software Foundation, Inc.
 
 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
 ;; Keywords: processes, lisp
@@ -308,7 +308,7 @@ quoted using shell quote syntax.
                           "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
        (inferior-lisp-mode)))
   (setq inferior-lisp-buffer "*inferior-lisp*")
-  (pop-to-buffer-same-window "*inferior-lisp*"))
+  (pop-to-buffer "*inferior-lisp*" display-comint-buffer-action))
 
 ;;;###autoload
 (defalias 'run-lisp 'inferior-lisp)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 9303f1ecb9..9c1358e466 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1,6 +1,6 @@
 ;;; js.el --- Major mode for editing JavaScript  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Karl Landstrom <karl.landstrom@brgeight.se>
 ;;         Daniel Colascione <dancol@dancol.org>
diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el
index 879eb72065..7ba74777c4 100644
--- a/lisp/progmodes/ld-script.el
+++ b/lisp/progmodes/ld-script.el
@@ -1,6 +1,6 @@
 ;;; ld-script.el --- GNU linker script editing mode for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO <yamato@redhat.com>
 ;; Keywords: languages, faces
diff --git a/lisp/progmodes/m4-mode.el b/lisp/progmodes/m4-mode.el
index d9c09f6fe6..b9fcd033bb 100644
--- a/lisp/progmodes/m4-mode.el
+++ b/lisp/progmodes/m4-mode.el
@@ -1,6 +1,6 @@
 ;;; m4-mode.el --- m4 code editing commands for Emacs  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrew Csillag <drew@thecsillags.com>
 ;; Keywords: languages, faces
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index df17b87c01..91307f6c09 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -1,6 +1,6 @@
 ;;; make-mode.el --- makefile editing commands for Emacs -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1992, 1994, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Thomas Neumann <tom@smart.bo.open.de>
 ;;     Eric S. Raymond <esr@snark.thyrsus.com>
@@ -542,8 +542,8 @@ not be enclosed in { } or ( )."
 This should identify a `make' command that can handle the `-q' option."
   :type 'string)
 
-(defvaralias 'makefile-query-one-target-method
-  'makefile-query-one-target-method-function)
+(define-obsolete-variable-alias 'makefile-query-one-target-method
+  'makefile-query-one-target-method-function "29.1")
 
 (defcustom makefile-query-one-target-method-function
   'makefile-query-by-make-minus-q
diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el
index 5026844602..5aaa277431 100644
--- a/lisp/progmodes/meta-mode.el
+++ b/lisp/progmodes/meta-mode.el
@@ -1,6 +1,6 @@
 ;;; meta-mode.el --- major mode for editing Metafont or MetaPost sources -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
 ;; Version: 1.0
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el
index 59e87b8741..97a218fcfa 100644
--- a/lisp/progmodes/mixal-mode.el
+++ b/lisp/progmodes/mixal-mode.el
@@ -1,6 +1,6 @@
 ;;; mixal-mode.el --- Major mode for the mix asm language.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Pieter E.J. Pareit <pieter.pareit@gmail.com>
 ;; Maintainer: Jose A Ortega Ruiz <jao@gnu.org>
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 79530f8167..ecc9386cae 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1,6 +1,6 @@
 ;;; octave.el --- editing octave source files under emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
 ;;        John Eaton <jwe@octave.org>
diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el
index 495c77bbd9..4ab9b4a996 100644
--- a/lisp/progmodes/opascal.el
+++ b/lisp/progmodes/opascal.el
@@ -1,6 +1,6 @@
 ;;; opascal.el --- major mode for editing Object Pascal source in Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Authors: Ray Blaak <blaak@infomatch.com>,
 ;;          Simon South <ssouth@member.fsf.org>
diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index 5938da542a..8dc03b72b1 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -1,6 +1,6 @@
 ;;; pascal.el --- major mode for editing pascal source in Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Espen Skoglund <esk@gnu.org>
 ;; Keywords: languages
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 20834dd2e1..92b47ce88f 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -1,6 +1,6 @@
 ;;; perl-mode.el --- Perl code editing commands for GNU Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: William F. Mann
 ;; Maintainer: emacs-devel@gnu.org
@@ -191,7 +191,9 @@
      ,(concat "\\<"
               (regexp-opt '("if" "until" "while" "elsif" "else" "unless"
                             "do" "dump" "for" "foreach" "exit" "die"
-                            "BEGIN" "END" "return" "exec" "eval") t)
+                            "BEGIN" "END" "return" "exec" "eval"
+                            "when" "given" "default")
+                          t)
               "\\>")
      ;;
      ;; Fontify declarators and prefixes as types.
@@ -212,7 +214,7 @@
 
 (eval-and-compile
   (defconst perl--syntax-exp-intro-keywords
-    '("split" "if" "unless" "until" "while" "print"
+    '("split" "if" "unless" "until" "while" "print" "printf"
       "grep" "map" "not" "or" "and" "for" "foreach" "return"))
 
   (defconst perl--syntax-exp-intro-regexp
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 496b081018..7738de6a74 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -1,6 +1,6 @@
 ;;; prog-mode.el --- Generic major mode for programming  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c2e125a017..eda19c46a3 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1,6 +1,6 @@
 ;;; project.el --- Operations on the current project  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 ;; Version: 0.8.1
 ;; Package-Requires: ((emacs "26.1") (xref "1.0.2"))
 
@@ -502,10 +502,12 @@ backend implementation of `project-external-roots'.")
 (declare-function vc-hg-command "vc-hg")
 
 (defun project--vc-list-files (dir backend extra-ignores)
+  (defvar vc-git-use-literal-pathspecs)
   (pcase backend
     (`Git
      (let ((default-directory (expand-file-name (file-name-as-directory dir)))
            (args '("-z"))
+           (vc-git-use-literal-pathspecs nil)
            files)
        ;; Include unregistered.
        (setq args (append args '("-c" "-o" "--exclude-standard")))
@@ -1015,7 +1017,7 @@ if one already exists."
          (default-project-shell-name (project-prefixed-buffer-name "shell"))
          (shell-buffer (get-buffer default-project-shell-name)))
     (if (and shell-buffer (not current-prefix-arg))
-        (pop-to-buffer-same-window shell-buffer)
+        (pop-to-buffer shell-buffer display-comint-buffer-action)
       (shell (generate-new-buffer-name default-project-shell-name)))))
 
 ;;;###autoload
@@ -1031,7 +1033,7 @@ if one already exists."
          (eshell-buffer-name (project-prefixed-buffer-name "eshell"))
          (eshell-buffer (get-buffer eshell-buffer-name)))
     (if (and eshell-buffer (not current-prefix-arg))
-        (pop-to-buffer-same-window eshell-buffer)
+        (pop-to-buffer eshell-buffer display-comint-buffer-action)
       (eshell t))))
 
 ;;;###autoload
@@ -1173,7 +1175,10 @@ displayed."
          (not (major-mode . help-mode)))
     (derived-mode . compilation-mode)
     (derived-mode . dired-mode)
-    (derived-mode . diff-mode))
+    (derived-mode . diff-mode)
+    (derived-mode . comint-mode)
+    (derived-mode . eshell-mode)
+    (derived-mode . change-log-mode))
   "List of conditions to kill buffers related to a project.
 This list is used by `project-kill-buffers'.
 Each condition is either:
@@ -1206,9 +1211,9 @@ current project, it will be killed."
                                (const and) sexp)
                          (cons :tag "Disjunction"
                                (const or) sexp)))
-  :version "28.1"
+  :version "29.1"
   :group 'project
-  :package-version '(project . "0.6.0"))
+  :package-version '(project . "0.8.2"))
 
 (defcustom project-kill-buffers-display-buffer-list nil
   "Non-nil to display list of buffers to kill before killing project buffers.
@@ -1216,7 +1221,7 @@ Used by `project-kill-buffers'."
   :type 'boolean
   :version "29.1"
   :group 'project
-  :package-version '(project . "0.8.1")
+  :package-version '(project . "0.8.2")
   :safe #'booleanp)
 
 (defun project--buffer-list (pr)
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index b68cb001a4..fdab4c019c 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1,6 +1,6 @@
 ;;; prolog.el --- major mode for Prolog (and Mercury) -*- lexical-binding:t -*-
 
-;; Copyright (C) 1986-1987, 1997-1999, 2002-2003, 2011-2021 Free
+;; Copyright (C) 1986-1987, 1997-1999, 2002-2003, 2011-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Authors: Emil Åström <emil_astrom(at)hotmail(dot)com>
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index 68c3cd91fa..7c9aee2b2a 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -1,6 +1,6 @@
 ;;; ps-mode.el --- PostScript mode for GNU Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author:     Peter Kleiweg <p.c.j.kleiweg@rug.nl>
 ;; Created:    20 Aug 1997
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 47d8d1ce8e..edd3139a7a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1,6 +1,6 @@
 ;;; python.el --- Python's flying circus support for Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Fabián E. Gallina <fgallina@gnu.org>
 ;; URL: https://github.com/fgallina/python.el
@@ -2996,8 +2996,9 @@ killed."
                   (mapconcat #'identity args " ")))
             (with-current-buffer buffer
               (inferior-python-mode))
-            (when show (display-buffer buffer))
             (and internal (set-process-query-on-exit-flag process nil))))
+        (when show
+          (pop-to-buffer proc-buffer-name))
         proc-buffer-name))))
 
 ;;;###autoload
@@ -3029,7 +3030,6 @@ process buffer for a list of commands.)"
          (python-shell-make-comint
           (or cmd (python-shell-calculate-command))
           (python-shell-get-process-name dedicated) show)))
-    (set-buffer buffer)
     (get-buffer-process buffer)))
 
 (defun run-python-internal ()
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index a8dc31b612..e1820714b6 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1,6 +1,6 @@
 ;;; ruby-mode.el --- Major mode for editing Ruby files -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Authors: Yukihiro Matsumoto
 ;;     Nobuyoshi Nakada
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index abcdcb3349..6f47f645e0 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -1,6 +1,6 @@
 ;;; scheme.el --- Scheme (and DSSSL) editing mode    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1986-1988, 1997-1998, 2001-2021 Free Software
+;; Copyright (C) 1986-1988, 1997-1998, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Bill Rozas <jinx@martigny.ai.mit.edu>
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index c6b6f83471..e0d597d89d 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1,6 +1,6 @@
 ;;; sh-script.el --- shell-script editing commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1997, 1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1993-1997, 1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
@@ -402,45 +402,42 @@ This is buffer-local in every such buffer.")
     (rpm . (,sh-mode-syntax-table ?\' ".")))
   "Syntax-table used in Shell-Script mode.  See `sh-feature'.")
 
-(defvar sh-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c(" 'sh-function)
-    (define-key map "\C-c\C-w" 'sh-while)
-    (define-key map "\C-c\C-u" 'sh-until)
-    (define-key map "\C-c\C-t" 'sh-tmp-file)
-    (define-key map "\C-c\C-s" 'sh-select)
-    (define-key map "\C-c\C-r" 'sh-repeat)
-    (define-key map "\C-c\C-o" 'sh-while-getopts)
-    (define-key map "\C-c\C-l" 'sh-indexed-loop)
-    (define-key map "\C-c\C-i" 'sh-if)
-    (define-key map "\C-c\C-f" 'sh-for)
-    (define-key map "\C-c\C-c" 'sh-case)
-    (define-key map "\C-c?" #'smie-config-show-indent)
-    (define-key map "\C-c=" #'smie-config-set-indent)
-    (define-key map "\C-c<" #'smie-config-set-indent)
-    (define-key map "\C-c>" #'smie-config-guess)
-    (define-key map "\C-c\C-\\" 'sh-backslash-region)
-
-    (define-key map "\C-c+" 'sh-add)
-    (define-key map "\C-\M-x" 'sh-execute-region)
-    (define-key map "\C-c\C-x" 'executable-interpret)
-    (define-key map "\C-c\C-n" 'sh-send-line-or-region-and-step)
-    (define-key map "\C-c\C-d" 'sh-cd-here)
-    (define-key map "\C-c\C-z" 'sh-show-shell)
-
-    (define-key map [remap delete-backward-char]
-      'backward-delete-char-untabify)
-    (define-key map "\C-c:" 'sh-set-shell)
-    (define-key map [remap backward-sentence] 'sh-beginning-of-command)
-    (define-key map [remap forward-sentence] 'sh-end-of-command)
-    map)
-  "Keymap used in Shell-Script mode.")
+(defvar-keymap sh-mode-map
+  :doc "Keymap used in Shell-Script mode."
+  "C-c ("    #'sh-function
+  "C-c C-w"  #'sh-while
+  "C-c C-u"  #'sh-until
+  "C-c C-t"  #'sh-tmp-file
+  "C-c C-s"  #'sh-select
+  "C-c C-r"  #'sh-repeat
+  "C-c C-o"  #'sh-while-getopts
+  "C-c C-l"  #'sh-indexed-loop
+  "C-c C-i"  #'sh-if
+  "C-c C-f"  #'sh-for
+  "C-c C-c"  #'sh-case
+  "C-c ?"    #'smie-config-show-indent
+  "C-c ="    #'smie-config-set-indent
+  "C-c <"    #'smie-config-set-indent
+  "C-c >"    #'smie-config-guess
+  "C-c C-\\" #'sh-backslash-region
+
+  "C-c +"    #'sh-add
+  "C-M-x"    #'sh-execute-region
+  "C-c C-x"  #'executable-interpret
+  "C-c C-n"  #'sh-send-line-or-region-and-step
+  "C-c C-d"  #'sh-cd-here
+  "C-c C-z"  #'sh-show-shell
+  "C-c :"    #'sh-set-shell
+
+  "<remap> <delete-backward-char>" #'backward-delete-char-untabify
+  "<remap> <backward-sentence>"    #'sh-beginning-of-command
+  "<remap> <forward-sentence>"     #'sh-end-of-command)
 
 (easy-menu-define sh-mode-menu sh-mode-map
   "Menu for Shell-Script mode."
   '("Sh-Script"
     ["Backslash region" sh-backslash-region
-     :help "Insert, align, or delete end-of-line backslashes on the lines in 
the region."]
+     :help "Insert, align, or delete end-of-line backslashes on the lines in 
the region"]
     ["Set shell type..." sh-set-shell
      :help "Set this buffer's shell to SHELL (a string)"]
     ["Execute script..." executable-interpret
@@ -458,7 +455,7 @@ This is buffer-local in every such buffer.")
     ["Select Statement" sh-select
      :help "Insert a select statement "]
     ["Indexed Loop" sh-indexed-loop
-     :help "Insert an indexed loop from 1 to n."]
+     :help "Insert an indexed loop from 1 to n"]
     ["Options Loop" sh-while-getopts
      :help "Insert a while getopts loop."]
     ["While Loop" sh-while
@@ -482,7 +479,7 @@ This is buffer-local in every such buffer.")
     ["Show indentation" smie-config-show-indent
      :help "Show the how the current line would be indented"]
     ["Learn buffer indentation" smie-config-guess
-     :help "Learn how to indent the buffer the way it currently is."]))
+     :help "Learn how to indent the buffer the way it currently is"]))
 
 (defvar sh-skeleton-pair-default-alist '((?\( _ ?\)) (?\))
                                      (?\[ ?\s _ ?\s ?\]) (?\])
@@ -867,7 +864,7 @@ See `sh-feature'.")
     "\\(?:\\(?:.*[^\\\n]\\)?\\(?:\\\\\\\\\\)*\\\\\n\\)*.*")
 
   (defconst sh-here-doc-open-re
-    (concat 
"[^<]<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._]\\)+\\)"
+    (concat 
"[^<]<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._@]\\)+\\)"
             sh-escaped-line-re "\\(\n\\)")))
 
 (defun sh--inside-noncommand-expression (pos)
diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el
index 7c0de9fc35..7e9aeab8fe 100644
--- a/lisp/progmodes/simula.el
+++ b/lisp/progmodes/simula.el
@@ -1,6 +1,6 @@
 ;;; simula.el --- SIMULA 87 code editing commands for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 1994, 1996, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1996, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no>
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index f5888a0ce7..69d16a4357 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -1,6 +1,6 @@
 ;;; sql.el --- specialized comint.el for SQL interpreters  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Michael Mauger <michael@mauger.com>
@@ -3318,7 +3318,7 @@ function like this: (sql-get-login \\='user \\='password 
\\='database)."
          (sql-get-login-ext 'sql-server "Server" 'sql-server-history plist))
 
         ('database
-         (sql-get-login-ext 'sql-database "Database"
+         (sql-get-login-ext 'sql-database "Database: "
                             'sql-database-history plist))
 
         ('port
diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el
index 33b70d83be..b1b78b4d12 100644
--- a/lisp/progmodes/subword.el
+++ b/lisp/progmodes/subword.el
@@ -1,6 +1,6 @@
 ;;; subword.el --- Handling capitalized subwords in a nomenclature -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO
 
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index b6a7a20d87..ed6dce02c0 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -1,6 +1,6 @@
 ;;; tcl.el --- Tcl code editing commands for Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;;    Chris Lindblad <cjl@lcs.mit.edu>
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index 4622256bb9..568c0f1d0f 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -1,6 +1,6 @@
 ;;; vera-mode.el --- major mode for editing Vera files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author:      Reto Zimmermann <reto@gnu.org>
 ;; Version:     2.28
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 14f252b42d..edce3fef6c 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -1,6 +1,6 @@
 ;;; verilog-mode.el --- major mode for editing verilog source in Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael McNamara <mac@verilog.com>
 ;;    Wilson Snyder <wsnyder@wsnyder.org>
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index f3a7d96c63..c6693b4de5 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -1,6 +1,6 @@
 ;;; vhdl-mode.el --- major mode for editing VHDL code  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Authors:     Reto Zimmermann <reto@gnu.org>
 ;;              Rodney J. Whitby <software.vhdl-mode@rwhitby.net>
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 176f599649..4388b0e7de 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -1,6 +1,6 @@
 ;;; which-func.el --- print current function in mode line  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author:   Alex Rezinsky <alexr@msil.sps.mot.com>
 ;;           (doesn't seem to be responsive any more)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index ca3594d253..9ce63a8f8a 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1,6 +1,6 @@
 ;;; xref.el --- Cross-referencing commands              -*-lexical-binding:t-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 ;; Version: 1.3.2
 ;; Package-Requires: ((emacs "26.1"))
 
@@ -44,7 +44,7 @@
 ;;
 ;; The last three methods operate with "xref" and "location" values.
 ;;
-;; One would usually call `make-xref' and `xref-make-file-location',
+;; One would usually call `xref-make' and `xref-make-file-location',
 ;; `xref-make-buffer-location' or `xref-make-bogus-location' to create
 ;; them.  More generally, a location must be an instance of a type for
 ;; which methods `xref-location-group' and `xref-location-marker' are
@@ -206,7 +206,19 @@ is not known."
                   (:constructor xref-make (summary location))
                   (:noinline t))
   "An xref item describes a reference to a location somewhere."
-  summary location)
+  (summary nil :documentation "String which describes the location.
+
+When `xref-location-line' returns non-nil (a number), the summary
+is implied to be the contents of a file or buffer line containing
+the location.  When multiple locations in a row report the same
+line, in the same group (corresponding to the case of multiple
+locations on one line), the summaries are concatenated in the
+Xref output buffer.  Consequently, any code that creates xref
+values should take care to slice the summary values when several
+locations point to the same line.
+
+This behavior is new in Emacs 28.")
+  location)
 
 (xref--defstruct (xref-match-item
                   (:include xref-item)
diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el
index 26ffe33b83..6e21131e4a 100644
--- a/lisp/progmodes/xscheme.el
+++ b/lisp/progmodes/xscheme.el
@@ -1,6 +1,6 @@
 ;;; xscheme.el --- run MIT Scheme under Emacs        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1986-1987, 1989-1990, 2001-2021 Free Software
+;; Copyright (C) 1986-1987, 1989-1990, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -574,9 +574,8 @@ See also the commands \\[xscheme-yank-pop] and 
\\[xscheme-yank-push]."
   (if (consp arg)
       (exchange-point-and-mark)))
 
-;; Old name, to avoid errors in users' init files.
-(fset 'xscheme-yank-previous-send
-      'xscheme-yank)
+(define-obsolete-function-alias 'xscheme-yank-previous-send
+  #'xscheme-yank "29.1")
 
 (defun xscheme-yank-pop (arg)
   "Insert or replace a just-yanked expression with an older expression.
diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el
index 72cbcf8bd6..f71c67849f 100644
--- a/lisp/ps-bdf.el
+++ b/lisp/ps-bdf.el
@@ -1,6 +1,6 @@
 ;;; ps-bdf.el --- BDF font file handler for ps-print  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1998-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2001-2022 Free Software Foundation, Inc.
 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/ps-def.el b/lisp/ps-def.el
index 4f8498d9ef..8c5187ca8b 100644
--- a/lisp/ps-def.el
+++ b/lisp/ps-def.el
@@ -1,6 +1,6 @@
 ;;; ps-def.el --- Emacs definitions for ps-print -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;;     Kenichi Handa <handa@gnu.org> (multi-byte characters)
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el
index 2d1dcd2b68..eb1abfd92d 100644
--- a/lisp/ps-mule.el
+++ b/lisp/ps-mule.el
@@ -1,6 +1,6 @@
 ;;; ps-mule.el --- provide multi-byte character facility to ps-print  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;;     Kenichi Handa <handa@gnu.org> (multi-byte characters)
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 0fc9554679..8df5204fa1 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -1,6 +1,6 @@
 ;;; ps-print.el --- print text from the buffer as PostScript -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>)
 ;;     Jacques Duthen (was <duthen@cegelec-red.fr>)
diff --git a/lisp/ps-samp.el b/lisp/ps-samp.el
index 2f7de40da6..13d5e7d245 100644
--- a/lisp/ps-samp.el
+++ b/lisp/ps-samp.el
@@ -1,6 +1,6 @@
 ;;; ps-samp.el --- ps-print sample setup code  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>)
 ;;     Jacques Duthen (was <duthen@cegelec-red.fr>)
diff --git a/lisp/recentf.el b/lisp/recentf.el
index 6b5a47c66f..5e2f221861 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -1,6 +1,6 @@
 ;;; recentf.el --- setup a menu of recently opened files  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: July 19 1999
diff --git a/lisp/rect.el b/lisp/rect.el
index d288adfbaf..15d636f074 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -1,6 +1,6 @@
 ;;; rect.el --- rectangle functions for GNU Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1999-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Didier Verna <didier@didierverna.net>
 ;; Keywords: internal
@@ -651,7 +651,8 @@ with a prefix argument, prompt for START-AT and FORMAT."
 (define-minor-mode rectangle-mark-mode
   "Toggle the region as rectangular.
 
-Activates the region if needed.  Only lasts until the region is deactivated."
+Activates the region if it's inactive and Transient Mark mode is
+on.  Only lasts until the region is next deactivated."
   :lighter nil
   (rectangle--reset-crutches)
   (when rectangle-mark-mode
diff --git a/lisp/register.el b/lisp/register.el
index 38ee87cd77..78aa130a94 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -1,6 +1,6 @@
 ;;; register.el --- register commands for Emacs      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1985, 1993-1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985, 1993-1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/registry.el b/lisp/registry.el
index c10ae91d16..4030da7b57 100644
--- a/lisp/registry.el
+++ b/lisp/registry.el
@@ -1,6 +1,6 @@
 ;;; registry.el --- Track and remember data items by various fields  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
 ;; Keywords: data
diff --git a/lisp/repeat.el b/lisp/repeat.el
index ea6da5d7f9..aaccc22784 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -1,6 +1,6 @@
 ;;; repeat.el --- convenient way to repeat the previous command  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Will Mengarini <seldon@eskimo.com>
 ;; Created: Mo 02 Mar 98
diff --git a/lisp/replace.el b/lisp/replace.el
index 0e81b15a09..60e507c642 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1,6 +1,6 @@
 ;;; replace.el --- replace commands for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2021 Free
+;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -2621,6 +2621,15 @@ It is used by `query-replace-regexp', `replace-regexp',
 It is called with three arguments, as if it were
 `re-search-forward'.")
 
+(defvar replace-regexp-function nil
+  "Function to convert the FROM string of query-replace commands to a regexp.
+This is used by `query-replace', `query-replace-regexp', etc. as
+the value of `isearch-regexp-function' when they search for the
+occurences of the string/regexp to be replaced.  This is intended
+to be used when the string to be replaced, as typed by the user,
+is not to be interpreted literally, but instead should be converted
+to a regexp that is actually used for the search.")
+
 (defun replace-search (search-string limit regexp-flag delimited-flag
                       case-fold &optional backward)
   "Search for the next occurrence of SEARCH-STRING to replace."
@@ -2633,7 +2642,8 @@ It is called with three arguments, as if it were
   ;; outside of this function because then another I-search
   ;; used after `recursive-edit' might override them.
   (let* ((isearch-regexp regexp-flag)
-        (isearch-regexp-function (or delimited-flag
+        (isearch-regexp-function (or replace-regexp-function
+                                     delimited-flag
                                      (and replace-char-fold
                                           (not regexp-flag)
                                           #'char-fold-to-regexp)))
@@ -2690,7 +2700,8 @@ It is called with three arguments, as if it were
   (if query-replace-lazy-highlight
       (let ((isearch-string search-string)
            (isearch-regexp regexp-flag)
-           (isearch-regexp-function (or delimited-flag
+           (isearch-regexp-function (or replace-regexp-function
+                                        delimited-flag
                                         (and replace-char-fold
                                              (not regexp-flag)
                                              #'char-fold-to-regexp)))
diff --git a/lisp/reposition.el b/lisp/reposition.el
index 02bee4165a..3095740939 100644
--- a/lisp/reposition.el
+++ b/lisp/reposition.el
@@ -1,6 +1,6 @@
 ;;; reposition.el --- center a Lisp function or comment on the screen  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1991, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael D. Ernst <mernst@theory.lcs.mit.edu>
 ;; Created: Jan 1991
diff --git a/lisp/reveal.el b/lisp/reveal.el
index 697df45c5c..64e9ceef64 100644
--- a/lisp/reveal.el
+++ b/lisp/reveal.el
@@ -1,6 +1,6 @@
 ;;; reveal.el --- Automatically reveal hidden text at point -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: outlines
diff --git a/lisp/rfn-eshadow.el b/lisp/rfn-eshadow.el
index 3c1958686f..f5779e59ac 100644
--- a/lisp/rfn-eshadow.el
+++ b/lisp/rfn-eshadow.el
@@ -1,6 +1,6 @@
 ;;; rfn-eshadow.el --- Highlight `shadowed' part of read-file-name input text  
-*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: convenience minibuffer
diff --git a/lisp/rot13.el b/lisp/rot13.el
index e509b22529..c063725de8 100644
--- a/lisp/rot13.el
+++ b/lisp/rot13.el
@@ -1,6 +1,6 @@
 ;;; rot13.el --- display a buffer in ROT13  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1988, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;;         Simon Josefsson
diff --git a/lisp/rtree.el b/lisp/rtree.el
index 0eaaa58e6e..a14d20cf97 100644
--- a/lisp/rtree.el
+++ b/lisp/rtree.el
@@ -1,6 +1,6 @@
 ;;; rtree.el --- functions for manipulating range trees  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 84c9d06ece..afe1cd4bfd 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -1,6 +1,6 @@
 ;;; ruler-mode.el --- display a ruler in the header line  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 24 Mar 2001
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 6745d379cb..aab304007b 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -1,6 +1,6 @@
 ;;; savehist.el --- Save minibuffer history  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Nikšić <hrvoje.niksic@avl.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 3eff816fa0..4d13ad3959 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -1,6 +1,6 @@
 ;;; saveplace.el --- automatically save place in files  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <kfogel@red-bean.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/scroll-all.el b/lisp/scroll-all.el
index 415244f9e9..8b2315fa15 100644
--- a/lisp/scroll-all.el
+++ b/lisp/scroll-all.el
@@ -1,6 +1,6 @@
 ;;; scroll-all.el --- scroll all buffers together minor mode  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com>
 ;; Keywords: convenience scroll lock
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index eecdb60f3a..3d12723c02 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -1,6 +1,6 @@
 ;;; scroll-bar.el --- window system-independent scroll bar support  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1995, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1999-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: hardware
diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el
index d283b8089c..d41e335233 100644
--- a/lisp/scroll-lock.el
+++ b/lisp/scroll-lock.el
@@ -1,6 +1,6 @@
 ;;; scroll-lock.el --- Scroll lock scrolling.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/select.el b/lisp/select.el
index 43424d94b3..7f29f02dab 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -1,6 +1,6 @@
 ;;; select.el --- lisp portion of standard selection support  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
@@ -140,24 +140,27 @@ MS-Windows does not have a \"primary\" selection."
 (defcustom x-select-request-type nil
   "Data type request for X selection.
 The value is one of the following data types, a list of them, or nil:
-  `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT'
+  `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT', 
`text/plain\\;charset=utf-8'
 
 If the value is one of the above symbols, try only the specified type.
 
 If the value is a list of them, try each of them in the specified
 order until succeed.
 
-The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)."
+The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING
+text/plain\\;charset=utf-8)."
   :type '(choice (const :tag "Default" nil)
                 (const COMPOUND_TEXT)
                 (const UTF8_STRING)
                 (const STRING)
                 (const TEXT)
+                 (const text/plain\;charset=utf-8)
                 (set :tag "List of values"
                      (const COMPOUND_TEXT)
                      (const UTF8_STRING)
                      (const STRING)
-                     (const TEXT)))
+                     (const TEXT)
+                      (const text/plain\;charset=utf-8)))
   :group 'killing)
 
 (defun gui--selection-value-internal (type)
@@ -165,9 +168,9 @@ The value nil is the same as the list (UTF8_STRING 
COMPOUND_TEXT STRING)."
 Call `gui-get-selection' with an appropriate DATA-TYPE argument
 decided by `x-select-request-type'.  The return value is already
 decoded.  If `gui-get-selection' signals an error, return nil."
-  (let ((request-type (if (eq window-system 'x)
+  (let ((request-type (if (memq window-system '(x pgtk))
                           (or x-select-request-type
-                              '(UTF8_STRING COMPOUND_TEXT STRING))
+                              '(UTF8_STRING COMPOUND_TEXT STRING 
text/plain\;charset=utf-8))
                         'STRING))
        text)
     (with-demoted-errors "gui-get-selection: %S"
@@ -312,6 +315,7 @@ the formats available in the clipboard if TYPE is 
`CLIPBOARD'."
                         selection-coding-system
                         (pcase data-type
                           ('UTF8_STRING 'utf-8)
+                          ('text/plain\;charset=utf-8 'utf-8)
                           ('COMPOUND_TEXT 'compound-text-with-extensions)
                           ('C_STRING nil)
                           ('STRING 'iso-8859-1)))))
diff --git a/lisp/server.el b/lisp/server.el
index 2f003a380a..da60f1cda7 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1,6 +1,6 @@
 ;;; server.el --- Lisp code for GNU Emacs running as server process -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1986-1987, 1992, 1994-2021 Free Software Foundation,
+;; Copyright (C) 1986-1987, 1992, 1994-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: William Sommerfeld <wesommer@athena.mit.edu>
@@ -900,12 +900,17 @@ This handles splitting the command if it would be bigger 
than
       )
 
     (cond (w
-           (server--create-frame
-            nowait proc
-            `((display . ,display)
-              ,@(if parent-id
-                    `((parent-id . ,(string-to-number parent-id))))
-              ,@parameters)))
+           (condition-case nil
+               (server--create-frame
+                nowait proc
+                `((display . ,display)
+                  ,@(if parent-id
+                        `((parent-id . ,(string-to-number parent-id))))
+                  ,@parameters))
+             (error
+              (server-log "Window system unsupported" proc)
+              (server-send-string proc "-window-system-unsupported \n")
+              nil)))
 
           (t
            (server-log "Window system unsupported" proc)
diff --git a/lisp/ses.el b/lisp/ses.el
index 5e2d254881..45e323e805 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1,6 +1,6 @@
 ;;; ses.el --- Simple Emacs Spreadsheet  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
 ;; Maintainer: Vincent Belaïche <vincentb1@users.sourceforge.net>
@@ -227,12 +227,6 @@ Used for listing local printers or renamed cells.")
                "w"       ses-set-column-width
                "x"       ses-export-keymap
                "\M-p"    ses-read-column-printer))
-       (repl '(;;We'll replace these wherever they appear in the keymap
-               clipboard-kill-region ses-kill-override
-               end-of-line           ses-end-of-line
-               kill-line             ses-delete-row
-               kill-region           ses-kill-override
-               open-line             ses-insert-row))
        (numeric "0123456789.-")
        (newmap (make-keymap)))
     ;;Get rid of printables
@@ -240,13 +234,11 @@ Used for listing local printers or renamed cells.")
     ;;These keys insert themselves as the beginning of a numeric value
     (dotimes (x (length numeric))
       (define-key newmap (substring numeric x (1+ x)) 'ses-read-cell))
-    ;;Override these global functions wherever they're bound
-    (while repl
-      (substitute-key-definition (car repl) (cadr repl) newmap
-                                (current-global-map))
-      (setq repl (cddr repl)))
-    ;;Apparently substitute-key-definition doesn't catch this?
-    (define-key newmap [(menu-bar) edit cut] 'ses-kill-override)
+    (define-key newmap [remap clipboard-kill-region] #'ses-kill-override)
+    (define-key newmap [remap end-of-line]           #'ses-end-of-line)
+    (define-key newmap [remap kill-line]             #'ses-delete-row)
+    (define-key newmap [remap kill-region]           #'ses-kill-override)
+    (define-key newmap [remap open-line]             #'ses-insert-row)
     ;;Define our other local keys
     (while keys
       (define-key newmap (car keys) (cadr keys))
diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el
index 63e9bd655c..c1c31fe9c6 100644
--- a/lisp/shadowfile.el
+++ b/lisp/shadowfile.el
@@ -1,6 +1,6 @@
 ;;; shadowfile.el --- automatic file copying  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: comm files
diff --git a/lisp/shell.el b/lisp/shell.el
index 370532ea46..dcb6bea042 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1,6 +1,6 @@
 ;;; shell.el --- specialized comint.el for running the shell -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1993-1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1988, 1993-1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
@@ -758,7 +758,7 @@ Make the shell buffer the current buffer, and return it.
                  (current-buffer)))
   ;; The buffer's window must be correctly set when we call comint
   ;; (so that comint sets the COLUMNS env var properly).
-  (pop-to-buffer-same-window buffer)
+  (pop-to-buffer buffer)
 
   (with-connection-local-variables
    ;; On remote hosts, the local `shell-file-name' might be useless.
diff --git a/lisp/simple.el b/lisp/simple.el
index d7576a7c03..70ac5620b5 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1,6 +1,6 @@
 ;;; simple.el --- basic editing commands for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1993-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal
@@ -4762,6 +4762,8 @@ File name handlers might not support pty association, if 
PROGRAM is nil."
         (forward-line -1)
       (beginning-of-line))))
 
+(declare-function thread-name "thread.c")
+
 (defun list-processes--refresh ()
   "Recompute the list of processes for the Process List buffer.
 Also, delete any process that is exited or signaled."
@@ -9040,6 +9042,7 @@ makes it easier to edit it."
     (define-key map [down-mouse-2] nil)
     (define-key map "\C-m" 'choose-completion)
     (define-key map "\e\e\e" 'delete-completion-window)
+    (define-key map [remap keyboard-quit] #'delete-completion-window)
     (define-key map [left] 'previous-completion)
     (define-key map [right] 'next-completion)
     (define-key map [?\t] 'next-completion)
@@ -9087,38 +9090,68 @@ Go to the window from which completion was requested."
       (if (get-buffer-window buf)
          (select-window (get-buffer-window buf))))))
 
+(defcustom completion-wrap-movement t
+  "Non-nil means to wrap around when selecting completion options.
+This affects the commands `next-completion' and
+`previous-completion'."
+  :type 'boolean
+  :version "29.1"
+  :group 'completion)
+
 (defun previous-completion (n)
-  "Move to the previous item in the completion list."
+  "Move to the previous item in the completion list.
+With prefix argument N, move back N items (negative N means move
+forward)."
   (interactive "p")
   (next-completion (- n)))
 
 (defun next-completion (n)
   "Move to the next item in the completion list.
-With prefix argument N, move N items (negative N means move backward)."
+With prefix argument N, move N items (negative N means move
+backward)."
   (interactive "p")
   (let ((beg (point-min)) (end (point-max)))
-    (while (and (> n 0) (not (eobp)))
-      ;; If in a completion, move to the end of it.
-      (when (get-text-property (point) 'mouse-face)
-       (goto-char (next-single-property-change (point) 'mouse-face nil end)))
-      ;; Move to start of next one.
-      (unless (get-text-property (point) 'mouse-face)
-       (goto-char (next-single-property-change (point) 'mouse-face nil end)))
-      (setq n (1- n)))
-    (while (and (< n 0) (not (bobp)))
-      (let ((prop (get-text-property (1- (point)) 'mouse-face)))
-       ;; If in a completion, move to the start of it.
-       (when (and prop (eq prop (get-text-property (point) 'mouse-face)))
-         (goto-char (previous-single-property-change
-                     (point) 'mouse-face nil beg)))
-       ;; Move to end of the previous completion.
-       (unless (or (bobp) (get-text-property (1- (point)) 'mouse-face))
-         (goto-char (previous-single-property-change
-                     (point) 'mouse-face nil beg)))
-       ;; Move to the start of that one.
-       (goto-char (previous-single-property-change
-                   (point) 'mouse-face nil beg))
-       (setq n (1+ n))))))
+    (catch 'bound
+      (while (> n 0)
+        ;; If in a completion, move to the end of it.
+        (when (get-text-property (point) 'mouse-face)
+          (goto-char (next-single-property-change (point) 'mouse-face nil 
end)))
+        ;; If at the last completion option, wrap or skip to the
+        ;; minibuffer, if requested.
+        (when (and completion-wrap-movement (eobp))
+          (if (and (member (this-command-keys) '("\t" [backtab]))
+                   completion-auto-select)
+              (throw 'bound nil)
+            (goto-char (point-min))))
+        ;; Move to start of next one.
+        (unless (get-text-property (point) 'mouse-face)
+          (goto-char (next-single-property-change (point) 'mouse-face nil 
end)))
+        (setq n (1- n)))
+      (while (< n 0)
+        (let ((prop (get-text-property (1- (point)) 'mouse-face)))
+          ;; If in a completion, move to the start of it.
+          (when (and prop (eq prop (get-text-property (point) 'mouse-face)))
+            (goto-char (previous-single-property-change
+                        (point) 'mouse-face nil beg)))
+          ;; Move to end of the previous completion.
+          (unless (or (bobp) (get-text-property (1- (point)) 'mouse-face))
+            (goto-char (previous-single-property-change
+                        (point) 'mouse-face nil beg)))
+          ;; If at the first completion option, wrap or skip to the
+          ;; minibuffer, if requested.
+          (when (and completion-wrap-movement (bobp))
+            (if (and (member (this-command-keys) '("\t" [backtab]))
+                     completion-auto-select)
+                (progn
+                  (goto-char (next-single-property-change (point) 'mouse-face 
nil end))
+                  (throw 'bound nil))
+              (goto-char (point-max))))
+          ;; Move to the start of that one.
+          (goto-char (previous-single-property-change
+                      (point) 'mouse-face nil beg))
+          (setq n (1+ n)))))
+    (when (/= 0 n)
+      (switch-to-minibuffer))))
 
 (defun choose-completion (&optional event)
   "Choose the completion at point.
@@ -9286,6 +9319,12 @@ Called from `temp-buffer-show-hook'."
   :version "22.1"
   :group 'completion)
 
+(defcustom completion-auto-select nil
+  "Non-nil means to automatically select the *Completions* buffer."
+  :type 'boolean
+  :version "29.1"
+  :group 'completion)
+
 ;; This function goes in completion-setup-hook, so that it is called
 ;; after the text of the completion list buffer is written.
 (defun completion-setup-function ()
@@ -9322,7 +9361,9 @@ Called from `temp-buffer-show-hook'."
            (insert "Click on a completion to select it.\n"))
        (insert (substitute-command-keys
                 "In this buffer, type \\[choose-completion] to \
-select the completion near point.\n\n"))))))
+select the completion near point.\n\n")))))
+  (when completion-auto-select
+    (switch-to-completions)))
 
 (add-hook 'completion-setup-hook #'completion-setup-function)
 
@@ -9335,10 +9376,16 @@ select the completion near point.\n\n"))))))
                            (get-buffer-window "*Completions*" 0)))))
     (when window
       (select-window window)
-      ;; In the new buffer, go to the first completion.
-      ;; FIXME: Perhaps this should be done in `minibuffer-completion-help'.
-      (when (bobp)
-       (next-completion 1)))))
+      (cond
+       ((and (memq this-command '(completion-at-point minibuffer-complete))
+             (equal (this-command-keys) [backtab])
+             (bobp))
+        (goto-char (point-max))
+        (previous-completion 1))
+       ;; In the new buffer, go to the first completion.
+       ;; FIXME: Perhaps this should be done in `minibuffer-completion-help'.
+       ((bobp)
+        (next-completion 1))))))
 
 (defun read-expression-switch-to-completions ()
   "Select the completion list window while reading an expression."
@@ -9676,7 +9723,7 @@ call `normal-erase-is-backspace-mode' (which see) 
instead."
        (if (if (eq normal-erase-is-backspace 'maybe)
                (and (not noninteractive)
                     (or (memq system-type '(ms-dos windows-nt))
-                       (memq window-system '(w32 ns))
+                       (memq window-system '(w32 ns pgtk))
                         (and (eq window-system 'x)
                              (fboundp 'x-backspace-delete-keys-p)
                              (x-backspace-delete-keys-p))
@@ -9850,24 +9897,7 @@ If it does not exist, create it and switch it to 
`messages-buffer-mode'."
 ;; versions together with bad values.  This is therefore not as
 ;; flexible as it could be.  See the thread:
 ;; https://lists.gnu.org/r/emacs-devel/2007-08/msg00300.html
-(defconst bad-packages-alist
-  ;; Not sure exactly which semantic versions have problems.
-  ;; Definitely 2.0pre3, probably all 2.0pre's before this.
-  '((semantic semantic-version "\\`2\\.0pre[1-3]\\'"
-              "The version of `semantic' loaded does not work in Emacs 22.
-It can cause constant high CPU load.
-Upgrade to at least Semantic 2.0pre4 (distributed with CEDET 1.0pre4).")
-    ;; CUA-mode does not work with GNU Emacs version 22.1 and newer.
-    ;; Except for version 1.2, all of the 1.x and 2.x version of cua-mode
-    ;; provided the `CUA-mode' feature.  Since this is no longer true,
-    ;; we can warn the user if the `CUA-mode' feature is ever provided.
-    (CUA-mode t nil
-"CUA-mode is now part of the standard GNU Emacs distribution,
-so you can now enable CUA via the Options menu or by customizing `cua-mode'.
-
-You have loaded an older version of CUA-mode which does not work
-correctly with this version of Emacs.  You should remove the old
-version and use the one distributed with Emacs."))
+(defconst bad-packages-alist nil
   "Alist of packages known to cause problems in this version of Emacs.
 Each element has the form (PACKAGE SYMBOL REGEXP STRING).
 PACKAGE is either a regular expression to match file names, or a
@@ -9875,9 +9905,11 @@ symbol (a feature name), like for `with-eval-after-load'.
 SYMBOL is either the name of a string variable, or t.  Upon
 loading PACKAGE, if SYMBOL is t or matches REGEXP, display a
 warning using STRING as the message.")
+(make-obsolete-variable 'bad-packages-alist nil "29.1")
 
 (defun bad-package-check (package)
   "Run a check using the element from `bad-packages-alist' matching PACKAGE."
+  (declare (obsolete nil "29.1"))
   (condition-case nil
       (let* ((list (assoc package bad-packages-alist))
              (symbol (nth 1 list)))
@@ -9889,11 +9921,6 @@ warning using STRING as the message.")
              (display-warning package (nth 3 list) :warning)))
     (error nil)))
 
-(dolist (elem bad-packages-alist)
-  (let ((pkg (car elem)))
-    (with-eval-after-load pkg
-      (bad-package-check pkg))))
-
 
 ;;; Generic dispatcher commands
 
diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index 2b183996d8..1bfc29f34e 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -1,6 +1,6 @@
 ;;; skeleton.el --- Lisp language extension for writing statement skeletons  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Maintainer: emacs-devel@gnu.org
@@ -37,7 +37,8 @@
 ;; page 2:     paired insertion
 ;; page 3:     mirror-mode, an example for setting up paired insertion
 
-(defvaralias 'skeleton-transformation 'skeleton-transformation-function)
+(define-obsolete-variable-alias 'skeleton-transformation
+  'skeleton-transformation-function "29.1")
 
 (defvar skeleton-transformation-function 'identity
   "If non-nil, function applied to literal strings before they are inserted.
@@ -65,7 +66,8 @@ region.")
   "Hook called at end of skeleton but before going to point of interest.
 The variables `v1' and `v2' are still set when calling this.")
 
-(defvaralias 'skeleton-filter 'skeleton-filter-function)
+(define-obsolete-variable-alias 'skeleton-filter
+  'skeleton-filter-function "29.1")
 
 ;;;###autoload
 (defvar skeleton-filter-function 'identity
diff --git a/lisp/so-long.el b/lisp/so-long.el
index c975384ddb..f4ae71d905 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -1,6 +1,6 @@
 ;;; so-long.el --- Say farewell to performance problems with minified code.  
-*- lexical-binding:t -*-
 ;;
-;; Copyright (C) 2015-2016, 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2016, 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Maintainer: Phil Sainty <psainty@orcon.net.nz>
diff --git a/lisp/sort.el b/lisp/sort.el
index 0925980541..eb8e2787d1 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -1,6 +1,6 @@
 ;;; sort.el --- commands to sort text in an Emacs buffer -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1986-1987, 1994-1995, 2001-2021 Free Software
+;; Copyright (C) 1986-1987, 1994-1995, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Howie Kaye
diff --git a/lisp/soundex.el b/lisp/soundex.el
index ed98c65e80..2a6605c00b 100644
--- a/lisp/soundex.el
+++ b/lisp/soundex.el
@@ -1,6 +1,6 @@
 ;;; soundex.el --- implement Soundex algorithm -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Christian Plaunt <chris@bliss.berkeley.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index cfa96608bf..e63a2642fe 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -1,6 +1,6 @@
 ;;; speedbar.el --- quick access to files and tags in a frame  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el
index 082eb8276e..ba1b81ef7e 100644
--- a/lisp/sqlite-mode.el
+++ b/lisp/sqlite-mode.el
@@ -1,6 +1,6 @@
 ;;; sqlite-mode.el --- Mode for examining sqlite3 database files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/sqlite.el b/lisp/sqlite.el
index 6d32a0468f..6a8a53a699 100644
--- a/lisp/sqlite.el
+++ b/lisp/sqlite.el
@@ -1,6 +1,6 @@
 ;;; sqlite.el --- Functions for interacting with sqlite3 databases  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/startup.el b/lisp/startup.el
index 3ac7532053..d90e7a7d26 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1,6 +1,6 @@
 ;;; startup.el --- process Emacs shell arguments  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994-2021 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1992, 1994-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -1056,6 +1056,9 @@ the `--debug-init' option to view a complete error 
backtrace."
     (when debug-on-error-should-be-set
       (setq debug-on-error debug-on-error-from-init-file))))
 
+(defvar lisp-directory nil
+  "Directory where Emacs's own *.el and *.elc Lisp files are installed.")
+
 (defun command-line ()
   "A subroutine of `normal-top-level'.
 Amongst another things, it parses the command-line arguments."
@@ -1087,8 +1090,7 @@ Amongst another things, it parses the command-line 
arguments."
   (let ((simple-file-name
         ;; Look for simple.el or simple.elc and use their directory
         ;; as the place where all Lisp files live.
-        (locate-file "simple" load-path (get-load-suffixes)))
-       lisp-dir)
+        (locate-file "simple" load-path (get-load-suffixes))))
     ;; Don't abort if simple.el cannot be found, but print a warning.
     ;; Although in most usage we are going to cryptically abort a moment
     ;; later anyway, due to missing required bidi data files (eg bug#13430).
@@ -1104,12 +1106,13 @@ please check its value")
          (unless (file-readable-p lispdir)
            (princ (format "Lisp directory %s not readable?" lispdir))
            (terpri)))
-      (setq lisp-dir (file-truename (file-name-directory simple-file-name)))
+      (setq lisp-directory
+            (file-truename (file-name-directory simple-file-name)))
       (setq load-history
            (mapcar (lambda (elt)
                      (if (and (stringp (car elt))
                               (not (file-name-absolute-p (car elt))))
-                         (cons (concat lisp-dir
+                         (cons (concat lisp-directory
                                        (car elt))
                                (cdr elt))
                        elt))
@@ -1570,17 +1573,22 @@ If this is nil, no message will be displayed."
   `((:face (variable-pitch font-lock-comment-face)
      "Welcome to "
      :link ("GNU Emacs"
-           ,(lambda (_button) (browse-url 
"https://www.gnu.org/software/emacs/";))
+           ,(lambda (_button)
+               (let ((browse-url-browser-function 'eww-browse-url))
+                 (browse-url "https://www.gnu.org/software/emacs/";)))
            "Browse https://www.gnu.org/software/emacs/";)
      ", one component of the "
      :link
      ,(lambda ()
        (if (eq system-type 'gnu/linux)
             `("GNU/Linux"
-              ,(lambda (_button) (browse-url 
"https://www.gnu.org/gnu/linux-and-gnu.html";))
+              ,(lambda (_button)
+                 (let ((browse-url-browser-function 'eww-browse-url))
+                   (browse-url "https://www.gnu.org/gnu/linux-and-gnu.html";)))
             "Browse https://www.gnu.org/gnu/linux-and-gnu.html";)
           `("GNU" ,(lambda (_button)
-                    (browse-url "https://www.gnu.org/gnu/thegnuproject.html";))
+                    (let ((browse-url-browser-function 'eww-browse-url))
+                       (browse-url 
"https://www.gnu.org/gnu/thegnuproject.html";)))
            "Browse https://www.gnu.org/gnu/thegnuproject.html";)))
      " operating system.\n\n"
      :face variable-pitch
@@ -1613,7 +1621,8 @@ If this is nil, no message will be displayed."
      "\n"
      :link ("Emacs Guided Tour"
            ,(lambda (_button)
-               (browse-url "https://www.gnu.org/software/emacs/tour/";))
+               (let ((browse-url-browser-function 'eww-browse-url))
+                 (browse-url "https://www.gnu.org/software/emacs/tour/";)))
            "Browse https://www.gnu.org/software/emacs/tour/";)
      "\tOverview of Emacs features at gnu.org\n"
      :link ("View Emacs Manual" ,(lambda (_button) (info-emacs-manual)))
@@ -1637,7 +1646,8 @@ Each element in the list should be a list of strings or 
pairs
      "This is "
      :link ("GNU Emacs"
            ,(lambda (_button)
-               (browse-url "https://www.gnu.org/software/emacs/";))
+               (let ((browse-url-browser-function 'eww-browse-url))
+                 (browse-url "https://www.gnu.org/software/emacs/";)))
            "Browse https://www.gnu.org/software/emacs/";)
      ", a text editor and more.\nIt's a component of the "
      :link
@@ -1645,9 +1655,12 @@ Each element in the list should be a list of strings or 
pairs
        (if (eq system-type 'gnu/linux)
           `("GNU/Linux"
             ,(lambda (_button)
-                (browse-url "https://www.gnu.org/gnu/linux-and-gnu.html";))
+                (let ((browse-url-browser-function 'eww-browse-url))
+                  (browse-url "https://www.gnu.org/gnu/linux-and-gnu.html";)))
             "Browse https://www.gnu.org/gnu/linux-and-gnu.html";)
-        `("GNU" ,(lambda (_button) (describe-gnu-project))
+        `("GNU" ,(lambda (_button)
+                    (let ((browse-url-browser-function 'eww-browse-url))
+                      (describe-gnu-project)))
           "Display info on the GNU project.")))
      " operating system.\n"
      :face (variable-pitch font-lock-builtin-face)
@@ -1671,7 +1684,9 @@ Each element in the list should be a list of strings or 
pairs
            ,(lambda (_button) (info "(emacs)Contributing")))
      "\tHow to report bugs and contribute improvements to Emacs\n"
      "\n"
-     :link ("GNU and Freedom" ,(lambda (_button) (describe-gnu-project)))
+     :link ("GNU and Freedom" ,(lambda (_button)
+                                 (let ((browse-url-browser-function 
'eww-browse-url))
+                                   (describe-gnu-project))))
      "\tWhy we developed GNU Emacs, and the GNU operating system\n"
      :link ("Absence of Warranty" ,(lambda (_button) (describe-no-warranty)))
      "\tGNU Emacs comes with "
@@ -1709,7 +1724,8 @@ Each element in the list should be a list of strings or 
pairs
      "\n"
      :link ("Emacs Guided Tour"
            ,(lambda (_button)
-               (browse-url "https://www.gnu.org/software/emacs/tour/";))
+               (let ((browse-url-browser-function 'eww-browse-url))
+                 (browse-url "https://www.gnu.org/software/emacs/tour/";)))
            "Browse https://www.gnu.org/software/emacs/tour/";)
      "\tSee an overview of Emacs features at gnu.org\n"
      :link ("Emacs Manual" ,(lambda (_button) (info-emacs-manual)))
@@ -1831,7 +1847,9 @@ a face or button specification."
        (make-button (prog1 (point) (insert-image img)) (point)
                     'face 'default
                     'help-echo "mouse-2, RET: Browse https://www.gnu.org/";
-                    'action (lambda (_button) (browse-url 
"https://www.gnu.org/";))
+                    'action (lambda (_button)
+                               (let ((browse-url-browser-function 
'eww-browse-url))
+                                 (browse-url "https://www.gnu.org/";)))
                     'follow-link t)
        (insert "\n\n")))))
 
@@ -1952,7 +1970,6 @@ splash screen in another window."
        (insert "\n")
        (fancy-startup-tail concise))
       (use-local-map splash-screen-keymap)
-      (setq-local browse-url-browser-function 'eww-browse-url)
       (setq tab-width 22
            buffer-read-only t)
       (set-buffer-modified-p nil)
@@ -1990,7 +2007,6 @@ splash screen in another window."
        (goto-char (point-min))
        (force-mode-line-update))
       (use-local-map splash-screen-keymap)
-      (setq-local browse-url-browser-function 'eww-browse-url)
       (setq tab-width 22)
       (setq buffer-read-only t)
       ;; Place point somewhere it doesn't cover a character.
@@ -2007,6 +2023,8 @@ we put it on this frame."
     ;; frame visible.
     (if (eq (window-system) 'w32)
        (sit-for 0 t))
+    (if (eq (window-system) 'pgtk)
+       (sit-for 0.1 t))
     (dolist (frame (append (frame-list) (list (selected-frame))))
       (if (and (frame-visible-p frame)
               (not (window-minibuffer-p (frame-selected-window frame))))
@@ -2276,7 +2294,9 @@ Type \\[describe-distribution] for information on "))
   (insert "\tHow to report bugs and contribute improvements to Emacs\n\n")
 
   (insert-button "GNU and Freedom"
-                'action (lambda (_button) (describe-gnu-project))
+                'action (lambda (_button)
+                           (let ((browse-url-browser-function 'eww-browse-url))
+                             (describe-gnu-project)))
                 'follow-link t)
   (insert "\t\tWhy we developed GNU Emacs and the GNU system\n")
 
diff --git a/lisp/strokes.el b/lisp/strokes.el
index db0eb83a3e..dc242d8f33 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -1,6 +1,6 @@
 ;;; strokes.el --- control Emacs through mouse strokes  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: David Bakhash <cadet@alum.mit.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/subr.el b/lisp/subr.el
index cc908619be..7906324f80 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -6526,136 +6526,6 @@ not a list, return a one-element list containing 
OBJECT."
       object
     (list object)))
 
-(defun define-keymap--compile (form &rest args)
-  ;; This compiler macro is only there for compile-time
-  ;; error-checking; it does not change the call in any way.
-  (while (and args
-              (keywordp (car args))
-              (not (eq (car args) :menu)))
-    (unless (memq (car args) '(:full :keymap :parent :suppress :name :prefix))
-      (byte-compile-warn "Invalid keyword: %s" (car args)))
-    (setq args (cdr args))
-    (when (null args)
-      (byte-compile-warn "Uneven number of keywords in %S" form))
-    (setq args (cdr args)))
-  ;; Bindings.
-  (while args
-    (let ((key (pop args)))
-      (when (and (stringp key) (not (key-valid-p key)))
-        (byte-compile-warn "Invalid `kbd' syntax: %S" key)))
-    (when (null args)
-      (byte-compile-warn "Uneven number of key bindings in %S" form))
-    (setq args (cdr args)))
-  form)
-
-(defun define-keymap (&rest definitions)
-  "Create a new keymap and define KEY/DEFEFINITION pairs as key sequences.
-The new keymap is returned.
-
-Options can be given as keywords before the KEY/DEFEFINITION
-pairs.  Available keywords are:
-
-:full      If non-nil, create a chartable alist (see `make-keymap').
-             If nil (i.e., the default), create a sparse keymap (see
-             `make-sparse-keymap').
-
-:suppress  If non-nil, the keymap will be suppressed (see `suppress-keymap').
-             If `nodigits', treat digits like other chars.
-
-:parent    If non-nil, this should be a keymap to use as the parent
-             (see `set-keymap-parent').
-
-:keymap    If non-nil, instead of creating a new keymap, the given keymap
-             will be destructively modified instead.
-
-:name      If non-nil, this should be a string to use as the menu for
-             the keymap in case you use it as a menu with `x-popup-menu'.
-
-:prefix    If non-nil, this should be a symbol to be used as a prefix
-             command (see `define-prefix-command').  If this is the case,
-             this symbol is returned instead of the map itself.
-
-KEY/DEFINITION pairs are as KEY and DEF in `keymap-set'.  KEY can
-also be the special symbol `:menu', in which case DEFINITION
-should be a MENU form as accepted by `easy-menu-define'.
-
-\(fn &key FULL PARENT SUPPRESS NAME PREFIX KEYMAP &rest [KEY DEFINITION]...)"
-  (declare (indent defun)
-           (compiler-macro define-keymap--compile))
-  (let (full suppress parent name prefix keymap)
-    ;; Handle keywords.
-    (while (and definitions
-                (keywordp (car definitions))
-                (not (eq (car definitions) :menu)))
-      (let ((keyword (pop definitions)))
-        (unless definitions
-          (error "Missing keyword value for %s" keyword))
-        (let ((value (pop definitions)))
-          (pcase keyword
-            (:full (setq full value))
-            (:keymap (setq keymap value))
-            (:parent (setq parent value))
-            (:suppress (setq suppress value))
-            (:name (setq name value))
-            (:prefix (setq prefix value))
-            (_ (error "Invalid keyword: %s" keyword))))))
-
-    (when (and prefix
-               (or full parent suppress keymap))
-      (error "A prefix keymap can't be defined with 
:full/:parent/:suppress/:keymap keywords"))
-
-    (when (and keymap full)
-      (error "Invalid combination: :keymap with :full"))
-
-    (let ((keymap (cond
-                   (keymap keymap)
-                   (prefix (define-prefix-command prefix nil name))
-                   (full (make-keymap name))
-                   (t (make-sparse-keymap name)))))
-      (when suppress
-        (suppress-keymap keymap (eq suppress 'nodigits)))
-      (when parent
-        (set-keymap-parent keymap parent))
-
-      ;; Do the bindings.
-      (while definitions
-        (let ((key (pop definitions)))
-          (unless definitions
-            (error "Uneven number of key/definition pairs"))
-          (let ((def (pop definitions)))
-            (if (eq key :menu)
-                (easy-menu-define nil keymap "" def)
-              (keymap-set keymap key def)))))
-      keymap)))
-
-(defmacro defvar-keymap (variable-name &rest defs)
-  "Define VARIABLE-NAME as a variable with a keymap definition.
-See `define-keymap' for an explanation of the keywords and KEY/DEFINITION.
-
-In addition to the keywords accepted by `define-keymap', this
-macro also accepts a `:doc' keyword, which (if present) is used
-as the variable documentation string.
-
-\(fn VARIABLE-NAME &key DOC FULL PARENT SUPPRESS NAME PREFIX KEYMAP &rest [KEY 
DEFINITION]...)"
-  (declare (indent 1))
-  (let ((opts nil)
-        doc)
-    (while (and defs
-                (keywordp (car defs))
-                (not (eq (car defs) :menu)))
-      (let ((keyword (pop defs)))
-        (unless defs
-          (error "Uneven number of keywords"))
-        (if (eq keyword :doc)
-            (setq doc (pop defs))
-          (push keyword opts)
-          (push (pop defs) opts))))
-    (unless (zerop (% (length defs) 2))
-      (error "Uneven number of key/definition pairs: %s" defs))
-    `(defvar ,variable-name
-       (define-keymap ,@(nreverse opts) ,@defs)
-       ,@(and doc (list doc)))))
-
 (defmacro with-delayed-message (args &rest body)
   "Like `progn', but display MESSAGE if BODY takes longer than TIMEOUT seconds.
 The MESSAGE form will be evaluated immediately, but the resulting
diff --git a/lisp/svg.el b/lisp/svg.el
index 3c7f055031..3c97b4a46b 100644
--- a/lisp/svg.el
+++ b/lisp/svg.el
@@ -1,6 +1,6 @@
 ;;; svg.el --- SVG image creation functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;         Felix E. Klee <felix.klee@inka.de>
diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el
index e9de31f50d..cdfc30c879 100644
--- a/lisp/t-mouse.el
+++ b/lisp/t-mouse.el
@@ -4,7 +4,7 @@
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mouse gpm linux
 
-;; Copyright (C) 1994-1995, 1998, 2006-2021 Free Software Foundation,
+;; Copyright (C) 1994-1995, 1998, 2006-2022 Free Software Foundation,
 ;; Inc.
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 7a5221d83a..d49fc2efea 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1,6 +1,6 @@
 ;;; tab-bar.el --- frame-local tabs with named persistent window 
configurations -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@linkov.net>
 ;; Keywords: frames tabs
@@ -1178,7 +1178,7 @@ which means the last tab on the tab bar.  For example, 
`C-u 2
 <MODIFIER>-9' selects the tab before the last tab."
   (interactive "p")
   (tab-bar-select-tab (- (length (funcall tab-bar-tabs-function))
-                         (1- (or arg 1)))))
+                         (1- (abs (or arg 1))))))
 
 (defun tab-bar-switch-to-recent-tab (&optional arg)
   "Switch to ARGth most recently visited tab.
@@ -1884,6 +1884,10 @@ This navigates forward in the history of window 
configurations."
             (goto-char wc-point)))
       (message "No more tab forward history"))))
 
+(defvar-keymap tab-bar-history-mode-map
+  "C-c <left>"  #'tab-bar-history-back
+  "C-c <right>" #'tab-bar-history-forward)
+
 (define-minor-mode tab-bar-history-mode
   "Toggle tab history mode for the tab bar.
 Tab history mode remembers window configurations used in every tab,
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index af0647acf7..1c1217cdf6 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -1,6 +1,6 @@
 ;;; tab-line.el --- window-local tabs with window buffers -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@linkov.net>
 ;; Keywords: windows tabs
@@ -495,6 +495,8 @@ which the tab will represent."
     (apply 'propertize
            (concat (propertize name
                                'keymap tab-line-tab-map
+                               'help-echo (if selected-p "Current tab"
+                                            "Click to select tab")
                                ;; Don't turn mouse-1 into mouse-2 (bug#49247)
                                'follow-link 'ignore)
                    (or (and (or buffer-p (assq 'buffer tab) (assq 'close tab))
@@ -615,6 +617,12 @@ the selected tab visible."
 
 (defvar tab-line-auto-hscroll-buffer (generate-new-buffer " 
*tab-line-hscroll*"))
 
+(defun tab-line--get-tab-property (prop string)
+  (or (get-pos-property 1 prop string) ;; for most cases of 1-char separator
+      (get-pos-property 0 prop string) ;; for empty separator
+      (let ((pos (next-single-property-change 0 prop string))) ;; long 
separator
+        (and pos (get-pos-property pos prop string)))))
+
 (defun tab-line-auto-hscroll (strings hscroll)
   (with-current-buffer tab-line-auto-hscroll-buffer
     (let ((truncate-partial-width-windows nil)
@@ -636,7 +644,7 @@ the selected tab visible."
                  (not (integerp hscroll)))
         (let ((selected (seq-position strings 'selected
                                       (lambda (str prop)
-                                        (get-pos-property 1 prop str)))))
+                                        (tab-line--get-tab-property prop 
str)))))
           (cond
            ((null selected)
             ;; Do nothing if no tab is selected
@@ -656,7 +664,7 @@ the selected tab visible."
                        (new-hscroll (when tab-prop
                                       (seq-position strings tab-prop
                                                     (lambda (str tab)
-                                                      (eq (get-pos-property 1 
'tab str) tab))))))
+                                                      (eq 
(tab-line--get-tab-property 'tab str) tab))))))
                   (when new-hscroll
                     (setq hscroll (float new-hscroll))
                     (set-window-parameter nil 'tab-line-hscroll hscroll)))
@@ -683,7 +691,7 @@ the selected tab visible."
                        (new-hscroll (when tab-prop
                                       (seq-position strings tab-prop
                                                     (lambda (str tab)
-                                                      (eq (get-pos-property 1 
'tab str) tab))))))
+                                                      (eq 
(tab-line--get-tab-property 'tab str) tab))))))
                   (when new-hscroll
                     (setq hscroll (float new-hscroll))
                     (set-window-parameter nil 'tab-line-hscroll 
hscroll)))))))))
@@ -742,7 +750,7 @@ So, for example, switching to a previous tab is equivalent 
to
 using the `previous-buffer' command."
   (interactive "e")
   (let* ((posnp (event-start event))
-         (tab (get-pos-property 1 'tab (car (posn-string posnp))))
+         (tab (tab-line--get-tab-property 'tab (car (posn-string posnp))))
          (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))))
     (if buffer
         (tab-line-select-tab-buffer buffer (posn-window posnp))
@@ -858,7 +866,7 @@ sight of the tab line."
   (interactive (list last-nonmenu-event))
   (let* ((posnp (and (listp event) (event-start event)))
          (window (and posnp (posn-window posnp)))
-         (tab (get-pos-property 1 'tab (car (posn-string posnp))))
+         (tab (tab-line--get-tab-property 'tab (car (posn-string posnp))))
          (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))
          (close-function (unless (bufferp tab) (cdr (assq 'close tab)))))
     (with-selected-window (or window (selected-window))
diff --git a/lisp/tabify.el b/lisp/tabify.el
index f7360313fc..61d5fe5131 100644
--- a/lisp/tabify.el
+++ b/lisp/tabify.el
@@ -1,6 +1,6 @@
 ;;; tabify.el --- tab conversion commands for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Package: emacs
diff --git a/lisp/talk.el b/lisp/talk.el
index 56d36dd8df..9ed6540d83 100644
--- a/lisp/talk.el
+++ b/lisp/talk.el
@@ -1,6 +1,6 @@
 ;;; talk.el --- allow several users to talk to each other through Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: comm, frames
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index db655619be..ed48b56842 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -1,6 +1,6 @@
 ;;; tar-mode.el --- simple editing of tar files from GNU Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1991, 1993-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1991, 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
 ;; Maintainer: emacs-devel@gnu.org
@@ -467,8 +467,8 @@ checksum before doing the check."
 
 (defun tar-clip-time-string (time)
   (declare (obsolete format-time-string "27.1"))
-  (let ((str (current-time-string time)))
-    (concat " " (substring str 4 16) (format-time-string " %Y" time))))
+  (let ((system-time-locale "C"))
+    (format-time-string " %b %e %H:%M %Y" time)))
 
 (defun tar-grind-file-mode (mode)
   "Construct a `rw-r--r--' string indicating MODE.
diff --git a/lisp/tempo.el b/lisp/tempo.el
index b722cc04ca..6da7e82d7c 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -1,6 +1,6 @@
 ;;; tempo.el --- Flexible template insertion -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: David Kågedal <davidk@lysator.liu.se>
 ;; Created: 16 Feb 1994
diff --git a/lisp/term.el b/lisp/term.el
index 698bef08b2..895dfbed6c 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1,6 +1,6 @@
 ;;; term.el --- general command interpreter in a window stuff -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1990, 1992, 1994-1995, 2001-2021 Free Software
+;; Copyright (C) 1988, 1990, 1992, 1994-1995, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Per Bothner <per@bothner.com>
@@ -1532,7 +1532,7 @@ commands to use in that buffer.
                                             shell-file-name))))
   (set-buffer (make-term "terminal" program))
   (term-char-mode)
-  (switch-to-buffer "*terminal*"))
+  (pop-to-buffer-same-window "*terminal*"))
 
 (defun term-exec (buffer name command startfile switches)
   "Start up a process in buffer for term modes.
@@ -3300,13 +3300,16 @@ Called as a buffer-local `post-command-hook' function in
 `term-char-mode' to prevent commands from putting the buffer into
 an inconsistent state by unexpectedly moving point.
 
-Mouse events are ignored so that mouse selection is unimpeded.
+Mouse and wheel events are ignored so that mouse selection and
+mouse wheel scrolling are unimpeded.
 
 Only acts when the pre-command position of point was equal to the
 process mark, and the `term-char-mode-point-at-process-mark'
 option is enabled.  See `term-set-goto-process-mark'."
   (when term-goto-process-mark
-    (unless (mouse-event-p last-command-event)
+    (unless (or (mouse-event-p last-command-event)
+                (memq (event-basic-type last-command-event)
+                      '(wheel-down wheel-up)))
       (goto-char (term-process-mark)))))
 
 (defun term-process-mark ()
diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el
index 3bedde503f..3169f712bc 100644
--- a/lisp/term/AT386.el
+++ b/lisp/term/AT386.el
@@ -1,6 +1,6 @@
 ;;; AT386.el --- terminal support package for IBM AT keyboards  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Keywords: terminals
diff --git a/lisp/term/README b/lisp/term/README
index 9e986bd8bc..ff3c1de635 100644
--- a/lisp/term/README
+++ b/lisp/term/README
@@ -1,4 +1,4 @@
-Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el
index 8ae58718e3..7a48fc04c6 100644
--- a/lisp/term/common-win.el
+++ b/lisp/term/common-win.el
@@ -1,6 +1,6 @@
 ;;; common-win.el --- common part of handling window systems  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: terminals
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index 3c4d00f7f9..ffd67e9cf0 100644
--- a/lisp/term/haiku-win.el
+++ b/lisp/term/haiku-win.el
@@ -1,6 +1,6 @@
 ;;; haiku-win.el --- set up windowing on Haiku -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -111,14 +111,17 @@ If TYPE is nil, return \"text/plain\"."
 
 (declare-function haiku-read-file-name "haikufns.c")
 
-(defun x-file-dialog (prompt dir default_filename mustmatch only_dir_p)
+(defun x-file-dialog (prompt dir &optional default-filename mustmatch 
only-dir-p)
   "SKIP: real doc in xfns.c."
   (if (eq (framep-on-display (selected-frame)) 'haiku)
-      (haiku-read-file-name prompt (selected-frame)
-                            (or dir (and default_filename
-                                         (file-name-directory 
default_filename)))
-                            mustmatch only_dir_p
-                            (file-name-nondirectory default_filename))
+      (haiku-read-file-name (if (not (string-suffix-p ": " prompt))
+                                prompt
+                              (substring prompt 0 (- (length prompt) 2)))
+                            (selected-frame)
+                            (or dir (and default-filename
+                                         (file-name-directory 
default-filename)))
+                            mustmatch only-dir-p
+                            (file-name-nondirectory default-filename))
     (error "x-file-dialog on a tty frame")))
 
 (defun haiku-dnd-handle-drag-n-drop-event (event)
diff --git a/lisp/term/internal.el b/lisp/term/internal.el
index fd75ded081..141adbf853 100644
--- a/lisp/term/internal.el
+++ b/lisp/term/internal.el
@@ -1,6 +1,6 @@
 ;;; internal.el --- support for PC internal terminal  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1993-1994, 1998-1999, 2001-2021 Free Software
+;; Copyright (C) 1993-1994, 1998-1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index e5b94eab76..1daaa60400 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -1,6 +1,6 @@
 ;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Dan Nicolaescu <dann@ics.uci.edu>
 
diff --git a/lisp/term/konsole.el b/lisp/term/konsole.el
index 1f65a46011..44ef8b9fac 100644
--- a/lisp/term/konsole.el
+++ b/lisp/term/konsole.el
@@ -1,5 +1,5 @@
 ;;; konsole.el --- terminal initialization for konsole  -*- lexical-binding:t 
-*-
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 (require 'term/xterm)
 
diff --git a/lisp/term/news.el b/lisp/term/news.el
index 40aa58ef1c..3e896b3dd6 100644
--- a/lisp/term/news.el
+++ b/lisp/term/news.el
@@ -1,6 +1,6 @@
 ;;; news.el --- keypad and function key bindings for the Sony NEWS keyboard  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 67a417c116..da6c5adee2 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1,6 +1,6 @@
 ;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/macOS window 
system  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2005-2022 Free Software Foundation, Inc.
 
 ;; Authors: Carl Edman
 ;;     Christian Limpach
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index 9e7b360b9c..327d51f275 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -1,6 +1,6 @@
 ;;; pc-win.el --- setup support for `PC windows' (whatever that is)  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994, 1996-1997, 1999, 2001-2021 Free Software
+;; Copyright (C) 1994, 1996-1997, 1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el
new file mode 100644
index 0000000000..0f5b9031db
--- /dev/null
+++ b/lisp/term/pgtk-win.el
@@ -0,0 +1,516 @@
+;;; xterm.el --- define function key sequences and standard colors for xterm  
-*- lexical-binding: t -*-
+
+;; Copyright (C) 1995, 2001-2020, 2022 Free Software Foundation, Inc.
+
+;; Author: FSF
+;; Keywords: terminals
+
+;; 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:
+(eval-when-compile (require 'cl-lib))
+(or (featurep 'pgtk)
+    (error "%s: Loading pgtk-win.el but not compiled for pure Gtk+-3."
+           invocation-name))
+
+;; Documentation-purposes only: actually loaded in loadup.el.
+(require 'term/common-win)
+(require 'frame)
+(require 'mouse)
+(require 'scroll-bar)
+(require 'faces)
+(require 'menu-bar)
+(require 'fontset)
+(require 'dnd)
+
+(defgroup pgtk nil
+  "Pure-GTK specific features."
+  :group 'environment)
+
+;;;; Command line argument handling.
+
+(defvar x-invocation-args)
+;; Set in term/common-win.el; currently unused by Gtk's x-open-connection.
+(defvar x-command-line-resources)
+
+;; pgtkterm.c.
+(defvar pgtk-input-file)
+
+(declare-function pgtk-use-im-context "pgtkim.c")
+(defvar pgtk-use-im-context-on-new-connection)
+
+(defun pgtk-handle-nxopen (_switch &optional temp)
+  (setq unread-command-events (append unread-command-events
+                                      (if temp '(pgtk-open-temp-file)
+                                        '(pgtk-open-file)))
+        pgtk-input-file (append pgtk-input-file (list (pop 
x-invocation-args)))))
+
+(defun pgtk-handle-nxopentemp (switch)
+  (pgtk-handle-nxopen switch t))
+
+(defun pgtk-ignore-1-arg (_switch)
+  (setq x-invocation-args (cdr x-invocation-args)))
+
+;;;; File handling.
+
+(declare-function pgtk-hide-emacs "pgtkfns.c" (on))
+
+
+(defun pgtk-drag-n-drop (event &optional new-frame force-text)
+  "Edit the files listed in the drag-n-drop EVENT.
+Switch to a buffer editing the last file dropped."
+  (interactive "e")
+  (let* ((window (posn-window (event-start event)))
+         (arg (car (cdr (cdr event))))
+         (type (car arg))
+         (data (car (cdr arg)))
+         (url-or-string (cond ((eq type 'file)
+                               (concat "file:" data))
+                              (t data))))
+    (set-frame-selected-window nil window)
+    (when new-frame
+      (select-frame (make-frame)))
+    (raise-frame)
+    (setq window (selected-window))
+    (if force-text
+        (dnd-insert-text window 'private data)
+      (dnd-handle-one-url window 'private url-or-string))))
+
+
+(defun pgtk-drag-n-drop-other-frame (event)
+  "Edit the files listed in the drag-n-drop EVENT, in other frames.
+May create new frames, or reuse existing ones.  The frame editing
+the last file dropped is selected."
+  (interactive "e")
+  (pgtk-drag-n-drop event t))
+
+(defun pgtk-drag-n-drop-as-text (event)
+  "Drop the data in EVENT as text."
+  (interactive "e")
+  (pgtk-drag-n-drop event nil t))
+
+(defun pgtk-drag-n-drop-as-text-other-frame (event)
+  "Drop the data in EVENT as text in a new frame."
+  (interactive "e")
+  (pgtk-drag-n-drop event t t))
+
+(global-set-key [drag-n-drop] 'pgtk-drag-n-drop)
+(global-set-key [C-drag-n-drop] 'pgtk-drag-n-drop-other-frame)
+(global-set-key [M-drag-n-drop] 'pgtk-drag-n-drop-as-text)
+(global-set-key [C-M-drag-n-drop] 'pgtk-drag-n-drop-as-text-other-frame)
+
+;;;; Frame-related functions.
+
+;; pgtkterm.c
+(defvar pgtk-alternate-modifier)
+(defvar pgtk-right-alternate-modifier)
+(defvar pgtk-right-command-modifier)
+(defvar pgtk-right-control-modifier)
+
+;; You say tomAYto, I say tomAHto..
+(with-no-warnings
+  (defvaralias 'pgtk-option-modifier 'pgtk-alternate-modifier)
+  (defvaralias 'pgtk-right-option-modifier 'pgtk-right-alternate-modifier))
+
+(defun pgtk-do-hide-emacs ()
+  (interactive)
+  (pgtk-hide-emacs t))
+
+(declare-function pgtk-hide-others "pgtkfns.c" ())
+
+(defun pgtk-do-hide-others ()
+  (interactive)
+  (pgtk-hide-others))
+
+(declare-function pgtk-emacs-info-panel "pgtkfns.c" ())
+
+(defun pgtk-do-emacs-info-panel ()
+  (interactive)
+  (pgtk-emacs-info-panel))
+
+(defun pgtk-next-frame ()
+  "Switch to next visible frame."
+  (interactive)
+  (other-frame 1))
+
+(defun pgtk-prev-frame ()
+  "Switch to previous visible frame."
+  (interactive)
+  (other-frame -1))
+
+;; Frame will be focused anyway, so select it
+;; (if this is not done, mode line is dimmed until first interaction)
+;; FIXME: Sounds like we're working around a bug in the underlying code.
+(add-hook 'after-make-frame-functions 'select-frame)
+
+(defvar tool-bar-mode)
+(declare-function tool-bar-mode "tool-bar" (&optional arg))
+
+;; Based on a function by David Reitter <dreitter@inf.ed.ac.uk> ;
+;; see https://lists.gnu.org/archive/html/emacs-devel/2005-09/msg00681.html .
+(defun pgtk-toggle-toolbar (&optional frame)
+  "Switches the tool bar on and off in frame FRAME.
+ If FRAME is nil, the change applies to the selected frame."
+  (interactive)
+  (modify-frame-parameters
+   frame (list (cons 'tool-bar-lines
+                      (if (> (or (frame-parameter frame 'tool-bar-lines) 0) 0)
+                                  0 1)) ))
+  (if (not tool-bar-mode) (tool-bar-mode t)))
+
+
+;;;; Dialog-related functions.
+
+;; Ask user for confirm before printing.  Due to Kevin Rodgers.
+(defun pgtk-print-buffer ()
+  "Interactive front-end to `print-buffer': asks for user confirmation first."
+  (interactive)
+  (if (and (called-interactively-p 'interactive)
+           (or (listp last-nonmenu-event)
+               (and (char-or-string-p (event-basic-type last-command-event))
+                    (memq 'super (event-modifiers last-command-event)))))
+      (let ((last-nonmenu-event (if (listp last-nonmenu-event)
+                                    last-nonmenu-event
+                                  ;; Fake it:
+                                  `(mouse-1 POSITION 1))))
+        (if (y-or-n-p (format "Print buffer %s? " (buffer-name)))
+            (print-buffer)
+         (error "Canceled")))
+    (print-buffer)))
+
+;;;; Font support.
+
+;; Needed for font listing functions under both backend and normal
+(setq scalable-fonts-allowed t)
+
+;; Default fontset.  This is mainly here to show how a fontset
+;; can be set up manually.  Ordinarily, fontsets are auto-created whenever
+;; a font is chosen by
+(defvar pgtk-standard-fontset-spec
+  ;; Only some code supports this so far, so use uglier XLFD version
+  ;; "-pgtk-*-*-*-*-*-10-*-*-*-*-*-fontset-standard,latin:Courier,han:Kai"
+  (mapconcat 'identity
+             '("-*-Monospace-*-*-*-*-10-*-*-*-*-*-fontset-standard"
+               "latin:-*-Courier-*-*-*-*-10-*-*-*-*-*-iso10646-1")
+             ",")
+  "String of fontset spec of the standard fontset.
+This defines a fontset consisting of the Courier and other fonts.
+See the documentation of `create-fontset-from-fontset-spec' for the format.")
+
+
+;;;; Pasteboard support.
+
+(define-obsolete-function-alias 'pgtk-store-cut-buffer-internal
+  'gui-set-selection "24.1")
+
+
+(defun pgtk-copy-including-secondary ()
+  (interactive)
+  (call-interactively 'kill-ring-save)
+  (gui-set-selection 'SECONDARY (buffer-substring (point) (mark t))))
+
+(defun pgtk-paste-secondary ()
+  (interactive)
+  (insert (gui-get-selection 'SECONDARY)))
+
+
+(defun pgtk-suspend-error ()
+  ;; Don't allow suspending if any of the frames are PGTK frames.
+  (if (memq 'pgtk (mapcar 'window-system (frame-list)))
+      (error "Cannot suspend Emacs while a PGTK GUI frame exists")))
+
+
+
+(defvar pgtk-initialized nil
+  "Non-nil if pure-GTK windowing has been initialized.")
+
+(declare-function x-handle-args "common-win" (args))
+(declare-function x-open-connection "pgtkfns.c"
+                  (display &optional xrm-string must-succeed))
+(declare-function pgtk-set-resource "pgtkfns.c" (owner name value))
+
+;; Do the actual pure-GTK Windows setup here; the above code just
+;; defines functions and variables that we use now.
+(cl-defmethod window-system-initialization (&context (window-system pgtk)
+                                            &optional display)
+  "Initialize Emacs for pure-GTK windowing."
+  (cl-assert (not pgtk-initialized))
+
+  ;; PENDING: not needed?
+  (setq command-line-args (x-handle-args command-line-args))
+
+  ;; Make sure we have a valid resource name.
+  (or (stringp x-resource-name)
+      (let (i)
+       (setq x-resource-name (copy-sequence invocation-name))
+
+       ;; Change any . or * characters in x-resource-name to hyphens,
+       ;; so as not to choke when we use it in X resource queries.
+       (while (setq i (string-match "[.*]" x-resource-name))
+         (aset x-resource-name i ?-))))
+
+  ;; Setup the default fontset.
+  (create-default-fontset)
+  ;; Create the standard fontset.
+  (condition-case err
+      (create-fontset-from-fontset-spec pgtk-standard-fontset-spec t)
+    (error (display-warning
+            'initialization
+            (format "Creation of the standard fontset failed: %s" err)
+            :error)))
+
+  (x-open-connection (or display
+                         x-display-name)
+                    x-command-line-resources
+                    ;; Exit Emacs with fatal error if this fails and we
+                    ;; are the initial display.
+                     (= (length (frame-list)) 0))
+
+  (x-apply-session-resources)
+
+  ;; Don't let Emacs suspend under PGTK.
+  (add-hook 'suspend-hook 'pgtk-suspend-error)
+
+  (setq pgtk-initialized t))
+
+;; Any display name is OK.
+(add-to-list 'display-format-alist '(".*" . pgtk))
+(cl-defmethod handle-args-function (args &context (window-system pgtk))
+  (x-handle-args args))
+
+(cl-defmethod frame-creation-function (params &context (window-system pgtk))
+  (x-create-frame-with-faces params))
+
+(declare-function pgtk-own-selection-internal "pgtkselect.c" (selection value 
&optional frame))
+(declare-function pgtk-disown-selection-internal "pgtkselect.c" (selection 
&optional time_object terminal))
+(declare-function pgtk-selection-owner-p "pgtkselect.c" (&optional selection 
terminal))
+(declare-function pgtk-selection-exists-p "pgtkselect.c" (&optional selection 
terminal))
+(declare-function pgtk-get-selection-internal "pgtkselect.c" (selection-symbol 
target-type &optional time_stamp terminal))
+
+(cl-defmethod gui-backend-set-selection (selection value
+                                         &context (window-system pgtk))
+  (if value (pgtk-own-selection-internal selection value)
+    (pgtk-disown-selection-internal selection)))
+
+(cl-defmethod gui-backend-selection-owner-p (selection
+                                             &context (window-system pgtk))
+  (pgtk-selection-owner-p selection))
+
+(cl-defmethod gui-backend-selection-exists-p (selection
+                                              &context (window-system pgtk))
+  (pgtk-selection-exists-p selection))
+
+(cl-defmethod gui-backend-get-selection (selection-symbol target-type
+                                         &context (window-system pgtk))
+  (pgtk-get-selection-internal selection-symbol target-type))
+
+
+(defvar pgtk-preedit-overlay nil)
+
+(defun pgtk-preedit-text (event)
+  "An internal function to display preedit text from input method.
+
+EVENT is an event of PGTK_PREEDIT_TEXT_EVENT.
+It contains colors and texts."
+  (interactive "e")
+  (when pgtk-preedit-overlay
+    (delete-overlay pgtk-preedit-overlay))
+  (setq pgtk-preedit-overlay nil)
+
+  (let ((ovstr "")
+        (idx 0)
+        atts ov str color face-name)
+    (dolist (part (nth 1 event))
+      (setq str (car part))
+      (setq face-name (intern (format "pgtk-im-%d" idx)))
+      (eval
+       `(defface ,face-name nil "face of input method preedit"))
+      (setq atts nil)
+      (when (setq color (cdr-safe (assq 'fg (cdr part))))
+        (setq atts (append atts `(:foreground ,color))))
+      (when (setq color (cdr-safe (assq 'bg (cdr part))))
+        (setq atts (append atts `(:background ,color))))
+      (when (setq color (cdr-safe (assq 'ul (cdr part))))
+        (setq atts (append atts `(:underline ,color))))
+      (face-spec-set face-name `((t . ,atts)))
+      (add-text-properties 0 (length str) `(face ,face-name) str)
+      (setq ovstr (concat ovstr str))
+      (setq idx (1+ idx)))
+
+    (setq ov (make-overlay (point) (point)))
+    (overlay-put ov 'before-string ovstr)
+    (setq pgtk-preedit-overlay ov)))
+
+
+(add-hook 'after-init-hook
+          (function
+           (lambda ()
+             (when (eq window-system 'pgtk)
+               (pgtk-use-im-context pgtk-use-im-context-on-new-connection)))))
+
+
+;;;
+
+(defcustom x-gtk-stock-map
+  (mapcar (lambda (arg)
+           (cons (purecopy (car arg)) (purecopy (cdr arg))))
+  '(
+    ("etc/images/new" . ("document-new" "gtk-new"))
+    ("etc/images/open" . ("document-open" "gtk-open"))
+    ("etc/images/diropen" . "n:system-file-manager")
+    ("etc/images/close" . ("window-close" "gtk-close"))
+    ("etc/images/save" . ("document-save" "gtk-save"))
+    ("etc/images/saveas" . ("document-save-as" "gtk-save-as"))
+    ("etc/images/undo" . ("edit-undo" "gtk-undo"))
+    ("etc/images/cut" . ("edit-cut" "gtk-cut"))
+    ("etc/images/copy" . ("edit-copy" "gtk-copy"))
+    ("etc/images/paste" . ("edit-paste" "gtk-paste"))
+    ("etc/images/search" . ("edit-find" "gtk-find"))
+    ("etc/images/print" . ("document-print" "gtk-print"))
+    ("etc/images/preferences" . ("preferences-system" "gtk-preferences"))
+    ("etc/images/help" . ("help-browser" "gtk-help"))
+    ("etc/images/left-arrow" . ("go-previous" "gtk-go-back"))
+    ("etc/images/right-arrow" . ("go-next" "gtk-go-forward"))
+    ("etc/images/home" . ("go-home" "gtk-home"))
+    ("etc/images/jump-to" . ("go-jump" "gtk-jump-to"))
+    ("etc/images/index" . ("gtk-search" "gtk-index"))
+    ("etc/images/exit" . ("application-exit" "gtk-quit"))
+    ("etc/images/cancel" . "gtk-cancel")
+    ("etc/images/info" . ("dialog-information" "gtk-info"))
+    ("etc/images/bookmark_add" . "n:bookmark_add")
+    ;; Used in Gnus and/or MH-E:
+    ("etc/images/attach" . ("mail-attachment" "gtk-attach"))
+    ("etc/images/connect" . "gtk-connect")
+    ("etc/images/contact" . "gtk-contact")
+    ("etc/images/delete" . ("edit-delete" "gtk-delete"))
+    ("etc/images/describe" . ("document-properties" "gtk-properties"))
+    ("etc/images/disconnect" . "gtk-disconnect")
+    ;; ("etc/images/exit" . "gtk-exit")
+    ("etc/images/lock-broken" . "gtk-lock_broken")
+    ("etc/images/lock-ok" . "gtk-lock_ok")
+    ("etc/images/lock" . "gtk-lock")
+    ("etc/images/next-page" . "gtk-next-page")
+    ("etc/images/refresh" . ("view-refresh" "gtk-refresh"))
+    ("etc/images/search-replace" . "edit-find-replace")
+    ("etc/images/sort-ascending" . ("view-sort-ascending" 
"gtk-sort-ascending"))
+    ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending")
+    ("etc/images/sort-criteria" . "gtk-sort-criteria")
+    ("etc/images/sort-descending" . ("view-sort-descending"
+                                    "gtk-sort-descending"))
+    ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending")
+    ("etc/images/spell" . ("tools-check-spelling" "gtk-spell-check"))
+    ("images/gnus/toggle-subscription" . "gtk-task-recurring")
+    ("images/mail/compose" . ("mail-message-new" "gtk-mail-compose"))
+    ("images/mail/copy" . "gtk-mail-copy")
+    ("images/mail/forward" . "gtk-mail-forward")
+    ("images/mail/inbox" . "gtk-inbox")
+    ("images/mail/move" . "gtk-mail-move")
+    ("images/mail/not-spam" . "gtk-not-spam")
+    ("images/mail/outbox" . "gtk-outbox")
+    ("images/mail/reply-all" . "gtk-mail-reply-to-all")
+    ("images/mail/reply" . "gtk-mail-reply")
+    ("images/mail/save-draft" . "gtk-mail-handling")
+    ("images/mail/send" . ("mail-send" "gtk-mail-send"))
+    ("images/mail/spam" . "gtk-spam")
+    ;; Used for GDB Graphical Interface
+    ("images/gud/break" . "gtk-no")
+    ("images/gud/recstart" . ("media-record" "gtk-media-record"))
+    ("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop"))
+    ;; No themed versions available:
+    ;; mail/preview (combining stock_mail and stock_zoom)
+    ;; mail/save    (combining stock_mail, stock_save and stock_convert)
+    ))
+  "How icons for tool bars are mapped to Gtk+ stock items.
+Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
+A value that begins with n: denotes a named icon instead of a stock icon."
+  :version "22.2"
+  :type '(choice (repeat
+                 (choice symbol
+                         (cons (string :tag "Emacs icon")
+                               (choice (group (string :tag "Named")
+                                              (string :tag "Stock"))
+                                       (string :tag "Stock/named"))))))
+  :group 'pgtk)
+
+(defcustom icon-map-list '(x-gtk-stock-map)
+  "A list of alists that map icon file names to stock/named icons.
+The alists are searched in the order they appear.  The first match is used.
+The keys in the alists are file names without extension and with two directory
+components.  For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
+to stock item gtk-open, use:
+
+  (\"etc/images/open\" . \"gtk-open\")
+
+Themes also have named icons.  To map to one of those, use n: before the name:
+
+  (\"etc/images/diropen\" . \"n:system-file-manager\")
+
+The list elements are either the symbol name for the alist or the
+alist itself.
+
+If you don't want stock icons, set the variable to nil."
+  :version "22.2"
+  :type '(choice (const :tag "Don't use stock icons" nil)
+                (repeat (choice symbol
+                                (cons (string :tag "Emacs icon")
+                                      (string :tag "Stock/named")))))
+  :group 'pgtk)
+
+(defconst x-gtk-stock-cache (make-hash-table :weakness t :test 'equal))
+
+(defun x-gtk-map-stock (file)
+  "Map icon with file name FILE to a Gtk+ stock name.
+This uses `icon-map-list' to map icon file names to stock icon names."
+  (when (stringp file)
+    (or (gethash file x-gtk-stock-cache)
+       (puthash
+        file
+        (save-match-data
+          (let* ((file-sans (file-name-sans-extension file))
+                 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)"
+                                         file-sans)
+                           (match-string 1 file-sans)))
+                 (icon-map icon-map-list)
+                 elem value)
+            (while (and (null value) icon-map)
+              (setq elem (car icon-map)
+                    value (assoc-string (or key file-sans)
+                                        (if (symbolp elem)
+                                            (symbol-value elem)
+                                          elem))
+                    icon-map (cdr icon-map)))
+            (and value (cdr value))))
+        x-gtk-stock-cache))))
+
+(declare-function accelerate-menu "pgtkmenu.c" (&optional frame) t)
+
+(defun pgtk-menu-bar-open (&optional frame)
+  "Open the menu bar if it is shown.
+`popup-menu' is used if it is off."
+  (interactive "i")
+  (cond
+   ((and (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))
+        (fboundp 'accelerate-menu))
+    (accelerate-menu frame))
+   (t
+    (popup-menu (mouse-menu-bar-map) last-nonmenu-event))))
+
+(provide 'pgtk-win)
+(provide 'term/pgtk-win)
+
+;;; pgtk-win.el ends here
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 9671e95aeb..4f21d9c7b4 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -1,6 +1,6 @@
 ;;; rxvt.el --- define function key sequences and standard colors for rxvt  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
 ;; Keywords: terminals
diff --git a/lisp/term/screen.el b/lisp/term/screen.el
index 9655f41b6c..62e3e64ca9 100644
--- a/lisp/term/screen.el
+++ b/lisp/term/screen.el
@@ -1,5 +1,5 @@
 ;;; screen.el --- terminal initialization for screen and tmux  -*- 
lexical-binding: t -*-
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 (require 'term/xterm)
 
diff --git a/lisp/term/st.el b/lisp/term/st.el
index 26478ca249..f44644e4db 100644
--- a/lisp/term/st.el
+++ b/lisp/term/st.el
@@ -1,6 +1,6 @@
 ;;; st.el --- terminal initialization for st  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;;; Commentary:
 
diff --git a/lisp/term/sun.el b/lisp/term/sun.el
index 4c88c80bf7..2742d8df91 100644
--- a/lisp/term/sun.el
+++ b/lisp/term/sun.el
@@ -1,6 +1,6 @@
 ;;; sun.el --- keybinding for standard default sunterm keys  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1987, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jeff Peck <peck@sun.com>
 ;; Keywords: terminals
diff --git a/lisp/term/tmux.el b/lisp/term/tmux.el
index 4ea6f416c8..02d1a3c032 100644
--- a/lisp/term/tmux.el
+++ b/lisp/term/tmux.el
@@ -1,5 +1,5 @@
 ;;; tmux.el --- terminal initialization for tmux  -*- lexical-binding: t -*-
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 (require 'term/xterm)
 
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 740d0654a1..79dc1c6377 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -1,6 +1,6 @@
 ;;; tty-colors.el --- color support for character terminals  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el
index 4447657d44..96b0f936d1 100644
--- a/lisp/term/tvi970.el
+++ b/lisp/term/tvi970.el
@@ -1,6 +1,6 @@
 ;;; tvi970.el --- terminal support for the Televideo 970  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Jim Blandy <jimb@occs.cs.oberlin.edu>
 ;; Keywords: terminals
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index 5e32e29792..2147c45784 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -1,6 +1,6 @@
 ;;; vt100.el --- define VT100 function key sequences in function-key-map  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1989, 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 0ee010b6c8..4ed01de9ae 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -1,6 +1,6 @@
 ;;; w32-win.el --- parse switches controlling interface with W32 window system 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallo
 ;; Keywords: terminals
diff --git a/lisp/term/w32console.el b/lisp/term/w32console.el
index 1a5dc05783..c039470c0c 100644
--- a/lisp/term/w32console.el
+++ b/lisp/term/w32console.el
@@ -1,6 +1,6 @@
 ;;; w32console.el --- Setup w32 console keys and colors.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el
index d3b0fdad24..7bcbbbe72c 100644
--- a/lisp/term/wyse50.el
+++ b/lisp/term/wyse50.el
@@ -1,6 +1,6 @@
 ;;; wyse50.el --- terminal support code for Wyse 50  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1993-1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1989, 1993-1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>,
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index d6e6318748..62cd984866 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1,6 +1,6 @@
 ;;; x-win.el --- parse relevant switches and set up for X  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals, i18n
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 52a64d6c41..a7e257f41c 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -1,6 +1,6 @@
 ;;; xterm.el --- define function key sequences and standard colors for xterm  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 25f0c35aa5..e37b0d988a 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1,6 +1,6 @@
 ;;; artist.el --- draw ascii graphics with your mouse -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author:       Tomas Abrahamsson <tab@lysator.liu.se>
 ;; Keywords:     mouse
@@ -338,7 +338,8 @@ Example:
 (defvar artist-pointer-shape (if (eq window-system 'x) x-pointer-crosshair nil)
   "If in X Windows, use this pointer shape while drawing with the mouse.")
 
-(defvaralias 'artist-text-renderer 'artist-text-renderer-function)
+(define-obsolete-variable-alias 'artist-text-renderer
+  'artist-text-renderer-function "29.1")
 
 (defcustom artist-text-renderer-function 'artist-figlet
   "Function for doing text rendering."
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index a429aae7f7..6168fed6c8 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -1,6 +1,6 @@
 ;;; bib-mode.el --- major mode for editing bib files  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Henry Kautz
 ;; (according to authors.el)
diff --git a/lisp/textmodes/bibtex-style.el b/lisp/textmodes/bibtex-style.el
index 27b2e0e333..d1ffce37d3 100644
--- a/lisp/textmodes/bibtex-style.el
+++ b/lisp/textmodes/bibtex-style.el
@@ -1,6 +1,6 @@
 ;;; bibtex-style.el --- Major mode for BibTeX Style files -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: tex
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 2dd4e8e7af..ab471db3dd 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1,6 +1,6 @@
 ;;; bibtex.el --- BibTeX mode for GNU Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994-1999, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1994-1999, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
@@ -1211,8 +1211,8 @@ See `bibtex-generate-autokey' for details."
   :type '(repeat (cons (regexp :tag "Old")
                        (string :tag "New"))))
 
-(defvaralias 'bibtex-autokey-name-case-convert
-  'bibtex-autokey-name-case-convert-function)
+(define-obsolete-variable-alias 'bibtex-autokey-name-case-convert
+  'bibtex-autokey-name-case-convert-function "29.1")
 
 (defcustom bibtex-autokey-name-case-convert-function #'downcase
   "Function called for each name to perform case conversion.
@@ -1286,8 +1286,8 @@ Case is significant.  See `bibtex-generate-autokey' for 
details."
   :group 'bibtex-autokey
   :type '(repeat regexp))
 
-(defvaralias 'bibtex-autokey-titleword-case-convert
-  'bibtex-autokey-titleword-case-convert-function)
+(define-obsolete-variable-alias 'bibtex-autokey-titleword-case-convert
+  'bibtex-autokey-titleword-case-convert-function "29.1")
 
 (defcustom bibtex-autokey-titleword-case-convert-function #'downcase
   "Function called for each titleword to perform case conversion.
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 30f8fd0ca9..f940de3ff4 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -1,6 +1,6 @@
 ;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Keywords: conf ini windows java
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index e5017a68f7..1139fd1976 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1,6 +1,6 @@
 ;;; css-mode.el --- Major mode to edit CSS files  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Maintainer: Simen Heggestøyl <simenheg@gmail.com>
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
index 2fa5e8de39..dc26a3c1b7 100644
--- a/lisp/textmodes/dns-mode.el
+++ b/lisp/textmodes/dns-mode.el
@@ -1,6 +1,6 @@
 ;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files 
 -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000-2001, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: DNS master zone file SOA comm
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index 4a5a5ab367..50ff668a9f 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -1,6 +1,6 @@
 ;;; enriched.el --- read and save files in text/enriched format  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: wp, faces
diff --git a/lisp/textmodes/etc-authors-mode.el 
b/lisp/textmodes/etc-authors-mode.el
index a79a1ecf4b..7eabdd4c2b 100644
--- a/lisp/textmodes/etc-authors-mode.el
+++ b/lisp/textmodes/etc-authors-mode.el
@@ -1,6 +1,6 @@
 ;;; etc-authors-mode.el --- font-locking for etc/AUTHORS  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefan@marxist.se>
 ;; Keywords: internal
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 4e161099cd..f41fd186e7 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -1,6 +1,6 @@
 ;;; fill.el --- fill commands for Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2021 Free
+;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 2a9cae29f7..664214419f 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1,6 +1,6 @@
 ;;; flyspell.el --- On-the-fly spell checker  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Manuel Serrano <Manuel.Serrano@sophia.inria.fr>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/glyphless-mode.el b/lisp/textmodes/glyphless-mode.el
index 177ba42c9c..4d48d90b56 100644
--- a/lisp/textmodes/glyphless-mode.el
+++ b/lisp/textmodes/glyphless-mode.el
@@ -1,6 +1,6 @@
 ;;; glyphless-mode.el --- minor mode for displaying glyphless characters  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 754ecb3a1d..ae3b18ed17 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1,6 +1,6 @@
 ;;; ispell.el --- interface to spell checkers  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1995, 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Ken Stevens <k.stevens@ieee.org>
 
@@ -296,7 +296,8 @@ The following values are supported:
   "Non-nil means suppress messages in `ispell-word'."
   :type 'boolean)
 
-(defvaralias 'ispell-format-word 'ispell-format-word-function)
+(define-obsolete-variable-alias 'ispell-format-word
+  'ispell-format-word-function "29.1")
 
 (defcustom ispell-format-word-function (function upcase)
   "Formatting function for displaying word being spell checked.
diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el
index d374cab27a..a0462756b0 100644
--- a/lisp/textmodes/less-css-mode.el
+++ b/lisp/textmodes/less-css-mode.el
@@ -1,6 +1,6 @@
 ;;; less-css-mode.el --- Major mode for editing Less CSS files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Steve Purcell <steve@sanityinc.com>
 ;; Maintainer: Simen Heggestøyl <simenheg@gmail.com>
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index 6b9b3f3e9d..0c908c722d 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -1,6 +1,6 @@
 ;;; makeinfo.el --- run makeinfo conveniently  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1991, 1993, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1993, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 936732153a..2ce74dd68b 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -1,6 +1,6 @@
 ;;; mhtml-mode.el --- HTML editing mode that handles CSS and JS -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Keywords: wp, hypermedia, comm, languages
 
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index 94519c3420..435423d31e 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -1,6 +1,6 @@
 ;;; nroff-mode.el --- GNU Emacs major mode for editing nroff source  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1994-1995, 1997, 2001-2021 Free Software
+;; Copyright (C) 1985-1986, 1994-1995, 1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index 558d6b81d7..24149f9afb 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -1,6 +1,6 @@
 ;;; page-ext.el --- extended page handling commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1991, 1993-1994, 2001-2021 Free Software
+;; Copyright (C) 1990-1991, 1993-1994, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Robert J. Chassell <bob@gnu.org>
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index b86a2f149d..3fc1832334 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -1,6 +1,6 @@
 ;;; page.el --- page motion commands for Emacs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: wp convenience
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 59b15e82a8..7daf71e990 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -1,6 +1,6 @@
 ;;; paragraphs.el --- paragraph and sentence parsing  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1985-1987, 1991, 1994-1997, 1999-2021 Free Software
+;; Copyright (C) 1985-1987, 1991, 1994-1997, 1999-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -479,18 +479,42 @@ sentences.  Also, every paragraph boundary terminates 
sentences as well."
       (setq arg (1- arg)))
     (constrain-to-field nil opoint t)))
 
-(defun repunctuate-sentences (&optional no-query)
+(defun repunctuate-sentences-filter (_start _end)
+  "Search filter used by `repunctuate-sentences' to skip unneeded spaces.
+By default, it skips occurrences that already have two spaces."
+  (/= 2 (- (point) (save-excursion (skip-chars-backward " ") (point)))))
+
+(defvar repunctuate-sentences-filter #'repunctuate-sentences-filter
+  "The default filter used by `repunctuate-sentences'.
+It is advised to use `add-function' on this to add more filters,
+for example, `(looking-back (rx (or \"e.g.\" \"i.e.\") \" \") 5)'
+with a set of predefined abbreviations to skip from adding two spaces.")
+
+(defun repunctuate-sentences (&optional no-query start end)
   "Put two spaces at the end of sentences from point to the end of buffer.
-It works using `query-replace-regexp'.
-If optional argument NO-QUERY is non-nil, make changes without
-asking for confirmation."
-  (interactive)
+It works using `query-replace-regexp'.  In Transient Mark mode,
+if the mark is active, operate on the contents of the region.
+Second and third arg START and END specify the region to operate on.
+If optional argument NO-QUERY is non-nil, make changes without asking
+for confirmation.  You can use `repunctuate-sentences-filter' to add
+filters to skip occurrences of spaces that don't need to be replaced."
+  (interactive (list nil
+                     (if (use-region-p) (region-beginning))
+                     (if (use-region-p) (region-end))))
   (let ((regexp "\\([]\"')]?\\)\\([.?!]\\)\\([]\"')]?\\) +")
         (to-string "\\1\\2\\3  "))
     (if no-query
-        (while (re-search-forward regexp nil t)
-          (replace-match to-string))
-      (query-replace-regexp regexp to-string))))
+        (progn
+          (when start (goto-char start))
+          (while (re-search-forward regexp end t)
+            (replace-match to-string)))
+      (unwind-protect
+          (progn
+            (add-function :after-while isearch-filter-predicate
+                          repunctuate-sentences-filter)
+            (query-replace-regexp regexp to-string nil start end))
+        (remove-function isearch-filter-predicate
+                         repunctuate-sentences-filter)))))
 
 
 (defun backward-sentence (&optional arg)
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index cb7f275ea6..17d9483f68 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -1,6 +1,6 @@
 ;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/pixel-fill.el b/lisp/textmodes/pixel-fill.el
index 0a0f0eb8b6..418d6a37c9 100644
--- a/lisp/textmodes/pixel-fill.el
+++ b/lisp/textmodes/pixel-fill.el
@@ -1,6 +1,6 @@
 ;;; pixel-fill.el --- variable pitch filling functions  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: filling
diff --git a/lisp/textmodes/po.el b/lisp/textmodes/po.el
index 1066e93af1..16c9140dcb 100644
--- a/lisp/textmodes/po.el
+++ b/lisp/textmodes/po.el
@@ -1,6 +1,6 @@
 ;;; po.el --- basic support of PO translation files  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1995-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Authors: François Pinard <pinard@iro.umontreal.ca>,
 ;;          Greg McGary <gkm@magilla.cichlid.com>,
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index ce556be00d..ba1deca47d 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -1,6 +1,6 @@
 ;;; refbib.el --- convert refer-style references to ones usable by Latex bib  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Henry Kautz <kautz@research.att.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el
index e710180d5f..1ee35d6a71 100644
--- a/lisp/textmodes/refer.el
+++ b/lisp/textmodes/refer.el
@@ -1,6 +1,6 @@
 ;;; refer.el --- look up references in bibliography files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 1996, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1996, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ashwin Ram <ashwin@cc.gatech.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index b2ebbd5f37..7d6d909966 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -1,6 +1,6 @@
 ;;; refill.el --- `auto-fill' by refilling paragraphs on changes  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Maintainer: Miles Bader <miles@gnu.org>
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index 977da700fd..47ad280edc 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -1,6 +1,6 @@
 ;;; reftex-auc.el --- RefTeX's interface to AUCTeX  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index e1475934dd..4e487d745c 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1,6 +1,6 @@
 ;;; reftex-cite.el --- creating citations with RefTeX  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index ee26d911a5..2d340de947 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -1,6 +1,6 @@
 ;;; reftex-dcr.el --- viewing cross references and citations with RefTeX  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index f787f5f3e5..5ab9ecd8db 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -1,6 +1,6 @@
 ;;; reftex-global.el --- operations on entire documents with RefTeX  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 357f7da2f9..734f82aba3 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1,6 +1,6 @@
 ;;; reftex-index.el --- index support with RefTeX  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index b8c75cb21b..016c9cf399 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -1,6 +1,6 @@
 ;;; reftex-parse.el --- parser functions for RefTeX  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 15d86b359c..3fe7a79a27 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -1,6 +1,6 @@
 ;;; reftex-ref.el --- code to create labels and references with RefTeX  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index b0a8ebf8ac..d77411483f 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -1,6 +1,6 @@
 ;;; reftex-sel.el --- the selection modes for RefTeX  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index b5f53ba86e..4ba3c2193e 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -1,6 +1,6 @@
 ;;; reftex-toc.el --- RefTeX's table of contents mode  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2000, 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index eedc067b86..f9d832f155 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1,6 +1,6 @@
 ;;; reftex-vars.el --- configuration variables for RefTeX  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1999, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
@@ -70,12 +70,16 @@
       ("tabwindow" ?f nil nil 1)))
 
     (rotating    "Sidewaysfigure and table"
-     (("sidewaysfigure" ?f nil nil caption)
-      ("sidewaystable"  ?t nil nil caption)))
-
-    (sidecap      "CSfigure and SCtable"
-     (("SCfigure"       ?f nil nil caption)
-      ("SCtable"        ?t nil nil caption)))
+     (("sidewaysfigure"  ?f nil nil caption)
+      ("sidewaysfigure*" ?f nil nil caption)
+      ("sidewaystable"   ?t nil nil caption)
+      ("sidewaystable*"  ?t nil nil caption)))
+
+    (sidecap      "SCfigure and SCtable"
+     (("SCfigure"  ?f nil nil caption)
+      ("SCfigure*" ?f nil nil caption)
+      ("SCtable"   ?t nil nil caption)
+      ("SCtable*"  ?t nil nil caption)))
 
     (subfigure   "Subfigure environments/macro"
      (("subfigure"   ?f nil nil caption)
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index f7424b60b3..907d50889a 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1,6 +1,6 @@
 ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2000, 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index fbb66fe40e..d65aea6286 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -1,6 +1,6 @@
 ;;; remember.el --- a mode for quickly jotting down things to remember  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999-2001, 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2001, 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index ed1d721f82..9d3e9effe6 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -1,6 +1,6 @@
 ;;; rst.el --- Mode for viewing and editing reStructuredText-documents  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: Stefan Merten <stefan at merten-home dot de>
 ;; Author: Stefan Merten <stefan at merten-home dot de>,
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index dedc388219..83631e6475 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1,6 +1,6 @@
 ;;; sgml-mode.el --- SGML- and HTML-editing modes -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992, 1995-1996, 1998, 2001-2021 Free Software
+;; Copyright (C) 1992, 1995-1996, 1998, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: James Clark <jjc@jclark.com>
@@ -75,7 +75,8 @@ a DOCTYPE or an XML declaration."
   :type 'boolean
   :version "22.1")
 
-(defvaralias 'sgml-transformation 'sgml-transformation-function)
+(define-obsolete-variable-alias 'sgml-transformation
+  'sgml-transformation-function "29.1")
 
 (defcustom sgml-transformation-function 'identity
   "Default value for `skeleton-transformation-function' in SGML mode."
@@ -623,6 +624,7 @@ Do \\[describe-key] on the following bindings to discover 
what they do.
   (setq-local comment-indent-function 'sgml-comment-indent)
   (setq-local comment-line-break-function 'sgml-comment-indent-new-line)
   (setq-local skeleton-further-elements '((completion-ignore-case t)))
+  (setq-local skeleton-end-newline nil)
   (setq-local skeleton-end-hook
              (lambda ()
                (or (eolp)
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index ca99d562e4..2175900194 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -1,6 +1,6 @@
 ;;; table.el --- create and edit WYSIWYG text based embedded tables  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Keywords: wp, convenience
 ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 5fba93c76e..1925d93d93 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1,6 +1,6 @@
 ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2021 Free
+;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -2037,7 +2037,7 @@ In the tex shell buffer this command behaves like 
`comint-send-input'."
 
 (defun tex-display-shell ()
   "Make the TeX shell buffer visible in a window."
-  (display-buffer (tex-shell-buf))
+  (display-buffer (tex-shell-buf) display-comint-buffer-action)
   (tex-recenter-output-buffer nil))
 
 (defun tex-shell-sentinel (proc _msg)
@@ -2441,7 +2441,7 @@ Only applies the FSPEC to the args part of FORMAT."
        (if cmds (tex-format-cmd (caar cmds) fspec))))))
 
 (defun tex-cmd-doc-view (file)
-  (pop-to-buffer (find-file-noselect file)))
+  (pop-to-buffer (find-file-noselect file) display-comint-buffer-action))
 
 (defun tex-compile (dir cmd)
   "Run a command CMD on current TeX buffer's file in DIR."
@@ -2698,7 +2698,7 @@ line LINE of the window, or centered if LINE is nil."
        (window))
     (if (null tex-shell)
        (message "No TeX output buffer")
-      (setq window (display-buffer tex-shell))
+      (setq window (display-buffer tex-shell display-comint-buffer-action))
       (with-selected-window window
        (bury-buffer tex-shell)
        (goto-char (point-max))
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index 550994cd7b..85110c3d1b 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -1,6 +1,6 @@
 ;;; texinfmt.el --- format Texinfo files into Info files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2021 Free Software
+;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index dbf30dabe5..7f6ed3d1da 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -1,6 +1,6 @@
 ;;; texinfo.el --- major mode for editing Texinfo files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2021 Free Software
+;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Robert J. Chassell
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index 6862da6046..5b468dc808 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -1,6 +1,6 @@
 ;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 1989-1992, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1989-1992, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 478cf62268..076f8dd98f 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -1,6 +1,6 @@
 ;;; text-mode.el --- text mode, and its idiosyncratic commands  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1992, 1994, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1985, 1992, 1994, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el
index 2a4c8cff8f..9dcfb10d6d 100644
--- a/lisp/textmodes/tildify.el
+++ b/lisp/textmodes/tildify.el
@@ -1,6 +1,6 @@
 ;;; tildify.el --- adding hard spaces into texts -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
 
 ;; Author:     Milan Zamazal <pdm@zamazal.org>
 ;;             Michal Nazarewicz <mina86@mina86.com>
diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el
index 5a3a64ad79..2fb5287aa0 100644
--- a/lisp/textmodes/two-column.el
+++ b/lisp/textmodes/two-column.el
@@ -1,6 +1,6 @@
 ;;; two-column.el --- minor mode for editing of two-column text  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992-1995, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1995, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Adapted-By: ESR, Daniel Pfeiffer
diff --git a/lisp/textmodes/underline.el b/lisp/textmodes/underline.el
index 3f4e63a349..49503cb5d3 100644
--- a/lisp/textmodes/underline.el
+++ b/lisp/textmodes/underline.el
@@ -1,6 +1,6 @@
 ;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs 
 -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: wp
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 2d1bf2013e..045264528f 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -1,6 +1,6 @@
 ;;; thingatpt.el --- get the `thing' at point  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1991-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Mike Williams <mikew@gopher.dosli.govt.nz>
 ;; Maintainer: emacs-devel@gnu.org
@@ -171,30 +171,24 @@ Possibilities include `symbol', `list', `sexp', `defun',
 When the optional argument NO-PROPERTIES is non-nil,
 strip text properties from the return value.
 
-If the current buffer uses fields (see Info node `(elisp)Fields'),
-this function will narrow to the field before identifying the
-thing at point.
-
 See the file `thingatpt.el' for documentation on how to define
 a symbol as a valid THING."
-  (save-restriction
-    (narrow-to-region (field-beginning) (field-end))
-    (let ((text
-           (cond
-            ((cl-loop for (pthing . function) in thing-at-point-provider-alist
-                      when (eq pthing thing)
-                      for result = (funcall function)
-                      when result
-                      return result))
-            ((get thing 'thing-at-point)
-             (funcall (get thing 'thing-at-point)))
-            (t
-             (let ((bounds (bounds-of-thing-at-point thing)))
-               (when bounds
-                 (buffer-substring (car bounds) (cdr bounds))))))))
-      (when (and text no-properties (sequencep text))
-        (set-text-properties 0 (length text) nil text))
-      text)))
+  (let ((text
+         (cond
+          ((cl-loop for (pthing . function) in thing-at-point-provider-alist
+                    when (eq pthing thing)
+                    for result = (funcall function)
+                    when result
+                    return result))
+          ((get thing 'thing-at-point)
+           (funcall (get thing 'thing-at-point)))
+          (t
+           (let ((bounds (bounds-of-thing-at-point thing)))
+             (when bounds
+               (buffer-substring (car bounds) (cdr bounds))))))))
+    (when (and text no-properties (sequencep text))
+      (set-text-properties 0 (length text) nil text))
+    text))
 
 ;;;###autoload
 (defun bounds-of-thing-at-mouse (event thing)
diff --git a/lisp/thread.el b/lisp/thread.el
index efb058c436..1e6e9e75a7 100644
--- a/lisp/thread.el
+++ b/lisp/thread.el
@@ -1,6 +1,6 @@
 ;;; thread.el --- Thread support in Emacs Lisp -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <gazally@runbox.com>
 ;; Maintainer: emacs-devel@gnu.org
@@ -30,6 +30,13 @@
 (eval-when-compile (require 'pcase))
 (eval-when-compile (require 'subr-x))
 
+(declare-function thread-name "thread.c")
+(declare-function thread-signal "thread.c")
+(declare-function thread--blocker "thread.c")
+(declare-function current-thread "thread.c")
+(declare-function thread-live-p "thread.c")
+(declare-function all-threads "thread.c")
+
 ;;;###autoload
 (defun thread-handle-event (event)
   "Handle thread events, propagated by `thread-signal'.
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 001b2c8e77..695fa8a856 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -1,6 +1,6 @@
 ;;; thumbs.el --- Thumbnails previewer for images files  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 04e736d027..7dd79d5bd3 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -1,6 +1,6 @@
 ;;; time-stamp.el --- Maintain last change time stamps in files edited by 
Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1993-1995, 1997, 2000-2021 Free Software
+;; Copyright (C) 1989, 1993-1995, 1997, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/time.el b/lisp/time.el
index fcea064b4c..cd985bfb28 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -1,6 +1,6 @@
 ;;; time.el --- display time, load and mail indicator in mode line of Emacs  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2021 Free Software
+;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -355,7 +355,7 @@ update which can wait for the next redisplay."
          (am-pm (if (>= hour 12) "pm" "am"))
          (minutes (substring time 14 16))
          (seconds (substring time 17 19))
-         (time-zone (car (cdr (current-time-zone now))))
+        (time-zone (format-time-string "%Z" now))
          (day (substring time 8 10))
          (year (format-time-string "%Y" now))
          (monthname (substring time 4 7))
diff --git a/lisp/timezone.el b/lisp/timezone.el
index 0fcdbdbc16..1e257c62d3 100644
--- a/lisp/timezone.el
+++ b/lisp/timezone.el
@@ -1,6 +1,6 @@
 ;;; timezone.el --- time zone package for GNU Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1990-1993, 1996, 1999, 2001-2021 Free Software
+;; Copyright (C) 1990-1993, 1996, 1999, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu Umeda <umerin@mse.kyutech.ac.jp>
@@ -299,11 +299,10 @@ Return a list in the same format as `current-time-zone's 
result,
 or nil if the local time zone could not be computed.
 DATE is the number of days elapsed since the (imaginary)
 Gregorian date Sunday, December 31, 1 BC."
-   (and (fboundp 'current-time-zone)
-       (let ((utc-time (timezone-time-from-absolute date seconds)))
-         (and utc-time
-              (let ((zone (current-time-zone utc-time)))
-                (and (car zone) zone))))))
+  (let ((utc-time (timezone-time-from-absolute date seconds)))
+    (and utc-time
+        (let ((zone (current-time-zone utc-time)))
+          (and (car zone) zone)))))
 
 (defun timezone-fix-time (date local timezone)
   "Convert DATE (default timezone LOCAL) to YYYY-MM-DD-HH-MM-SS-ZONE vector.
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 0d8c22d871..d8beddca61 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -1,6 +1,6 @@
 ;;; tmm.el --- text mode access to menu-bar  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1996, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Ilya Zakharevich <ilya@math.mps.ohio-state.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index f5d64aeb36..7ec5c0becc 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -1,6 +1,6 @@
 ;;; tool-bar.el --- setting up the tool bar  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: mouse frames
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 6cc482d012..1cf16fdb5d 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -1,6 +1,6 @@
 ;;; tooltip.el --- show tooltip windows  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <gerd@acm.org>
 ;; Keywords: help c mouse tools
diff --git a/lisp/transient.el b/lisp/transient.el
index f80e6afb10..0d7f9d0317 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1,6 +1,6 @@
 ;;; transient.el --- Transient commands          -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Jonas Bernoulli <jonas@bernoul.li>
 ;; Homepage: https://github.com/magit/transient
diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el
index 8691f03f86..4ba96a36a4 100644
--- a/lisp/tree-widget.el
+++ b/lisp/tree-widget.el
@@ -1,6 +1,6 @@
 ;;; tree-widget.el --- Tree widget  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Created: 16 Feb 2001
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index bf985280d8..2d313076e3 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -1,6 +1,6 @@
 ;;; tutorial.el --- tutorial for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help, internal
diff --git a/lisp/type-break.el b/lisp/type-break.el
index a6d5cd0170..267facccc4 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -1,6 +1,6 @@
 ;;; type-break.el --- encourage rests from typing at appropriate intervals  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1995, 1997, 2000-2021 Free Software Foundation,
+;; Copyright (C) 1994-1995, 1997, 2000-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Noah Friedman <friedman@splode.com>
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index b9a4c3c683..2ef1f04f70 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -1,6 +1,6 @@
 ;;; uniquify.el --- unique buffer names dependent on file name -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1995-1997, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1989, 1995-1997, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Dick King <king@reasoning.com>
diff --git a/lisp/url/ChangeLog.1 b/lisp/url/ChangeLog.1
index cdd37a64cd..2f7813e64c 100644
--- a/lisp/url/ChangeLog.1
+++ b/lisp/url/ChangeLog.1
@@ -3068,7 +3068,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1999, 2001-2002, 2004-2021 Free Software Foundation,
+  Copyright (C) 1999, 2001-2002, 2004-2022 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
diff --git a/lisp/url/url-about.el b/lisp/url/url-about.el
index 6ae90ccefa..3943cae9e5 100644
--- a/lisp/url/url-about.el
+++ b/lisp/url/url-about.el
@@ -1,6 +1,6 @@
 ;;; url-about.el --- Show internal URLs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 2d9a7758f1..585010d21c 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -1,6 +1,6 @@
 ;;; url-auth.el --- Uniform Resource Locator authorization modules -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index f869d2e2cf..3e69227124 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -1,6 +1,6 @@
 ;;; url-cache.el --- Uniform Resource Locator retrieval tool  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-cid.el b/lisp/url/url-cid.el
index 3095f7bd2c..c580a47d48 100644
--- a/lisp/url/url-cid.el
+++ b/lisp/url/url-cid.el
@@ -1,6 +1,6 @@
 ;;; url-cid.el --- Content-ID URL loader  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1998-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 60388df255..6b9ce5da93 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -1,6 +1,6 @@
 ;;; url-cookie.el --- URL cookie support  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index 192b1ac4f4..f108639500 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -1,6 +1,6 @@
 ;;; url-dav.el --- WebDAV support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/url/url-dired.el b/lisp/url/url-dired.el
index feb7c50ce5..1bbd741c1a 100644
--- a/lisp/url/url-dired.el
+++ b/lisp/url/url-dired.el
@@ -1,6 +1,6 @@
 ;;; url-dired.el --- URL Dired minor mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, files
 
diff --git a/lisp/url/url-domsuf.el b/lisp/url/url-domsuf.el
index 59d70cbd0e..10de368317 100644
--- a/lisp/url/url-domsuf.el
+++ b/lisp/url/url-domsuf.el
@@ -1,6 +1,6 @@
 ;;; url-domsuf.el --- Say what domain names can have cookies set.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 
diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el
index 4e737e965d..710986fd9a 100644
--- a/lisp/url/url-expand.el
+++ b/lisp/url/url-expand.el
@@ -1,6 +1,6 @@
 ;;; url-expand.el --- expand-file-name for URLs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el
index 0e2ab5544b..31e5c07234 100644
--- a/lisp/url/url-file.el
+++ b/lisp/url/url-file.el
@@ -1,6 +1,6 @@
 ;;; url-file.el --- File retrieval code  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-ftp.el b/lisp/url/url-ftp.el
index 3cda29a086..92445cac3f 100644
--- a/lisp/url/url-ftp.el
+++ b/lisp/url/url-ftp.el
@@ -1,6 +1,6 @@
 ;;; url-ftp.el --- FTP wrapper  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-future.el b/lisp/url/url-future.el
index c573317528..56787f7c5e 100644
--- a/lisp/url/url-future.el
+++ b/lisp/url/url-future.el
@@ -1,6 +1,6 @@
 ;;; url-future.el --- general futures facility for url.el -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
 ;; Keywords: data
diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el
index caffa6fb7b..c4a41f56b3 100644
--- a/lisp/url/url-gw.el
+++ b/lisp/url/url-gw.el
@@ -1,6 +1,6 @@
 ;;; url-gw.el --- Gateway munging for URL loading  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1997-1998, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 650c610e04..74f77cd238 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -1,6 +1,6 @@
 ;;; url-handlers.el --- file-name-handler stuff for URL loading  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -396,7 +396,8 @@ if it had been inserted from a file named URL."
 (url-handlers-create-wrapper file-writable-p (url))
 (url-handlers-create-wrapper file-directory-p (url))
 (url-handlers-create-wrapper file-executable-p (url))
-(url-handlers-create-wrapper directory-files (url &optional full match nosort))
+(url-handlers-create-wrapper
+ directory-files (url &optional full match nosort count))
 (url-handlers-create-wrapper file-truename (url &optional counter prev-dirs))
 
 (add-hook 'find-file-hook #'url-handlers-set-buffer-mode)
diff --git a/lisp/url/url-history.el b/lisp/url/url-history.el
index 5dd1f09913..cb4814afca 100644
--- a/lisp/url/url-history.el
+++ b/lisp/url/url-history.el
@@ -1,6 +1,6 @@
 ;;; url-history.el --- Global history tracking for URL package  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 44ebedeeae..16c3a6a1e6 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -1,6 +1,6 @@
 ;;; url-http.el --- HTTP retrieval routines  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999, 2001, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/url/url-imap.el b/lisp/url/url-imap.el
index f2e9b4c4a1..2bc8b2026d 100644
--- a/lisp/url/url-imap.el
+++ b/lisp/url/url-imap.el
@@ -1,6 +1,6 @@
 ;;; url-imap.el --- IMAP retrieval routines  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <jas@pdc.kth.se>
 ;; Keywords: comm, data, processes
diff --git a/lisp/url/url-irc.el b/lisp/url/url-irc.el
index c895144ae2..9161f7d13e 100644
--- a/lisp/url/url-irc.el
+++ b/lisp/url/url-irc.el
@@ -1,6 +1,6 @@
 ;;; url-irc.el --- IRC URL interface  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-ldap.el b/lisp/url/url-ldap.el
index 5d18f85fad..fabac30249 100644
--- a/lisp/url/url-ldap.el
+++ b/lisp/url/url-ldap.el
@@ -1,6 +1,6 @@
 ;;; url-ldap.el --- LDAP Uniform Resource Locator retrieval code  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1998-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el
index 4fd631d295..4f75ce3620 100644
--- a/lisp/url/url-mailto.el
+++ b/lisp/url/url-mailto.el
@@ -1,6 +1,6 @@
 ;;; url-mailto.el --- Mail Uniform Resource Locator retrieval code  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-methods.el b/lisp/url/url-methods.el
index cfe7d5bc6a..70c4fbb986 100644
--- a/lisp/url/url-methods.el
+++ b/lisp/url/url-methods.el
@@ -1,6 +1,6 @@
 ;;; url-methods.el --- Load URL schemes as needed  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-misc.el b/lisp/url/url-misc.el
index c741b6c85a..479f64c3e0 100644
--- a/lisp/url/url-misc.el
+++ b/lisp/url/url-misc.el
@@ -1,6 +1,6 @@
 ;;; url-misc.el --- Misc Uniform Resource Locator retrieval code  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2002, 2004-2021 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2002, 2004-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Keywords: comm, data, processes
diff --git a/lisp/url/url-news.el b/lisp/url/url-news.el
index c9216862b0..519f23df31 100644
--- a/lisp/url/url-news.el
+++ b/lisp/url/url-news.el
@@ -1,6 +1,6 @@
 ;;; url-news.el --- News Uniform Resource Locator retrieval code  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el
index 0449930408..409b9d87be 100644
--- a/lisp/url/url-nfs.el
+++ b/lisp/url/url-nfs.el
@@ -1,6 +1,6 @@
 ;;; url-nfs.el --- NFS URL interface  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index cd332f5ff7..24b064773b 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -1,6 +1,6 @@
 ;;; url-parse.el --- Uniform Resource Locator parser -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-privacy.el b/lisp/url/url-privacy.el
index 58ae6efbfc..f897248fe4 100644
--- a/lisp/url/url-privacy.el
+++ b/lisp/url/url-privacy.el
@@ -1,6 +1,6 @@
 ;;; url-privacy.el --- Global history tracking for URL package  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -48,6 +48,7 @@
          (pcase (or window-system 'tty)
            ('x "X11")
            ('ns "OpenStep")
+            ('pgtk "PureGTK")
            ('tty "TTY")
            (_ nil)))))
 
diff --git a/lisp/url/url-proxy.el b/lisp/url/url-proxy.el
index 0ffe51616d..c72e459a4e 100644
--- a/lisp/url/url-proxy.el
+++ b/lisp/url/url-proxy.el
@@ -1,6 +1,6 @@
 ;;; url-proxy.el --- Proxy server support  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2004-2022 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index 0923731ad8..8741bca942 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -1,6 +1,6 @@
 ;;; url-queue.el --- Fetching web pages in parallel   -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: comm
diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el
index 5cf0d804d6..30c1961407 100644
--- a/lisp/url/url-tramp.el
+++ b/lisp/url/url-tramp.el
@@ -1,6 +1,6 @@
 ;;; url-tramp.el --- file-name-handler magic invoking Tramp for some protocols 
 -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, data, processes, hypermedia
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 7ffccfd3a0..b8b7980e40 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -1,6 +1,6 @@
 ;;; url-util.el --- Miscellaneous helper routines for URL library -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2001, 2004-2021 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2001, 2004-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index d916a71e41..83c089a930 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -1,6 +1,6 @@
 ;;; url-vars.el --- Variables for Uniform Resource Locator tool  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2001, 2004-2021 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2001, 2004-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
diff --git a/lisp/url/url.el b/lisp/url/url.el
index bc44d55a47..2c1fdf0157 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -1,6 +1,6 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1996-1999, 2001, 2004-2021 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2001, 2004-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
diff --git a/lisp/userlock.el b/lisp/userlock.el
index 9a2d45a846..d985cb5c8b 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -1,6 +1,6 @@
 ;;; userlock.el --- handle file access contention between multiple users  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Richard King
 ;; (according to authors.el)
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index 1290d7e03a..e9a21825e1 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -1,6 +1,6 @@
 ;;; add-log.el --- change log maintenance commands for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1985-1986, 1988, 1993-1994, 1997-1998, 2000-2021 Free
+;; Copyright (C) 1985-1986, 1988, 1993-1994, 1997-1998, 2000-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -590,9 +590,8 @@ Compatibility function for \\[next-error] invocations."
     ["Go To Source" change-log-goto-source
      :help "Go to source location of ChangeLog tag near point"]))
 
-;; It used to be called change-log-time-zone-rule but really should be
-;; called add-log-time-zone-rule since it's only used from add-log-* code.
-(defvaralias 'change-log-time-zone-rule 'add-log-time-zone-rule)
+(define-obsolete-variable-alias 'change-log-time-zone-rule
+  'add-log-time-zone-rule "29.1")
 (defvar add-log-time-zone-rule nil
   "Time zone rule used for calculating change log time stamps.
 If nil, use local time.  If t, use Universal Time.
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index 29dfaa7668..b56b4c0d83 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -1,6 +1,6 @@
 ;;; compare-w.el --- compare text between windows for Emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2021 Free Software
+;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el
index 7886cc1eae..7f921a7339 100644
--- a/lisp/vc/cvs-status.el
+++ b/lisp/vc/cvs-status.el
@@ -1,6 +1,6 @@
 ;;; cvs-status.el --- major mode for browsing `cvs status' output -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs cvs status tree vc tools
@@ -30,12 +30,11 @@
 
 (require 'cl-lib)
 (require 'pcvs)
-(require 'easy-mmode)
 
 ;;;
 
 (defvar-keymap cvs-status-mode-map
-  :parent     'cvs-mode-map
+  :parent     cvs-mode-map
   "n"         #'next-line
   "p"         #'previous-line
   "N"         #'cvs-status-next
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 8f83aa580e..ca8df5d380 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1,6 +1,6 @@
 ;;; diff-mode.el --- a mode for viewing/editing context diffs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: convenience patch diff vc
@@ -2612,19 +2612,17 @@ fixed, visit it in a buffer."
                          "\\(?:index.*\n\\)?"
                          "--- \\(?:" null-device "\\|a/\\(.*\\)\\)\n"
                          "\\+\\+\\+ \\(?:" null-device "\\|b/\\(.*\\)\\)\n"))))
-        (put-text-property (match-beginning 0)
-                           (or (match-beginning 2) (match-beginning 1))
-                           'display (propertize
-                                     (cond
-                                      ((null (match-beginning 1))
-                                       (concat "new file  " (match-string 2)))
-                                      ((null (match-beginning 2))
-                                       (concat "deleted   " (match-string 1)))
-                                      (t
-                                       (concat "modified  " (match-string 1))))
-                                     'face '(diff-file-header diff-header)))
-        (put-text-property (match-end 1) (1- (match-end 0))
-                           'display ""))))
+        (put-text-property (match-beginning 0) (1- (match-end 0))
+                           'display
+                           (propertize
+                            (cond
+                             ((null (match-string 1))
+                              (concat "new file  " (match-string 2)))
+                             ((null (match-string 2))
+                              (concat "deleted  " (match-string 1)))
+                             (t
+                              (concat "modified  " (match-string 1))))
+                            'face '(diff-file-header diff-header))))))
   nil)
 
 ;;; Syntax highlighting from font-lock
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 4061fedd57..4abcf6c15a 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -1,6 +1,6 @@
 ;;; diff.el --- run `diff'  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994, 1996, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1996, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Frank Bresz
diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el
index 68abea794f..ca56a2851d 100644
--- a/lisp/vc/ediff-diff.el
+++ b/lisp/vc/ediff-diff.el
@@ -1,6 +1,6 @@
 ;;; ediff-diff.el --- diff-related utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el
index 48e1f15f05..4e41204169 100644
--- a/lisp/vc/ediff-help.el
+++ b/lisp/vc/ediff-help.el
@@ -1,6 +1,6 @@
 ;;; ediff-help.el --- Code related to the contents of Ediff help buffers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-hook.el b/lisp/vc/ediff-hook.el
index ff48bb3845..cee376de30 100644
--- a/lisp/vc/ediff-hook.el
+++ b/lisp/vc/ediff-hook.el
@@ -1,6 +1,6 @@
 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 4b352bd34f..de0a4d71ed 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -1,6 +1,6 @@
 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el
index d0ce9d326d..de8c587b1c 100644
--- a/lisp/vc/ediff-merg.el
+++ b/lisp/vc/ediff-merg.el
@@ -1,6 +1,6 @@
 ;;; ediff-merg.el --- merging utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index bec0ec0120..4871690111 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -1,6 +1,6 @@
 ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1995-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index a03c6a5ed7..17654f80ec 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -1,6 +1,6 @@
 ;;; ediff-ptch.el --- Ediff's  patch support  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index d4660a179e..b41def2aff 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -1,6 +1,6 @@
 ;;; ediff-util.el --- the core commands and utilities of ediff  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
@@ -521,7 +521,25 @@ to invocation.")
     (erase-buffer)
     (ediff-set-help-message)
     (insert ediff-help-message)
-    (shrink-window-if-larger-than-buffer)
+    ;; With the fix for Bug#49277 and an 'ediff-setup-windows-plain'
+    ;; layout, the window of the control buffer we want to adjust here
+    ;; is no longer the lower of two windows on their frame both showing
+    ;; that control buffer but rather the bottom-most window in the
+    ;; established ediff layout for that frame.  As a consequence,
+    ;; 'shrink-window-if-larger-than-buffer' will fail to show the whole
+    ;; buffer with 'ediff-toggle-help' because that window's maximum
+    ;; height is not half the height of its frame but the height of the
+    ;; control buffer's window in the established layout (Bug#52504).
+    ;;
+    ;; The form below is an attempt to emulate the behavior of Emacs 27
+    ;; as faithfully as possible in this regard (the use of 'ceiling'
+    ;; mimics the behavior of 'split-window' giving the lower window the
+    ;; residue line when the window to split has an uneven number of
+    ;; lines).
+    (when (and (window-combined-p)
+              (pos-visible-in-window-p (point-min)))
+      (fit-window-to-buffer
+       nil (ceiling (/ (window-total-height (frame-root-window)) 2.0))))
     (or (ediff-multiframe-setup-p)
        (ediff-indent-help-message))
     (ediff-set-help-overlays)
diff --git a/lisp/vc/ediff-vers.el b/lisp/vc/ediff-vers.el
index 0646ba3cc2..2fdbe64147 100644
--- a/lisp/vc/ediff-vers.el
+++ b/lisp/vc/ediff-vers.el
@@ -1,6 +1,6 @@
 ;;; ediff-vers.el --- version control interface to Ediff  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index bc6aa28850..1e702edb41 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -1,6 +1,6 @@
 ;;; ediff-wind.el --- window manipulation utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: ediff
diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el
index cb4c8d9305..840ab8cf51 100644
--- a/lisp/vc/ediff.el
+++ b/lisp/vc/ediff.el
@@ -1,6 +1,6 @@
 ;;; ediff.el --- a comprehensive visual interface to diff & patch  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Created: February 2, 1994
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 6e3f302263..79dafe60cc 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -1,6 +1,6 @@
 ;;; log-edit.el --- Major mode for editing CVS commit messages -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs cvs commit log vc
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index d45c1696a2..9952345db5 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -1,6 +1,6 @@
 ;;; log-view.el --- Major mode for browsing revision log histories -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: tools, vc
diff --git a/lisp/vc/pcvs-defs.el b/lisp/vc/pcvs-defs.el
index c3109f7e85..2f11716bde 100644
--- a/lisp/vc/pcvs-defs.el
+++ b/lisp/vc/pcvs-defs.el
@@ -1,6 +1,6 @@
 ;;; pcvs-defs.el --- variable definitions for PCL-CVS  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs-info.el b/lisp/vc/pcvs-info.el
index 21fe98daca..11d14f9576 100644
--- a/lisp/vc/pcvs-info.el
+++ b/lisp/vc/pcvs-info.el
@@ -1,6 +1,6 @@
 ;;; pcvs-info.el --- internal representation of a fileinfo entry  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs-parse.el b/lisp/vc/pcvs-parse.el
index 3a96c93054..77c5469a17 100644
--- a/lisp/vc/pcvs-parse.el
+++ b/lisp/vc/pcvs-parse.el
@@ -1,6 +1,6 @@
 ;;; pcvs-parse.el --- the CVS output parser  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el
index 75d9fe9bee..702033dd88 100644
--- a/lisp/vc/pcvs-util.el
+++ b/lisp/vc/pcvs-util.el
@@ -1,6 +1,6 @@
 ;;; pcvs-util.el --- utility functions for PCL-CVS  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 2d7b8cb2ef..c19fe9bd2a 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -1,6 +1,6 @@
 ;;; pcvs.el --- a front-end to CVS  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 
 ;; Author: The PCL-CVS Trust <pcl-cvs@cyclic.com>
 ;;     Per Cederqvist <ceder@lysator.liu.se>
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 6c1b8cc95b..6a4f6542b5 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -1,6 +1,6 @@
 ;;; smerge-mode.el --- Minor mode to resolve diff3 conflicts -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: vc, tools, revision control, merge, diff3, cvs, conflict
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index def87db871..bd4ff3e015 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -1,6 +1,6 @@
 ;;; vc-annotate.el --- VC Annotate Support  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Martin Lorentzson <emwson@emw.ericsson.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 48fedeca5a..836630acb5 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -1,6 +1,6 @@
 ;;; vc-bzr.el --- VC backend for the bzr revision control system  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;;        Riccardo Murri <riccardo.murri@gmail.com>
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index c895447224..e234b9a044 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -1,6 +1,6 @@
 ;;; vc-cvs.el --- non-resident support for CVS version-control  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1995, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see vc.el for full credits)
 ;; Package: vc
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 49a8af10e7..61e2cd2390 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -1,6 +1,6 @@
 ;;; vc-dav.el --- vc.el support for WebDAV  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2001, 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: url, vc
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 32e492171d..ba6e098d98 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1,6 +1,6 @@
 ;;; vc-dir.el --- Directory status display under VC  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Dan Nicolaescu <dann@ics.uci.edu>
 ;; Keywords: vc tools
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 346974bdba..5c664d58f1 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -1,6 +1,6 @@
 ;;; vc-dispatcher.el --- generic command-dispatcher facility.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see below for full credits)
 ;; Keywords: vc tools
@@ -127,8 +127,12 @@ preserve the setting."
   :group 'vc)
 
 (defcustom vc-command-messages nil
-  "If non-nil, display run messages from back-end commands."
-  :type 'boolean
+  "If non-nil, display and log messages about running back-end commands.
+If the value is `log', messages about running VC back-end commands are
+logged in the *Messages* buffer, but not displayed."
+  :type '(choice (const :tag "No messages" nil)
+                 (const :tag "Display and log messages" t)
+                 (const :tag "Log messages, but don't display" log))
   :group 'vc)
 
 (defcustom vc-suppress-confirm nil
@@ -311,7 +315,10 @@ case, and the process object in the asynchronous case."
                      (substring command 0 -1)
                    command)
                  " " (vc-delistify flags)
-                 " " (vc-delistify files))))
+                 " " (vc-delistify files)))
+        (vc-inhibit-message
+         (or (eq vc-command-messages 'log)
+             (eq (selected-window) (active-minibuffer-window)))))
     (save-current-buffer
       (unless (or (eq buffer t)
                  (and (stringp buffer)
@@ -335,7 +342,7 @@ case, and the process object in the asynchronous case."
                       (apply #'start-file-process command (current-buffer)
                               command squeezed))))
                (when vc-command-messages
-                 (let ((inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+                 (let ((inhibit-message vc-inhibit-message))
                    (message "Running in background: %s" full-command)))
                 ;; Get rid of the default message insertion, in case we don't
                 ;; set a sentinel explicitly.
@@ -345,11 +352,11 @@ case, and the process object in the asynchronous case."
                (when vc-command-messages
                  (vc-run-delayed
                    (let ((message-truncate-lines t)
-                         (inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+                         (inhibit-message vc-inhibit-message))
                      (message "Done in background: %s" full-command)))))
            ;; Run synchronously
            (when vc-command-messages
-             (let ((inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+             (let ((inhibit-message vc-inhibit-message))
                (message "Running in foreground: %s" full-command)))
            (let ((buffer-undo-list t))
              (setq status (apply #'process-file command nil t nil squeezed)))
@@ -364,7 +371,7 @@ case, and the process object in the asynchronous case."
                     (if (integerp status) (format "status %d" status) status)
                     full-command))
            (when vc-command-messages
-             (let ((inhibit-message (eq (selected-window) 
(active-minibuffer-window))))
+             (let ((inhibit-message vc-inhibit-message))
                (message "Done (status=%d): %s" status full-command)))))
        (vc-run-delayed
          (run-hook-with-args 'vc-post-command-functions
diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el
index 254e47933d..252e6edd6e 100644
--- a/lisp/vc/vc-filewise.el
+++ b/lisp/vc/vc-filewise.el
@@ -1,6 +1,6 @@
 ;;; vc-filewise.el --- common functions for file-oriented back ends.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1992-1996, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1996, 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see vc.el for full credits)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5c6a39aec9..2e6690c537 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1,6 +1,6 @@
 ;;; vc-git.el --- VC backend for the git version control system -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Alexandre Julliard <julliard@winehq.org>
 ;; Keywords: vc tools
@@ -223,6 +223,12 @@ included in the completions."
 ;; History of Git commands.
 (defvar vc-git-history nil)
 
+;; Default to t because commands which don't support literal pathspecs
+;; ignore the environment variable silently.
+(defvar vc-git-use-literal-pathspecs t
+  "Non-nil to treat pathspecs in commands literally.
+Good example of file name that needs this: \"test[56].xx\".")
+
 ;; Clear up the cache to force vc-call to check again and discover
 ;; new functions when we reload this file.
 (put 'Git 'vc-functions nil)
@@ -242,20 +248,6 @@ included in the completions."
 ;;;###autoload         (load "vc-git" nil t)
 ;;;###autoload         (vc-git-registered file))))
 
-;; Good example of file name that needs this: "test[56].xx".
-(defun vc-git--literal-pathspec (file)
-  "Prepend :(literal) path magic to FILE."
-  (when file
-    ;; Expand abbreviated file names.
-    (when (file-name-absolute-p file)
-      (setq file (expand-file-name file)))
-    (concat ":(literal)" (file-local-name file))))
-
-(defun vc-git--literal-pathspecs (files)
-  "Prepend :(literal) path magic to FILES."
-  (unless (vc-git--file-list-is-rootdir files)
-    (mapcar #'vc-git--literal-pathspec files)))
-
 (defun vc-git-registered (file)
   "Check whether FILE is registered with git."
   (let ((dir (vc-git-root file)))
@@ -269,12 +261,12 @@ included in the completions."
                (name (file-relative-name file dir))
                (str (with-demoted-errors "Error: %S"
                       (cd dir)
-                      (vc-git--out-ok "ls-files" "-c" "-z" "--" 
(vc-git--literal-pathspec name))
+                      (vc-git--out-ok "ls-files" "-c" "-z" "--" name)
                       ;; If result is empty, use ls-tree to check for deleted
                       ;; file.
                       (when (eq (point-min) (point-max))
                         (vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD"
-                                        "--" (vc-git--literal-pathspec name)))
+                                        "--" name))
                       (buffer-string))))
           (and str
                (> (length str) (length name))
@@ -358,7 +350,7 @@ in the order given by `git status'."
             ,@(when (version<= "1.7.6.3" (vc-git--program-version))
                 '("--ignored"))
             "--"))
-        (status (apply #'vc-git--run-command-string (vc-git--literal-pathspec 
file) args)))
+        (status (apply #'vc-git--run-command-string file args)))
     (if (null status)
         ;; If status is nil, there was an error calling git, likely because
         ;; the file is not in a git repo.
@@ -636,28 +628,28 @@ or an empty string if none."
     (pcase (vc-git-dir-status-state->stage git-state)
       ('update-index
        (if files
-           (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files) "add" "--refresh" "--")
+           (vc-git-command (current-buffer) 'async files "add" "--refresh" 
"--")
          (vc-git-command (current-buffer) 'async nil
                          "update-index" "--refresh")))
       ('ls-files-added
-       (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files)
+       (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-c" "-s" "--"))
       ('ls-files-up-to-date
-       (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files)
+       (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-c" "-s" "--"))
       ('ls-files-conflict
-       (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files)
+       (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-u" "--"))
       ('ls-files-unknown
-       (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files)
+       (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-o" "--exclude-standard" "--"))
       ('ls-files-ignored
-       (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files)
+       (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-o" "-i" "--directory"
                        "--no-empty-directory" "--exclude-standard" "--"))
       ;; --relative added in Git 1.5.5.
       ('diff-index
-       (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs 
files)
+       (vc-git-command (current-buffer) 'async files
                        "diff-index" "--relative" "-z" "-M" "HEAD" "--")))
     (vc-run-delayed
       (vc-git-after-dir-status-stage git-state))))
@@ -885,12 +877,12 @@ The car of the list is the current branch."
     (when flist
       (vc-git-command nil 0 flist "update-index" "--add" "--"))
     (when dlist
-      (vc-git-command nil 0 (vc-git--literal-pathspecs dlist) "add"))))
+      (vc-git-command nil 0 dlist "add"))))
 
 (defalias 'vc-git-responsible-p #'vc-git-root)
 
 (defun vc-git-unregister (file)
-  (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--cached" 
"--"))
+  (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
 
 (declare-function log-edit-mode "log-edit" ())
 (declare-function log-edit-toggle-header "log-edit" (header value))
@@ -956,7 +948,7 @@ It is based on `log-edit-mode', and has Git-specific 
extensions.")
                (lambda (value) (when (equal value "yes") (list argument)))))
       ;; When operating on the whole tree, better pass "-a" than ".", since "."
       ;; fails when we're committing a merge.
-      (apply #'vc-git-command nil 0 (if only (vc-git--literal-pathspecs files))
+      (apply #'vc-git-command nil 0 (if only files)
              (nconc (if msg-file (list "commit" "-F"
                                        (file-local-name msg-file))
                       (list "commit" "-m"))
@@ -983,7 +975,7 @@ It is based on `log-edit-mode', and has Git-specific 
extensions.")
         (coding-system-for-write 'binary)
         (fullname
          (let ((fn (vc-git--run-command-string
-                    (vc-git--literal-pathspec file) "ls-files" "-z" 
"--full-name" "--")))
+                    file "ls-files" "-z" "--full-name" "--")))
            ;; ls-files does not return anything when looking for a
            ;; revision of a file that has been renamed or removed.
            (if (string= fn "")
@@ -1000,14 +992,14 @@ It is based on `log-edit-mode', and has Git-specific 
extensions.")
                    (vc-git-root file)))
 
 (defun vc-git-checkout (file &optional rev)
-  (vc-git-command nil 0 (vc-git--literal-pathspec file) "checkout" (or rev 
"HEAD")))
+  (vc-git-command nil 0 file "checkout" (or rev "HEAD")))
 
 (defun vc-git-revert (file &optional contents-done)
   "Revert FILE to the version stored in the git repository."
   (if contents-done
       (vc-git-command nil 0 file "update-index" "--")
-    (vc-git-command nil 0 (vc-git--literal-pathspec file) "reset" "-q" "--")
-    (vc-git-command nil nil (vc-git--literal-pathspec file) "checkout" "-q" 
"--")))
+    (vc-git-command nil 0 file "reset" "-q" "--")
+    (vc-git-command nil nil file "checkout" "-q" "--")))
 
 (defvar vc-git-error-regexp-alist
   '(("^ \\(.+\\)\\> *|" 1 nil nil 0))
@@ -1091,7 +1083,7 @@ This prompts for a branch to merge from."
 (defun vc-git-conflicted-files (directory)
   "Return the list of files with conflicts in DIRECTORY."
   (let* ((status
-          (vc-git--run-command-string (vc-git--literal-pathspec directory) 
"status" "--porcelain" "--"))
+          (vc-git--run-command-string directory "status" "--porcelain" "--"))
          (lines (when status (split-string status "\n" 'omit-nulls)))
          files)
     (dolist (line lines files)
@@ -1180,7 +1172,7 @@ If LIMIT is a revision string, use it as an end-revision."
     (let ((inhibit-read-only t))
       (with-current-buffer buffer
        (apply #'vc-git-command buffer
-              'async (vc-git--literal-pathspecs files)
+              'async files
               (append
                '("log" "--no-color")
                 (when (and vc-git-print-log-follow
@@ -1434,7 +1426,7 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
     (if vc-git-diff-switches
         (apply #'vc-git-command (or buffer "*vc-diff*")
               1 ; bug#21969
-              (vc-git--literal-pathspecs files)
+               files
                command
                "--exit-code"
                (append (vc-switches 'git 'diff)
@@ -1519,7 +1511,7 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
       (let* ((fname (file-relative-name file))
              (prev-rev (with-temp-buffer
                          (and
-                          (vc-git--out-ok "rev-list" "-2" rev "--" 
(vc-git--literal-pathspec fname))
+                          (vc-git--out-ok "rev-list" "-2" rev "--" fname)
                           (goto-char (point-max))
                           (bolp)
                           (zerop (forward-line -1))
@@ -1547,7 +1539,7 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
          (current-rev
           (with-temp-buffer
             (and
-             (vc-git--out-ok "rev-list" "-1" rev "--" 
(vc-git--literal-pathspec file))
+             (vc-git--out-ok "rev-list" "-1" rev "--" file)
              (goto-char (point-max))
              (bolp)
              (zerop (forward-line -1))
@@ -1559,7 +1551,7 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
           (and current-rev
                (with-temp-buffer
                  (and
-                  (vc-git--out-ok "rev-list" "HEAD" "--" 
(vc-git--literal-pathspec file))
+                  (vc-git--out-ok "rev-list" "HEAD" "--" file)
                   (goto-char (point-min))
                   (search-forward current-rev nil t)
                   (zerop (forward-line -1))
@@ -1569,13 +1561,13 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
     (or (vc-git-symbolic-commit next-rev) next-rev)))
 
 (defun vc-git-delete-file (file)
-  (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--"))
+  (vc-git-command nil 0 file "rm" "-f" "--"))
 
 (defun vc-git-rename-file (old new)
   (vc-git-command nil 0 (list old new) "mv" "-f" "--"))
 
 (defun vc-git-mark-resolved (files)
-  (vc-git-command nil 0 (vc-git--literal-pathspecs files) "add"))
+  (vc-git-command nil 0 files "add"))
 
 (defvar vc-git-extra-menu-map
   (let ((map (make-sparse-keymap)))
@@ -1797,6 +1789,8 @@ The difference to vc-do-command is that this function 
always invokes
         (process-environment
          (append
           `("GIT_DIR"
+            ,@(when vc-git-use-literal-pathspecs
+                '("GIT_LITERAL_PATHSPECS=1"))
             ;; Avoid repository locking during background operations
             ;; (bug#21559).
             ,@(when revert-buffer-in-progress-p
@@ -1834,6 +1828,8 @@ The difference to vc-do-command is that this function 
always invokes
        (process-environment
         (append
          `("GIT_DIR"
+            ,@(when vc-git-use-literal-pathspecs
+                '("GIT_LITERAL_PATHSPECS=1"))
            ;; Avoid repository locking during background operations
            ;; (bug#21559).
            ,@(when revert-buffer-in-progress-p
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 6bec9edbf3..026f125396 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -1,6 +1,6 @@
 ;;; vc-hg.el --- VC backend for the mercurial version control system  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: Ivan Kanis
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index cd5b11d840..e71796b745 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -1,6 +1,6 @@
 ;;; vc-hooks.el --- resident support for version-control  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-1996, 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1996, 1998-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see vc.el for full credits)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el
index ea69893071..20fbf92bb1 100644
--- a/lisp/vc/vc-mtn.el
+++ b/lisp/vc/vc-mtn.el
@@ -1,6 +1,6 @@
 ;;; vc-mtn.el --- VC backend for Monotone  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: vc
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 2422e99d3d..20f3b1fba7 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -1,6 +1,6 @@
 ;;; vc-rcs.el --- support for RCS version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see vc.el for full credits)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 4b56fbf28e..4bbf92b327 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -1,6 +1,6 @@
 ;;; vc-sccs.el --- support for SCCS version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see vc.el for full credits)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index b408b7de76..1c1a7b5d13 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -1,6 +1,6 @@
 ;;; vc-src.el --- support for SRC version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see vc.el for full credits)
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index e14519cc20..b38a676acb 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -1,6 +1,6 @@
 ;;; vc-svn.el --- non-resident support for Subversion version-control  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 64f752f248..6041c79efc 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1,6 +1,6 @@
 ;;; vc.el --- drive a version-control system from within Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-1998, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1998, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: FSF (see below for full credits)
 ;; Maintainer: emacs-devel@gnu.org
@@ -2755,7 +2755,7 @@ to the working revision (except for keyword expansion)."
     (unwind-protect
        (when (if vc-revert-show-diff
                  (progn
-                   (setq diff-buffer (generate-new-buffer-name "*vc-diff*"))
+                   (setq diff-buffer (generate-new-buffer "*vc-diff*"))
                    (vc-diff-internal vc-allow-async-revert vc-fileset
                                      nil nil nil diff-buffer))
                ;; Avoid querying the user again.
diff --git a/lisp/vcursor.el b/lisp/vcursor.el
index df65db39e3..8b7105df51 100644
--- a/lisp/vcursor.el
+++ b/lisp/vcursor.el
@@ -1,6 +1,6 @@
 ;;; vcursor.el --- manipulate an alternative ("virtual") cursor  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994, 1996, 1998, 2001-2021 Free Software Foundation,
+;; Copyright (C) 1994, 1996, 1998, 2001-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Peter Stephenson <pws@ibmth.df.unipi.it>
diff --git a/lisp/version.el b/lisp/version.el
index 5d0a1ae37d..45f72b4329 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -1,6 +1,6 @@
 ;;; version.el --- record version number of Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1992, 1994-1995, 1999-2021 Free Software
+;; Copyright (C) 1985, 1992, 1994-1995, 1999-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/view.el b/lisp/view.el
index 321bc5f566..bfc0341b2a 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -1,6 +1,6 @@
 ;;; view.el --- peruse file or buffer without editing  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1985, 1989, 1994-1995, 1997, 2000-2021 Free Software
+;; Copyright (C) 1985, 1989, 1994-1995, 1997, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
diff --git a/lisp/vt-control.el b/lisp/vt-control.el
index 8f62b5757a..b80d3505b3 100644
--- a/lisp/vt-control.el
+++ b/lisp/vt-control.el
@@ -1,6 +1,6 @@
 ;;; vt-control.el --- Common VTxxx control functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Keywords: terminals
diff --git a/lisp/vt100-led.el b/lisp/vt100-led.el
index 117bef7065..a6a256a6a7 100644
--- a/lisp/vt100-led.el
+++ b/lisp/vt100-led.el
@@ -1,6 +1,6 @@
 ;;; vt100-led.el --- functions for LED control on VT-100 terminals & clones  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1988, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index 2548fa4d44..f353566b06 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -1,6 +1,6 @@
 ;;; w32-fns.el --- Lisp routines for 32-bit Windows  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Geoff Voelker <voelker@cs.washington.edu>
 ;; Keywords: internal
diff --git a/lisp/w32-vars.el b/lisp/w32-vars.el
index f00e474e1e..9be34c0dc0 100644
--- a/lisp/w32-vars.el
+++ b/lisp/w32-vars.el
@@ -1,6 +1,6 @@
 ;;; w32-vars.el --- MS-Windows specific user options  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; Author: Jason Rumney <jasonr@gnu.org>
 ;; Keywords: internal
diff --git a/lisp/wdired.el b/lisp/wdired.el
index eb5a638556..1c02562721 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -1,6 +1,6 @@
 ;;; wdired.el --- Rename files editing their names in dired buffers -*- 
coding: utf-8; lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Filename: wdired.el
 ;; Author: Juan León Lahoz García <juanleon1@gmail.com>
@@ -155,26 +155,24 @@ nonexistent directory will fail."
   :version "26.1"
   :type 'boolean)
 
-(defvar wdired-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-x\C-s" #'wdired-finish-edit)
-    (define-key map "\C-c\C-c" #'wdired-finish-edit)
-    (define-key map "\C-c\C-k" #'wdired-abort-changes)
-    (define-key map "\C-c\C-[" #'wdired-abort-changes)
-    (define-key map "\C-x\C-q" #'wdired-exit)
-    (define-key map "\C-m"     #'undefined)
-    (define-key map "\C-j"     #'undefined)
-    (define-key map "\C-o"     #'undefined)
-    (define-key map [up]       #'wdired-previous-line)
-    (define-key map "\C-p"     #'wdired-previous-line)
-    (define-key map [down]     #'wdired-next-line)
-    (define-key map "\C-n"     #'wdired-next-line)
-    (define-key map [remap upcase-word] #'wdired-upcase-word)
-    (define-key map [remap capitalize-word] #'wdired-capitalize-word)
-    (define-key map [remap downcase-word] #'wdired-downcase-word)
-    (define-key map [remap self-insert-command] #'wdired--self-insert)
-    map)
-  "Keymap used in `wdired-mode'.")
+(defvar-keymap wdired-mode-map
+  :doc "Keymap used in `wdired-mode'."
+  "C-x C-s" #'wdired-finish-edit
+  "C-c C-c" #'wdired-finish-edit
+  "C-c C-k" #'wdired-abort-changes
+  "C-c C-[" #'wdired-abort-changes
+  "C-x C-q" #'wdired-exit
+  "RET"     #'undefined
+  "C-j"     #'undefined
+  "C-o"     #'undefined
+  "<up>"    #'wdired-previous-line
+  "C-p"     #'wdired-previous-line
+  "<down>"  #'wdired-next-line
+  "C-n"     #'wdired-next-line
+  "<remap> <upcase-word>"         #'wdired-upcase-word
+  "<remap> <capitalize-word>"     #'wdired-capitalize-word
+  "<remap> <downcase-word>"       #'wdired-downcase-word
+  "<remap> <self-insert-command>" #'wdired--self-insert)
 
 (easy-menu-define wdired-mode-menu wdired-mode-map
   "Menu for `wdired-mode'."
@@ -872,21 +870,19 @@ Like original function but it skips read-only words."
 ;; The following code deals with changing the access bits (or
 ;; permissions) of the files.
 
-(defvar wdired-perm-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map " " #'wdired-toggle-bit)
-    (define-key map "r" #'wdired-set-bit)
-    (define-key map "w" #'wdired-set-bit)
-    (define-key map "x" #'wdired-set-bit)
-    (define-key map "-" #'wdired-set-bit)
-    (define-key map "S" #'wdired-set-bit)
-    (define-key map "s" #'wdired-set-bit)
-    (define-key map "T" #'wdired-set-bit)
-    (define-key map "t" #'wdired-set-bit)
-    (define-key map "s" #'wdired-set-bit)
-    (define-key map "l" #'wdired-set-bit)
-    (define-key map [mouse-1] #'wdired-mouse-toggle-bit)
-    map))
+(defvar-keymap wdired-perm-mode-map
+  "SPC" #'wdired-toggle-bit
+  "r"   #'wdired-set-bit
+  "w"   #'wdired-set-bit
+  "x"   #'wdired-set-bit
+  "-"   #'wdired-set-bit
+  "S"   #'wdired-set-bit
+  "s"   #'wdired-set-bit
+  "T"   #'wdired-set-bit
+  "t"   #'wdired-set-bit
+  "s"   #'wdired-set-bit
+  "l"   #'wdired-set-bit
+  "<mouse-1>" #'wdired-mouse-toggle-bit)
 
 ;; Put a keymap property to the permission bits of the files, and store the
 ;; original name and permissions as a property
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 5a482c5253..8e726c40dd 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1,6 +1,6 @@
 ;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl.gnu@gmail.com>
 ;; Keywords: data, wp
diff --git a/lisp/wid-browse.el b/lisp/wid-browse.el
index 7ce0633b40..e71e8cd493 100644
--- a/lisp/wid-browse.el
+++ b/lisp/wid-browse.el
@@ -1,6 +1,6 @@
 ;;; wid-browse.el --- functions for browsing widgets  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: extensions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index a53add7d08..f00a524c0c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1,6 +1,6 @@
 ;;; wid-edit.el --- Functions for creating and using widgets -*- 
lexical-binding:t -*-
 ;;
-;; Copyright (C) 1996-1997, 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: emacs-devel@gnu.org
@@ -437,8 +437,9 @@ the :notify function can't know the new value.")
        (follow-link (widget-get widget :follow-link))
        (help-echo (widget-get widget :help-echo)))
     (widget-put widget :button-overlay overlay)
-    (if (functionp help-echo)
+    (when (functionp help-echo)
       (setq help-echo 'widget-mouse-help))
+    (overlay-put overlay 'before-string #(" " 0 1 (invisible t)))
     (overlay-put overlay 'button widget)
     (overlay-put overlay 'keymap (widget-get widget :keymap))
     (overlay-put overlay 'evaporate t)
@@ -3459,7 +3460,7 @@ It reads a directory name from an editable text field."
     map))
 
 (define-widget 'key-sequence 'restricted-sexp
-  "A key sequence."
+  "A key sequence.  This is obsolete; use the `key' type instead."
   :prompt-value 'widget-field-prompt-value
   :prompt-internal 'widget-symbol-prompt-internal
 ; :prompt-match 'fboundp   ;; What was this good for?  KFS
@@ -3525,6 +3526,27 @@ It reads a directory name from an editable text field."
     value))
 
 
+(defvar widget-key-prompt-value-history nil
+  "History of input to `widget-key-prompt-value'.")
+
+(define-widget 'key 'editable-field
+  "A key sequence."
+  :prompt-value 'widget-field-prompt-value
+  :match 'key-valid-p
+  :format "%{%t%}: %v"
+  :validate 'widget-key-validate
+  :keymap widget-key-sequence-map
+  :help-echo "C-q: insert KEY, EVENT, or CODE; RET: enter value"
+  :tag "Key")
+
+(defun widget-key-validate (widget)
+  (unless (and (stringp (widget-value widget))
+               (key-valid-p (widget-value widget)))
+    (widget-put widget :error (format "Invalid key: %S"
+                                      (widget-value widget)))
+    widget))
+
+
 (define-widget 'sexp 'editable-field
   "An arbitrary Lisp expression."
   :tag "Lisp expression"
diff --git a/lisp/widget.el b/lisp/widget.el
index 0232f6cf93..300a95bd22 100644
--- a/lisp/widget.el
+++ b/lisp/widget.el
@@ -1,6 +1,6 @@
 ;;; widget.el --- a library of user interface components  -*- lexical-binding: 
t; -*-
 ;;
-;; Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: help, extensions, faces, hypermedia
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 8904f5cbf7..c8ea4fd1e5 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -1,6 +1,6 @@
 ;;; windmove.el --- directional window-selection routines  -*- 
lexical-binding:t -*-
 ;;
-;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Hovav Shacham (hovav@cs.stanford.edu)
 ;; Created: 17 October 1998
@@ -448,6 +448,7 @@ unless `windmove-create-window' is non-nil and a new window 
is created."
 (defvar windmove-mode-map (make-sparse-keymap)
   "Map used by `windmove-install-defaults'.")
 
+;;;###autoload
 (define-minor-mode windmove-mode
   "Global minor mode for default windmove commands."
   :keymap windmove-mode-map
diff --git a/lisp/window.el b/lisp/window.el
index 0f17bb28b4..3f61d53128 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1,6 +1,6 @@
 ;;; window.el --- GNU Emacs window commands aside from those written in C  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1989, 1992-1994, 2000-2021 Free Software
+;; Copyright (C) 1985, 1989, 1992-1994, 2000-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -5151,7 +5151,10 @@ nil means to not handle the buffer in a particular way.  
This
     (cond
      ;; First try to delete dedicated windows that are not side windows.
      ((and dedicated (not (eq dedicated 'side))
-           (window--delete window 'dedicated (eq bury-or-kill 'kill))))
+           (window--delete window 'dedicated (eq bury-or-kill 'kill)))
+      ;; If the previously selected window is still alive, select it.
+      (when (window-live-p (nth 2 quit-restore))
+        (select-window (nth 2 quit-restore))))
      ((and (not prev-buffer)
           (eq (nth 1 quit-restore) 'tab)
           (eq (nth 3 quit-restore) buffer))
@@ -7471,6 +7474,14 @@ ALIST.  See `display-buffer' for details."
   :version "24.1"
   :group 'windows)
 
+(defcustom display-comint-buffer-action 'display-buffer-same-window
+  "The action to display a comint buffer."
+  :type display-buffer--action-function-custom-type
+  :risky t
+  :version "29.1"
+  :group 'windows
+  :group 'comint)
+
 (defconst display-buffer-fallback-action
   '((display-buffer--maybe-same-window  ;FIXME: why isn't this redundant?
      display-buffer-reuse-window
diff --git a/lisp/winner.el b/lisp/winner.el
index 1b2807f248..e671b83880 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -1,6 +1,6 @@
 ;;; winner.el --- Restore old window configurations  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
 ;; Author: Ivar Rummelhoff <ivarru@math.uio.no>
 ;; Created: 27 Feb 1997
diff --git a/lisp/woman.el b/lisp/woman.el
index 1ca4d5e871..2e0d9a9090 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1,6 +1,6 @@
 ;;; woman.el --- browse UN*X manual pages `wo (without) man'  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Francis J. Wright <F.J.Wright@qmul.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 2819c6163d..559679131b 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -1,6 +1,6 @@
 ;;; x-dnd.el --- drag and drop support for X  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/lisp/xdg.el b/lisp/xdg.el
index 6055898214..6a0b1dedd1 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -1,6 +1,6 @@
 ;;; xdg.el --- XDG specification and standard support -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <mvoteiza@udel.edu>
 ;; Created: 27 January 2017
diff --git a/lisp/xml.el b/lisp/xml.el
index e2ba02e195..9c9f1d9b17 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -1,6 +1,6 @@
 ;;; xml.el --- XML parser -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Emmanuel Briot <briot@gnat.com>
 ;; Maintainer: Mark A. Hershberger <mah@everybody.org>
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index e4e91aa892..313665f6bf 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -1,6 +1,6 @@
 ;;; xt-mouse.el --- support the mouse when emacs run in an xterm -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994, 2000-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2000-2022 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: mouse, terminals
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 64a1b1bcda..36197c298c 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -1,6 +1,6 @@
 ;;; xwidget.el --- api functions for xwidgets  -*- lexical-binding: t -*-
 ;;
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Joakim Verona (joakim@verona.se)
 ;;
@@ -60,6 +60,7 @@
 (declare-function xwidget-webkit-set-cookie-storage-file "xwidget.c" (xwidget 
file))
 (declare-function xwidget-live-p "xwidget.c" (xwidget))
 (declare-function xwidget-webkit-stop-loading "xwidget.c" (xwidget))
+(declare-function xwidget-info "xwidget.c" (xwidget))
 
 (defgroup xwidget nil
   "Displaying native widgets in Emacs buffers."
@@ -138,7 +139,7 @@ Interactively, URL defaults to the string looking like a 
url around point."
 Get the URL of current session, then browse to the URL
 in `split-window-below' with a new xwidget webkit session."
   (interactive nil xwidget-webkit-mode)
-  (let ((url (xwidget-webkit-current-url)))
+  (let ((url (xwidget-webkit-uri (xwidget-webkit-current-session))))
     (with-selected-window (split-window-below)
       (xwidget-webkit-new-session url))))
 
@@ -147,7 +148,7 @@ in `split-window-below' with a new xwidget webkit session."
 Get the URL of current session, then browse to the URL
 in `split-window-right' with a new xwidget webkit session."
   (interactive nil xwidget-webkit-mode)
-  (let ((url (xwidget-webkit-current-url)))
+  (let ((url (xwidget-webkit-uri (xwidget-webkit-current-session))))
     (with-selected-window (split-window-right)
       (xwidget-webkit-new-session url))))
 
@@ -347,23 +348,36 @@ If N is omitted or nil, scroll down by one line."
 
 (defun xwidget-webkit-scroll-forward (&optional n)
   "Scroll webkit horizontally by N chars.
-The width of char is calculated with `window-font-width'.
-If N is omitted or nil, scroll forwards by one char."
+If the widget is larger than the window, hscroll by N columns
+instead.  The width of char is calculated with
+`window-font-width'.  If N is omitted or nil, scroll forwards by
+one char."
   (interactive "p" xwidget-webkit-mode)
-  (xwidget-webkit-execute-script
-   (xwidget-webkit-current-session)
-   (format "window.scrollBy(%d, 0);"
-           (* n (window-font-width)))))
+  (let ((session (xwidget-webkit-current-session)))
+    (if (> (- (aref (xwidget-info session) 2)
+              (window-text-width nil t))
+           (window-font-width))
+        (set-window-hscroll nil (+ (window-hscroll) n))
+      (xwidget-webkit-execute-script session
+                                     (format "window.scrollBy(%d, 0);"
+                                             (* n (window-font-width)))))))
 
 (defun xwidget-webkit-scroll-backward (&optional n)
   "Scroll webkit back by N chars.
-The width of char is calculated with `window-font-width'.
-If N is omitted or nil, scroll backwards by one char."
+If the widget is larger than the window, hscroll backwards by N
+columns instead.  The width of char is calculated with
+`window-font-width'.  If N is omitted or nil, scroll backwards by
+one char."
   (interactive "p" xwidget-webkit-mode)
-  (xwidget-webkit-execute-script
-   (xwidget-webkit-current-session)
-   (format "window.scrollBy(-%d, 0);"
-           (* n (window-font-width)))))
+  (let ((session (xwidget-webkit-current-session)))
+    (if (and (> (- (aref (xwidget-info session) 2)
+                   (window-text-width nil t))
+                (window-font-width))
+             (> (window-hscroll) 0))
+        (set-window-hscroll nil (- (window-hscroll) n))
+      (xwidget-webkit-execute-script session
+                                     (format "window.scrollBy(%-d, 0);"
+                                             (* n (window-font-width)))))))
 
 (defun xwidget-webkit-scroll-top ()
   "Scroll webkit to the very top."
@@ -531,24 +545,31 @@ directory, URL is saved at the specified directory as 
FILE-NAME."
 ;;; Bookmarks integration
 
 (defcustom xwidget-webkit-bookmark-jump-new-session nil
-  "Control bookmark jump to use new session or not.
-If non-nil, use a new xwidget webkit session after bookmark jump.
-Otherwise, it will use `xwidget-webkit-last-session'.
-When you set this variable to nil, consider further customization with
-`xwidget-webkit-last-session-buffer'."
+  "Whether to jump to a bookmarked URL in a new xwidget webkit session.
+If non-nil, create a new xwidget webkit session, otherwise use
+the value of `xwidget-webkit-last-session'."
   :version "28.1"
   :type 'boolean)
 
 (defun xwidget-webkit-bookmark-make-record ()
-  "Create bookmark record in webkit xwidget.
-See `xwidget-webkit-bookmark-jump-new-session' for whether this
-should create a new session or not."
+  "Create a bookmark record for a webkit xwidget."
   (nconc (bookmark-make-record-default t t)
          `((page . ,(xwidget-webkit-uri (xwidget-webkit-current-session)))
-           (handler  . (lambda (bmk)
-                         (xwidget-webkit-browse-url
-                          (bookmark-prop-get bmk 'page)
-                          xwidget-webkit-bookmark-jump-new-session))))))
+           (handler . xwidget-webkit-bookmark-jump-handler))))
+
+;;;###autoload
+(defun xwidget-webkit-bookmark-jump-handler (bookmark)
+  "Jump to the web page bookmarked by the bookmark record BOOKMARK.
+If `xwidget-webkit-bookmark-jump-new-session' is non-nil, create
+a new xwidget-webkit session, otherwise use an existing session."
+  (let* ((url (bookmark-prop-get bookmark 'page))
+        (xwbuf (if (or xwidget-webkit-bookmark-jump-new-session
+                        (not (xwidget-webkit-current-session)))
+                   (xwidget-webkit--create-new-session-buffer url)
+                  (xwidget-buffer (xwidget-webkit-current-session)))))
+    (with-current-buffer xwbuf
+      (xwidget-webkit-goto-uri (xwidget-webkit-current-session) url))
+    (set-buffer xwbuf)))
 
 ;;; xwidget webkit session
 
@@ -796,37 +817,44 @@ For example, use this to display an anchor."
   (add-to-list 'window-size-change-functions
                'xwidget-webkit-adjust-size-in-frame))
 
-(defun xwidget-webkit-new-session (url &optional callback)
-  "Create a new webkit session buffer with URL."
+(defun xwidget-webkit--create-new-session-buffer (url &optional callback)
+  "Create a new webkit session buffer to display URL in an xwidget.
+Optional function CALLBACK specifies the callback for webkit xwidgets;
+see `xwidget-webkit-callback'."
   (let* ((bufname
-          ;; Generate a temp-name based on current buffer name. it
-          ;; will be renamed by `xwidget-webkit-callback' in the
-          ;; future. This approach can limit flicker of buffer-name in
-          ;; mode-line.
+          ;; Generate a temp-name based on current buffer name.  The
+          ;; buffer will subsequently be renamed by
+          ;; `xwidget-webkit-callback'.  This approach can avoid
+          ;; flicker of buffer-name in mode-line.
           (generate-new-buffer-name (buffer-name)))
          (callback (or callback #'xwidget-webkit-callback))
          (current-session (xwidget-webkit-current-session))
          xw)
-    (setq xwidget-webkit-last-session-buffer (switch-to-buffer
-                                              (get-buffer-create bufname)))
+    (setq xwidget-webkit-last-session-buffer (get-buffer-create bufname))
     ;; The xwidget id is stored in a text property, so we need to have
     ;; at least character in this buffer.
     ;; Insert invisible url, good default for next `g' to browse url.
-    (let ((start (point)))
-      (insert url)
-      (put-text-property start (+ start (length url)) 'invisible t)
-      (setq xw (xwidget-insert
-                start 'webkit bufname
-                (xwidget-window-inside-pixel-width (selected-window))
-                (xwidget-window-inside-pixel-height (selected-window))
-                nil current-session)))
-    (when xwidget-webkit-cookie-file
-      (xwidget-webkit-set-cookie-storage-file
-       xw (expand-file-name xwidget-webkit-cookie-file)))
-    (xwidget-put xw 'callback callback)
-    (xwidget-put xw 'display-callback #'xwidget-webkit-display-callback)
-    (xwidget-webkit-mode)
-    (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))
+    (with-current-buffer xwidget-webkit-last-session-buffer
+      (let ((start (point)))
+        (insert url)
+        (put-text-property start (+ start (length url)) 'invisible t)
+        (setq xw (xwidget-insert
+                  start 'webkit bufname
+                  (xwidget-window-inside-pixel-width (selected-window))
+                  (xwidget-window-inside-pixel-height (selected-window))
+                  nil current-session)))
+      (when xwidget-webkit-cookie-file
+        (xwidget-webkit-set-cookie-storage-file
+         xw (expand-file-name xwidget-webkit-cookie-file)))
+      (xwidget-put xw 'callback callback)
+      (xwidget-put xw 'display-callback #'xwidget-webkit-display-callback)
+      (xwidget-webkit-mode))
+    xwidget-webkit-last-session-buffer))
+
+(defun xwidget-webkit-new-session (url)
+  "Display URL in a new webkit xwidget."
+  (switch-to-buffer (xwidget-webkit--create-new-session-buffer url))
+  (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url))
 
 (defun xwidget-webkit-import-widget (xwidget)
   "Create a new webkit session buffer from XWIDGET, an existing xwidget.
diff --git a/lisp/yank-media.el b/lisp/yank-media.el
index decab3b362..9836082fb2 100644
--- a/lisp/yank-media.el
+++ b/lisp/yank-media.el
@@ -1,6 +1,6 @@
 ;;; yank-media.el --- Yanking images and HTML  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: utility
diff --git a/lwlib/ChangeLog.1 b/lwlib/ChangeLog.1
index bf839cf709..4dac7763b9 100644
--- a/lwlib/ChangeLog.1
+++ b/lwlib/ChangeLog.1
@@ -1964,7 +1964,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1995-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1995-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in
index fb0ae0e1c2..d58c7bf6ac 100644
--- a/lwlib/Makefile.in
+++ b/lwlib/Makefile.in
@@ -1,7 +1,7 @@
 ### @configure_input@
 
 # Copyright (C) 1992, 1993 Lucid, Inc.
-# Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 #
 # This file is part of the Lucid Widget Library.
 #
diff --git a/lwlib/deps.mk b/lwlib/deps.mk
index 66c464f8f9..6a7eb1e0ca 100644
--- a/lwlib/deps.mk
+++ b/lwlib/deps.mk
@@ -1,7 +1,7 @@
 ### deps.mk --- lwlib/Makefile fragment for GNU Emacs
 
 # Copyright (C) 1992, 1993 Lucid, Inc.
-# Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 #
 # This file is part of the Lucid Widget Library.
 #
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index 8806d3f700..d17acae728 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -1,7 +1,7 @@
 /* The lwlib interface to Athena widgets.
 
 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu>
-Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-Xlw.c b/lwlib/lwlib-Xlw.c
index 54dc06f52a..e3b596369e 100644
--- a/lwlib/lwlib-Xlw.c
+++ b/lwlib/lwlib-Xlw.c
@@ -1,7 +1,7 @@
 /* The lwlib interface to "xlwmenu" menus.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994, 2000-2021 Free Software Foundation, Inc.
+Copyright (C) 1994, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 525465fa99..fa60fc89d0 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -1,6 +1,6 @@
 /* The lwlib interface to Motif widgets.
 
-Copyright (C) 1994-1997, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1994-1997, 1999-2022 Free Software Foundation, Inc.
 Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
diff --git a/lwlib/lwlib-int.h b/lwlib/lwlib-int.h
index ef76d67bfc..100e2ece69 100644
--- a/lwlib/lwlib-int.h
+++ b/lwlib/lwlib-int.h
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 2000-2021 Free Software Foundation, Inc.
+Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c
index 3c700e0c5f..ff86886c95 100644
--- a/lwlib/lwlib-utils.c
+++ b/lwlib/lwlib-utils.c
@@ -1,7 +1,7 @@
 /* Defines some widget utility functions.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-widget.h b/lwlib/lwlib-widget.h
index 2fd84c043f..5226db5f63 100644
--- a/lwlib/lwlib-widget.h
+++ b/lwlib/lwlib-widget.h
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1994, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 820538f738..30546b60e5 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -1,7 +1,7 @@
 /* A general interface to the widgets of different toolkits.
 
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994-1996, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h
index ab48d85890..86b1c60a5d 100644
--- a/lwlib/lwlib.h
+++ b/lwlib/lwlib.h
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1994, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index a0a10d13db..369162c7fe 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -1,7 +1,7 @@
 /* Implements a lightweight menubar widget.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994-1995, 1997, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 1997, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
@@ -1390,27 +1390,46 @@ fit_to_screen (XlwMenuWidget mw,
                window_state *previous_ws,
                Boolean horizontal_p)
 {
-  unsigned int screen_width = WidthOfScreen (XtScreen (mw));
-  unsigned int screen_height = HeightOfScreen (XtScreen (mw));
+  int screen_width, screen_height;
+  int screen_x, screen_y;
+  int prev_screen_x, prev_screen_y;
+
+#ifdef emacs
+  xlw_monitor_dimensions_at_pos (XtDisplay (mw), XtScreen (mw),
+                                previous_ws->x, previous_ws->y,
+                                &prev_screen_x, &prev_screen_y,
+                                &screen_width, &screen_height);
+  xlw_monitor_dimensions_at_pos (XtDisplay (mw), XtScreen (mw),
+                                ws->x, ws->y, &screen_x, &screen_y,
+                                &screen_width, &screen_height);
+#else
+  screen_width = WidthOfScreen (XtScreen (mw));
+  screen_height = HeightOfScreen (XtScreen (mw));
+  prev_screen_x = screen_x = 0;
+  prev_screen_y = screen_y = 0;
+#endif
   /* 1 if we are unable to avoid an overlap between
      this menu and the parent menu in the X dimension.  */
   int horizontal_overlap = 0;
 
-  if (ws->x < 0)
-    ws->x = 0;
-  else if (ws->x + ws->width > screen_width)
+  if (ws->x < screen_x)
+    ws->x = screen_x;
+  else if (ws->x + ws->width > screen_x + screen_width)
     {
       if (!horizontal_p)
        /* The addition of shadow-thickness for a sub-menu's position is
           to reflect a similar adjustment when the menu is displayed to
           the right of the invoking menu-item; it makes the sub-menu
           look more `attached' to the menu-item.  */
-       ws->x = previous_ws->x - ws->width + mw->menu.shadow_thickness;
+       ws->x = screen_x + (previous_ws->x
+                           - prev_screen_x
+                           - ws->width
+                           + mw->menu.shadow_thickness);
       else
-       ws->x = screen_width - ws->width;
-      if (ws->x < 0)
+       ws->x = screen_x + (screen_width - ws->width);
+      if (ws->x < screen_x)
        {
-         ws->x = 0;
+         ws->x = screen_x;
          horizontal_overlap = 1;
        }
     }
@@ -1427,16 +1446,18 @@ fit_to_screen (XlwMenuWidget mw,
        ws->y = previous_ws->y - ws->height;
     }
 
-  if (ws->y < 0)
-    ws->y = 0;
-  else if (ws->y + ws->height > screen_height)
+  if (ws->y < screen_y)
+    ws->y = screen_y;
+  else if (ws->y + ws->height > screen_y + screen_height)
     {
       if (horizontal_p)
-       ws->y = previous_ws->y - ws->height;
+       ws->y = screen_y + (previous_ws->y
+                           - prev_screen_y
+                           - ws->height);
       else
-       ws->y = screen_height - ws->height;
-      if (ws->y < 0)
-        ws->y = 0;
+       ws->y = screen_y + (screen_height - ws->height);
+      if (ws->y < screen_y)
+        ws->y = screen_y;
     }
 }
 
@@ -2626,7 +2647,21 @@ pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent 
*event)
   int          borderwidth = mw->menu.shadow_thickness;
   Screen*      screen = XtScreen (mw);
   Display       *display = XtDisplay (mw);
+  int          screen_x;
+  int          screen_y;
+  int          screen_w;
+  int          screen_h;
 
+#ifdef emacs
+  xlw_monitor_dimensions_at_pos (display, screen, x, y,
+                                &screen_x, &screen_y,
+                                &screen_w, &screen_h);
+#else
+  screen_x = 0;
+  screen_y = 0;
+  screen_w = WidthOfScreen (screen);
+  screen_h = HeightOfScreen (screen);
+#endif
   next_release_must_exit = 0;
 
   mw->menu.inside_entry = NULL;
@@ -2640,14 +2675,14 @@ pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent 
*event)
 
   x -= borderwidth;
   y -= borderwidth;
-  if (x < borderwidth)
-    x = borderwidth;
-  if (x + w + 2 * borderwidth > WidthOfScreen (screen))
-    x = WidthOfScreen (screen) - w - 2 * borderwidth;
-  if (y < borderwidth)
-    y = borderwidth;
-  if (y + h + 2 * borderwidth> HeightOfScreen (screen))
-    y = HeightOfScreen (screen) - h - 2 * borderwidth;
+  if (x < screen_x + borderwidth)
+    x = screen_x + borderwidth;
+  if (x + w + 2 * borderwidth > screen_x + screen_w)
+    x = (screen_x + screen_w) - w - 2 * borderwidth;
+  if (y < screen_y + borderwidth)
+    y = screen_y + borderwidth;
+  if (y + h + 2 * borderwidth > screen_y + screen_h)
+    y = (screen_y + screen_h) - h - 2 * borderwidth;
 
   mw->menu.popped_up = True;
   if (XtIsShell (XtParent ((Widget)mw)))
diff --git a/lwlib/xlwmenu.h b/lwlib/xlwmenu.h
index 89e548bc8d..7f4bf35939 100644
--- a/lwlib/xlwmenu.h
+++ b/lwlib/xlwmenu.h
@@ -1,6 +1,6 @@
 /* Interface of a lightweight menubar widget.
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h
index bb37b0dee2..455ecdbce0 100644
--- a/lwlib/xlwmenuP.h
+++ b/lwlib/xlwmenuP.h
@@ -1,6 +1,6 @@
 /* Internals of a lightweight menubar widget.
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
index 9ba1743e65..dea34e8341 100644
--- a/m4/00gnulib.m4
+++ b/m4/00gnulib.m4
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 8
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/__inline.m4 b/m4/__inline.m4
index b28cc6abc5..fbe2098e86 100644
--- a/m4/__inline.m4
+++ b/m4/__inline.m4
@@ -1,5 +1,5 @@
 # Test for __inline keyword
-dnl Copyright 2017-2021 Free Software Foundation, Inc.
+dnl Copyright 2017-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/absolute-header.m4 b/m4/absolute-header.m4
index 52d80d0428..67d6507c3e 100644
--- a/m4/absolute-header.m4
+++ b/m4/absolute-header.m4
@@ -1,5 +1,5 @@
 # absolute-header.m4 serial 17
-dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/acl.m4 b/m4/acl.m4
index aaf231aee9..8909442d7f 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -1,7 +1,7 @@
 # acl.m4 - check for access control list (ACL) primitives
 # serial 24
 
-# Copyright (C) 2002, 2004-2021 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index ba2f679d8e..dc6f47e330 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,5 +1,5 @@
-# alloca.m4 serial 20
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2021 Free Software Foundation,
+# alloca.m4 serial 21
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2022 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,17 +26,15 @@ AC_DEFUN([gl_FUNC_ALLOCA],
       AC_DEFINE([HAVE_ALLOCA], [1],
         [Define to 1 if you have 'alloca' after including <alloca.h>,
          a header that may be supplied by this distribution.])
-      ALLOCA_H=alloca.h
+      GL_GENERATE_ALLOCA_H=true
     else
       dnl alloca exists as a library function, i.e. it is slow and probably
       dnl a memory leak. Don't define HAVE_ALLOCA in this case.
-      ALLOCA_H=
+      GL_GENERATE_ALLOCA_H=false
     fi
   else
-    ALLOCA_H=alloca.h
+    GL_GENERATE_ALLOCA_H=true
   fi
-  AC_SUBST([ALLOCA_H])
-  AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
 
   if test $ac_cv_working_alloca_h = yes; then
     HAVE_ALLOCA_H=1
diff --git a/m4/builtin-expect.m4 b/m4/builtin-expect.m4
index c58411643c..b1fb12a3fb 100644
--- a/m4/builtin-expect.m4
+++ b/m4/builtin-expect.m4
@@ -1,6 +1,6 @@
 dnl Check for __builtin_expect.
 
-dnl Copyright 2016-2021 Free Software Foundation, Inc.
+dnl Copyright 2016-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/byteswap.m4 b/m4/byteswap.m4
index 1083b4c9e2..99aeb68727 100644
--- a/m4/byteswap.m4
+++ b/m4/byteswap.m4
@@ -1,5 +1,5 @@
-# byteswap.m4 serial 4
-dnl Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc.
+# byteswap.m4 serial 5
+dnl Copyright (C) 2005, 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -10,10 +10,8 @@ AC_DEFUN([gl_BYTESWAP],
 [
   dnl Prerequisites of lib/byteswap.in.h.
   AC_CHECK_HEADERS([byteswap.h], [
-    BYTESWAP_H=''
+    GL_GENERATE_BYTESWAP_H=false
   ], [
-    BYTESWAP_H='byteswap.h'
+    GL_GENERATE_BYTESWAP_H=true
   ])
-  AC_SUBST([BYTESWAP_H])
-  AM_CONDITIONAL([GL_GENERATE_BYTESWAP_H], [test -n "$BYTESWAP_H"])
 ])
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index 0dfb2da9a6..b55d5c06e2 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,6 +1,6 @@
 # canonicalize.m4 serial 37
 
-dnl Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2007, 2009-2022 Free Software Foundation, Inc.
 
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
index c3b9e7ea40..2253553313 100644
--- a/m4/clock_time.m4
+++ b/m4/clock_time.m4
@@ -1,10 +1,11 @@
-# clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc.
+# clock_time.m4 serial 11
+dnl Copyright (C) 2002-2006, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
+# Check for clock_getres, clock_gettime and clock_settime,
+# and set LIB_CLOCK_GETTIME.
 # For a program named, say foo, you should add a line like the following
 # in the corresponding Makefile.am file:
 # foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
@@ -26,6 +27,6 @@ AC_DEFUN([gl_CLOCK_TIME],
     AC_SEARCH_LIBS([clock_gettime], [rt posix4],
                    [test "$ac_cv_search_clock_gettime" = "none required" ||
                     LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
-    AC_CHECK_FUNCS([clock_gettime clock_settime])
+    AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime])
   LIBS=$gl_saved_libs
 ])
diff --git a/m4/copy-file-range.m4 b/m4/copy-file-range.m4
index 82904e9fce..4c7ec4eaaf 100644
--- a/m4/copy-file-range.m4
+++ b/m4/copy-file-range.m4
@@ -1,5 +1,5 @@
 # copy-file-range.m4
-dnl Copyright 2019-2021 Free Software Foundation, Inc.
+dnl Copyright 2019-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/d-type.m4 b/m4/d-type.m4
index 534a59e3e5..b8858b1918 100644
--- a/m4/d-type.m4
+++ b/m4/d-type.m4
@@ -5,7 +5,7 @@ dnl
 dnl Check whether struct dirent has a member named d_type.
 dnl
 
-# Copyright (C) 1997, 1999-2004, 2006, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999-2004, 2006, 2009-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4
index 17e2a20c5d..ddaca1680d 100644
--- a/m4/dirent_h.m4
+++ b/m4/dirent_h.m4
@@ -1,5 +1,5 @@
 # dirent_h.m4 serial 19
-dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/dirfd.m4 b/m4/dirfd.m4
index 3c9ce5dc65..92001700ef 100644
--- a/m4/dirfd.m4
+++ b/m4/dirfd.m4
@@ -2,7 +2,7 @@
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 
-# Copyright (C) 2001-2006, 2008-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2006, 2008-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/double-slash-root.m4 b/m4/double-slash-root.m4
index c9bbcef678..09ff5f0d17 100644
--- a/m4/double-slash-root.m4
+++ b/m4/double-slash-root.m4
@@ -1,5 +1,5 @@
 # double-slash-root.m4 serial 4   -*- Autoconf -*-
-dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index 0753a32491..7e777cdee6 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,5 +1,5 @@
 #serial 27
-dnl Copyright (C) 2002, 2005, 2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/eealloc.m4 b/m4/eealloc.m4
index 002f0c8671..a6aa2f88d0 100644
--- a/m4/eealloc.m4
+++ b/m4/eealloc.m4
@@ -1,5 +1,5 @@
 # eealloc.m4 serial 3
-dnl Copyright (C) 2003, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/environ.m4 b/m4/environ.m4
index ae5329108e..583dac3932 100644
--- a/m4/environ.m4
+++ b/m4/environ.m4
@@ -1,5 +1,5 @@
 # environ.m4 serial 8
-dnl Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/errno_h.m4 b/m4/errno_h.m4
index 51dfe92938..4be9780a7e 100644
--- a/m4/errno_h.m4
+++ b/m4/errno_h.m4
@@ -1,5 +1,5 @@
-# errno_h.m4 serial 13
-dnl Copyright (C) 2004, 2006, 2008-2021 Free Software Foundation, Inc.
+# errno_h.m4 serial 14
+dnl Copyright (C) 2004, 2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -68,13 +68,11 @@ booboo
       [gl_cv_header_errno_h_complete=yes])
   ])
   if test $gl_cv_header_errno_h_complete = yes; then
-    ERRNO_H=''
+    GL_GENERATE_ERRNO_H=false
   else
     gl_NEXT_HEADERS([errno.h])
-    ERRNO_H='errno.h'
+    GL_GENERATE_ERRNO_H=true
   fi
-  AC_SUBST([ERRNO_H])
-  AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
   gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
   gl_REPLACE_ERRNO_VALUE([ENOLINK])
   gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
@@ -88,7 +86,7 @@ booboo
 # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
 AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
 [
-  if test -n "$ERRNO_H"; then
+  if $GL_GENERATE_ERRNO_H; then
     AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
       AC_EGREP_CPP([yes],[
 #include <errno.h>
diff --git a/m4/euidaccess.m4 b/m4/euidaccess.m4
index 4aeb90a7e0..04f66f9d5d 100644
--- a/m4/euidaccess.m4
+++ b/m4/euidaccess.m4
@@ -1,5 +1,5 @@
 # euidaccess.m4 serial 15
-dnl Copyright (C) 2002-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/execinfo.m4 b/m4/execinfo.m4
index 75ab44beee..b370e4dfdf 100644
--- a/m4/execinfo.m4
+++ b/m4/execinfo.m4
@@ -1,6 +1,6 @@
 # Check for GNU-style execinfo.h.
 
-dnl Copyright 2012-2021 Free Software Foundation, Inc.
+dnl Copyright 2012-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -10,7 +10,7 @@ AC_DEFUN([gl_EXECINFO_H],
   AC_CHECK_HEADERS_ONCE([execinfo.h])
 
   LIB_EXECINFO=''
-  EXECINFO_H='execinfo.h'
+  GL_GENERATE_EXECINFO_H=true
 
   if test $ac_cv_header_execinfo_h = yes; then
     gl_saved_libs=$LIBS
@@ -18,14 +18,10 @@ AC_DEFUN([gl_EXECINFO_H],
         [test "$ac_cv_search_backtrace_symbols_fd" = "none required" ||
          LIB_EXECINFO=$ac_cv_search_backtrace_symbols_fd])
     LIBS=$gl_saved_libs
-    test "$ac_cv_search_backtrace_symbols_fd" = no || EXECINFO_H=''
+    if test "$ac_cv_search_backtrace_symbols_fd" != no; then
+      GL_GENERATE_EXECINFO_H=false
+    fi
   fi
 
-  if test -n "$EXECINFO_H"; then
-    AC_LIBOBJ([execinfo])
-  fi
-
-  AC_SUBST([EXECINFO_H])
   AC_SUBST([LIB_EXECINFO])
-  AM_CONDITIONAL([GL_GENERATE_EXECINFO_H], [test -n "$EXECINFO_H"])
 ])
diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4
index 8c86d69e05..3b4ef8c3cc 100644
--- a/m4/explicit_bzero.m4
+++ b/m4/explicit_bzero.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2017-2021 Free Software Foundation, Inc.
+dnl Copyright 2017-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 5792a9557a..0b3e4b5af7 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,7 +1,7 @@
 # serial 22  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index a4ac5ea532..2e914dbc07 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -1,6 +1,6 @@
 dnl 'extern inline' a la ISO C99.
 
-dnl Copyright 2012-2021 Free Software Foundation, Inc.
+dnl Copyright 2012-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/faccessat.m4 b/m4/faccessat.m4
index 9d6b363511..0ba5b3b687 100644
--- a/m4/faccessat.m4
+++ b/m4/faccessat.m4
@@ -1,7 +1,7 @@
 # serial 10
 # See if we need to provide faccessat replacement.
 
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
index 66c0e308fc..a5cf95a88b 100644
--- a/m4/fchmodat.m4
+++ b/m4/fchmodat.m4
@@ -1,5 +1,5 @@
 # fchmodat.m4 serial 6
-dnl Copyright (C) 2004-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index f6264345c1..428e5709d3 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,5 +1,5 @@
 # fcntl.m4 serial 11
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4
index aba44735d1..267f98bf52 100644
--- a/m4/fcntl_h.m4
+++ b/m4/fcntl_h.m4
@@ -1,6 +1,6 @@
 # serial 20
 # Configure fcntl.h.
-dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
index d42838087b..3001608408 100644
--- a/m4/fdopendir.m4
+++ b/m4/fdopendir.m4
@@ -1,7 +1,7 @@
 # serial 14
 # See if we need to provide fdopendir.
 
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/filemode.m4 b/m4/filemode.m4
index 4dc24efbd3..902c35e359 100644
--- a/m4/filemode.m4
+++ b/m4/filemode.m4
@@ -1,5 +1,5 @@
 # filemode.m4 serial 9
-dnl Copyright (C) 2002, 2005-2006, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/flexmember.m4 b/m4/flexmember.m4
index 49b1c752da..3b4237e9f7 100644
--- a/m4/flexmember.m4
+++ b/m4/flexmember.m4
@@ -1,7 +1,7 @@
 # serial 5
 # Check for flexible array member support.
 
-# Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/fpending.m4 b/m4/fpending.m4
index 131356ad46..de4eb7f9b3 100644
--- a/m4/fpending.m4
+++ b/m4/fpending.m4
@@ -1,6 +1,6 @@
 # serial 23
 
-# Copyright (C) 2000-2001, 2004-2021 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2004-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/fpieee.m4 b/m4/fpieee.m4
index 3f16957fbd..c0c23e9565 100644
--- a/m4/fpieee.m4
+++ b/m4/fpieee.m4
@@ -1,5 +1,5 @@
 # fpieee.m4 serial 2  -*- coding: utf-8 -*-
-dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/free.m4 b/m4/free.m4
index a7923b9059..dfeecd2bf1 100644
--- a/m4/free.m4
+++ b/m4/free.m4
@@ -1,5 +1,5 @@
 # free.m4 serial 6
-# Copyright (C) 2003-2005, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003-2005, 2009-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/fstatat.m4 b/m4/fstatat.m4
index d730e46d30..e8604a6ad3 100644
--- a/m4/fstatat.m4
+++ b/m4/fstatat.m4
@@ -1,5 +1,5 @@
 # fstatat.m4 serial 4
-dnl Copyright (C) 2004-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index d005579f9e..06e608866b 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -1,7 +1,7 @@
 # serial 35
 # Obtaining file system usage information.
 
-# Copyright (C) 1997-1998, 2000-2001, 2003-2021 Free Software Foundation, Inc.
+# Copyright (C) 1997-1998, 2000-2001, 2003-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/fsync.m4 b/m4/fsync.m4
index 6dc8cd1c0f..cbf35fe310 100644
--- a/m4/fsync.m4
+++ b/m4/fsync.m4
@@ -1,5 +1,5 @@
 # fsync.m4 serial 2
-dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/futimens.m4 b/m4/futimens.m4
index 2e9f53e5a8..e3caa7d898 100644
--- a/m4/futimens.m4
+++ b/m4/futimens.m4
@@ -1,7 +1,7 @@
 # serial 9
 # See if we need to provide futimens replacement.
 
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4
index 8fbc941898..6134eaace0 100644
--- a/m4/getdtablesize.m4
+++ b/m4/getdtablesize.m4
@@ -1,5 +1,5 @@
 # getdtablesize.m4 serial 8
-dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4
index bd746cdf88..d7a71f5ca6 100644
--- a/m4/getgroups.m4
+++ b/m4/getgroups.m4
@@ -3,7 +3,7 @@
 dnl From Jim Meyering.
 dnl A wrapper around AC_FUNC_GETGROUPS.
 
-# Copyright (C) 1996-1997, 1999-2004, 2008-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2004, 2008-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index bba2216949..7bb8890bd5 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -1,6 +1,6 @@
 # Check for getloadavg.
 
-# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2021 Free Software
+# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2022 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index bb95c5ea28..ff78ed535d 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,5 +1,5 @@
-# getopt.m4 serial 47
-dnl Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc.
+# getopt.m4 serial 48
+dnl Copyright (C) 2002-2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -21,6 +21,8 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
       REPLACE_GETOPT=1
     fi
   ])
+  GL_GENERATE_GETOPT_H=false
+  GL_GENERATE_GETOPT_CDEFS_H=false
   if test $REPLACE_GETOPT = 1; then
     dnl Arrange for getopt.h to be created.
     gl_GETOPT_SUBSTITUTE_HEADER
@@ -374,8 +376,6 @@ AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
   AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
     [Define to rpl_ if the getopt replacement functions and variables
      should be used.])
-  GETOPT_H=getopt.h
-  GETOPT_CDEFS_H=getopt-cdefs.h
-  AC_SUBST([GETOPT_H])
-  AC_SUBST([GETOPT_CDEFS_H])
+  GL_GENERATE_GETOPT_H=true
+  GL_GENERATE_GETOPT_CDEFS_H=true
 ])
diff --git a/m4/getrandom.m4 b/m4/getrandom.m4
index 5f174dc7eb..6ca715005d 100644
--- a/m4/getrandom.m4
+++ b/m4/getrandom.m4
@@ -1,5 +1,5 @@
 # getrandom.m4 serial 8
-dnl Copyright 2020-2021 Free Software Foundation, Inc.
+dnl Copyright 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/gettime.m4 b/m4/gettime.m4
index de7c33046c..f0aeb4d0e4 100644
--- a/m4/gettime.m4
+++ b/m4/gettime.m4
@@ -1,5 +1,5 @@
-# gettime.m4 serial 9
-dnl Copyright (C) 2002, 2004-2006, 2009-2021 Free Software Foundation, Inc.
+# gettime.m4 serial 11
+dnl Copyright (C) 2002, 2004-2006, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -9,5 +9,13 @@ AC_DEFUN([gl_GETTIME],
   dnl Prerequisites of lib/gettime.c.
   AC_REQUIRE([gl_CLOCK_TIME])
   AC_REQUIRE([gl_TIMESPEC])
-  AC_CHECK_FUNCS_ONCE([gettimeofday])
+  AC_CHECK_FUNCS_ONCE([timespec_get])
+])
+
+AC_DEFUN([gl_GETTIME_RES],
+[
+  dnl Prerequisites of lib/gettime-res.c.
+  AC_REQUIRE([gl_CLOCK_TIME])
+  AC_REQUIRE([gl_TIMESPEC])
+  AC_CHECK_FUNCS_ONCE([timespec_getres])
 ])
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
index 37c54404bb..f729601b1d 100644
--- a/m4/gettimeofday.m4
+++ b/m4/gettimeofday.m4
@@ -1,6 +1,6 @@
 # serial 29
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 12b19dbcb4..87a9a751b6 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 67
-dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 69
+dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -879,6 +879,36 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
   AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS])
 ])
 
+dnl gl_CONDITIONAL_HEADER([foo.h])
+dnl takes a shell variable GL_GENERATE_FOO_H (with value true or false) as 
input
+dnl and produces
+dnl   - an AC_SUBSTed variable FOO_H that is either a file name or empty, based
+dnl     on whether GL_GENERATE_FOO_H is true or false,
+dnl   - an Automake conditional GL_GENERATE_FOO_H that evaluates to the value 
of
+dnl     the shell variable GL_GENERATE_FOO_H.
+AC_DEFUN([gl_CONDITIONAL_HEADER],
+[
+  m4_pushdef([gl_header_name], AS_TR_SH(m4_toupper($1)))
+  m4_pushdef([gl_generate_var], [GL_GENERATE_]AS_TR_SH(m4_toupper($1)))
+  m4_pushdef([gl_generate_cond], [GL_GENERATE_]AS_TR_SH(m4_toupper($1)))
+  case "$gl_generate_var" in
+    false) gl_header_name='' ;;
+    true)
+      dnl It is OK to use a .h file in lib/ from within tests/, but not vice
+      dnl versa.
+      if test -z "$gl_header_name"; then
+        gl_header_name="${gl_source_base_prefix}$1"
+      fi
+      ;;
+    *) echo "*** gl_generate_var is not set correctly" 1>&2; exit 1 ;;
+  esac
+  AC_SUBST(gl_header_name)
+  AM_CONDITIONAL(gl_generate_cond, [$gl_generate_var])
+  m4_popdef([gl_generate_cond])
+  m4_popdef([gl_generate_var])
+  m4_popdef([gl_header_name])
+])
+
 dnl Expands to some code for use in .c programs that, on native Windows, 
defines
 dnl the Microsoft deprecated alias function names to the underscore-prefixed
 dnl actual function names. With this macro, these function names are available
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index e314edcfb5..c47ea915f1 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2021 Free Software Foundation, Inc.
+# Copyright (C) 2002-2022 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -103,6 +103,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module fsusage:
   # Code from module fsync:
   # Code from module futimens:
+  # Code from module gen-header:
   # Code from module getdtablesize:
   # Code from module getgroups:
   # Code from module getloadavg:
@@ -128,6 +129,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module libgmp:
   # Code from module limits-h:
   # Code from module lstat:
+  # Code from module malloc-gnu:
   # Code from module malloc-posix:
   # Code from module manywarnings:
   # Code from module memmem-simple:
@@ -224,10 +226,15 @@ AC_DEFUN([gl_INIT],
   m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL])
   gl_COMMON
   gl_source_base='lib'
+  gl_source_base_prefix=
   gl_FUNC_ACL
   gl_FUNC_ALLOCA
+  gl_CONDITIONAL_HEADER([alloca.h])
+  AC_PROG_MKDIR_P
   gl___BUILTIN_EXPECT
   gl_BYTESWAP
+  gl_CONDITIONAL_HEADER([byteswap.h])
+  AC_PROG_MKDIR_P
   gl_CANONICALIZE_LGPL
   if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
     AC_LIBOBJ([canonicalize-lgpl])
@@ -255,6 +262,7 @@ AC_DEFUN([gl_INIT],
   gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
   gl_DIRENT_H
   gl_DIRENT_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   gl_DOUBLE_SLASH_ROOT
   gl_FUNC_DUP2
   if test $REPLACE_DUP2 = 1; then
@@ -265,7 +273,14 @@ AC_DEFUN([gl_INIT],
   gl_ENVIRON
   gl_UNISTD_MODULE_INDICATOR([environ])
   gl_HEADER_ERRNO_H
+  gl_CONDITIONAL_HEADER([errno.h])
+  AC_PROG_MKDIR_P
   gl_EXECINFO_H
+  gl_CONDITIONAL_HEADER([execinfo.h])
+  AC_PROG_MKDIR_P
+  if $GL_GENERATE_EXECINFO_H; then
+    AC_LIBOBJ([execinfo])
+  fi
   gl_FUNC_EXPLICIT_BZERO
   if test $HAVE_EXPLICIT_BZERO = 0; then
     AC_LIBOBJ([explicit_bzero])
@@ -293,6 +308,7 @@ AC_DEFUN([gl_INIT],
   gl_FCNTL_MODULE_INDICATOR([fcntl])
   gl_FCNTL_H
   gl_FCNTL_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   gl_FUNC_FDOPENDIR
   if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then
     AC_LIBOBJ([fdopendir])
@@ -345,6 +361,9 @@ AC_DEFUN([gl_INIT],
   dnl mechanism), there is no need to do any AC_LIBOBJ or AC_SUBST here; they 
are
   dnl done in the getopt-posix module.
   gl_FUNC_GETOPT_POSIX
+  gl_CONDITIONAL_HEADER([getopt.h])
+  gl_CONDITIONAL_HEADER([getopt-cdefs.h])
+  AC_PROG_MKDIR_P
   if test $REPLACE_GETOPT = 1; then
     AC_LIBOBJ([getopt])
     AC_LIBOBJ([getopt1])
@@ -367,15 +386,22 @@ AC_DEFUN([gl_INIT],
   fi
   gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
   gl_IEEE754_H
+  gl_CONDITIONAL_HEADER([ieee754.h])
+  AC_PROG_MKDIR_P
   gl_INTTYPES_INCOMPLETE
   gl_INTTYPES_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   AC_REQUIRE([gl_LARGEFILE])
   gl___INLINE
   gl_LIBGMP
+  gl_CONDITIONAL_HEADER([gmp.h])
+  AC_PROG_MKDIR_P
   if test $HAVE_LIBGMP != yes; then
     AC_LIBOBJ([mini-gmp-gnulib])
   fi
   gl_LIMITS_H
+  gl_CONDITIONAL_HEADER([limits.h])
+  AC_PROG_MKDIR_P
   gl_FUNC_LSTAT
   if test $REPLACE_LSTAT = 1; then
     AC_LIBOBJ([lstat])
@@ -458,16 +484,26 @@ AC_DEFUN([gl_INIT],
   gl_STRING_MODULE_INDICATOR([sigdescr_np])
   gl_SIGNAL_H
   gl_SIGNAL_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   gl_TYPE_SOCKLEN_T
   gt_TYPE_SSIZE_T
   gl_STAT_TIME
   gl_STAT_BIRTHTIME
   gl_STDALIGN_H
+  gl_CONDITIONAL_HEADER([stdalign.h])
+  AC_PROG_MKDIR_P
   gl_STDDEF_H
   gl_STDDEF_H_REQUIRE_DEFAULTS
+  gl_CONDITIONAL_HEADER([stddef.h])
+  AC_PROG_MKDIR_P
   gl_STDINT_H
+  gl_CONDITIONAL_HEADER([stdint.h])
+  dnl Because of gl_REPLACE_LIMITS_H:
+  gl_CONDITIONAL_HEADER([limits.h])
+  AC_PROG_MKDIR_P
   gl_STDIO_H
   gl_STDIO_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
   gl_STDIO_MODULE_INDICATOR([fscanf])
@@ -493,6 +529,7 @@ AC_DEFUN([gl_INIT],
   gl_STDIO_MODULE_INDICATOR([fwrite])
   gl_STDLIB_H
   gl_STDLIB_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   gl_FUNC_STPCPY
   if test $HAVE_STPCPY = 0; then
     AC_LIBOBJ([stpcpy])
@@ -501,6 +538,7 @@ AC_DEFUN([gl_INIT],
   gl_STRING_MODULE_INDICATOR([stpcpy])
   gl_STRING_H
   gl_STRING_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   gl_FUNC_STRNLEN
   if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then
     AC_LIBOBJ([strnlen])
@@ -537,6 +575,7 @@ AC_DEFUN([gl_INIT],
   gl_MODULE_INDICATOR([tempname])
   gl_TIME_H
   gl_TIME_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   gl_TIME_R
   if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
     AC_LIBOBJ([time_r])
@@ -558,6 +597,7 @@ AC_DEFUN([gl_INIT],
   gl_TIMESPEC
   gl_UNISTD_H
   gl_UNISTD_H_REQUIRE_DEFAULTS
+  AC_PROG_MKDIR_P
   AC_DEFINE([GNULIB_STDIO_SINGLE_THREAD], [1],
     [Define to 1 if you want the FILE stream functions getc, putc, etc.
      to use unlocked I/O if available, throughout the package.
@@ -586,6 +626,7 @@ AC_DEFUN([gl_INIT],
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
   gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false
   gl_gnulib_enabled_lchmod=false
+  gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b=false
   gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=false
   gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31=false
   gl_gnulib_enabled_open=false
@@ -721,16 +762,31 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_lchmod=true
     fi
   }
+  func_gl_gnulib_m4code_e80bf6f757095d2e5fc94dafb8f8fc8b ()
+  {
+    if ! $gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b; then
+      gl_FUNC_MALLOC_GNU
+      if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then
+        AC_LIBOBJ([malloc])
+      fi
+      gl_STDLIB_MODULE_INDICATOR([malloc-gnu])
+      gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b=true
+      func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866
+      if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then
+        func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec
+      fi
+    fi
+  }
   func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 ()
   {
     if ! $gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866; then
       AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
-      if test $REPLACE_MALLOC = 1; then
+      if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
         AC_LIBOBJ([malloc])
       fi
       gl_STDLIB_MODULE_INDICATOR([malloc-posix])
       gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=true
-      if test $REPLACE_MALLOC = 1; then
+      if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
         func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec
       fi
     fi
@@ -783,26 +839,33 @@ AC_DEFUN([gl_INIT],
   {
     if ! $gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b; then
       gl_FUNC_REALLOC_GNU
-      if test $REPLACE_REALLOC = 1; then
+      if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then
         AC_LIBOBJ([realloc])
       fi
+      gl_STDLIB_MODULE_INDICATOR([realloc-gnu])
       gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=true
+      if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then
+        func_gl_gnulib_m4code_e80bf6f757095d2e5fc94dafb8f8fc8b
+      fi
       func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4
+      if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then
+        func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec
+      fi
     fi
   }
   func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 ()
   {
     if ! $gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4; then
       gl_FUNC_REALLOC_POSIX
-      if test $REPLACE_REALLOC = 1; then
+      if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then
         AC_LIBOBJ([realloc])
       fi
       gl_STDLIB_MODULE_INDICATOR([realloc-posix])
       gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=true
-      if test $REPLACE_REALLOC = 1; then
+      if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then
         func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866
       fi
-      if test $REPLACE_REALLOC = 1; then
+      if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then
         func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec
       fi
     fi
@@ -937,6 +1000,7 @@ AC_DEFUN([gl_INIT],
   AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], 
[$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], 
[$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_lchmod], [$gl_gnulib_enabled_lchmod])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b], 
[$gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866], 
[$gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31], 
[$gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_open], [$gl_gnulib_enabled_open])
@@ -993,6 +1057,7 @@ AC_DEFUN([gl_INIT],
   m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL])
   gl_COMMON
   gl_source_base='tests'
+  gl_source_base_prefix=
 changequote(,)dnl
   gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr 
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 
's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS
 changequote([, ])dnl
diff --git a/m4/group-member.m4 b/m4/group-member.m4
index 7a7bb40afc..f9bc38b629 100644
--- a/m4/group-member.m4
+++ b/m4/group-member.m4
@@ -1,6 +1,6 @@
 # serial 14
 
-# Copyright (C) 1999-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 1999-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/ieee754-h.m4 b/m4/ieee754-h.m4
index 68af3bd7eb..aff4f2c2df 100644
--- a/m4/ieee754-h.m4
+++ b/m4/ieee754-h.m4
@@ -1,6 +1,6 @@
 # Configure ieee754-h module
 
-dnl Copyright 2018-2021 Free Software Foundation, Inc.
+dnl Copyright 2018-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -10,12 +10,10 @@ AC_DEFUN([gl_IEEE754_H],
   AC_REQUIRE([AC_C_BIGENDIAN])
   AC_CHECK_HEADERS_ONCE([ieee754.h])
   if test $ac_cv_header_ieee754_h = yes; then
-    IEEE754_H=
+    GL_GENERATE_IEEE754_H=false
   else
-    IEEE754_H=ieee754.h
+    GL_GENERATE_IEEE754_H=true
     AC_DEFINE([_GL_REPLACE_IEEE754_H], 1,
               [Define to 1 if <ieee754.h> is missing.])
   fi
-  AC_SUBST([IEEE754_H])
-  AM_CONDITIONAL([GL_GENERATE_IEEE754_H], [test -n "$IEEE754_H"])
 ])
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index bdd542bc64..a9247f6f11 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,5 +1,5 @@
 # include_next.m4 serial 26
-dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -193,9 +193,9 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
              if test AS_VAR_GET([gl_header_exists]) = yes; then
              AS_VAR_POPDEF([gl_header_exists])
             ])
-           gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
-           AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
-           AS_VAR_SET([gl_next_header], ['"'$gl_header'"'])
+          gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
+          AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
+          AS_VAR_SET([gl_next_header], ['"'$gl_header'"'])
           m4_if([$2], [check],
             [else
                AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index 64b1de5c42..df25a21eb9 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,5 +1,5 @@
-# inttypes.m4 serial 35
-dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
+# inttypes.m4 serial 36
+dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -36,7 +36,7 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
 AC_DEFUN([gl_INTTYPES_PRI_SCN],
 [
   PRIPTR_PREFIX=
-  if test -n "$STDINT_H"; then
+  if $GL_GENERATE_STDINT_H; then
     dnl Using the gnulib <stdint.h>. It defines intptr_t to 'long' or
     dnl 'long long', depending on _WIN64.
     AC_COMPILE_IFELSE(
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index fbde5e6647..3e8b5e39a7 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -1,7 +1,7 @@
 # Enable large files on systems where this is not the default.
 # Enable support for files on Linux file systems with 64-bit inode numbers.
 
-# Copyright 1992-1996, 1998-2021 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/lchmod.m4 b/m4/lchmod.m4
index 3d181be051..5baee738ef 100644
--- a/m4/lchmod.m4
+++ b/m4/lchmod.m4
@@ -1,6 +1,6 @@
 #serial 8
 
-dnl Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/libgmp.m4 b/m4/libgmp.m4
index c630a19e64..a2dee93382 100644
--- a/m4/libgmp.m4
+++ b/m4/libgmp.m4
@@ -1,6 +1,6 @@
-# libgmp.m4 serial 5
+# libgmp.m4 serial 6
 # Configure the GMP library or a replacement.
-dnl Copyright 2020-2021 Free Software Foundation, Inc.
+dnl Copyright 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -59,11 +59,10 @@ AC_DEFUN([gl_LIBGMP],
             [ Try specifying --with-libgmp-prefix=DIR.])])
      fi])
   if test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" = yes; then
-    GMP_H=
+    GL_GENERATE_GMP_H=false
   else
-    GMP_H=gmp.h
+    GL_GENERATE_GMP_H=true
   fi
-  AC_SUBST([GMP_H])
   AM_CONDITIONAL([GL_GENERATE_MINI_GMP_H],
     [test $HAVE_LIBGMP != yes])
   AM_CONDITIONAL([GL_GENERATE_GMP_GMP_H],
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index 00c9fe9e50..5d5a5bf584 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -1,6 +1,6 @@
 dnl Check whether limits.h has needed features.
 
-dnl Copyright 2016-2021 Free Software Foundation, Inc.
+dnl Copyright 2016-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -27,18 +27,15 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
        [gl_cv_header_limits_width=yes],
        [gl_cv_header_limits_width=no])])
   if test "$gl_cv_header_limits_width" = yes; then
-    LIMITS_H=
+    GL_GENERATE_LIMITS_H=false
   else
-    LIMITS_H=limits.h
+    GL_GENERATE_LIMITS_H=true
   fi
-  AC_SUBST([LIMITS_H])
-  AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
 ])
 
 dnl Unconditionally enables the replacement of <limits.h>.
 AC_DEFUN([gl_REPLACE_LIMITS_H],
 [
   AC_REQUIRE([gl_LIMITS_H])
-  LIMITS_H='limits.h'
-  AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
+  GL_GENERATE_LIMITS_H=true
 ])
diff --git a/m4/lstat.m4 b/m4/lstat.m4
index 62e9db29a7..d987060bd1 100644
--- a/m4/lstat.m4
+++ b/m4/lstat.m4
@@ -1,6 +1,6 @@
 # serial 33
 
-# Copyright (C) 1997-2001, 2003-2021 Free Software Foundation, Inc.
+# Copyright (C) 1997-2001, 2003-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/malloc.m4 b/m4/malloc.m4
index 972e808ab7..6b76c1e64d 100644
--- a/m4/malloc.m4
+++ b/m4/malloc.m4
@@ -1,5 +1,5 @@
-# malloc.m4 serial 27
-dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
+# malloc.m4 serial 28
+dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -43,8 +43,9 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
-  if test $REPLACE_MALLOC = 0; then
-    _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC=1])
+  REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX"
+  if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then
+    _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1])
   fi
 ])
 
@@ -56,7 +57,7 @@ AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
-  test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1
+  test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1
 ])
 
 # Test whether malloc, realloc, calloc refuse to create objects
@@ -109,7 +110,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
     AC_DEFINE([HAVE_MALLOC_POSIX], [1],
       [Define if malloc, realloc, and calloc set errno on allocation failure.])
   else
-    REPLACE_MALLOC=1
+    REPLACE_MALLOC_FOR_MALLOC_POSIX=1
   fi
 ])
 
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 872ea58e62..253393e51b 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
 # manywarnings.m4 serial 23
-dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4
index e7fe3580db..a6eba1bc12 100644
--- a/m4/mbstate_t.m4
+++ b/m4/mbstate_t.m4
@@ -1,5 +1,5 @@
 # mbstate_t.m4 serial 14
-dnl Copyright (C) 2000-2002, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/md5.m4 b/m4/md5.m4
index 021b352aac..cefb9cfe8e 100644
--- a/m4/md5.m4
+++ b/m4/md5.m4
@@ -1,5 +1,5 @@
 # md5.m4 serial 14
-dnl Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/memmem.m4 b/m4/memmem.m4
index 6dac766128..e01aa5c713 100644
--- a/m4/memmem.m4
+++ b/m4/memmem.m4
@@ -1,5 +1,5 @@
 # memmem.m4 serial 29
-dnl Copyright (C) 2002-2004, 2007-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4
index f9d9ec8f30..1107eb4a46 100644
--- a/m4/mempcpy.m4
+++ b/m4/mempcpy.m4
@@ -1,5 +1,5 @@
 # mempcpy.m4 serial 12
-dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation,
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2022 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/memrchr.m4 b/m4/memrchr.m4
index 40f61c5ac0..ec5e2083bc 100644
--- a/m4/memrchr.m4
+++ b/m4/memrchr.m4
@@ -1,5 +1,5 @@
 # memrchr.m4 serial 11
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2022 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/minmax.m4 b/m4/minmax.m4
index e21a6879a0..b976739794 100644
--- a/m4/minmax.m4
+++ b/m4/minmax.m4
@@ -1,5 +1,5 @@
 # minmax.m4 serial 4
-dnl Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mkostemp.m4 b/m4/mkostemp.m4
index 46534d48ef..2176f37296 100644
--- a/m4/mkostemp.m4
+++ b/m4/mkostemp.m4
@@ -1,5 +1,5 @@
 # mkostemp.m4 serial 2
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 721189af56..d48f40d187 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,5 +1,5 @@
 # serial 36
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2022 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/mode_t.m4 b/m4/mode_t.m4
index 3bd4b89fee..e08d27a749 100644
--- a/m4/mode_t.m4
+++ b/m4/mode_t.m4
@@ -1,5 +1,5 @@
 # mode_t.m4 serial 2
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/multiarch.m4 b/m4/multiarch.m4
index f1678d9f6e..5d942765d4 100644
--- a/m4/multiarch.m4
+++ b/m4/multiarch.m4
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 9
-dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/nocrash.m4 b/m4/nocrash.m4
index 27412cd2e8..91f00c1bc9 100644
--- a/m4/nocrash.m4
+++ b/m4/nocrash.m4
@@ -1,5 +1,5 @@
 # nocrash.m4 serial 5
-dnl Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/nproc.m4 b/m4/nproc.m4
index 887c66bee8..5c220ae2c4 100644
--- a/m4/nproc.m4
+++ b/m4/nproc.m4
@@ -1,5 +1,5 @@
 # nproc.m4 serial 5
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/nstrftime.m4 b/m4/nstrftime.m4
index b510554b94..0f613048e3 100644
--- a/m4/nstrftime.m4
+++ b/m4/nstrftime.m4
@@ -1,6 +1,6 @@
 # serial 37
 
-# Copyright (C) 1996-1997, 1999-2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2007, 2009-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/off_t.m4 b/m4/off_t.m4
index bdec43c804..0890adafc3 100644
--- a/m4/off_t.m4
+++ b/m4/off_t.m4
@@ -1,5 +1,5 @@
 # off_t.m4 serial 1
-dnl Copyright (C) 2012-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2012-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/open-cloexec.m4 b/m4/open-cloexec.m4
index 542a90f42a..16cd5ec4cb 100644
--- a/m4/open-cloexec.m4
+++ b/m4/open-cloexec.m4
@@ -1,6 +1,6 @@
 # Test whether O_CLOEXEC is defined.
 
-dnl Copyright 2017-2021 Free Software Foundation, Inc.
+dnl Copyright 2017-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/open-slash.m4 b/m4/open-slash.m4
index e619039e87..4fbf491a75 100644
--- a/m4/open-slash.m4
+++ b/m4/open-slash.m4
@@ -1,5 +1,5 @@
 # open-slash.m4 serial 2
-dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/open.m4 b/m4/open.m4
index c63438650d..f82fd6cac1 100644
--- a/m4/open.m4
+++ b/m4/open.m4
@@ -1,5 +1,5 @@
 # open.m4 serial 15
-dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pathmax.m4 b/m4/pathmax.m4
index e67c656659..44add9905e 100644
--- a/m4/pathmax.m4
+++ b/m4/pathmax.m4
@@ -1,5 +1,5 @@
 # pathmax.m4 serial 11
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2022 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/pid_t.m4 b/m4/pid_t.m4
index b7650a10f1..cb26f3612e 100644
--- a/m4/pid_t.m4
+++ b/m4/pid_t.m4
@@ -1,5 +1,5 @@
 # pid_t.m4 serial 4
-dnl Copyright (C) 2020-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pipe2.m4 b/m4/pipe2.m4
index 43d547cb40..b752247825 100644
--- a/m4/pipe2.m4
+++ b/m4/pipe2.m4
@@ -1,5 +1,5 @@
 # pipe2.m4 serial 2
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index 9de63baf99..86114416cb 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,5 +1,5 @@
 # pselect.m4 serial 10
-dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index ff7fa9610e..0aa8c53f9e 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -1,5 +1,5 @@
 # pthread_sigmask.m4 serial 21
-dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/rawmemchr.m4 b/m4/rawmemchr.m4
index 452fab18f1..dae419355a 100644
--- a/m4/rawmemchr.m4
+++ b/m4/rawmemchr.m4
@@ -1,5 +1,5 @@
 # rawmemchr.m4 serial 3
-dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/readlink.m4 b/m4/readlink.m4
index 352788c65d..d1dd521225 100644
--- a/m4/readlink.m4
+++ b/m4/readlink.m4
@@ -1,5 +1,5 @@
 # readlink.m4 serial 16
-dnl Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4
index 1ced672185..63c5205e11 100644
--- a/m4/readlinkat.m4
+++ b/m4/readlinkat.m4
@@ -1,7 +1,7 @@
 # serial 6
 # See if we need to provide readlinkat replacement.
 
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/realloc.m4 b/m4/realloc.m4
index 0abc4185ed..86e57c259f 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,5 +1,5 @@
-# realloc.m4 serial 24
-dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
+# realloc.m4 serial 26
+dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -43,8 +43,8 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
-  if test $REPLACE_REALLOC = 0; then
-    _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1])
+  if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
+    _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
   fi
 ])# gl_FUNC_REALLOC_GNU
 
@@ -57,7 +57,7 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
-  if test $REPLACE_MALLOC = 1; then
-    REPLACE_REALLOC=1
+  if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
+    REPLACE_REALLOC_FOR_REALLOC_POSIX=1
   fi
 ])
diff --git a/m4/regex.m4 b/m4/regex.m4
index 1c7e562f6c..47342986d2 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,6 +1,6 @@
 # serial 73
 
-# Copyright (C) 1996-2001, 2003-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001, 2003-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/sha1.m4 b/m4/sha1.m4
index fdba7a6f7b..0d7abc7245 100644
--- a/m4/sha1.m4
+++ b/m4/sha1.m4
@@ -1,5 +1,5 @@
 # sha1.m4 serial 12
-dnl Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sha256.m4 b/m4/sha256.m4
index f49899c84c..b3d8f92e9f 100644
--- a/m4/sha256.m4
+++ b/m4/sha256.m4
@@ -1,5 +1,5 @@
 # sha256.m4 serial 8
-dnl Copyright (C) 2005, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sha512.m4 b/m4/sha512.m4
index b45fdf50f6..31710575f7 100644
--- a/m4/sha512.m4
+++ b/m4/sha512.m4
@@ -1,5 +1,5 @@
 # sha512.m4 serial 9
-dnl Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sig2str.m4 b/m4/sig2str.m4
index 8951bbd7f0..6531606092 100644
--- a/m4/sig2str.m4
+++ b/m4/sig2str.m4
@@ -1,5 +1,5 @@
 # serial 7
-dnl Copyright (C) 2002, 2005-2006, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sigdescr_np.m4 b/m4/sigdescr_np.m4
index 17c22506cc..4ce3b01589 100644
--- a/m4/sigdescr_np.m4
+++ b/m4/sigdescr_np.m4
@@ -1,5 +1,5 @@
 # sigdescr_np.m4 serial 2
-dnl Copyright (C) 2020-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/signal_h.m4 b/m4/signal_h.m4
index 8b938809b7..4c05c6274f 100644
--- a/m4/signal_h.m4
+++ b/m4/signal_h.m4
@@ -1,5 +1,5 @@
 # signal_h.m4 serial 22
-dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/socklen.m4 b/m4/socklen.m4
index eca1d1b946..1390ac41bd 100644
--- a/m4/socklen.m4
+++ b/m4/socklen.m4
@@ -1,5 +1,5 @@
 # socklen.m4 serial 11
-dnl Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
index f0ed509fcc..03b2b895b9 100644
--- a/m4/ssize_t.m4
+++ b/m4/ssize_t.m4
@@ -1,5 +1,5 @@
 # ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4
index b39c3ee997..347954990b 100644
--- a/m4/st_dm_mode.m4
+++ b/m4/st_dm_mode.m4
@@ -1,6 +1,6 @@
 # serial 6
 
-# Copyright (C) 1998-1999, 2001, 2009-2021 Free Software Foundation,
+# Copyright (C) 1998-1999, 2001, 2009-2022 Free Software Foundation,
 # Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/stat-time.m4 b/m4/stat-time.m4
index df1c2a7453..342857d39e 100644
--- a/m4/stat-time.m4
+++ b/m4/stat-time.m4
@@ -1,6 +1,6 @@
 # Checks for stat-related time functions.
 
-# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2021 Free Software
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2022 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4
index 7b1a042af1..5ca18607fe 100644
--- a/m4/std-gnu11.m4
+++ b/m4/std-gnu11.m4
@@ -9,7 +9,7 @@
 m4_version_prereq([2.70], [], [
 
 
-# Copyright (C) 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
index e22d7f78c0..78577cb2ac 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -1,6 +1,6 @@
 # Check for stdalign.h that conforms to C11.
 
-dnl Copyright 2011-2021 Free Software Foundation, Inc.
+dnl Copyright 2011-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -49,11 +49,8 @@ AC_DEFUN([gl_STDALIGN_H],
        [gl_cv_header_working_stdalign_h=no])])
 
   if test $gl_cv_header_working_stdalign_h = yes; then
-    STDALIGN_H=''
+    GL_GENERATE_STDALIGN_H=false
   else
-    STDALIGN_H='stdalign.h'
+    GL_GENERATE_STDALIGN_H=true
   fi
-
-  AC_SUBST([STDALIGN_H])
-  AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
 ])
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index 1303d2e06c..abfd203038 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,5 +1,5 @@
-# stddef_h.m4 serial 11
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+# stddef_h.m4 serial 12
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -14,7 +14,7 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
   dnl Persuade OpenBSD <stddef.h> to declare max_align_t.
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
-  STDDEF_H=
+  GL_GENERATE_STDDEF_H=false
 
   dnl Test whether the type max_align_t exists and whether its alignment
   dnl "is as great as is supported by the implementation in all contexts".
@@ -41,12 +41,12 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
     ])
   if test $gl_cv_type_max_align_t = no; then
     HAVE_MAX_ALIGN_T=0
-    STDDEF_H=stddef.h
+    GL_GENERATE_STDDEF_H=true
   fi
 
   if test $gt_cv_c_wchar_t = no; then
     HAVE_WCHAR_T=0
-    STDDEF_H=stddef.h
+    GL_GENERATE_STDDEF_H=true
   fi
 
   AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
@@ -58,12 +58,10 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
       [gl_cv_decl_null_works=no])])
   if test $gl_cv_decl_null_works = no; then
     REPLACE_NULL=1
-    STDDEF_H=stddef.h
+    GL_GENERATE_STDDEF_H=true
   fi
 
-  AC_SUBST([STDDEF_H])
-  AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
-  if test -n "$STDDEF_H"; then
+  if $GL_GENERATE_STDDEF_H; then
     gl_NEXT_HEADERS([stddef.h])
   fi
 ])
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index 2eb1652d8e..c3f0894277 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,5 +1,5 @@
-# stdint.m4 serial 60
-dnl Copyright (C) 2001-2021 Free Software Foundation, Inc.
+# stdint.m4 serial 61
+dnl Copyright (C) 2001-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -296,7 +296,7 @@ static const char *macro_values[] =
   HAVE_C99_STDINT_H=0
   HAVE_SYS_BITYPES_H=0
   HAVE_SYS_INTTYPES_H=0
-  STDINT_H=stdint.h
+  GL_GENERATE_STDINT_H=true
   case "$gl_cv_header_working_stdint_h" in
     *yes)
       HAVE_C99_STDINT_H=1
@@ -341,7 +341,7 @@ int32_t i32 = INT32_C (0x7fffffff);
               ]])],
            [gl_cv_header_stdint_width=yes])])
       if test "$gl_cv_header_stdint_width" = yes; then
-        STDINT_H=
+        GL_GENERATE_STDINT_H=false
       fi
       ;;
     *)
@@ -364,8 +364,6 @@ int32_t i32 = INT32_C (0x7fffffff);
   AC_SUBST([HAVE_C99_STDINT_H])
   AC_SUBST([HAVE_SYS_BITYPES_H])
   AC_SUBST([HAVE_SYS_INTTYPES_H])
-  AC_SUBST([STDINT_H])
-  AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
 ])
 
 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index e704383862..cc80e77365 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,5 +1,5 @@
-# stdio_h.m4 serial 56
-dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
+# stdio_h.m4 serial 57
+dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -119,6 +119,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN_GNU])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE])
@@ -202,6 +203,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_FDOPEN=0;              AC_SUBST([REPLACE_FDOPEN])
   REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
   REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
+  REPLACE_FOPEN_FOR_FOPEN_GNU=0; AC_SUBST([REPLACE_FOPEN_FOR_FOPEN_GNU])
   REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
   REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
   REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 9c1d1c76c1..9e2096976f 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 63
-dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 66
+dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -68,12 +68,14 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP])
@@ -90,6 +92,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
@@ -164,11 +167,13 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_UNLOCKPT=1;           AC_SUBST([HAVE_UNLOCKPT])
   HAVE_DECL_UNSETENV=1;      AC_SUBST([HAVE_DECL_UNSETENV])
   REPLACE_ALIGNED_ALLOC=0;   AC_SUBST([REPLACE_ALIGNED_ALLOC])
-  REPLACE_CALLOC=0;          AC_SUBST([REPLACE_CALLOC])
+  REPLACE_CALLOC_FOR_CALLOC_GNU=0;    AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU])
+  REPLACE_CALLOC_FOR_CALLOC_POSIX=0;  
AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
   REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
   REPLACE_FREE=0;            AC_SUBST([REPLACE_FREE])
   REPLACE_INITSTATE=0;       AC_SUBST([REPLACE_INITSTATE])
-  REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
+  REPLACE_MALLOC_FOR_MALLOC_GNU=0;    AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU])
+  REPLACE_MALLOC_FOR_MALLOC_POSIX=0;  
AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX])
   REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_POSIX_MEMALIGN=0;  AC_SUBST([REPLACE_POSIX_MEMALIGN])
@@ -178,7 +183,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_QSORT_R=0;         AC_SUBST([REPLACE_QSORT_R])
   REPLACE_RANDOM=0;          AC_SUBST([REPLACE_RANDOM])
   REPLACE_RANDOM_R=0;        AC_SUBST([REPLACE_RANDOM_R])
-  REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
+  REPLACE_REALLOC_FOR_REALLOC_GNU=0;    
AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU])
+  REPLACE_REALLOC_FOR_REALLOC_POSIX=0;  
AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX])
   REPLACE_REALLOCARRAY=0;    AC_SUBST([REPLACE_REALLOCARRAY])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
   REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4
index eb44f03adb..241e68c8c5 100644
--- a/m4/stpcpy.m4
+++ b/m4/stpcpy.m4
@@ -1,5 +1,5 @@
 # stpcpy.m4 serial 9
-dnl Copyright (C) 2002, 2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index e88ac9ca85..9e09b96e16 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -1,6 +1,6 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007-2021 Free Software Foundation, Inc.
+# Copyright (C) 2007-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/strnlen.m4 b/m4/strnlen.m4
index 1d4f10616e..0934274de7 100644
--- a/m4/strnlen.m4
+++ b/m4/strnlen.m4
@@ -1,5 +1,5 @@
 # strnlen.m4 serial 14
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2022 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
index d767d57451..08598936b3 100644
--- a/m4/strtoimax.m4
+++ b/m4/strtoimax.m4
@@ -1,5 +1,5 @@
 # strtoimax.m4 serial 16
-dnl Copyright (C) 2002-2004, 2006, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4
index 14455dc3db..dc37d9984d 100644
--- a/m4/strtoll.m4
+++ b/m4/strtoll.m4
@@ -1,5 +1,5 @@
 # strtoll.m4 serial 9
-dnl Copyright (C) 2002, 2004, 2006, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/symlink.m4 b/m4/symlink.m4
index 209decee4c..5be2babbcb 100644
--- a/m4/symlink.m4
+++ b/m4/symlink.m4
@@ -1,7 +1,7 @@
 # serial 9
 # See if we need to provide symlink replacement.
 
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_random_h.m4 b/m4/sys_random_h.m4
index 37bc31606b..a5ba85c67c 100644
--- a/m4/sys_random_h.m4
+++ b/m4/sys_random_h.m4
@@ -1,5 +1,5 @@
 # sys_random_h.m4 serial 8
-dnl Copyright (C) 2020-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
index 2e7d140dee..2743cd1795 100644
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,5 +1,5 @@
 # sys_select_h.m4 serial 23
-dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
index 5676a0d217..ba3ae68e61 100644
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
-# sys_socket_h.m4 serial 28
-dnl Copyright (C) 2005-2021 Free Software Foundation, Inc.
+# sys_socket_h.m4 serial 29
+dnl Copyright (C) 2005-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -22,6 +22,7 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
       ;;
   esac
 
+  GL_GENERATE_SYS_SOCKET_H=false
   AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
     [gl_cv_header_sys_socket_h_selfcontained],
     [
@@ -44,7 +45,7 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
             [gl_cv_header_sys_socket_h_shut=no])
         ])
       if test $gl_cv_header_sys_socket_h_shut = no; then
-        SYS_SOCKET_H='sys/socket.h'
+        GL_GENERATE_SYS_SOCKET_H=true
       fi
     fi
   fi
@@ -83,7 +84,7 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
   fi
   if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
      || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
-    SYS_SOCKET_H='sys/socket.h'
+    GL_GENERATE_SYS_SOCKET_H=true
   fi
   gl_PREREQ_SYS_H_WINSOCK2
 
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index ac91d425bb..b5a9789b81 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,5 +1,5 @@
 # sys_stat_h.m4 serial 41   -*- Autoconf -*-
-dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4
index c425a9639a..bc5e2b1364 100644
--- a/m4/sys_time_h.m4
+++ b/m4/sys_time_h.m4
@@ -1,7 +1,7 @@
 # Configure a replacement for <sys/time.h>.
 # serial 12
 
-# Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4
index 6dd6fee10c..a5bef220c2 100644
--- a/m4/sys_types_h.m4
+++ b/m4/sys_types_h.m4
@@ -1,5 +1,5 @@
 # sys_types_h.m4 serial 13
-dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/tempname.m4 b/m4/tempname.m4
index 14c796d3eb..22ccec1f8d 100644
--- a/m4/tempname.m4
+++ b/m4/tempname.m4
@@ -1,6 +1,6 @@
 #serial 5
 
-# Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007, 2009-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index b57474b48b..98d7b6e01b 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -1,8 +1,8 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc.
 
-# serial 18
+# serial 19
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -133,6 +133,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET])
@@ -151,6 +152,7 @@ AC_DEFUN([gl_TIME_H_DEFAULTS],
   HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
   HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
   HAVE_TIMESPEC_GET=1;                   AC_SUBST([HAVE_TIMESPEC_GET])
+  HAVE_TIMESPEC_GETRES=1;                AC_SUBST([HAVE_TIMESPEC_GETRES])
   dnl Even GNU libc does not have timezone_t yet.
   HAVE_TIMEZONE_T=0;                     AC_SUBST([HAVE_TIMEZONE_T])
   dnl If another module says to replace or to not replace, do that.
diff --git a/m4/time_r.m4 b/m4/time_r.m4
index 2d49b64f12..8a1ad9dadf 100644
--- a/m4/time_r.m4
+++ b/m4/time_r.m4
@@ -1,6 +1,6 @@
 dnl Reentrant time functions: localtime_r, gmtime_r.
 
-dnl Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/time_rz.m4 b/m4/time_rz.m4
index c5e85dc625..4cb6a06485 100644
--- a/m4/time_rz.m4
+++ b/m4/time_rz.m4
@@ -1,6 +1,6 @@
 dnl Time zone functions: tzalloc, localtime_rz, etc.
 
-dnl Copyright (C) 2015-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2015-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 58123beb0c..f1893941f8 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,5 +1,5 @@
 # timegm.m4 serial 13
-dnl Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
index 003e36e9d1..8d41f945c5 100644
--- a/m4/timer_time.m4
+++ b/m4/timer_time.m4
@@ -1,5 +1,5 @@
 # timer_time.m4 serial 5
-dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/timespec.m4 b/m4/timespec.m4
index 40307d4f60..6a1afef040 100644
--- a/m4/timespec.m4
+++ b/m4/timespec.m4
@@ -1,6 +1,6 @@
 #serial 15
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/tm_gmtoff.m4 b/m4/tm_gmtoff.m4
index 2743999fbc..9275bed673 100644
--- a/m4/tm_gmtoff.m4
+++ b/m4/tm_gmtoff.m4
@@ -1,5 +1,5 @@
 # tm_gmtoff.m4 serial 3
-dnl Copyright (C) 2002, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 0ce4ea4511..f93f97a1bd 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 89
-dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
+# unistd_h.m4 serial 90
+dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -112,6 +112,7 @@ AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS_GNU])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY])
@@ -170,98 +171,99 @@ AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS],
 AC_DEFUN([gl_UNISTD_H_DEFAULTS],
 [
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
-  HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE])
-  HAVE_DUP3=1;            AC_SUBST([HAVE_DUP3])
-  HAVE_EUIDACCESS=1;      AC_SUBST([HAVE_EUIDACCESS])
-  HAVE_EXECVPE=1;         AC_SUBST([HAVE_EXECVPE])
-  HAVE_FACCESSAT=1;       AC_SUBST([HAVE_FACCESSAT])
-  HAVE_FCHDIR=1;          AC_SUBST([HAVE_FCHDIR])
-  HAVE_FCHOWNAT=1;        AC_SUBST([HAVE_FCHOWNAT])
-  HAVE_FDATASYNC=1;       AC_SUBST([HAVE_FDATASYNC])
-  HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
-  HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
-  HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
-  HAVE_GETENTROPY=1;      AC_SUBST([HAVE_GETENTROPY])
-  HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
-  HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
-  HAVE_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
-  HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
-  HAVE_GETPASS=1;         AC_SUBST([HAVE_GETPASS])
-  HAVE_GROUP_MEMBER=1;    AC_SUBST([HAVE_GROUP_MEMBER])
-  HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
-  HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
-  HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
-  HAVE_PIPE=1;            AC_SUBST([HAVE_PIPE])
-  HAVE_PIPE2=1;           AC_SUBST([HAVE_PIPE2])
-  HAVE_PREAD=1;           AC_SUBST([HAVE_PREAD])
-  HAVE_PWRITE=1;          AC_SUBST([HAVE_PWRITE])
-  HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
-  HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
-  HAVE_SETHOSTNAME=1;     AC_SUBST([HAVE_SETHOSTNAME])
-  HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
-  HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
-  HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
-  HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
-  HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
-  HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
-  HAVE_DECL_EXECVPE=1;    AC_SUBST([HAVE_DECL_EXECVPE])
-  HAVE_DECL_FCHDIR=1;     AC_SUBST([HAVE_DECL_FCHDIR])
-  HAVE_DECL_FDATASYNC=1;  AC_SUBST([HAVE_DECL_FDATASYNC])
-  HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
-  HAVE_DECL_GETLOGIN=1;   AC_SUBST([HAVE_DECL_GETLOGIN])
-  HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
-  HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
-  HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
-  HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
-  HAVE_DECL_TRUNCATE=1;   AC_SUBST([HAVE_DECL_TRUNCATE])
-  HAVE_DECL_TTYNAME_R=1;  AC_SUBST([HAVE_DECL_TTYNAME_R])
-  HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
-  HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
-  REPLACE_ACCESS=0;       AC_SUBST([REPLACE_ACCESS])
-  REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
-  REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
-  REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
-  REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
-  REPLACE_EXECL=0;        AC_SUBST([REPLACE_EXECL])
-  REPLACE_EXECLE=0;       AC_SUBST([REPLACE_EXECLE])
-  REPLACE_EXECLP=0;       AC_SUBST([REPLACE_EXECLP])
-  REPLACE_EXECV=0;        AC_SUBST([REPLACE_EXECV])
-  REPLACE_EXECVE=0;       AC_SUBST([REPLACE_EXECVE])
-  REPLACE_EXECVP=0;       AC_SUBST([REPLACE_EXECVP])
-  REPLACE_EXECVPE=0;      AC_SUBST([REPLACE_EXECVPE])
-  REPLACE_FACCESSAT=0;    AC_SUBST([REPLACE_FACCESSAT])
-  REPLACE_FCHOWNAT=0;     AC_SUBST([REPLACE_FCHOWNAT])
-  REPLACE_FTRUNCATE=0;    AC_SUBST([REPLACE_FTRUNCATE])
-  REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
-  REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
-  REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
-  REPLACE_GETLOGIN_R=0;   AC_SUBST([REPLACE_GETLOGIN_R])
-  REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
-  REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
-  REPLACE_GETPASS=0;      AC_SUBST([REPLACE_GETPASS])
-  REPLACE_ISATTY=0;       AC_SUBST([REPLACE_ISATTY])
-  REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
-  REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
-  REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
-  REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
-  REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
-  REPLACE_PWRITE=0;       AC_SUBST([REPLACE_PWRITE])
-  REPLACE_READ=0;         AC_SUBST([REPLACE_READ])
-  REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
-  REPLACE_READLINKAT=0;   AC_SUBST([REPLACE_READLINKAT])
-  REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
-  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
-  REPLACE_SYMLINK=0;      AC_SUBST([REPLACE_SYMLINK])
-  REPLACE_SYMLINKAT=0;    AC_SUBST([REPLACE_SYMLINKAT])
-  REPLACE_TRUNCATE=0;     AC_SUBST([REPLACE_TRUNCATE])
-  REPLACE_TTYNAME_R=0;    AC_SUBST([REPLACE_TTYNAME_R])
-  REPLACE_UNLINK=0;       AC_SUBST([REPLACE_UNLINK])
-  REPLACE_UNLINKAT=0;     AC_SUBST([REPLACE_UNLINKAT])
-  REPLACE_USLEEP=0;       AC_SUBST([REPLACE_USLEEP])
-  REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
-  UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H])
-  UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
+  HAVE_CHOWN=1;                      AC_SUBST([HAVE_CHOWN])
+  HAVE_COPY_FILE_RANGE=1;            AC_SUBST([HAVE_COPY_FILE_RANGE])
+  HAVE_DUP3=1;                       AC_SUBST([HAVE_DUP3])
+  HAVE_EUIDACCESS=1;                 AC_SUBST([HAVE_EUIDACCESS])
+  HAVE_EXECVPE=1;                    AC_SUBST([HAVE_EXECVPE])
+  HAVE_FACCESSAT=1;                  AC_SUBST([HAVE_FACCESSAT])
+  HAVE_FCHDIR=1;                     AC_SUBST([HAVE_FCHDIR])
+  HAVE_FCHOWNAT=1;                   AC_SUBST([HAVE_FCHOWNAT])
+  HAVE_FDATASYNC=1;                  AC_SUBST([HAVE_FDATASYNC])
+  HAVE_FSYNC=1;                      AC_SUBST([HAVE_FSYNC])
+  HAVE_FTRUNCATE=1;                  AC_SUBST([HAVE_FTRUNCATE])
+  HAVE_GETDTABLESIZE=1;              AC_SUBST([HAVE_GETDTABLESIZE])
+  HAVE_GETENTROPY=1;                 AC_SUBST([HAVE_GETENTROPY])
+  HAVE_GETGROUPS=1;                  AC_SUBST([HAVE_GETGROUPS])
+  HAVE_GETHOSTNAME=1;                AC_SUBST([HAVE_GETHOSTNAME])
+  HAVE_GETLOGIN=1;                   AC_SUBST([HAVE_GETLOGIN])
+  HAVE_GETPAGESIZE=1;                AC_SUBST([HAVE_GETPAGESIZE])
+  HAVE_GETPASS=1;                    AC_SUBST([HAVE_GETPASS])
+  HAVE_GROUP_MEMBER=1;               AC_SUBST([HAVE_GROUP_MEMBER])
+  HAVE_LCHOWN=1;                     AC_SUBST([HAVE_LCHOWN])
+  HAVE_LINK=1;                       AC_SUBST([HAVE_LINK])
+  HAVE_LINKAT=1;                     AC_SUBST([HAVE_LINKAT])
+  HAVE_PIPE=1;                       AC_SUBST([HAVE_PIPE])
+  HAVE_PIPE2=1;                      AC_SUBST([HAVE_PIPE2])
+  HAVE_PREAD=1;                      AC_SUBST([HAVE_PREAD])
+  HAVE_PWRITE=1;                     AC_SUBST([HAVE_PWRITE])
+  HAVE_READLINK=1;                   AC_SUBST([HAVE_READLINK])
+  HAVE_READLINKAT=1;                 AC_SUBST([HAVE_READLINKAT])
+  HAVE_SETHOSTNAME=1;                AC_SUBST([HAVE_SETHOSTNAME])
+  HAVE_SLEEP=1;                      AC_SUBST([HAVE_SLEEP])
+  HAVE_SYMLINK=1;                    AC_SUBST([HAVE_SYMLINK])
+  HAVE_SYMLINKAT=1;                  AC_SUBST([HAVE_SYMLINKAT])
+  HAVE_UNLINKAT=1;                   AC_SUBST([HAVE_UNLINKAT])
+  HAVE_USLEEP=1;                     AC_SUBST([HAVE_USLEEP])
+  HAVE_DECL_ENVIRON=1;               AC_SUBST([HAVE_DECL_ENVIRON])
+  HAVE_DECL_EXECVPE=1;               AC_SUBST([HAVE_DECL_EXECVPE])
+  HAVE_DECL_FCHDIR=1;                AC_SUBST([HAVE_DECL_FCHDIR])
+  HAVE_DECL_FDATASYNC=1;             AC_SUBST([HAVE_DECL_FDATASYNC])
+  HAVE_DECL_GETDOMAINNAME=1;         AC_SUBST([HAVE_DECL_GETDOMAINNAME])
+  HAVE_DECL_GETLOGIN=1;              AC_SUBST([HAVE_DECL_GETLOGIN])
+  HAVE_DECL_GETLOGIN_R=1;            AC_SUBST([HAVE_DECL_GETLOGIN_R])
+  HAVE_DECL_GETPAGESIZE=1;           AC_SUBST([HAVE_DECL_GETPAGESIZE])
+  HAVE_DECL_GETUSERSHELL=1;          AC_SUBST([HAVE_DECL_GETUSERSHELL])
+  HAVE_DECL_SETHOSTNAME=1;           AC_SUBST([HAVE_DECL_SETHOSTNAME])
+  HAVE_DECL_TRUNCATE=1;              AC_SUBST([HAVE_DECL_TRUNCATE])
+  HAVE_DECL_TTYNAME_R=1;             AC_SUBST([HAVE_DECL_TTYNAME_R])
+  HAVE_OS_H=0;                       AC_SUBST([HAVE_OS_H])
+  HAVE_SYS_PARAM_H=0;                AC_SUBST([HAVE_SYS_PARAM_H])
+  REPLACE_ACCESS=0;                  AC_SUBST([REPLACE_ACCESS])
+  REPLACE_CHOWN=0;                   AC_SUBST([REPLACE_CHOWN])
+  REPLACE_CLOSE=0;                   AC_SUBST([REPLACE_CLOSE])
+  REPLACE_DUP=0;                     AC_SUBST([REPLACE_DUP])
+  REPLACE_DUP2=0;                    AC_SUBST([REPLACE_DUP2])
+  REPLACE_EXECL=0;                   AC_SUBST([REPLACE_EXECL])
+  REPLACE_EXECLE=0;                  AC_SUBST([REPLACE_EXECLE])
+  REPLACE_EXECLP=0;                  AC_SUBST([REPLACE_EXECLP])
+  REPLACE_EXECV=0;                   AC_SUBST([REPLACE_EXECV])
+  REPLACE_EXECVE=0;                  AC_SUBST([REPLACE_EXECVE])
+  REPLACE_EXECVP=0;                  AC_SUBST([REPLACE_EXECVP])
+  REPLACE_EXECVPE=0;                 AC_SUBST([REPLACE_EXECVPE])
+  REPLACE_FACCESSAT=0;               AC_SUBST([REPLACE_FACCESSAT])
+  REPLACE_FCHOWNAT=0;                AC_SUBST([REPLACE_FCHOWNAT])
+  REPLACE_FTRUNCATE=0;               AC_SUBST([REPLACE_FTRUNCATE])
+  REPLACE_GETCWD=0;                  AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETDOMAINNAME=0;           AC_SUBST([REPLACE_GETDOMAINNAME])
+  REPLACE_GETDTABLESIZE=0;           AC_SUBST([REPLACE_GETDTABLESIZE])
+  REPLACE_GETLOGIN_R=0;              AC_SUBST([REPLACE_GETLOGIN_R])
+  REPLACE_GETGROUPS=0;               AC_SUBST([REPLACE_GETGROUPS])
+  REPLACE_GETPAGESIZE=0;             AC_SUBST([REPLACE_GETPAGESIZE])
+  REPLACE_GETPASS=0;                 AC_SUBST([REPLACE_GETPASS])
+  REPLACE_GETPASS_FOR_GETPASS_GNU=0; 
AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU])
+  REPLACE_ISATTY=0;                  AC_SUBST([REPLACE_ISATTY])
+  REPLACE_LCHOWN=0;                  AC_SUBST([REPLACE_LCHOWN])
+  REPLACE_LINK=0;                    AC_SUBST([REPLACE_LINK])
+  REPLACE_LINKAT=0;                  AC_SUBST([REPLACE_LINKAT])
+  REPLACE_LSEEK=0;                   AC_SUBST([REPLACE_LSEEK])
+  REPLACE_PREAD=0;                   AC_SUBST([REPLACE_PREAD])
+  REPLACE_PWRITE=0;                  AC_SUBST([REPLACE_PWRITE])
+  REPLACE_READ=0;                    AC_SUBST([REPLACE_READ])
+  REPLACE_READLINK=0;                AC_SUBST([REPLACE_READLINK])
+  REPLACE_READLINKAT=0;              AC_SUBST([REPLACE_READLINKAT])
+  REPLACE_RMDIR=0;                   AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SLEEP=0;                   AC_SUBST([REPLACE_SLEEP])
+  REPLACE_SYMLINK=0;                 AC_SUBST([REPLACE_SYMLINK])
+  REPLACE_SYMLINKAT=0;               AC_SUBST([REPLACE_SYMLINKAT])
+  REPLACE_TRUNCATE=0;                AC_SUBST([REPLACE_TRUNCATE])
+  REPLACE_TTYNAME_R=0;               AC_SUBST([REPLACE_TTYNAME_R])
+  REPLACE_UNLINK=0;                  AC_SUBST([REPLACE_UNLINK])
+  REPLACE_UNLINKAT=0;                AC_SUBST([REPLACE_UNLINKAT])
+  REPLACE_USLEEP=0;                  AC_SUBST([REPLACE_USLEEP])
+  REPLACE_WRITE=0;                   AC_SUBST([REPLACE_WRITE])
+  UNISTD_H_HAVE_SYS_RANDOM_H=0;      AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H])
+  UNISTD_H_HAVE_WINSOCK2_H=0;        AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
   UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
                            AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
 ])
diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4
index b689020ff4..d42c95cedb 100644
--- a/m4/unlocked-io.m4
+++ b/m4/unlocked-io.m4
@@ -1,6 +1,6 @@
 # unlocked-io.m4 serial 16
 
-# Copyright (C) 1998-2006, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 1998-2006, 2009-2022 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index 2ee4ef9ec9..62aec78a63 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2003-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index b5bff1651f..3abdb86511 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -1,7 +1,7 @@
 # serial 9
 # See if we need to provide utimensat replacement.
 
-dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index 0440e78532..bf22161406 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -1,7 +1,7 @@
 # Detect some bugs in glibc's implementation of utimes.
 # serial 8
 
-dnl Copyright (C) 2003-2005, 2009-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2005, 2009-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/vararrays.m4 b/m4/vararrays.m4
index 36946acc23..28e22a49df 100644
--- a/m4/vararrays.m4
+++ b/m4/vararrays.m4
@@ -4,7 +4,7 @@
 
 # From Paul Eggert
 
-# Copyright (C) 2001, 2009-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2009-2022 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 9e24d898e8..60088f93ed 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,5 +1,5 @@
 # warnings.m4 serial 16
-dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4
index 34db10e5cc..268e3e5159 100644
--- a/m4/wchar_t.m4
+++ b/m4/wchar_t.m4
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/year2038.m4 b/m4/year2038.m4
index da0f8d7303..06db589ba9 100644
--- a/m4/year2038.m4
+++ b/m4/year2038.m4
@@ -1,5 +1,5 @@
 # year2038.m4 serial 7
-dnl Copyright (C) 2017-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2017-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/zzgnulib.m4 b/m4/zzgnulib.m4
index b9533847cb..fd73a201fd 100644
--- a/m4/zzgnulib.m4
+++ b/m4/zzgnulib.m4
@@ -1,5 +1,5 @@
 # zzgnulib.m4 serial 1
-dnl Copyright (C) 2020-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/make-dist b/make-dist
index eb040150d9..447e90f018 100755
--- a/make-dist
+++ b/make-dist
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### make-dist: create an Emacs distribution tar file from current srcdir
 
-## Copyright (C) 1995, 1997-1998, 2000-2021 Free Software Foundation,
+## Copyright (C) 1995, 1997-1998, 2000-2022 Free Software Foundation,
 ## Inc.
 
 ## This file is part of GNU Emacs.
@@ -299,13 +299,6 @@ if [ $check = yes ]; then
     echo "${bogosities}"
   fi
 
-  ## This exits with non-zero status if any .info files need
-  ## rebuilding.
-  if [ -r Makefile ] && [ "$with_info" = "yes" ]; then
-      echo "Checking to see if info files are up-to-date..."
-      make --question info || error=yes
-  fi
-
   ## Is this a release?
   case $version in
       [1-9][0-9].[0-9])
@@ -392,9 +385,11 @@ manifest=MANIFEST
 # other way when adding or deleting a distributed file while not using Git.
 # TODO: maybe this should ignore $update, and always update MANIFEST
 # if .git is present.
+# Filter out the files in msdos/autogen/, as they aren't useful in the
+# tarball, and get in the way during the build of the MSDOS port.
 if ( [ $update = yes ] || [ ! -f $manifest ] ) && [ -r .git ]; then
   echo "Updating $manifest"
-  git ls-files > $manifest || exit
+  git ls-files | sed -e '/^msdos\/autogen\//d' > $manifest || exit
   printf '%s\n' $possibly_non_vc_files $info_files >>$manifest || exit
   sort -u -o $manifest $manifest || exit
 fi
diff --git a/modules/modhelp.py b/modules/modhelp.py
index 07dfdf3f73..d8b4dceb78 100755
--- a/modules/modhelp.py
+++ b/modules/modhelp.py
@@ -2,7 +2,7 @@
 
 # Module helper script.
 
-# Copyright 2015-2021 Free Software Foundation, Inc.
+# Copyright 2015-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/msdos/ChangeLog.1 b/msdos/ChangeLog.1
index ce94d415ea..aef002c459 100644
--- a/msdos/ChangeLog.1
+++ b/msdos/ChangeLog.1
@@ -1550,7 +1550,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1994-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1994-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/msdos/INSTALL b/msdos/INSTALL
index 6bb71434d4..453bfa434a 100644
--- a/msdos/INSTALL
+++ b/msdos/INSTALL
@@ -1,6 +1,6 @@
 GNU Emacs Installation Guide for the DJGPP (a.k.a. MS-DOS) port
 
-Copyright (C) 1992, 1994, 1996-1997, 2000-2021 Free Software Foundation,
+Copyright (C) 1992, 1994, 1996-1997, 2000-2022 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
diff --git a/msdos/README b/msdos/README
index 9feaed8945..cdda15f00d 100644
--- a/msdos/README
+++ b/msdos/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -10,7 +10,7 @@ The files emacs.ico and emacs.pif are for using the DJGPP 
version on
 Windows 3.X.  Since these are binary files, their copyright notice is
 reproduced here:
 
-# Copyright (C) 1993, 2002-2021 Free Software Foundation, Inc.
+# Copyright (C) 1993, 2002-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/autogen/Makefile.in b/msdos/autogen/Makefile.in
index 0bdc408752..cd7c97b295 100644
--- a/msdos/autogen/Makefile.in
+++ b/msdos/autogen/Makefile.in
@@ -1,7 +1,7 @@
 # Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2009, 2013-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994-2009, 2013-2022 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/msdos/autogen/config.in b/msdos/autogen/config.in
index 560f5f346f..14782ab4bf 100644
--- a/msdos/autogen/config.in
+++ b/msdos/autogen/config.in
@@ -2,7 +2,7 @@
 
 /* GNU Emacs site configuration template file.
 
-Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2021 Free Software
+Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/msdos/depfiles.bat b/msdos/depfiles.bat
index 131f2fc04d..8c36fbcdef 100644
--- a/msdos/depfiles.bat
+++ b/msdos/depfiles.bat
@@ -1,7 +1,7 @@
 @echo off
 rem   ----------------------------------------------------------------------
 rem   Auxiliary script for MSDOS, run by ../config.bat
-rem   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+rem   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
 
diff --git a/msdos/inttypes.h b/msdos/inttypes.h
index 28633ca9ff..daaa80bfa5 100644
--- a/msdos/inttypes.h
+++ b/msdos/inttypes.h
@@ -1,6 +1,6 @@
 /* Replacement inttypes.h file for building GNU Emacs on MS-DOS with DJGPP.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/msdos/langinfo.h b/msdos/langinfo.h
index a74c3f7f8e..02137ba36c 100644
--- a/msdos/langinfo.h
+++ b/msdos/langinfo.h
@@ -1,6 +1,6 @@
 /* Replacement langinfo.h file for building GNU Emacs on MS-DOS with DJGPP.
 
-Copyright (C) 2021 Free Software Foundation, Inc.
+Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/msdos/mainmake.v2 b/msdos/mainmake.v2
index f22ebea590..2e7d242f0b 100644
--- a/msdos/mainmake.v2
+++ b/msdos/mainmake.v2
@@ -1,6 +1,6 @@
 # Top-level Makefile for Emacs under MS-DOS/DJGPP v2.0 or higher. 
-*-makefile-*-
 
-# Copyright (C) 1996-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp
index 60f67e4303..e041e4e5b8 100644
--- a/msdos/sed1v2.inp
+++ b/msdos/sed1v2.inp
@@ -2,7 +2,7 @@
 # Configuration script for src/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1996-1997, 1999-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed1x.inp b/msdos/sed1x.inp
index 30c242dcb9..858f565f41 100644
--- a/msdos/sed1x.inp
+++ b/msdos/sed1x.inp
@@ -2,7 +2,7 @@
 # Extra configuration script for src/makefile for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994-1997, 1999-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994-1997, 1999-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp
index 52fbd4e9cb..8728c8dac4 100644
--- a/msdos/sed2v2.inp
+++ b/msdos/sed2v2.inp
@@ -2,7 +2,7 @@
 # Configuration script for src/config.h under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1993-1997, 1999-2000, 2002-2021 Free Software
+# Copyright (C) 1993-1997, 1999-2000, 2002-2022 Free Software
 # Foundation, Inc.
 #
 # This file is part of GNU Emacs.
@@ -27,7 +27,7 @@
 #ifndef MSDOS\
 #define MSDOS\
 #endif
-/^#undef COPYRIGHT *$/s/^.*$/#define COPYRIGHT "Copyright (C) 2021 Free 
Software Foundation, Inc."/
+/^#undef COPYRIGHT *$/s/^.*$/#define COPYRIGHT "Copyright (C) 2022 Free 
Software Foundation, Inc."/
 /^#undef DIRECTORY_SEP *$/s!^.*$!#define DIRECTORY_SEP '/'!
 /^#undef DOS_NT *$/s/^.*$/#define DOS_NT/
 /^#undef FLOAT_CHECK_DOMAIN *$/s/^.*$/#define FLOAT_CHECK_DOMAIN/
diff --git a/msdos/sed2x.inp b/msdos/sed2x.inp
index 00b5f07d1b..c147d62193 100644
--- a/msdos/sed2x.inp
+++ b/msdos/sed2x.inp
@@ -2,7 +2,7 @@
 # Extra configuration script for src/config.h for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp
index f7c9eb05ba..5b5d321607 100644
--- a/msdos/sed3v2.inp
+++ b/msdos/sed3v2.inp
@@ -2,7 +2,7 @@
 # Configuration script for lib-src/makefile under DJGPP v2
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1996, 1998, 2000-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed4.inp b/msdos/sed4.inp
index 09d3523d86..f1c6662bf5 100644
--- a/msdos/sed4.inp
+++ b/msdos/sed4.inp
@@ -2,7 +2,7 @@
 # Configuration script for src/paths.h
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed5x.inp b/msdos/sed5x.inp
index 3639a07c3c..57895ed1c3 100644
--- a/msdos/sed5x.inp
+++ b/msdos/sed5x.inp
@@ -2,7 +2,7 @@
 # Configuration script for oldxmenu/makefile for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed6.inp b/msdos/sed6.inp
index a0ab94599d..41cd41993b 100644
--- a/msdos/sed6.inp
+++ b/msdos/sed6.inp
@@ -3,7 +3,7 @@
 # doc/lispintro/Makefile, and doc/misc/Makefile under DJGPP v2.x
 # ---------------------------------------------------------------------------
 #
-# Copyright (C) 1997, 2000-2021 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedadmin.inp b/msdos/sedadmin.inp
index 9f6dacad5d..79a18144f3 100644
--- a/msdos/sedadmin.inp
+++ b/msdos/sedadmin.inp
@@ -2,7 +2,7 @@
 # Configuration script for admin/unidata/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2014-2021 Free Software Foundation, Inc.
+# Copyright (C) 2014-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedalloc.inp b/msdos/sedalloc.inp
index 90377dd5d8..0341148608 100644
--- a/msdos/sedalloc.inp
+++ b/msdos/sedalloc.inp
@@ -2,7 +2,7 @@
 # Configuration script for SYSTEM_MALLOC/REL_ALLOC in src/config.h
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2008-2021 Free Software Foundation, Inc.
+# Copyright (C) 2008-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedleim.inp b/msdos/sedleim.inp
index 1d5ee7a687..612cfb9235 100644
--- a/msdos/sedleim.inp
+++ b/msdos/sedleim.inp
@@ -2,7 +2,7 @@
 # Configuration script for leim/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1999-2021 Free Software Foundation, Inc.
+# Copyright (C) 1999-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedlibcf.inp b/msdos/sedlibcf.inp
index 38c54e678e..741192c973 100644
--- a/msdos/sedlibcf.inp
+++ b/msdos/sedlibcf.inp
@@ -5,7 +5,7 @@
 # files whose names are invalid on DOS 8+3 filesystems.
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
+# Copyright (C) 2011-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp
index b3b94297d6..59ebec9e75 100644
--- a/msdos/sedlibmk.inp
+++ b/msdos/sedlibmk.inp
@@ -2,7 +2,7 @@
 # Configuration script for lib/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
+# Copyright (C) 2011-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedlisp.inp b/msdos/sedlisp.inp
index 5b3dc26ec5..731bf0bb8e 100644
--- a/msdos/sedlisp.inp
+++ b/msdos/sedlisp.inp
@@ -2,7 +2,7 @@
 # Configuration script for lisp/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2000-2021 Free Software Foundation, Inc.
+# Copyright (C) 2000-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/nextstep/ChangeLog.1 b/nextstep/ChangeLog.1
index 8e7e2783ad..86583d227e 100644
--- a/nextstep/ChangeLog.1
+++ b/nextstep/ChangeLog.1
@@ -312,7 +312,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2008-2021 Free Software Foundation, Inc.
+  Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/nextstep/INSTALL b/nextstep/INSTALL
index 148be2d05c..945d67faa4 100644
--- a/nextstep/INSTALL
+++ b/nextstep/INSTALL
@@ -1,4 +1,4 @@
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/nextstep/Makefile.in b/nextstep/Makefile.in
index 42b2ab2715..92d7f28fe6 100644
--- a/nextstep/Makefile.in
+++ b/nextstep/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-## Copyright (C) 2012-2021 Free Software Foundation, Inc.
+## Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/nextstep/README b/nextstep/README
index 141a5b21fe..3ee437949c 100644
--- a/nextstep/README
+++ b/nextstep/README
@@ -105,7 +105,7 @@ future development.
 
 
 ----------------------------------------------------------------------
-Copyright 2008-2021 Free Software Foundation, Inc.
+Copyright 2008-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in
index f9f0ec0857..170db67c11 100644
--- a/nextstep/templates/Info.plist.in
+++ b/nextstep/templates/Info.plist.in
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/ChangeLog.1 b/nt/ChangeLog.1
index d0aed936d1..632dc642cd 100644
--- a/nt/ChangeLog.1
+++ b/nt/ChangeLog.1
@@ -3548,7 +3548,7 @@
 ;; add-log-time-zone-rule: t
 ;; End:
 
-  Copyright (C) 1995-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1995-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/nt/INSTALL b/nt/INSTALL
index c324fb4ae7..0b8ca98c8a 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -1,7 +1,7 @@
                    Building and Installing Emacs on MS-Windows
                           using the MSYS and MinGW tools
 
-  Copyright (C) 2013-2021 Free Software Foundation, Inc.
+  Copyright (C) 2013-2022 Free Software Foundation, Inc.
   See the end of the file for license conditions.
 
 The MSYS/MinGW build described here is supported on versions of
diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64
index c3845d5b17..fd8f60bb0b 100644
--- a/nt/INSTALL.W64
+++ b/nt/INSTALL.W64
@@ -1,7 +1,7 @@
          Building and Installing Emacs on 64-bit MS-Windows
                      using MSYS2 and MinGW-w64
 
-  Copyright (c) 2015-2021 Free Software Foundation, Inc.
+  Copyright (c) 2015-2022 Free Software Foundation, Inc.
   See the end of the file for license conditions.
 
 This document describes how to compile a 64-bit GNU Emacs using MSYS2
diff --git a/nt/Makefile.in b/nt/Makefile.in
index 811680da85..c904e6d451 100644
--- a/nt/Makefile.in
+++ b/nt/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2013-2021 Free Software Foundation, Inc.
+# Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/nt/README b/nt/README
index 3da31d018b..a142994b74 100644
--- a/nt/README
+++ b/nt/README
@@ -1,6 +1,6 @@
             Emacs for Windows NT/2000 and Windows 95/98/ME
 
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
   See the end of the file for license conditions.
 
   This directory contains support for compiling and running GNU Emacs on
diff --git a/nt/README.W32 b/nt/README.W32
index 495af0baed..cbb5b12551 100644
--- a/nt/README.W32
+++ b/nt/README.W32
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
                Emacs version 29.0.50 for MS-Windows
diff --git a/nt/addpm.c b/nt/addpm.c
index 4fbcf6c05e..22134e482a 100644
--- a/nt/addpm.c
+++ b/nt/addpm.c
@@ -1,5 +1,5 @@
 /* Add entries to the GNU Emacs Program Manager folder.
-   Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c
index f5a0550aa9..ad061306a3 100644
--- a/nt/cmdproxy.c
+++ b/nt/cmdproxy.c
@@ -1,5 +1,5 @@
 /* Proxy shell designed for use with Emacs on Windows 95 and NT.
-   Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
    Accepts subset of Unix sh(1) command-line options, for compatibility
    with elisp code written for Unix.  When possible, executes external
diff --git a/nt/configure.bat b/nt/configure.bat
index 0cb1a632e2..60682a7a81 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -1,7 +1,7 @@
 @echo off
 rem   ----------------------------------------------------------------------
 rem   This was the old configuration script for MS Windows operating systems
-rem   Copyright (C) 1999-2021 Free Software Foundation, Inc.
+rem   Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
 
diff --git a/nt/ddeclient.c b/nt/ddeclient.c
index 0a44cbfd77..87f209422c 100644
--- a/nt/ddeclient.c
+++ b/nt/ddeclient.c
@@ -1,5 +1,5 @@
 /* Simple client interface to DDE servers.
-   Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/epaths.nt b/nt/epaths.nt
index a75ed52a34..da17883bf2 100644
--- a/nt/epaths.nt
+++ b/nt/epaths.nt
@@ -12,7 +12,7 @@
    the host system (e.g., i686-pc-mingw32), and @SRC@ by the root of
    the Emacs source tree used to build Emacs.  */
 /*
-Copyright (C) 1993, 1995, 1997, 1999, 2001-2021 Free Software
+Copyright (C) 1993, 1995, 1997, 1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk
index e9f00e748e..4748474f1d 100644
--- a/nt/gnulib-cfg.mk
+++ b/nt/gnulib-cfg.mk
@@ -1,6 +1,6 @@
 # Configurations for ../lib/gnulib.mk.
 #
-# Copyright 2017-2021 Free Software Foundation, Inc.
+# Copyright 2017-2022 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/nt/icons/README b/nt/icons/README
index a8849b2eee..4d9fb15e52 100644
--- a/nt/icons/README
+++ b/nt/icons/README
@@ -2,13 +2,13 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: emacs.ico
 Author: Kentaro Ohkouchi <nanasess@fsm.ne.jp>
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later
 
 
 File: emacs22.ico
 Author: Andrew Zhilin
-Copyright (C) 2005-2021 Free Software Foundation, Inc.
+Copyright (C) 2005-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 
@@ -17,7 +17,7 @@ Files: gnu2a32.ico gnu2a32t.ico gnu2b48.ico gnu2b48t.ico
        gnu5w32.ico gnu5w32t.ico gnu6w48.ico gnu6w48t.ico
        gnu7.ico    gnu8.ico     gnu9.ico
 Author: Rob Davenport <rgd at bigfoot.com>
-Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
   <http://users.adelphia.net/~rob.davenport/gnuicons.html>
diff --git a/nt/inc/grp.h b/nt/inc/grp.h
index 41511477db..14866684a9 100644
--- a/nt/inc/grp.h
+++ b/nt/inc/grp.h
@@ -1,6 +1,6 @@
 /* Replacement grp.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2003-2021 Free Software Foundation, Inc.
+Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/inttypes.h b/nt/inc/inttypes.h
index 89c000238f..c41966b14a 100644
--- a/nt/inc/inttypes.h
+++ b/nt/inc/inttypes.h
@@ -1,6 +1,6 @@
 /* Replacement inttypes.h file for building GNU Emacs on Windows with MSVC.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/langinfo.h b/nt/inc/langinfo.h
index 86f4ce5bd9..9475e6a11c 100644
--- a/nt/inc/langinfo.h
+++ b/nt/inc/langinfo.h
@@ -1,6 +1,6 @@
 /* Replacement langinfo.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index aad51b59cf..3f4b2f3489 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -1,6 +1,6 @@
 /* System description file for Windows NT.
 
-Copyright (C) 1993-1995, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/nl_types.h b/nt/inc/nl_types.h
index 8926f75f79..155a62f4c0 100644
--- a/nt/inc/nl_types.h
+++ b/nt/inc/nl_types.h
@@ -1,6 +1,6 @@
 /* Replacement nl_types.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h
index 0ee3d4a9ff..812e54c402 100644
--- a/nt/inc/stdint.h
+++ b/nt/inc/stdint.h
@@ -1,6 +1,6 @@
 /* Replacement stdint.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/resource.h b/nt/inc/sys/resource.h
index d35f89b8cd..87f396b1f2 100644
--- a/nt/inc/sys/resource.h
+++ b/nt/inc/sys/resource.h
@@ -1,6 +1,6 @@
 /* A limited emulation of sys/resource.h.
 
-Copyright (C) 2016-2021 Free Software Foundation, Inc.
+Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index 48b24628f8..87123dcc64 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h
index aa93bd4af4..17e5dd6264 100644
--- a/nt/inc/sys/stat.h
+++ b/nt/inc/sys/stat.h
@@ -1,7 +1,7 @@
 /* sys/stat.h supplied with MSVCRT uses too narrow data types for
    inode and user/group id, so we replace them with our own.
 
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/wait.h b/nt/inc/sys/wait.h
index 481ad9c38b..56f690baa1 100644
--- a/nt/inc/sys/wait.h
+++ b/nt/inc/sys/wait.h
@@ -1,6 +1,6 @@
 /* A limited emulation of sys/wait.h on Posix systems.
 
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/preprep.c b/nt/preprep.c
index 8b054b19a7..a2de049d59 100644
--- a/nt/preprep.c
+++ b/nt/preprep.c
@@ -1,5 +1,5 @@
 /* Pre-process emacs.exe for profiling by MSVC.
-   Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/runemacs.c b/nt/runemacs.c
index b4ed9fb156..ea1e420fab 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -1,6 +1,6 @@
 /* runemacs --- Simple program to start Emacs with its console window hidden.
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c
index 8ffa817f6c..646631df84 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -21,7 +21,7 @@ without express or implied warranty.
 
 
 /*
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/ChangeLog.1 b/oldXMenu/ChangeLog.1
index c237774a3f..ebbbcd2df2 100644
--- a/oldXMenu/ChangeLog.1
+++ b/oldXMenu/ChangeLog.1
@@ -712,7 +712,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c
index 2077a71848..69e5234940 100644
--- a/oldXMenu/Create.c
+++ b/oldXMenu/Create.c
@@ -21,7 +21,7 @@ without express or implied warranty.
 
 
 /*
-Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/FindSel.c b/oldXMenu/FindSel.c
index 53d14053b3..2db43df2f9 100644
--- a/oldXMenu/FindSel.c
+++ b/oldXMenu/FindSel.c
@@ -21,7 +21,7 @@ without express or implied warranty.
 
 
 /*
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/Internal.c b/oldXMenu/Internal.c
index 476336ce49..5d1a5d2bbc 100644
--- a/oldXMenu/Internal.c
+++ b/oldXMenu/Internal.c
@@ -21,7 +21,7 @@ without express or implied warranty.
 
 
 /*
-Copyright (C) 1993, 1996, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993, 1996, 2001-2022 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in
index 39fd155735..5cbc8a4829 100644
--- a/oldXMenu/Makefile.in
+++ b/oldXMenu/Makefile.in
@@ -15,7 +15,7 @@
 ## without express or implied warranty.
 
 
-## Copyright (C) 2001-2021 Free Software Foundation, Inc.
+## Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/deps.mk b/oldXMenu/deps.mk
index f1876bf769..cef392815d 100644
--- a/oldXMenu/deps.mk
+++ b/oldXMenu/deps.mk
@@ -15,7 +15,7 @@
 ## without express or implied warranty.
 
 
-## Copyright (C) 2001-2021 Free Software Foundation, Inc.
+## Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/insque.c b/oldXMenu/insque.c
index c09d1292aa..75e59f3b33 100644
--- a/oldXMenu/insque.c
+++ b/oldXMenu/insque.c
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993-1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1998, 2001-2022 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/src/.gdbinit b/src/.gdbinit
index f74e295f7e..132f414af9 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-1998, 2000-2021 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2000-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -41,6 +41,11 @@ handle SIGUSR2 noprint pass
 # debugging.
 handle SIGALRM ignore
 
+# On selection send failed.
+if defined_HAVE_PGTK
+  handle SIGPIPE nostop noprint
+end
+
 # Use $bugfix so that the value isn't a constant.
 # Using a constant runs into GDB bugs sometimes.
 define xgetptr
@@ -1224,6 +1229,9 @@ set print pretty on
 set print sevenbit-strings
 
 show environment DISPLAY
+if defined_HAVE_PGTK
+  show environment WAYLAND_DISPLAY
+end
 show environment TERM
 
 # When debugging, it is handy to be able to "return" from
diff --git a/src/ChangeLog.1 b/src/ChangeLog.1
index 3429aa4947..7076a1e13f 100644
--- a/src/ChangeLog.1
+++ b/src/ChangeLog.1
@@ -3521,7 +3521,7 @@
        * minibuf.c: Don't allow entry to minibuffer
        while minibuffer is selected.
 
-    Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index bba161d342..ba1cea18d4 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -27912,7 +27912,7 @@ See ChangeLog.9 for earlier changes.
 ;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index cf5e7b7a2a..15ab227171 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -31385,7 +31385,7 @@ See ChangeLog.10 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2007-2021 Free Software Foundation, Inc.
+  Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index 77540ee5b1..18618bbfb2 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -22936,7 +22936,7 @@ See ChangeLog.11 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2021 Free Software Foundation, Inc.
+  Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.13 b/src/ChangeLog.13
index 3fb23ceff3..abf2a9421a 100644
--- a/src/ChangeLog.13
+++ b/src/ChangeLog.13
@@ -17905,7 +17905,7 @@ See ChangeLog.12 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2021 Free Software Foundation, Inc.
+  Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index 44c575c564..1642518532 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -4771,7 +4771,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-    Copyright (C) 1986-1988, 2001-2021 Free Software Foundation, Inc.
+    Copyright (C) 1986-1988, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index 1cae9bfc65..4b3675eaa8 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -16503,7 +16503,7 @@ See ChangeLog.2 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.4 b/src/ChangeLog.4
index f34e4cb0f5..e55967673d 100644
--- a/src/ChangeLog.4
+++ b/src/ChangeLog.4
@@ -6906,7 +6906,7 @@ See ChangeLog.3 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.5 b/src/ChangeLog.5
index af0f6b9c38..c74e44d7a2 100644
--- a/src/ChangeLog.5
+++ b/src/ChangeLog.5
@@ -7148,7 +7148,7 @@ See ChangeLog.4 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1994-1995, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1994-1995, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.6 b/src/ChangeLog.6
index 709148569e..fc7cc5e4d4 100644
--- a/src/ChangeLog.6
+++ b/src/ChangeLog.6
@@ -5358,7 +5358,7 @@ See ChangeLog.5 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1995-1996, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index 7e9a085e50..e893a2a6d8 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -11091,7 +11091,7 @@ See ChangeLog.6 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1997-1998, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index 8587a14f2c..ef2472a0f3 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -13979,7 +13979,7 @@
 
 See ChangeLog.7 for earlier changes.
 
-  Copyright (C) 1999, 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.9 b/src/ChangeLog.9
index 25a17e74fe..b6d3f93445 100644
--- a/src/ChangeLog.9
+++ b/src/ChangeLog.9
@@ -13294,7 +13294,7 @@ See ChangeLog.8 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2021 Free Software Foundation, Inc.
+  Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/Makefile.in b/src/Makefile.in
index 3a8445db2d..83210b1317 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2021 Free Software
+# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2022 Free Software
 # Foundation, Inc.
 
 # This file is part of GNU Emacs.
@@ -297,6 +297,9 @@ W32_OBJ=@W32_OBJ@
 ## -lkernel32 if CYGWIN but not HAVE_W32, else empty.
 W32_LIBS=@W32_LIBS@
 
+PGTK_OBJ=@PGTK_OBJ@
+PGTK_LIBS=@PGTK_LIBS@
+
 ## emacs.res if HAVE_W32
 EMACSRES = @EMACSRES@
 ## If HAVE_W32, compiler arguments for including
@@ -432,7 +435,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o 
$(XMENU_OBJ) window.o \
        $(if $(HYBRID_MALLOC),sheap.o) \
        $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
        $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(JSON_OBJ) \
-       $(HAIKU_OBJ)
+       $(HAIKU_OBJ) $(PGTK_OBJ)
 doc_obj = $(base_obj) $(NS_OBJC_OBJ)
 obj = $(doc_obj) $(HAIKU_CXX_OBJ)
 
@@ -522,11 +525,11 @@ endif
 ## but the second one seems like it could be more future-proof.
 shortlisp =
 lisp.mk: $(lispsource)/loadup.el
-       @rm -f $@
        ${AM_V_GEN}( printf 'shortlisp = \\\n'; \
        sed -n 's/^[ \t]*(load "\([^"]*\)".*/\1/p' $< | \
          sed -e 's/$$/.elc \\/' -e 's/\.el\.elc/.el/'; \
-       echo "" ) > $@
+       echo "" ) > $@.tmp
+       $(AM_V_at)mv -f $@.tmp $@
 
 -include lisp.mk
 shortlisp_filter = leim/leim-list.el site-load.elc site-init.elc
@@ -539,7 +542,7 @@ export LISP_PRELOADED = ${shortlisp}
 lisp = $(addprefix ${lispsource}/,${shortlisp})
 
 ## Construct full set of libraries to be linked.
-LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
+LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(PGTK_LIBS) $(LIBX_BASE) 
$(LIBIMAGE) \
    $(LIBX_OTHER) $(LIBSOUND) \
    $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \
    $(WEBKIT_LIBS) \
@@ -614,8 +617,8 @@ endif
 
 ifeq ($(HAVE_BE_APP),yes)
 Emacs: emacs$(EXEEXT)
-       cp -f emacs$(EXEEXT) $@
-       $(AM_V_GEN) $(libsrc)/be-resources \
+       $(AM_V_GEN) cp -f emacs$(EXEEXT) $@
+       $(AM_V_at) $(libsrc)/be-resources \
          $(etc)/images/icons/hicolor/32x32/apps/emacs.png $@
 Emacs.pdmp: $(pdmp)
        $(AM_V_GEN) cp -f $(pdmp) $@
@@ -639,13 +642,13 @@ endif
 ## for the first time, this prevents any variation between configurations
 ## in the contents of the DOC file.
 ##
-$(etc)/DOC: lisp.mk $(libsrc)/make-docfile$(EXEEXT) $(doc_obj) $(lisp)
+$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(doc_obj) 
$(lispsource)/loaddefs.el
        $(AM_V_GEN)$(MKDIR_P) $(etc)
        $(AM_V_at)rm -f $(etc)/DOC
        $(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \
          $(SOME_MACHINE_OBJECTS) $(doc_obj) > $(etc)/DOC
        $(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \
-         $(shortlisp)
+         loaddefs.el
 
 $(libsrc)/make-docfile$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT): \
   $(lib)/libgnu.a
diff --git a/src/README b/src/README
index 1f42449edd..54d83df57b 100644
--- a/src/README
+++ b/src/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/src/alloc.c b/src/alloc.c
index 9f52a414d6..7582a42601 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,6 +1,6 @@
 /* Storage allocation and gc for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
+Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -3888,6 +3888,7 @@ count as reachable for the purpose of deciding whether to 
run
 FUNCTION.  FUNCTION will be run once per finalizer object.  */)
   (Lisp_Object function)
 {
+  CHECK_TYPE (FUNCTIONP (function), Qfunctionp, function);
   struct Lisp_Finalizer *finalizer
     = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, function, PVEC_FINALIZER);
   finalizer->function = function;
@@ -6145,6 +6146,9 @@ garbage_collect (void)
   mark_terminals ();
   mark_kboards ();
   mark_threads ();
+#ifdef HAVE_PGTK
+  mark_pgtkterm ();
+#endif
 
 #ifdef USE_GTK
   xg_mark_data ();
@@ -7721,6 +7725,12 @@ enum defined_HAVE_X_WINDOWS { defined_HAVE_X_WINDOWS = 
true };
 enum defined_HAVE_X_WINDOWS { defined_HAVE_X_WINDOWS = false };
 #endif
 
+#ifdef HAVE_PGTK
+enum defined_HAVE_PGTK { defined_HAVE_PGTK = true };
+#else
+enum defined_HAVE_PGTK { defined_HAVE_PGTK = false };
+#endif
+
 /* When compiled with GCC, GDB might say "No enum type named
    pvec_type" if we don't have at least one symbol with that type, and
    then xbacktrace could fail.  Similarly for the other enums and
@@ -7740,5 +7750,6 @@ union
   enum More_Lisp_Bits More_Lisp_Bits;
   enum pvec_type pvec_type;
   enum defined_HAVE_X_WINDOWS defined_HAVE_X_WINDOWS;
+  enum defined_HAVE_PGTK defined_HAVE_PGTK;
 } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
 #endif /* __GNUC__ */
diff --git a/src/atimer.c b/src/atimer.c
index df35603f32..1c6c881fc0 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -1,5 +1,5 @@
 /* Asynchronous timers.
-   Copyright (C) 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/atimer.h b/src/atimer.h
index e3e283a75c..7d6d853ffd 100644
--- a/src/atimer.h
+++ b/src/atimer.h
@@ -1,5 +1,5 @@
 /* Asynchronous timers.
-   Copyright (C) 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/bidi.c b/src/bidi.c
index 890a60acc4..c5d524f049 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1,6 +1,6 @@
 /* Low-level bidirectional buffer/string-scanning functions for GNU Emacs.
 
-Copyright (C) 2000-2001, 2004-2005, 2009-2021 Free Software Foundation,
+Copyright (C) 2000-2001, 2004-2005, 2009-2022 Free Software Foundation,
 Inc.
 
 Author: Eli Zaretskii <eliz@gnu.org>
diff --git a/src/bignum.c b/src/bignum.c
index 1ac75c19e2..cb5322f291 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -1,6 +1,6 @@
 /* Big numbers for Emacs.
 
-Copyright 2018-2021 Free Software Foundation, Inc.
+Copyright 2018-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -53,6 +53,15 @@ init_bignum (void)
 {
   eassert (mp_bits_per_limb == GMP_NUMB_BITS);
   integer_width = 1 << 16;
+
+  /* FIXME: The Info node `(gmp) Custom Allocation' states: "No error
+     return is allowed from any of these functions, if they return
+     then they must have performed the specified operation. [...]
+     There's currently no defined way for the allocation functions to
+     recover from an error such as out of memory, they must terminate
+     program execution.  A 'longjmp' or throwing a C++ exception will
+     have undefined results."  But xmalloc and xrealloc do call
+     'longjmp'.  */
   mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp);
 
   for (int i = 0; i < ARRAYELTS (mpz); i++)
diff --git a/src/bignum.h b/src/bignum.h
index 33a540e909..5f94ce850c 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -1,6 +1,6 @@
 /* Big numbers for Emacs.
 
-Copyright 2018-2021 Free Software Foundation, Inc.
+Copyright 2018-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/blockinput.h b/src/blockinput.h
index 8e4657b27c..a98fc69eb9 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -1,5 +1,5 @@
 /* blockinput.h - interface to blocking complicated interrupt-driven input.
-   Copyright (C) 1989, 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/buffer.c b/src/buffer.c
index a2fd0a83bc..10ac91915c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,6 +1,6 @@
 /* Buffer manipulation primitives for GNU Emacs.
 
-Copyright (C) 1985-1989, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -6023,15 +6023,16 @@ specifies.  */);
 
   DEFVAR_PER_BUFFER ("indicate-empty-lines",
                     &BVAR (current_buffer, indicate_empty_lines), Qnil,
-                    doc: /* Visually indicate empty lines after the buffer end.
-If non-nil, a bitmap is displayed in the left fringe of a window on
-window-systems.  */);
+                    doc: /* Visually indicate unused ("empty") screen lines 
after the buffer end.
+If non-nil, a bitmap is displayed in the left fringe of a window
+on graphical displays for each screen line that doesn't correspond
+to any buffer text.  */);
 
   DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
                     &BVAR (current_buffer, indicate_buffer_boundaries), Qnil,
                     doc: /* Visually indicate buffer boundaries and scrolling.
 If non-nil, the first and last line of the buffer are marked in the fringe
-of a window on window-systems with angle bitmaps, or if the window can be
+of a window on graphical displays with angle bitmaps, or if the window can be
 scrolled, the top and bottom line of the window are marked with up and down
 arrow bitmaps.
 
diff --git a/src/buffer.h b/src/buffer.h
index 8623bed08e..135eaf72d3 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,6 +1,6 @@
 /* Header file for the buffer manipulation primitives.
 
-Copyright (C) 1985-1986, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/bytecode.c b/src/bytecode.c
index 4fd41acab8..472992be18 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,5 +1,5 @@
 /* Execution of byte code produced by bytecomp.el.
-   Copyright (C) 1985-1988, 1993, 2000-2021 Free Software Foundation,
+   Copyright (C) 1985-1988, 1993, 2000-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/callint.c b/src/callint.c
index afe4b62fa0..f9a03c6f8c 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -1,5 +1,5 @@
 /* Call a Lisp function interactively.
-   Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2021 Free Software
+   Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/callproc.c b/src/callproc.c
index c89628bb0e..4d3b0bb8e0 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,6 +1,6 @@
 /* Synchronous subprocess invocation for GNU Emacs.
 
-Copyright (C) 1985-1988, 1993-1995, 1999-2021 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1999-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 81e9ed153f..2ea5f09b4c 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -1,7 +1,7 @@
 /* -*- coding: utf-8 -*- */
 /* GNU Emacs case conversion functions.
 
-Copyright (C) 1985, 1994, 1997-1999, 2001-2021 Free Software Foundation,
+Copyright (C) 1985, 1994, 1997-1999, 2001-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/casetab.c b/src/casetab.c
index 4699857cb8..6ea27318bc 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -1,5 +1,5 @@
 /* GNU Emacs routines to deal with case tables.
-   Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 Author: Howard Gayle
 
diff --git a/src/category.c b/src/category.c
index ec8f61f7f0..bedde0de45 100644
--- a/src/category.c
+++ b/src/category.c
@@ -1,6 +1,6 @@
 /* GNU Emacs routines to deal with category tables.
 
-Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/ccl.c b/src/ccl.c
index 7c033afc88..377eb3a0ea 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1,5 +1,5 @@
 /* CCL (Code Conversion Language) interpreter.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/character.c b/src/character.c
index 38a81d36b0..eba417d005 100644
--- a/src/character.c
+++ b/src/character.c
@@ -1,6 +1,6 @@
 /* Basic character support.
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 Copyright (C) 1995, 1997, 1998, 2001 Electrotechnical Laboratory, JAPAN.
   Licensed to the Free Software Foundation.
 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
diff --git a/src/charset.c b/src/charset.c
index 7cd0fa78f0..dec9d56df2 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1,6 +1,6 @@
 /* Basic character set support.
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
@@ -63,7 +63,7 @@ Lisp_Object Vcharset_hash_table;
 /* Table of struct charset.  */
 struct charset *charset_table;
 int charset_table_size;
-static int charset_table_used;
+int charset_table_used;
 
 /* Special charsets corresponding to symbols.  */
 int charset_ascii;
diff --git a/src/charset.h b/src/charset.h
index 97122d82a6..4f4a14f1bd 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -1,5 +1,5 @@
 /* Header for charset handler.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
@@ -249,6 +249,7 @@ extern Lisp_Object Vcharset_hash_table;
 /* Table of struct charset.  */
 extern struct charset *charset_table;
 extern int charset_table_size;
+extern int charset_table_used;
 
 #define CHARSET_FROM_ID(id) (charset_table + (id))
 
diff --git a/src/cm.c b/src/cm.c
index fe81ca869e..a175b4a338 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -1,5 +1,5 @@
 /* Cursor motion subroutines for GNU Emacs.
-   Copyright (C) 1985, 1995, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1995, 2001-2022 Free Software Foundation, Inc.
     based primarily on public domain code written by Chris Torek
 
 This file is part of GNU Emacs.
diff --git a/src/cm.h b/src/cm.h
index 9bea33299c..f8034997c6 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -1,5 +1,5 @@
 /* Cursor motion calculation definitions for GNU Emacs
-   Copyright (C) 1985, 1989, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1989, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/cmds.c b/src/cmds.c
index 00fde0ef79..626c9198aa 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -1,6 +1,6 @@
 /* Simple built-in editing commands.
 
-Copyright (C) 1985, 1993-1998, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1998, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/coding.c b/src/coding.c
index f8004d202e..df6c423caa 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1,5 +1,5 @@
 /* Coding system handler (conversion, detection, etc).
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/coding.h b/src/coding.h
index d06bed3f5d..d86c17d18b 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -1,5 +1,5 @@
 /* Header for coding system handler.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/commands.h b/src/commands.h
index 2205ebf7d3..6cc3e78de0 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -1,5 +1,5 @@
 /* Definitions needed by most editing commands.
-   Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/comp.c b/src/comp.c
index fb9b1a5a2d..64db13fc1c 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -1,5 +1,5 @@
 /* Compile Emacs Lisp into native code.
-   Copyright (C) 2019-2021 Free Software Foundation, Inc.
+   Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 Author: Andrea Corallo <akrl@sdf.org>
 
@@ -5278,16 +5278,16 @@ LATE_LOAD has to be non-nil when loading for deferred 
compilation.  */)
        Fmake_temp_file_internal (filename, Qnil, build_string (".eln.tmp"),
                                  Qnil);
       if (NILP (Ffile_writable_p (tmp_filename)))
-       comp_u->handle = dynlib_open (SSDATA (encoded_filename));
+       comp_u->handle = dynlib_open_for_eln (SSDATA (encoded_filename));
       else
        {
          Frename_file (filename, tmp_filename, Qt);
-         comp_u->handle = dynlib_open (SSDATA (ENCODE_FILE (tmp_filename)));
+         comp_u->handle = dynlib_open_for_eln (SSDATA (ENCODE_FILE 
(tmp_filename)));
          Frename_file (tmp_filename, filename, Qnil);
        }
     }
   else
-    comp_u->handle = dynlib_open (SSDATA (encoded_filename));
+    comp_u->handle = dynlib_open_for_eln (SSDATA (encoded_filename));
 
   if (!comp_u->handle)
     xsignal2 (Qnative_lisp_load_failed, filename,
diff --git a/src/comp.h b/src/comp.h
index 96bb52a14b..40f1e9b979 100644
--- a/src/comp.h
+++ b/src/comp.h
@@ -1,6 +1,6 @@
 /* Elisp native compiler definitions
 
-Copyright (C) 2019-2021 Free Software Foundation, Inc.
+Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/composite.c b/src/composite.c
index c170805d9d..711284ba6f 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1,5 +1,5 @@
 /* Composite sequence support.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 
2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
diff --git a/src/composite.h b/src/composite.h
index 945f261291..d77dd0d506 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -1,5 +1,5 @@
 /* Header for composite sequence handler.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 
2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
diff --git a/src/conf_post.h b/src/conf_post.h
index 2c6fbb0dba..6db76a2dfa 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -1,6 +1,6 @@
 /* conf_post.h --- configure.ac includes this via AH_BOTTOM
 
-Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2021 Free Software
+Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/cygw32.c b/src/cygw32.c
index b11d94d3a6..1b43de2c05 100644
--- a/src/cygw32.c
+++ b/src/cygw32.c
@@ -1,5 +1,5 @@
 /* Cygwin support routines.
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/cygw32.h b/src/cygw32.h
index 19cb77539b..fe1f6da11a 100644
--- a/src/cygw32.h
+++ b/src/cygw32.h
@@ -1,5 +1,5 @@
 /* Header for Cygwin support routines.
-   Copyright (C) 2011-2021 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/data.c b/src/data.c
index 6c1fd7d1a1..44d05e9884 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
 /* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
+   Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/dbusbind.c b/src/dbusbind.c
index c005474d44..7cfdbbe23c 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1,5 +1,5 @@
 /* Elisp bindings for D-Bus.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/decompress.c b/src/decompress.c
index 17224f6123..60f8bfd6a2 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -1,5 +1,5 @@
 /* Interface to zlib.
-   Copyright (C) 2013-2021 Free Software Foundation, Inc.
+   Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/deps.mk b/src/deps.mk
index eda2ed6338..deffab93ec 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -1,6 +1,6 @@
 ### deps.mk --- src/Makefile fragment for GNU Emacs
 
-## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2021 Free Software
+## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2022 Free Software
 ## Foundation, Inc.
 
 ## This file is part of GNU Emacs.
diff --git a/src/dired.c b/src/dired.c
index ebcf77bc26..7fb54f2f67 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -1,5 +1,5 @@
 /* Lisp functions for making directory listings.
-   Copyright (C) 1985-1986, 1993-1994, 1999-2021 Free Software
+   Copyright (C) 1985-1986, 1993-1994, 1999-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/dispextern.h b/src/dispextern.h
index ff4e7293d8..954992a0ec 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1,6 +1,6 @@
 /* Interface definitions for display code.
 
-Copyright (C) 1985, 1993-1994, 1997-2021 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1994, 1997-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -123,17 +123,20 @@ typedef HDC Emacs_Pix_Context;
 
 #ifdef HAVE_NS
 #include "nsgui.h"
-#define FACE_COLOR_TO_PIXEL(face_color, frame) (FRAME_NS_P (frame) \
-                                                ? ns_color_index_to_rgba 
(face_color, frame) \
-                                                : face_color)
 /* Following typedef needed to accommodate the MSDOS port, believe it or not.  
*/
 typedef struct ns_display_info Display_Info;
 typedef Emacs_Pixmap Emacs_Pix_Container;
 typedef Emacs_Pixmap Emacs_Pix_Context;
-#else
-#define FACE_COLOR_TO_PIXEL(face_color, frame) face_color
 #endif
 
+#ifdef HAVE_PGTK
+#include "pgtkgui.h"
+/* Following typedef needed to accommodate the MSDOS port, believe it or not.  
*/
+typedef struct pgtk_display_info Display_Info;
+typedef Emacs_Pixmap XImagePtr;
+typedef XImagePtr XImagePtr_or_DC;
+#endif /* HAVE_PGTK */
+
 #ifdef HAVE_HAIKU
 #include "haikugui.h"
 typedef struct haiku_display_info Display_Info;
@@ -1400,6 +1403,9 @@ struct glyph_string
   Emacs_GC *gc;
   HDC hdc;
 #endif
+#if defined (HAVE_PGTK)
+  Emacs_GC xgcv;
+#endif
 
   /* A pointer to the first glyph in the string.  This glyph
      corresponds to char2b[0].  Needed to draw rectangles if
diff --git a/src/dispnew.c b/src/dispnew.c
index a976bf94c5..178d5caffb 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1,6 +1,6 @@
 /* Updating of data structures for redisplay.
 
-Copyright (C) 1985-1988, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -6453,6 +6453,15 @@ init_display_interactive (void)
     }
 #endif
 
+#ifdef HAVE_PGTK
+  if (!inhibit_window_system && !will_dump_p ())
+    {
+      Vinitial_window_system = Qpgtk;
+      Vwindow_system_version = make_fixnum (3);
+      return;
+    }
+#endif
+
 #ifdef HAVE_HAIKU
   if (!inhibit_window_system && !will_dump_p ())
     {
diff --git a/src/disptab.h b/src/disptab.h
index adf411b805..49764727f8 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -1,5 +1,5 @@
 /* Things for GLYPHS and glyph tables.
-   Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/dmpstruct.awk b/src/dmpstruct.awk
index c7b93da3bc..b40d2979d5 100644
--- a/src/dmpstruct.awk
+++ b/src/dmpstruct.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2021 Free Software Foundation, Inc.
+# Copyright (C) 2018-2022 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/src/doc.c b/src/doc.c
index 5c8f059288..5be0ba4d97 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,6 +1,6 @@
 /* Record indices of function doc strings stored in a file. -*- coding: utf-8 
-*-
 
-Copyright (C) 1985-1986, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -84,16 +84,19 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
   char *from, *to, *name, *p, *p1;
   Lisp_Object file, pos;
   ptrdiff_t count = SPECPDL_INDEX ();
+  Lisp_Object dir;
   USE_SAFE_ALLOCA;
 
   if (FIXNUMP (filepos))
     {
       file = Vdoc_file_name;
+      dir = Vdoc_directory;
       pos = filepos;
     }
   else if (CONSP (filepos))
     {
       file = XCAR (filepos);
+      dir = Fsymbol_value (Qlisp_directory);
       pos = XCDR (filepos);
     }
   else
@@ -101,7 +104,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
 
   EMACS_INT position = eabs (XFIXNUM (pos));
 
-  if (!STRINGP (Vdoc_directory))
+  if (!STRINGP (dir))
     return Qnil;
 
   if (!STRINGP (file))
@@ -113,7 +116,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
   Lisp_Object tem = Ffile_name_absolute_p (file);
   file = ENCODE_FILE (file);
   Lisp_Object docdir
-    = NILP (tem) ? ENCODE_FILE (Vdoc_directory) : empty_unibyte_string;
+    = NILP (tem) ? ENCODE_FILE (dir) : empty_unibyte_string;
   ptrdiff_t docdir_sizemax = SBYTES (docdir) + 1;
   if (will_dump_p ())
     docdir_sizemax = max (docdir_sizemax, sizeof sibling_etc);
@@ -665,6 +668,7 @@ See variable `text-quoting-style'.  */)
 void
 syms_of_doc (void)
 {
+  DEFSYM (Qlisp_directory, "lisp-directory");
   DEFSYM (Qsubstitute_command_keys, "substitute-command-keys");
   DEFSYM (Qfunction_documentation, "function-documentation");
   DEFSYM (Qgrave, "grave");
diff --git a/src/doprnt.c b/src/doprnt.c
index fe484b8e76..19f58d0844 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -1,7 +1,7 @@
 /* Output like sprintf to a buffer of specified size.    -*- coding: utf-8 -*-
    Also takes args differently: pass one pointer to the end
    of the format string in addition to the format string itself.
-   Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/dosfns.c b/src/dosfns.c
index 17e896cf2e..e9792cbb82 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -1,6 +1,6 @@
 /* MS-DOS specific Lisp utilities.  Coded by Manabu Higashida, 1991.
    Major changes May-July 1993 Morten Welinder (only 10% original code left)
-   Copyright (C) 1991, 1993, 1996-1998, 2001-2021 Free Software
+   Copyright (C) 1991, 1993, 1996-1998, 2001-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/dosfns.h b/src/dosfns.h
index 6ad2a03470..1115a9c726 100644
--- a/src/dosfns.h
+++ b/src/dosfns.h
@@ -2,7 +2,7 @@
    Coded by Manabu Higashida, 1991.
    Modified by Morten Welinder, 1993-1994.
 
-Copyright (C) 1991, 1994-1995, 1997, 1999, 2001-2021 Free Software
+Copyright (C) 1991, 1994-1995, 1997, 1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/dynlib.c b/src/dynlib.c
index a8c8843961..8cb9a23374 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -1,6 +1,6 @@
 /* Portable API for dynamic loading.
 
-Copyright 2015-2021 Free Software Foundation, Inc.
+Copyright 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -104,6 +104,12 @@ dynlib_open (const char *dll_fname)
   return (dynlib_handle_ptr) hdll;
 }
 
+dynlib_handle_ptr
+dynlib_open_for_eln (const char *dll_fname)
+{
+  return dynlib_open (dll_fname);
+}
+
 void *
 dynlib_sym (dynlib_handle_ptr h, const char *sym)
 {
@@ -269,6 +275,12 @@ dynlib_close (dynlib_handle_ptr h)
 
 dynlib_handle_ptr
 dynlib_open (const char *path)
+{
+  return dlopen (path, RTLD_LAZY | RTLD_GLOBAL);
+}
+
+dynlib_handle_ptr
+dynlib_open_for_eln (const char *path)
 {
   return dlopen (path, RTLD_LAZY);
 }
diff --git a/src/dynlib.h b/src/dynlib.h
index e20d8891a2..ac3d8e58ab 100644
--- a/src/dynlib.h
+++ b/src/dynlib.h
@@ -1,6 +1,6 @@
 /* Portable API for dynamic loading.
 
-Copyright 2015-2021 Free Software Foundation, Inc.
+Copyright 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -24,6 +24,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 typedef void *dynlib_handle_ptr;
 dynlib_handle_ptr dynlib_open (const char *path);
+dynlib_handle_ptr dynlib_open_for_eln (const char *path);
 int dynlib_close (dynlib_handle_ptr h);
 const char *dynlib_error (void);
 
diff --git a/src/editfns.c b/src/editfns.c
index 5c9c34dc35..790f66e3a0 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,6 +1,6 @@
 /* Lisp functions pertaining to editing.                 -*- coding: utf-8 -*-
 
-Copyright (C) 1985-1987, 1989, 1993-2021 Free Software Foundation, Inc.
+Copyright (C) 1985-1987, 1989, 1993-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1233,7 +1233,11 @@ return "unknown".
 If optional argument UID is an integer, return the full name
 of the user with that uid, or nil if there is no such user.
 If UID is a string, return the full name of the user with that login
-name, or nil if there is no such user.  */)
+name, or nil if there is no such user.
+
+If the full name includes commas, remove everything starting with
+the first comma, because the \\='gecos\\=' field of the \\='/etc/passwd\\=' 
file
+is in general a comma-separated list.  */)
   (Lisp_Object uid)
 {
   struct passwd *pw;
@@ -1263,7 +1267,8 @@ name, or nil if there is no such user.  */)
     return Qnil;
 
   p = USER_FULL_NAME;
-  /* Chop off everything after the first comma. */
+  /* Chop off everything after the first comma, since 'pw_gecos' is a
+     comma-separated list. */
   q = strchr (p, ',');
   full = make_string (p, q ? q - p : strlen (p));
 
diff --git a/src/emacs-icon.h b/src/emacs-icon.h
index 87790bbc29..1c7bb7f884 100644
--- a/src/emacs-icon.h
+++ b/src/emacs-icon.h
@@ -1,7 +1,7 @@
 /* XPM */
 /* Emacs icon
 
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 Author: Kentaro Ohkouchi <nanasess@fsm.ne.jp>
         Nicolas Petton <nicolas@petton.fr>
diff --git a/src/emacs-module.c b/src/emacs-module.c
index f8fb54c072..392b3ba965 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1,6 +1,6 @@
 /* emacs-module.c - Module loading and runtime implementation
 
-Copyright (C) 2015-2021 Free Software Foundation, Inc.
+Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index a56e4dd12a..6642b55d93 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -1,6 +1,6 @@
 /* emacs-module.h - GNU Emacs module API.
 
-Copyright (C) 2015-2021 Free Software Foundation, Inc.
+Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/emacs.c b/src/emacs.c
index 3fc055aed9..3b708db779 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,6 +1,6 @@
 /* Fully extensible Emacs, running on Unix, intended for GNU.
 
-Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2021 Free Software
+Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -1909,6 +1909,9 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   init_bignum ();
   init_threads ();
   init_eval ();
+#ifdef HAVE_PGTK
+  init_pgtkterm ();   /* before init_atimer(). */
+#endif
   running_asynch_code = 0;
   init_random ();
 
@@ -2245,6 +2248,15 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
       syms_of_fontset ();
 #endif /* HAVE_NS */
 
+#ifdef HAVE_PGTK
+      syms_of_pgtkterm ();
+      syms_of_pgtkfns ();
+      syms_of_pgtkselect ();
+      syms_of_pgtkmenu ();
+      syms_of_pgtkim ();
+      syms_of_fontset ();
+      syms_of_xsettings ();
+#endif /* HAVE_PGTK */
 #ifdef HAVE_HAIKU
       syms_of_haikuterm ();
       syms_of_haikufns ();
@@ -2328,7 +2340,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
 #ifdef HAVE_DBUS
   init_dbusbind ();
 #endif
-#ifdef USE_GTK
+#if defined(USE_GTK) && !defined(HAVE_PGTK)
   init_xterm ();
 #endif
 
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 1f5b0947e5..da56031e2a 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -1,7 +1,7 @@
 /* A Gtk Widget that inherits GtkFixed, but can be shrunk.
 This file is only use when compiling with Gtk+ 3.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -22,8 +22,11 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "frame.h"
+#ifdef HAVE_PGTK
+#include "pgtkterm.h"
+#else
 #include "xterm.h"
-#include "xwidget.h"
+#endif
 #include "emacsgtkfixed.h"
 
 /* Silence a bogus diagnostic; see GNOME bug 683906.  */
@@ -47,7 +50,9 @@ static void emacs_fixed_get_preferred_width  (GtkWidget 
*widget,
 static void emacs_fixed_get_preferred_height (GtkWidget *widget,
                                               gint      *minimum,
                                               gint      *natural);
+#ifndef HAVE_PGTK
 static GType emacs_fixed_get_type (void);
+#endif
 G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
 
 static EmacsFixed *
@@ -93,9 +98,15 @@ emacs_fixed_get_preferred_width (GtkWidget *widget,
 {
   EmacsFixed *fixed = EMACS_FIXED (widget);
   EmacsFixedPrivate *priv = fixed->priv;
+#ifdef HAVE_PGTK
+  int w = priv->f->output_data.pgtk->size_hints.min_width;
+  if (minimum) *minimum = w;
+  if (natural) *natural = priv->f->output_data.pgtk->preferred_width;
+#else
   int w = priv->f->output_data.x->size_hints.min_width;
   if (minimum) *minimum = w;
   if (natural) *natural = w;
+#endif
 }
 
 static void
@@ -105,12 +116,20 @@ emacs_fixed_get_preferred_height (GtkWidget *widget,
 {
   EmacsFixed *fixed = EMACS_FIXED (widget);
   EmacsFixedPrivate *priv = fixed->priv;
+#ifdef HAVE_PGTK
+  int h = priv->f->output_data.pgtk->size_hints.min_height;
+  if (minimum) *minimum = h;
+  if (natural) *natural = priv->f->output_data.pgtk->preferred_height;
+#else
   int h = priv->f->output_data.x->size_hints.min_height;
   if (minimum) *minimum = h;
   if (natural) *natural = h;
+#endif
 }
 
 
+#ifndef HAVE_PGTK
+
 /* Override the X function so we can intercept Gtk+ 3 calls.
    Use our values for min_width/height so that KDE don't freak out
    (Bug#8919), and so users can resize our frames as they wish.  */
@@ -145,8 +164,13 @@ XSetWMSizeHints (Display *d,
 
   if ((hints->flags & PMinSize) && f)
     {
+#ifdef HAVE_PGTK
+      int w = f->output_data.pgtk->size_hints.min_width;
+      int h = f->output_data.pgtk->size_hints.min_height;
+#else
       int w = f->output_data.x->size_hints.min_width;
       int h = f->output_data.x->size_hints.min_height;
+#endif
       data[5] = w;
       data[6] = h;
     }
@@ -164,3 +188,5 @@ XSetWMNormalHints (Display *d, Window w, XSizeHints *hints)
 {
   XSetWMSizeHints (d, w, hints, XA_WM_NORMAL_HINTS);
 }
+
+#endif
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h
index 78879764d8..af5e22e6f4 100644
--- a/src/emacsgtkfixed.h
+++ b/src/emacsgtkfixed.h
@@ -1,7 +1,7 @@
 /* A Gtk Widget that inherits GtkFixed, but can be shrunk.
 This file is only use when compiling with Gtk+ 3.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -27,6 +27,11 @@ struct frame;
 
 G_BEGIN_DECLS
 
+#ifdef HAVE_PGTK
+#define EMACS_TYPE_FIXED        (emacs_fixed_get_type ())
+#define EMACS_IS_FIXED(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
EMACS_TYPE_FIXED))
+#endif
+
 struct frame;
 
 typedef struct _EmacsFixedPrivate       EmacsFixedPrivate;
@@ -44,6 +49,10 @@ struct _EmacsFixedClass
   GtkFixedClass parent_class;
 };
 
+#ifdef HAVE_PGTK
+extern GType emacs_fixed_get_type (void);
+#endif
+
 extern GtkWidget *emacs_fixed_new (struct frame *f);
 
 G_END_DECLS
diff --git a/src/epaths.in b/src/epaths.in
index 0c72610c6c..2eccd0ac60 100644
--- a/src/epaths.in
+++ b/src/epaths.in
@@ -1,6 +1,6 @@
 /* Hey Emacs, this is -*- C -*- code!  */
 /*
-Copyright (C) 1993, 1995, 1997, 1999, 2001-2021 Free Software
+Copyright (C) 1993, 1995, 1997, 1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/eval.c b/src/eval.c
index ffc3b2b832..29243b1d54 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,6 +1,6 @@
 /* Evaluator for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1985-1987, 1993-1995, 1999-2021 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1999-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -2651,6 +2651,19 @@ eval_sub (Lisp_Object form)
             interpreted using lexical-binding or not.  */
          specbind (Qlexical_binding,
                    NILP (Vinternal_interpreter_environment) ? Qnil : Qt);
+
+         /* Make the macro aware of any defvar declarations in scope. */
+         Lisp_Object dynvars = Vmacroexp__dynvars;
+         for (Lisp_Object p = Vinternal_interpreter_environment;
+              !NILP (p); p = XCDR(p))
+           {
+             Lisp_Object e = XCAR (p);
+             if (SYMBOLP (e))
+               dynvars = Fcons(e, dynvars);
+           }
+         if (!EQ (dynvars, Vmacroexp__dynvars))
+           specbind (Qmacroexp__dynvars, dynvars);
+
          exp = apply1 (Fcdr (fun), original_args);
          exp = unbind_to (count1, exp);
          val = eval_sub (exp);
@@ -4624,5 +4637,6 @@ alist of active lexical bindings.  */);
   defsubr (&Sbacktrace_eval);
   defsubr (&Sbacktrace__locals);
   defsubr (&Sspecial_variable_p);
+  DEFSYM (Qfunctionp, "functionp");
   defsubr (&Sfunctionp);
 }
diff --git a/src/fileio.c b/src/fileio.c
index a0563ccba4..9c50cbb35a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,6 +1,6 @@
 /* File IO for GNU Emacs.
 
-Copyright (C) 1985-1988, 1993-2021 Free Software Foundation, Inc.
+Copyright (C) 1985-1988, 1993-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -195,7 +195,11 @@ get_file_errno_data (char const *string, Lisp_Object name, 
int errorno)
   if (errorno == EEXIST)
     return Fcons (Qfile_already_exists, errdata);
   else
-    return Fcons (errorno == ENOENT ? Qfile_missing : Qfile_error,
+    return Fcons (errorno == ENOENT
+                 ? Qfile_missing
+                 : (errorno == EACCES
+                    ? Qpermission_denied
+                    : Qfile_error),
                  Fcons (build_string (string), errdata));
 }
 
@@ -6380,6 +6384,7 @@ syms_of_fileio (void)
   DEFSYM (Qfile_already_exists, "file-already-exists");
   DEFSYM (Qfile_date_error, "file-date-error");
   DEFSYM (Qfile_missing, "file-missing");
+  DEFSYM (Qpermission_denied, "permission-denied");
   DEFSYM (Qfile_notify_error, "file-notify-error");
   DEFSYM (Qremote_file_error, "remote-file-error");
   DEFSYM (Qexcl, "excl");
@@ -6438,6 +6443,11 @@ behaves as if file names were encoded in `utf-8'.  */);
   Fput (Qfile_missing, Qerror_message,
        build_pure_c_string ("File is missing"));
 
+  Fput (Qpermission_denied, Qerror_conditions,
+       Fpurecopy (list3 (Qpermission_denied, Qfile_error, Qerror)));
+  Fput (Qpermission_denied, Qerror_message,
+       build_pure_c_string ("Cannot access file or directory"));
+
   Fput (Qfile_notify_error, Qerror_conditions,
        Fpurecopy (list3 (Qfile_notify_error, Qfile_error, Qerror)));
   Fput (Qfile_notify_error, Qerror_message,
diff --git a/src/filelock.c b/src/filelock.c
index c12776246b..a213c2b3ca 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -1,6 +1,6 @@
 /* Lock files for editing.
 
-Copyright (C) 1985-1987, 1993-1994, 1996, 1998-2021 Free Software
+Copyright (C) 1985-1987, 1993-1994, 1996, 1998-2022 Free Software
 Foundation, Inc.
 
 Author: Richard King
diff --git a/src/firstfile.c b/src/firstfile.c
index 2733e1b5d6..719c29db8b 100644
--- a/src/firstfile.c
+++ b/src/firstfile.c
@@ -1,5 +1,5 @@
 /* Mark beginning of data space to dump as pure, for GNU Emacs.
-   Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/floatfns.c b/src/floatfns.c
index f52dae4719..f2b3b13acd 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -1,6 +1,6 @@
 /* Primitive operations on floating point for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1988, 1993-1994, 1999, 2001-2021 Free Software Foundation,
+Copyright (C) 1988, 1993-1994, 1999, 2001-2022 Free Software Foundation,
 Inc.
 
 Author: Wolfgang Rupprecht (according to ack.texi)
diff --git a/src/fns.c b/src/fns.c
index 76c76c92ba..86c49e6fc6 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1,6 +1,6 @@
 /* Random utility Lisp functions.
 
-Copyright (C) 1985-1987, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -3653,7 +3653,7 @@ base64_encode_1 (const char *from, char *to, ptrdiff_t 
length,
          c = string_char_and_length ((unsigned char *) from + i, &bytes);
          if (CHAR_BYTE8_P (c))
            c = CHAR_TO_BYTE8 (c);
-         else if (c >= 256)
+         else if (c >= 128)
            return -1;
          i += bytes;
        }
@@ -3696,7 +3696,7 @@ base64_encode_1 (const char *from, char *to, ptrdiff_t 
length,
          c = string_char_and_length ((unsigned char *) from + i, &bytes);
          if (CHAR_BYTE8_P (c))
            c = CHAR_TO_BYTE8 (c);
-         else if (c >= 256)
+         else if (c >= 128)
            return -1;
          i += bytes;
        }
@@ -3721,7 +3721,7 @@ base64_encode_1 (const char *from, char *to, ptrdiff_t 
length,
          c = string_char_and_length ((unsigned char *) from + i, &bytes);
          if (CHAR_BYTE8_P (c))
            c = CHAR_TO_BYTE8 (c);
-         else if (c >= 256)
+         else if (c >= 128)
            return -1;
          i += bytes;
        }
diff --git a/src/font.c b/src/font.c
index d780d781f6..58ff1a7981 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1,6 +1,6 @@
 /* font.c -- "Font" primitives.
 
-Copyright (C) 2006-2021 Free Software Foundation, Inc.
+Copyright (C) 2006-2022 Free Software Foundation, Inc.
 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
   Registration Number H13PRO009
@@ -2768,7 +2768,6 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, 
int size)
              int candidate = XFIXNUM (AREF (entity, prop)) >> 8;
 
              if (candidate != required
-#ifdef HAVE_NTGUI
                  /* A kludge for w32 font search, where listing a
                     family returns only 4 standard weights: regular,
                     italic, bold, bold-italic.  For other values one
@@ -2778,10 +2777,14 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object 
spec, int size)
                     weight, so if we require exact match, the
                     non-regular font will be rejected.  So we relax
                     the accuracy of the match here, and let
-                    font_sort_entities find the best match.  */
+                    font_sort_entities find the best match.
+
+                    Similar things happen on Posix platforms, when
+                    people use font families that don't have the
+                    regular weight, only the medium weight: these
+                    families get rejected if we require an exact match.  */
                  && (prop != FONT_WEIGHT_INDEX
                      || eabs (candidate - required) > 100)
-#endif
                  )
                prop = FONT_SPEC_MAX;
            }
@@ -5741,7 +5744,11 @@ match.  */);
   syms_of_xftfont ();
 #endif  /* HAVE_XFT */
 #endif  /* not USE_CAIRO */
-#endif /* HAVE_X_WINDOWS */
+#else  /* not HAVE_X_WINDOWS */
+#ifdef USE_CAIRO
+  syms_of_ftcrfont ();
+#endif
+#endif /* not HAVE_X_WINDOWS */
 #else  /* not HAVE_FREETYPE */
 #ifdef HAVE_X_WINDOWS
   syms_of_xfont ();
diff --git a/src/font.h b/src/font.h
index 2da5ec4504..424616a4a1 100644
--- a/src/font.h
+++ b/src/font.h
@@ -1,5 +1,5 @@
 /* font.h -- Interface definition for font handling.
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
diff --git a/src/fontset.c b/src/fontset.c
index 7d4bd65f70..eb563a69e2 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1,6 +1,6 @@
 /* Fontset handler.
 
-Copyright (C) 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 2001-2022 Free Software Foundation, Inc.
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/fontset.h b/src/fontset.h
index 42cca50d38..79210eab86 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -1,5 +1,5 @@
 /* Header for fontset handler.
-   Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/frame.c b/src/frame.c
index 33e9606e41..92120792f8 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1,6 +1,6 @@
 /* Generic frame functions.
 
-Copyright (C) 1993-1995, 1997, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 1997, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -225,7 +225,8 @@ Value is:
  `x' for an Emacs frame that is really an X window,
  `w32' for an Emacs frame that is a window on MS-Windows display,
  `ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
- `pc' for a direct-write MS-DOS frame.
+ `pc' for a direct-write MS-DOS frame,
+ `pgtk' for an Emacs frame running on pure GTK.
  `haiku' for an Emacs frame running in Haiku.
 See also `frame-live-p'.  */)
   (Lisp_Object object)
@@ -245,6 +246,8 @@ See also `frame-live-p'.  */)
       return Qpc;
     case output_ns:
       return Qns;
+    case output_pgtk:
+      return Qpgtk;
     case output_haiku:
       return Qhaiku;
     default:
@@ -2215,7 +2218,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
     /* Since a similar behavior was observed on the Lucid and Motif
        builds (see Bug#5802, Bug#21509, Bug#23499, Bug#27816), we now
        don't delete the terminal for these builds either.  */
-    if (terminal->reference_count == 0 && terminal->type == output_x_window)
+    if (terminal->reference_count == 0 &&
+       (terminal->type == output_x_window || terminal->type == output_pgtk))
       terminal->reference_count = 1;
 #endif /* USE_X_TOOLKIT || USE_GTK */
     if (terminal->reference_count == 0)
@@ -5896,7 +5900,7 @@ This function is for internal use only.  */)
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-# if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \
+# if (defined USE_GTK || defined HAVE_PGTK || defined HAVE_NS || defined 
HAVE_XINERAMA \
       || defined HAVE_XRANDR)
 void
 free_monitors (struct MonitorInfo *monitors, int n_monitors)
@@ -5934,6 +5938,10 @@ make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                           attributes);
       attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
                          attributes);
+#ifdef HAVE_PGTK
+      attributes = Fcons (Fcons (Qscale_factor, make_float (mi->scale_factor)),
+                         attributes);
+#endif
       attributes = Fcons (Fcons (Qmm_size,
                                  list2i (mi->mm_width, mi->mm_height)),
                           attributes);
@@ -6023,6 +6031,7 @@ syms_of_frame (void)
   DEFSYM (Qw32, "w32");
   DEFSYM (Qpc, "pc");
   DEFSYM (Qns, "ns");
+  DEFSYM (Qpgtk, "pgtk");
   DEFSYM (Qhaiku, "haiku");
   DEFSYM (Qvisible, "visible");
   DEFSYM (Qbuffer_predicate, "buffer-predicate");
@@ -6046,6 +6055,9 @@ syms_of_frame (void)
 
   DEFSYM (Qworkarea, "workarea");
   DEFSYM (Qmm_size, "mm-size");
+#ifdef HAVE_PGTK
+  DEFSYM (Qscale_factor, "scale-factor");
+#endif
   DEFSYM (Qframes, "frames");
   DEFSYM (Qsource, "source");
 
diff --git a/src/frame.h b/src/frame.h
index cb2bad71c5..cb2f58e261 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1,5 +1,5 @@
 /* Define frame-object for GNU Emacs.
-   Copyright (C) 1993-1994, 1999-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -585,6 +585,7 @@ struct frame
     struct x_output *x;         /* From xterm.h.  */
     struct w32_output *w32;     /* From w32term.h.  */
     struct ns_output *ns;       /* From nsterm.h.  */
+    struct pgtk_output *pgtk; /* From pgtkterm.h. */
     struct haiku_output *haiku; /* From haikuterm.h. */
   }
   output_data;
@@ -853,6 +854,11 @@ default_pixels_per_inch_y (void)
 #else
 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
 #endif
+#ifndef HAVE_PGTK
+#define FRAME_PGTK_P(f) false
+#else
+#define FRAME_PGTK_P(f) ((f)->output_method == output_pgtk)
+#endif
 #ifndef HAVE_HAIKU
 #define FRAME_HAIKU_P(f) false
 #else
@@ -870,6 +876,9 @@ default_pixels_per_inch_y (void)
 #ifdef HAVE_NS
 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
 #endif
+#ifdef HAVE_PGTK
+#define FRAME_WINDOW_P(f) FRAME_PGTK_P(f)
+#endif
 #ifdef HAVE_HAIKU
 #define FRAME_WINDOW_P(f) FRAME_HAIKU_P (f)
 #endif
@@ -925,6 +934,8 @@ default_pixels_per_inch_y (void)
 /* Scale factor of frame F.  */
 #if defined HAVE_NS
 # define FRAME_SCALE_FACTOR(f) (FRAME_NS_P (f) ? ns_frame_scale_factor (f) : 1)
+#elif defined HAVE_PGTK
+# define FRAME_SCALE_FACTOR(f) (FRAME_PGTK_P (f) ? pgtk_frame_scale_factor (f) 
: 1)
 #else
 # define FRAME_SCALE_FACTOR(f) 1
 #endif
@@ -1682,7 +1693,7 @@ extern const char *x_get_resource_string (const char *, 
const char *);
 extern void x_sync (struct frame *);
 #endif /* HAVE_X_WINDOWS */
 
-#ifndef HAVE_NS
+#if !defined (HAVE_NS) && !defined (HAVE_PGTK)
 
 /* Set F's bitmap icon, if specified among F's parameters.  */
 
@@ -1718,6 +1729,9 @@ struct MonitorInfo {
   Emacs_Rectangle geom, work;
   int mm_width, mm_height;
   char *name;
+#ifdef HAVE_PGTK
+  double scale_factor;
+#endif
 };
 
 extern void free_monitors (struct MonitorInfo *monitors, int n_monitors);
diff --git a/src/fringe.c b/src/fringe.c
index b651a4eb0d..1f4dd46ec5 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1,5 +1,5 @@
 /* Fringe handling (split from xdisp.c).
-   Copyright (C) 1985-1988, 1993-1995, 1997-2021 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1997-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -30,6 +30,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "termhooks.h"
 #include "pdumper.h"
 
+#include "pgtkterm.h"
+
 /* Fringe bitmaps are represented in three different ways:
 
    Logical bitmaps are used internally to denote things like
@@ -1408,7 +1410,7 @@ If BITMAP overrides a standard fringe bitmap, the 
original bitmap is restored.
    On W32 and MAC (little endian), there's no need to do this.
 */
 
-#if defined (HAVE_X_WINDOWS)
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_PGTK)
 static const unsigned char swap_nibble[16] = {
   0x0, 0x8, 0x4, 0xc,           /* 0000 1000 0100 1100 */
   0x2, 0xa, 0x6, 0xe,           /* 0010 1010 0110 1110 */
@@ -1471,6 +1473,25 @@ init_fringe_bitmap (int which, struct fringe_bitmap *fb, 
int once_p)
 #endif /* not USE_CAIRO */
 #endif /* HAVE_X_WINDOWS */
 
+#if !defined(HAVE_X_WINDOWS) && defined (HAVE_PGTK)
+      unsigned short *bits = fb->bits;
+      int j;
+
+      for (j = 0; j < fb->height; j++)
+       {
+         unsigned short b = *bits;
+#ifdef WORDS_BIGENDIAN
+         *bits++ = (b << (16 - fb->width));
+#else
+         b = (unsigned short)((swap_nibble[b & 0xf] << 12)
+                              | (swap_nibble[(b>>4) & 0xf] << 8)
+                              | (swap_nibble[(b>>8) & 0xf] << 4)
+                              | (swap_nibble[(b>>12) & 0xf]));
+         *bits++ = (b >> (16 - fb->width));
+#endif
+       }
+#endif /* !HAVE_X_WINDOWS && HAVE_PGTK */
+
 #ifdef HAVE_NTGUI
       unsigned short *bits = fb->bits;
       int j;
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index 820b3c0bd0..558e44d5b9 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -1,5 +1,5 @@
 /* ftcrfont.c -- FreeType font driver on cairo.
-   Copyright (C) 2015-2021 Free Software Foundation, Inc.
+   Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -24,10 +24,12 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
-#else /* Otherwise, Haiku */
+#elif HAVE_HAIKU
 #include "haikuterm.h"
 #include "haiku_support.h"
 #include "termchar.h"
+#else
+#include "pgtkterm.h"
 #endif
 #include "blockinput.h"
 #include "charset.h"
@@ -167,6 +169,10 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   cairo_matrix_init_scale (&font_matrix, pixel_size, pixel_size);
   cairo_matrix_init_identity (&ctm);
   cairo_font_options_t *options = cairo_font_options_create ();
+#ifdef USE_BE_CAIRO
+  if (be_use_subpixel_antialiasing ())
+    cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL);
+#endif
   cairo_scaled_font_t *scaled_font
     = cairo_scaled_font_create (font_face, &font_matrix, &ctm, options);
   cairo_font_face_destroy (font_face);
@@ -526,7 +532,11 @@ ftcrfont_draw (struct glyph_string *s,
   block_input ();
 
 #ifndef USE_BE_CAIRO
+#ifdef HAVE_X_WINDOWS
   cr = x_begin_cr_clip (f, s->gc);
+#else
+  cr = pgtk_begin_cr_clip (f);
+#endif
 #else
   BView_draw_lock (FRAME_HAIKU_VIEW (f));
   EmacsWindow_begin_cr_critical_section (FRAME_HAIKU_WINDOW (f));
@@ -539,19 +549,16 @@ ftcrfont_draw (struct glyph_string *s,
       return 0;
     }
   BView_cr_dump_clipping (FRAME_HAIKU_VIEW (f), cr);
-
-  if (s->left_overhang && s->clip_head && !s->for_overlaps)
-    {
-      cairo_rectangle (cr, s->clip_head->x, 0,
-                      FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
-      cairo_clip (cr);
-    }
 #endif
 
   if (with_background)
     {
 #ifndef USE_BE_CAIRO
+#ifdef HAVE_X_WINDOWS
       x_set_cr_source_with_gc_background (f, s->gc);
+#else
+      pgtk_set_cr_source_with_color (f, s->xgcv.background);
+#endif
 #else
       struct face *face = s->face;
 
@@ -579,7 +586,11 @@ ftcrfont_draw (struct glyph_string *s,
                                                        NULL));
     }
 #ifndef USE_BE_CAIRO
+#ifdef HAVE_X_WINDOWS
   x_set_cr_source_with_gc_foreground (f, s->gc);
+#else
+  pgtk_set_cr_source_with_color (f, s->xgcv.foreground);
+#endif
 #else
   uint32_t col = s->hl == DRAW_CURSOR ?
     FRAME_OUTPUT_DATA (s->f)->cursor_fg : face->foreground;
@@ -591,7 +602,11 @@ ftcrfont_draw (struct glyph_string *s,
   cairo_set_scaled_font (cr, ftcrfont_info->cr_scaled_font);
   cairo_show_glyphs (cr, glyphs, len);
 #ifndef USE_BE_CAIRO
+#ifdef HAVE_X_WINDOWS
   x_end_cr_clip (f);
+#else
+  pgtk_end_cr_clip (f);
+#endif
 #else
   haiku_end_cr_clip (cr);
   EmacsWindow_end_cr_critical_section (FRAME_HAIKU_WINDOW (f));
diff --git a/src/ftfont.c b/src/ftfont.c
index cf592759ab..2bdcce306b 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1,5 +1,5 @@
 /* ftfont.c -- FreeType font driver.
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
diff --git a/src/ftfont.h b/src/ftfont.h
index 0e0bebb6f6..cfab8d3154 100644
--- a/src/ftfont.h
+++ b/src/ftfont.h
@@ -25,6 +25,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_SIZES_H
+#include FT_TRUETYPE_TABLES_H
 #ifdef FT_BDF_H
 # include FT_BDF_H
 #endif
diff --git a/src/getpagesize.h b/src/getpagesize.h
index ec497d0404..446c1e374a 100644
--- a/src/getpagesize.h
+++ b/src/getpagesize.h
@@ -1,5 +1,5 @@
 /* Emulate getpagesize on systems that lack it.
-   Copyright (C) 1986, 1992, 1995, 2001-2021 Free Software Foundation,
+   Copyright (C) 1986, 1992, 1995, 2001-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 4da6156943..70c503af54 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -1,5 +1,5 @@
 /* Filesystem notifications support with glib API.
-   Copyright (C) 2013-2021 Free Software Foundation, Inc.
+   Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 55ae7365d9..f063af60cf 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1,5 +1,5 @@
 /* Declarations for `malloc' and friends.
-   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2021 Free
+   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2022 Free
    Software Foundation, Inc.
                  Written May 1989 by Mike Haertel.
 
diff --git a/src/gnutls.c b/src/gnutls.c
index 22e7f2cbc1..3ec3837067 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -1,5 +1,5 @@
 /* GnuTLS glue for GNU Emacs.
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/gnutls.h b/src/gnutls.h
index 5fa08f8b12..791e5340c2 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -1,5 +1,5 @@
 /* GnuTLS glue for GNU Emacs.
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 8f8db4ed37..93f51d7796 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1,6 +1,6 @@
 /* Functions for creating and updating GTK widgets.
 
-Copyright (C) 2003-2021 Free Software Foundation, Inc.
+Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,13 +17,6 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
-/* FIXME: This code is problematic; it misuses GTK, so the GTK
-   developers don't think they should fix the resulting problems in GTK
-   itself.  The right way to fix this is by rewriting the code in Emacs
-   to use GTK3 properly.  As of 2020, there is a project to do this.
-   Talk with Yuuki Harano <masm+emacs@masm11.me> if you are interested
-   in doing substantial work on this.  */
-
 #include <config.h>
 
 #ifdef USE_GTK
@@ -37,7 +30,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "dispextern.h"
 #include "frame.h"
 #include "systime.h"
+#ifndef HAVE_PGTK
 #include "xterm.h"
+#define xp x
+typedef struct x_output xp_output;
+#else
+#define xp pgtk
+typedef struct pgtk_output xp_output;
+#endif
 #include "blockinput.h"
 #include "window.h"
 #include "gtkutil.h"
@@ -56,7 +56,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #endif
 
 #ifdef HAVE_GTK3
+#ifndef HAVE_PGTK
 #include <gtk/gtkx.h>
+#endif
 #include "emacsgtkfixed.h"
 #endif
 
@@ -131,6 +133,7 @@ static GdkDisplay *gdpy_def;
 static void
 xg_set_screen (GtkWidget *w, struct frame *f)
 {
+#ifndef HAVE_PGTK
   if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ())
     {
       GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
@@ -141,6 +144,17 @@ xg_set_screen (GtkWidget *w, struct frame *f)
       else
         gtk_window_set_screen (GTK_WINDOW (w), gscreen);
     }
+#else
+  if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ())
+    {
+      GdkScreen *gscreen = gdk_display_get_default_screen (FRAME_X_DISPLAY 
(f));
+
+      if (GTK_IS_MENU (w))
+       gtk_menu_set_screen (GTK_MENU (w), gscreen);
+      else
+       gtk_window_set_screen (GTK_WINDOW (w), gscreen);
+    }
+#endif
 }
 
 
@@ -152,12 +166,20 @@ xg_set_screen (GtkWidget *w, struct frame *f)
    multiple displays.  */
 
 void
+#ifndef HAVE_PGTK
 xg_display_open (char *display_name, Display **dpy)
+#else
+xg_display_open (char *display_name, GdkDisplay **dpy)
+#endif
 {
   GdkDisplay *gdpy;
 
   unrequest_sigio ();  /* See comment in x_display_ok, xterm.c.  */
+#ifndef HAVE_PGTK
   gdpy = gdk_display_open (display_name);
+#else
+  gdpy = gdk_display_open (strlen (display_name) == 0 ? NULL : display_name);
+#endif
   request_sigio ();
   if (!gdpy_def && gdpy)
     {
@@ -166,7 +188,11 @@ xg_display_open (char *display_name, Display **dpy)
                                               gdpy);
     }
 
+#ifndef HAVE_PGTK
   *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL;
+#else
+  *dpy = gdpy;
+#endif
 }
 
 /* Scaling/HiDPI functions. */
@@ -188,6 +214,9 @@ xg_get_gdk_scale (void)
 int
 xg_get_scale (struct frame *f)
 {
+#ifdef HAVE_PGTK
+  return 1;
+#endif
 #ifdef HAVE_GTK3
   if (FRAME_GTK_WIDGET (f))
     return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
@@ -198,8 +227,13 @@ xg_get_scale (struct frame *f)
 /* Close display DPY.  */
 
 void
+#ifndef HAVE_PGTK
 xg_display_close (Display *dpy)
+#else
+xg_display_close (GdkDisplay *gdpy)
+#endif
 {
+#ifndef HAVE_PGTK
   GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
 
   /* If this is the default display, try to change it before closing.
@@ -223,6 +257,31 @@ xg_display_close (Display *dpy)
     }
 
   gdk_display_close (gdpy);
+
+#else
+
+  /* If this is the default display, try to change it before closing.
+     If there is no other display to use, gdpy_def is set to NULL, and
+     the next call to xg_display_open resets the default display.  */
+  if (gdk_display_get_default () == gdpy)
+    {
+      struct pgtk_display_info *dpyinfo;
+      GdkDisplay *gdpy_new = NULL;
+
+      /* Find another display.  */
+      for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+       if (dpyinfo->gdpy != gdpy)
+         {
+           gdpy_new = dpyinfo->gdpy;
+           gdk_display_manager_set_default_display (gdk_display_manager_get (),
+                                                    gdpy_new);
+            break;
+        }
+      gdpy_def = gdpy_new;
+    }
+
+  gdk_display_close (gdpy);
+#endif
 }
 
 
@@ -234,12 +293,19 @@ xg_display_close (Display *dpy)
    scroll bars on display DPY.  */
 
 GdkCursor *
+#ifndef HAVE_PGTK
 xg_create_default_cursor (Display *dpy)
+#else
+xg_create_default_cursor (GdkDisplay *gdpy)
+#endif
 {
+#ifndef HAVE_PGTK
   GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
+#endif
   return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR);
 }
 
+#ifndef HAVE_PGTK
 /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel.  */
 
 static GdkPixbuf *
@@ -339,6 +405,8 @@ xg_get_pixbuf_from_surface (cairo_surface_t *surface)
 }
 #endif /* USE_CAIRO && !HAVE_GTK3 */
 
+#endif /* !HAVE_PGTK */
+
 static Lisp_Object
 file_for_image (Lisp_Object image)
 {
@@ -609,8 +677,13 @@ xg_check_special_colors (struct frame *f,
   block_input ();
   {
 #ifdef HAVE_GTK3
+#ifndef HAVE_PGTK
     GtkStyleContext *gsty
       = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f));
+#else
+    GtkStyleContext *gsty
+      = gtk_widget_get_style_context (FRAME_WIDGET (f));
+#endif
     GdkRGBA col;
     char buf[sizeof "rgb://rrrr/gggg/bbbb"];
     int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED;
@@ -634,8 +707,13 @@ xg_check_special_colors (struct frame *f,
       r = col.red * 65535,
       g = col.green * 65535,
       b = col.blue * 65535;
+#ifndef HAVE_PGTK
     sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b);
     success_p = x_parse_color (f, buf, color) != 0;
+#else
+    sprintf (buf, "#%04x%04x%04x", r, g, b);
+    success_p = pgtk_parse_color (f, buf, color) != 0;
+#endif
 #else
     GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
     GdkColor *grgb = get_bg
@@ -659,6 +737,9 @@ xg_check_special_colors (struct frame *f,
 /***********************************************************************
                               Tooltips
  ***********************************************************************/
+
+#ifndef HAVE_PGTK
+
 /* Gtk+ calls this callback when the parent of our tooltip dummy changes.
    We use that to pop down the tooltip.  This happens if Gtk+ for some
    reason wants to change or hide the tooltip.  */
@@ -669,7 +750,7 @@ hierarchy_ch_cb (GtkWidget *widget,
                  gpointer   user_data)
 {
   struct frame *f = user_data;
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl);
 
   if (! top || ! GTK_IS_WINDOW (top))
@@ -691,7 +772,7 @@ qttip_cb (GtkWidget  *widget,
           gpointer    user_data)
 {
   struct frame *f = user_data;
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   if (x->ttip_widget == NULL)
     {
       GtkWidget *p;
@@ -738,7 +819,7 @@ xg_prepare_tooltip (struct frame *f,
                     int *width,
                     int *height)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   GtkWidget *widget;
   GdkWindow *gwin;
   GdkScreen *screen;
@@ -789,13 +870,19 @@ xg_prepare_tooltip (struct frame *f,
 void
 xg_show_tooltip (struct frame *f, int root_x, int root_y)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   if (x->ttip_window)
     {
       block_input ();
+#ifndef HAVE_PGTK
       gtk_window_move (x->ttip_window, root_x / xg_get_scale (f),
                       root_y / xg_get_scale (f));
       gtk_widget_show (GTK_WIDGET (x->ttip_window));
+#else
+      gtk_widget_show (GTK_WIDGET (x->ttip_window));
+      gtk_window_move (x->ttip_window, root_x / xg_get_scale (f),
+                      root_y / xg_get_scale (f));
+#endif
       unblock_input ();
     }
 }
@@ -807,10 +894,9 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
 bool
 xg_hide_tooltip (struct frame *f)
 {
-  if (f->output_data.x->ttip_window)
+  if (f->output_data.xp->ttip_window)
     {
-      GtkWindow *win = f->output_data.x->ttip_window;
-
+      GtkWindow *win = f->output_data.xp->ttip_window;
       block_input ();
       gtk_widget_hide (GTK_WIDGET (win));
 
@@ -828,6 +914,30 @@ xg_hide_tooltip (struct frame *f)
   return FALSE;
 }
 
+#else  /* HAVE_PGTK */
+
+void
+xg_show_tooltip (struct frame *f,
+                Lisp_Object string)
+{
+  Lisp_Object encoded_string = ENCODE_UTF_8 (string);
+  gtk_widget_set_tooltip_text (FRAME_GTK_OUTER_WIDGET (f)
+                              ? FRAME_GTK_OUTER_WIDGET (f)
+                              : FRAME_GTK_WIDGET (f),
+                              SSDATA (encoded_string));
+}
+
+bool
+xg_hide_tooltip (struct frame *f)
+{
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    gtk_widget_set_tooltip_text (FRAME_GTK_OUTER_WIDGET (f), NULL);
+  gtk_widget_set_tooltip_text (FRAME_GTK_WIDGET (f), NULL);
+  return TRUE;
+}
+
+#endif /* HAVE_PGTK */
+
 
 /***********************************************************************
     General functions for creating widgets, resizing, events, e.t.c.
@@ -979,8 +1089,23 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
   bool was_visible = false;
   bool hide_child_frame;
 
+#ifndef HAVE_PGTK
   gtk_window_get_size (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                       &gwidth, &gheight);
+#else
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      gtk_window_get_size (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                          &gwidth, &gheight);
+    }
+  else
+    {
+      GtkAllocation alloc;
+      gtk_widget_get_allocation (FRAME_GTK_WIDGET (f), &alloc);
+      gwidth = alloc.width;
+      gheight = alloc.height;
+    }
+#endif
 
   /* Do this before resize, as we don't know yet if we will be resized.  */
   FRAME_RIF (f)->clear_under_internal_border (f);
@@ -1000,11 +1125,37 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
      remain unchanged but giving the frame back its normal size will
      be broken ... */
   if (EQ (fullscreen, Qfullwidth) && width == FRAME_PIXEL_WIDTH (f))
+#ifndef HAVE_PGTK
     gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                       gwidth, outer_height);
+#else
+    if (FRAME_GTK_OUTER_WIDGET (f))
+      {
+       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                          gwidth, outer_height);
+      }
+    else
+      {
+       gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+                                    gwidth, outer_height);
+      }
+#endif
   else if (EQ (fullscreen, Qfullheight) && height == FRAME_PIXEL_HEIGHT (f))
+#ifndef HAVE_PGTK
     gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                       outer_width, gheight);
+#else
+    if (FRAME_GTK_OUTER_WIDGET (f))
+      {
+       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                          outer_width, gheight);
+      }
+    else
+      {
+       gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+                                    outer_width, gheight);
+      }
+#endif
   else if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f))
     {
       was_visible = true;
@@ -1015,17 +1166,38 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
           if (hide_child_frame)
             {
               block_input ();
+#ifndef HAVE_PGTK
               gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f));
+#else
+             gtk_widget_hide (FRAME_WIDGET (f));
+#endif
               unblock_input ();
             }
 
+#ifndef HAVE_PGTK
          gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                             outer_width, outer_height);
+#else
+         if (FRAME_GTK_OUTER_WIDGET (f))
+           {
+             gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                outer_width, outer_height);
+           }
+         else
+           {
+             gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+                                          outer_width, outer_height);
+           }
+#endif
 
           if (hide_child_frame)
             {
               block_input ();
+#ifndef HAVE_PGTK
               gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
+#else
+             gtk_widget_show_all (FRAME_WIDGET (f));
+#endif
               unblock_input ();
             }
 
@@ -1034,8 +1206,21 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     }
   else
     {
+#ifndef HAVE_PGTK
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         outer_width, outer_height);
+#else
+      if (FRAME_GTK_OUTER_WIDGET (f))
+       {
+         gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                            outer_width, outer_height);
+       }
+      else
+       {
+         gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+                                      outer_width, outer_height);
+       }
+#endif
       fullscreen = Qnil;
     }
 
@@ -1060,7 +1245,9 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
       /* Must call this to flush out events */
       (void)gtk_events_pending ();
       gdk_flush ();
+#ifndef HAVE_PGTK
       x_wait_for_event (f, ConfigureNotify);
+#endif
 
       if (!NILP (fullscreen))
        /* Try to restore fullscreen state.  */
@@ -1093,11 +1280,12 @@ xg_height_or_width_changed (struct frame *f)
   gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                      FRAME_TOTAL_PIXEL_WIDTH (f),
                      FRAME_TOTAL_PIXEL_HEIGHT (f));
-  f->output_data.x->hint_flags = 0;
+  f->output_data.xp->hint_flags = 0;
   x_wm_set_size_hint (f, 0, 0);
 }
 #endif
 
+#ifndef HAVE_PGTK
 /* Convert an X Window WSESC on display DPY to its corresponding GtkWidget.
    Must be done like this, because GtkWidget:s can have "hidden"
    X Window that aren't accessible.
@@ -1125,6 +1313,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
   unblock_input ();
   return gwdesc;
 }
+#endif
 
 /* Set the background of widget W to PIXEL.  */
 
@@ -1132,9 +1321,18 @@ static void
 xg_set_widget_bg (struct frame *f, GtkWidget *w, unsigned long pixel)
 {
 #ifdef HAVE_GTK3
-  XColor xbg;
+  Emacs_Color xbg;
   xbg.pixel = pixel;
+#ifndef HAVE_PGTK
   if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg))
+#else
+  xbg.red = (pixel >> 16) & 0xff;
+  xbg.green = (pixel >> 8) & 0xff;
+  xbg.blue = (pixel >> 0) & 0xff;
+  xbg.red |= xbg.red << 8;
+  xbg.green |= xbg.green << 8;
+  xbg.blue |= xbg.blue << 8;
+#endif
     {
       const char format[] = "* { background-color: #%02x%02x%02x; }";
       /* The format is always longer than the resulting string.  */
@@ -1169,7 +1367,16 @@ style_changed_cb (GObject *go,
   struct input_event event;
   GdkDisplay *gdpy = user_data;
   const char *display_name = gdk_display_get_name (gdpy);
+#ifndef HAVE_PGTK
   Display *dpy = GDK_DISPLAY_XDISPLAY (gdpy);
+#else
+  GdkDisplay *dpy = gdpy;
+#endif
+
+#ifndef HAVE_PGTK
+  if (display_name == NULL)
+    display_name = "";
+#endif
 
   EVENT_INIT (event);
   event.kind = CONFIG_CHANGED_EVENT;
@@ -1190,7 +1397,11 @@ style_changed_cb (GObject *go,
         {
           struct frame *f = XFRAME (frame);
           if (FRAME_LIVE_P (f)
+#ifndef HAVE_PGTK
               && FRAME_X_P (f)
+#else
+              && FRAME_PGTK_P (f)
+#endif
               && FRAME_X_DISPLAY (f) == dpy)
             {
               FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f);
@@ -1204,6 +1415,7 @@ style_changed_cb (GObject *go,
 
 /* Called when a delete-event occurs on WIDGET.  */
 
+#ifndef HAVE_PGTK
 static gboolean
 delete_cb (GtkWidget *widget,
            GdkEvent  *event,
@@ -1211,6 +1423,7 @@ delete_cb (GtkWidget *widget,
 {
   return TRUE;
 }
+#endif
 
 /* Create and set up the GTK widgets for frame F.
    Return true if creation succeeded.  */
@@ -1224,17 +1437,27 @@ xg_create_frame_widgets (struct frame *f)
 #ifndef HAVE_GTK3
   GtkRcStyle *style;
 #endif
+  GtkWindowType type = GTK_WINDOW_TOPLEVEL;
   char *title = 0;
 
   block_input ();
 
+#ifndef HAVE_PGTK  /* gtk_plug not found. */
   if (FRAME_X_EMBEDDED_P (f))
     {
       GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
-      wtop = gtk_plug_new_for_display (gdpy, f->output_data.x->parent_desc);
+      wtop = gtk_plug_new_for_display (gdpy, f->output_data.xp->parent_desc);
     }
   else
-    wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    wtop = gtk_window_new (type);
+#else
+  if (f->tooltip)
+    {
+      type = GTK_WINDOW_POPUP;
+    }
+  wtop = gtk_window_new (type);
+  gtk_widget_add_events (wtop, GDK_ALL_EVENTS_MASK);
+#endif
 
   /* gtk_window_set_has_resize_grip is a Gtk+ 3.0 function but Ubuntu
      has backported it to Gtk+ 2.0 and they add the resize grip for
@@ -1291,8 +1514,8 @@ xg_create_frame_widgets (struct frame *f)
 
   FRAME_GTK_OUTER_WIDGET (f) = wtop;
   FRAME_GTK_WIDGET (f) = wfixed;
-  f->output_data.x->vbox_widget = wvbox;
-  f->output_data.x->hbox_widget = whbox;
+  f->output_data.xp->vbox_widget = wvbox;
+  f->output_data.xp->hbox_widget = whbox;
 
   gtk_widget_set_has_window (wfixed, TRUE);
 
@@ -1311,7 +1534,10 @@ xg_create_frame_widgets (struct frame *f)
      FIXME: gtk_widget_set_double_buffered is deprecated and might stop
      working in the future.  We need to migrate away from combining
      X and GTK+ drawing to a pure GTK+ build.  */
+
+#ifndef HAVE_PGTK
   gtk_widget_set_double_buffered (wfixed, FALSE);
+#endif
 
 #if ! GTK_CHECK_VERSION (3, 22, 0)
   gtk_window_set_wmclass (GTK_WINDOW (wtop),
@@ -1319,10 +1545,12 @@ xg_create_frame_widgets (struct frame *f)
                           SSDATA (Vx_resource_class));
 #endif
 
+#ifndef HAVE_PGTK
   /* Add callback to do nothing on WM_DELETE_WINDOW.  The default in
      GTK is to destroy the widget.  We want Emacs to do that instead.  */
   g_signal_connect (G_OBJECT (wtop), "delete-event",
                     G_CALLBACK (delete_cb), f);
+#endif
 
   /* Convert our geometry parameters into a geometry string
      and specify it.
@@ -1333,7 +1561,9 @@ xg_create_frame_widgets (struct frame *f)
 
   gtk_widget_add_events (wfixed,
                          GDK_POINTER_MOTION_MASK
+#ifndef HAVE_PGTK
                          | GDK_EXPOSURE_MASK
+#endif
                          | GDK_BUTTON_PRESS_MASK
                          | GDK_BUTTON_RELEASE_MASK
                          | GDK_KEY_PRESS_MASK
@@ -1341,13 +1571,19 @@ xg_create_frame_widgets (struct frame *f)
                          | GDK_LEAVE_NOTIFY_MASK
                          | GDK_FOCUS_CHANGE_MASK
                          | GDK_STRUCTURE_MASK
+#ifdef HAVE_PGTK
+                         | GDK_SCROLL_MASK
+                         | GDK_SMOOTH_SCROLL_MASK
+#endif
                          | GDK_VISIBILITY_NOTIFY_MASK);
 
+#ifndef HAVE_PGTK
   /* Must realize the windows so the X window gets created.  It is used
      by callers of this function.  */
   gtk_widget_realize (wfixed);
   FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (wfixed);
   initial_set_up_x_back_buffer (f);
+#endif
 
   /* Since GTK clears its window by filling with the background color,
      we must keep X and GTK background in sync.  */
@@ -1364,6 +1600,9 @@ xg_create_frame_widgets (struct frame *f)
   gtk_widget_modify_style (wfixed, style);
 #else
   gtk_widget_set_can_focus (wfixed, TRUE);
+#ifdef HAVE_PGTK
+  gtk_widget_grab_focus (wfixed);
+#endif
   gtk_window_set_resizable (GTK_WINDOW (wtop), TRUE);
 #endif
 
@@ -1376,11 +1615,13 @@ xg_create_frame_widgets (struct frame *f)
     }
 
   /* Steal a tool tip window we can move ourselves.  */
-  f->output_data.x->ttip_widget = 0;
-  f->output_data.x->ttip_lbl = 0;
-  f->output_data.x->ttip_window = 0;
+  f->output_data.xp->ttip_widget = 0;
+  f->output_data.xp->ttip_lbl = 0;
+  f->output_data.xp->ttip_window = 0;
+#ifndef HAVE_PGTK
   gtk_widget_set_tooltip_text (wtop, "Dummy text");
   g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
+#endif
 
   {
     GdkScreen *screen = gtk_widget_get_screen (wtop);
@@ -1403,12 +1644,114 @@ xg_create_frame_widgets (struct frame *f)
   return 1;
 }
 
+#ifdef HAVE_PGTK
+void
+xg_create_frame_outer_widgets (struct frame *f)
+{
+  GtkWidget *wtop;
+  GtkWidget *wvbox, *whbox;
+  GtkWindowType type = GTK_WINDOW_TOPLEVEL;
+  char *title = 0;
+
+  block_input ();
+
+  wtop = gtk_window_new (type);
+  gtk_widget_add_events (wtop, GDK_ALL_EVENTS_MASK);
+
+  xg_set_screen (wtop, f);
+
+  wvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  whbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_box_set_homogeneous (GTK_BOX (wvbox), FALSE);
+  gtk_box_set_homogeneous (GTK_BOX (whbox), FALSE);
+
+  /* Use same names as the Xt port does.  I.e. Emacs.pane.emacs by default */
+  gtk_widget_set_name (wtop, EMACS_CLASS);
+  gtk_widget_set_name (wvbox, "pane");
+
+  /* If this frame has a title or name, set it in the title bar.  */
+  if (! NILP (f->title))
+    title = SSDATA (ENCODE_UTF_8 (f->title));
+  else if (! NILP (f->name))
+    title = SSDATA (ENCODE_UTF_8 (f->name));
+
+  if (title)
+    gtk_window_set_title (GTK_WINDOW (wtop), title);
+
+  if (FRAME_UNDECORATED (f))
+    {
+      gtk_window_set_decorated (GTK_WINDOW (wtop), FALSE);
+      store_frame_param (f, Qundecorated, Qt);
+    }
+
+  FRAME_GTK_OUTER_WIDGET (f) = wtop;
+  f->output_data.xp->vbox_widget = wvbox;
+  f->output_data.xp->hbox_widget = whbox;
+
+  gtk_container_add (GTK_CONTAINER (wtop), wvbox);
+  gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, 0);
+
+  if (FRAME_EXTERNAL_TOOL_BAR (f))
+    update_frame_tool_bar (f);
+
+#if ! GTK_CHECK_VERSION (3, 22, 0)
+  gtk_window_set_wmclass (GTK_WINDOW (wtop),
+                          SSDATA (Vx_resource_name),
+                          SSDATA (Vx_resource_class));
+#endif
+
+  /* Convert our geometry parameters into a geometry string
+     and specify it.
+     GTK will itself handle calculating the real position this way.  */
+  xg_set_geometry (f);
+  f->win_gravity
+    = gtk_window_get_gravity (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+
+  gtk_window_set_resizable (GTK_WINDOW (wtop), TRUE);
+
+  if (FRAME_OVERRIDE_REDIRECT (f))
+    {
+      GdkWindow *gwin = gtk_widget_get_window (wtop);
+
+      if (gwin)
+       gdk_window_set_override_redirect (gwin, TRUE);
+    }
+
+  /* Steal a tool tip window we can move ourselves.  */
+  f->output_data.xp->ttip_widget = 0;
+  f->output_data.xp->ttip_lbl = 0;
+  f->output_data.xp->ttip_window = 0;
+#ifndef HAVE_PGTK
+  gtk_widget_set_tooltip_text (wtop, "Dummy text");
+  g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
+#endif
+
+  {
+    GdkScreen *screen = gtk_widget_get_screen (wtop);
+    GtkSettings *gs = gtk_settings_get_for_screen (screen);
+    /* Only connect this signal once per screen.  */
+    if (! g_signal_handler_find (G_OBJECT (gs),
+                                 G_SIGNAL_MATCH_FUNC,
+                                 0, 0, 0,
+                                 (gpointer) G_CALLBACK (style_changed_cb),
+                                 0))
+      {
+        g_signal_connect (G_OBJECT (gs), "notify::gtk-theme-name",
+                          G_CALLBACK (style_changed_cb),
+                          gdk_screen_get_display (screen));
+      }
+  }
+
+  unblock_input ();
+}
+#endif
+
 void
 xg_free_frame_widgets (struct frame *f)
 {
   if (FRAME_GTK_OUTER_WIDGET (f))
     {
-      struct x_output *x = f->output_data.x;
+      xp_output *x = f->output_data.xp;
       struct xg_frame_tb_info *tbinfo
         = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
                              TB_INFO_KEY);
@@ -1416,10 +1759,14 @@ xg_free_frame_widgets (struct frame *f)
         xfree (tbinfo);
 
       /* x_free_frame_resources should have taken care of it */
+#ifndef HAVE_PGTK
       eassert (!FRAME_X_DOUBLE_BUFFERED_P (f));
+#endif
       gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
       FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
+#ifndef HAVE_PGTK
       FRAME_X_RAW_DRAWABLE (f) = 0;
+#endif
       FRAME_GTK_OUTER_WIDGET (f) = 0;
       if (x->ttip_widget)
         {
@@ -1461,9 +1808,12 @@ x_wm_set_size_hint (struct frame *f, long int flags, 
bool user_position)
 
   XSETFRAME (frame, f);
   fs_state = Fframe_parameter (frame, Qfullscreen);
-  if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) &&
-      (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) ||
-       x_wm_supports (f, FRAME_DISPLAY_INFO 
(f)->Xatom_net_wm_state_fullscreen)))
+  if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth))
+#ifndef HAVE_PGTK
+      && (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) ||
+         x_wm_supports (f, FRAME_DISPLAY_INFO 
(f)->Xatom_net_wm_state_fullscreen))
+#endif
+      )
     {
       /* Don't set hints when maximized or fullscreen.  Apparently KWin and
          Gtk3 don't get along and the frame shrinks (!).
@@ -1474,14 +1824,14 @@ x_wm_set_size_hint (struct frame *f, long int flags, 
bool user_position)
   if (flags)
     {
       memset (&size_hints, 0, sizeof (size_hints));
-      f->output_data.x->size_hints = size_hints;
-      f->output_data.x->hint_flags = hint_flags;
+      f->output_data.xp->size_hints = size_hints;
+      f->output_data.xp->hint_flags = hint_flags;
     }
   else
     flags = f->size_hint_flags;
 
-  size_hints = f->output_data.x->size_hints;
-  hint_flags = f->output_data.x->hint_flags;
+  size_hints = f->output_data.xp->size_hints;
+  hint_flags = f->output_data.xp->hint_flags;
 
   hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE;
   size_hints.width_inc = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
@@ -1543,16 +1893,16 @@ x_wm_set_size_hint (struct frame *f, long int flags, 
bool user_position)
   size_hints.width_inc /= scale;
   size_hints.height_inc /= scale;
 
-  if (hint_flags != f->output_data.x->hint_flags
+  if (hint_flags != f->output_data.xp->hint_flags
       || memcmp (&size_hints,
-                &f->output_data.x->size_hints,
+                &f->output_data.xp->size_hints,
                 sizeof (size_hints)) != 0)
     {
       block_input ();
       gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                                      NULL, &size_hints, hint_flags);
-      f->output_data.x->size_hints = size_hints;
-      f->output_data.x->hint_flags = hint_flags;
+      f->output_data.xp->size_hints = size_hints;
+      f->output_data.xp->hint_flags = hint_flags;
       unblock_input ();
     }
 }
@@ -1592,6 +1942,10 @@ xg_set_background_color (struct frame *f, unsigned long 
bg)
 void
 xg_set_undecorated (struct frame *f, Lisp_Object undecorated)
 {
+#ifdef HAVE_PGTK
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return;
+#endif
   if (FRAME_GTK_WIDGET (f))
     {
       block_input ();
@@ -1618,7 +1972,11 @@ xg_frame_restack (struct frame *f1, struct frame *f2, 
bool above_flag)
       XSETFRAME (frame2, f2);
 
       gdk_window_restack (gwin1, gwin2, above_flag);
+#ifndef HAVE_PGTK
       x_sync (f1);
+#else
+      gdk_flush ();
+#endif
     }
   unblock_input ();
 }
@@ -1629,10 +1987,17 @@ void
 xg_set_skip_taskbar (struct frame *f, Lisp_Object skip_taskbar)
 {
   block_input ();
+#ifndef HAVE_PGTK
   if (FRAME_GTK_WIDGET (f))
     gdk_window_set_skip_taskbar_hint
       (gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (f)),
        NILP (skip_taskbar) ? FALSE : TRUE);
+#else
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    gdk_window_set_skip_taskbar_hint
+      (gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (f)),
+       NILP (skip_taskbar) ? FALSE : TRUE);
+#endif
   unblock_input ();
 }
 
@@ -1641,6 +2006,10 @@ xg_set_skip_taskbar (struct frame *f, Lisp_Object 
skip_taskbar)
 void
 xg_set_no_focus_on_map (struct frame *f, Lisp_Object no_focus_on_map)
 {
+#ifdef HAVE_PGTK
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return;
+#endif
   block_input ();
   if (FRAME_GTK_WIDGET (f))
     {
@@ -1656,12 +2025,19 @@ xg_set_no_focus_on_map (struct frame *f, Lisp_Object 
no_focus_on_map)
 void
 xg_set_no_accept_focus (struct frame *f, Lisp_Object no_accept_focus)
 {
+  gboolean g_no_accept_focus = NILP (no_accept_focus) ? TRUE : FALSE;
+#ifdef HAVE_PGTK
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    {
+      if (FRAME_WIDGET (f))
+       gtk_widget_set_can_focus (FRAME_WIDGET (f), g_no_accept_focus);
+      return;
+    }
+#endif
   block_input ();
   if (FRAME_GTK_WIDGET (f))
     {
       GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f));
-      gboolean g_no_accept_focus = NILP (no_accept_focus) ? TRUE : FALSE;
-
       gtk_window_set_accept_focus (gwin, g_no_accept_focus);
     }
   unblock_input ();
@@ -1682,18 +2058,24 @@ xg_set_override_redirect (struct frame *f, Lisp_Object 
override_redirect)
   unblock_input ();
 }
 
+#ifndef HAVE_PGTK
 /* Set the frame icon to ICON_PIXMAP/MASK.  This must be done with GTK
    functions so GTK does not overwrite the icon.  */
 
 void
 xg_set_frame_icon (struct frame *f, Pixmap icon_pixmap, Pixmap icon_mask)
 {
+#ifdef HAVE_PGTK
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return;
+#endif
   GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f,
                                                    icon_pixmap,
                                                    icon_mask);
   if (gp)
     gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), gp);
 }
+#endif
 
 
 
@@ -2230,6 +2612,11 @@ xg_get_file_name (struct frame *f,
   int filesel_done = 0;
   xg_get_file_func func;
 
+#ifdef HAVE_PGTK
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    error ("Can't open dialog from child frames");
+#endif
+
 #ifdef HAVE_GTK_FILE_SELECTION_NEW
 
   if (xg_uses_old_file_dialog ())
@@ -2327,6 +2714,11 @@ xg_get_font (struct frame *f, const char *default_name)
   int done = 0;
   Lisp_Object font = Qnil;
 
+#ifdef HAVE_PGTK
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    error ("Can't open dialog from child frames");
+#endif
+
   w = gtk_font_chooser_dialog_new
     ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
 
@@ -2524,7 +2916,7 @@ xg_mark_data (void)
     {
       struct frame *f = XFRAME (frame);
 
-      if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f))
+      if ((FRAME_X_P (f) || FRAME_PGTK_P (f)) && FRAME_GTK_OUTER_WIDGET (f))
         {
           struct xg_frame_tb_info *tbinfo
             = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
@@ -2688,6 +3080,11 @@ make_menu_item (const char *utf8_label,
   if (wtoadd) gtk_container_add (GTK_CONTAINER (w), wtoadd);
   if (! item->enabled) gtk_widget_set_sensitive (w, FALSE);
 
+#ifdef HAVE_PGTK
+  if (!NILP (item->help))
+    gtk_widget_set_tooltip_text (w, SSDATA (item->help));
+#endif
+
   return w;
 }
 
@@ -2754,6 +3151,20 @@ xg_create_one_menuitem (widget_value *item,
   return w;
 }
 
+#ifdef HAVE_PGTK
+static gboolean
+menu_bar_button_pressed_cb (GtkWidget *widget, GdkEvent *event,
+                           gpointer user_data)
+{
+  struct frame *f = user_data;
+
+  if (event->button.button < 4)
+    set_frame_menubar (f, true);
+
+  return false;
+}
+#endif
+
 /* Create a full menu tree specified by DATA.
    F is the frame the created menu belongs to.
    SELECT_CB is the callback to use when a menu item is selected.
@@ -2811,6 +3222,10 @@ create_menus (widget_value *data,
       else
         {
           wmenu = gtk_menu_bar_new ();
+#ifdef HAVE_PGTK
+         g_signal_connect (G_OBJECT (wmenu), "button-press-event",
+                           G_CALLBACK (menu_bar_button_pressed_cb), f);
+#endif
           /* Set width of menu bar to a small value so it doesn't enlarge
              a small initial frame size.  The width will be set to the
              width of the frame later on when it is added to a container.
@@ -2827,9 +3242,15 @@ create_menus (widget_value *data,
       if (name)
         gtk_widget_set_name (wmenu, name);
 
+#ifndef HAVE_PGTK
       if (deactivate_cb)
         g_signal_connect (G_OBJECT (wmenu),
                           "selection-done", deactivate_cb, 0);
+#else
+      if (deactivate_cb)
+        g_signal_connect (G_OBJECT (wmenu),
+                          "deactivate", deactivate_cb, 0);
+#endif
     }
 
   for (item = data; item; item = item->next)
@@ -3551,7 +3972,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data)
 void
 xg_update_frame_menubar (struct frame *f)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   GtkRequisition req;
 
   if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget))
@@ -3584,7 +4005,7 @@ xg_update_frame_menubar (struct frame *f)
 void
 free_frame_menubar (struct frame *f)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
 
   if (x->menubar_widget)
     {
@@ -3600,6 +4021,7 @@ free_frame_menubar (struct frame *f)
     }
 }
 
+#ifndef HAVE_PGTK
 bool
 xg_event_is_for_menubar (struct frame *f, const XEvent *event)
 {
@@ -3616,7 +4038,7 @@ xg_event_is_for_menubar (struct frame *f, const XEvent 
*event)
 
 #ifdef HAVE_XINPUT2
   XIDeviceEvent *xev = (XIDeviceEvent *) event->xcookie.data;
-  if (event->type == GenericEvent) /* XI_ButtonPress or XI_ButtonRelease */
+  if (event->type == GenericEvent) /* XI_ButtonPress or XI_ButtonRelease or a 
touch event.  */
     {
       if (! (xev->event_x >= 0
             && xev->event_x < FRAME_PIXEL_WIDTH (f)
@@ -3653,8 +4075,21 @@ xg_event_is_for_menubar (struct frame *f, const XEvent 
*event)
   list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget));
   if (! list) return 0;
   int scale = xg_get_scale (f);
-  rec.x = event->xbutton.x / scale;
-  rec.y = event->xbutton.y / scale;
+#ifdef HAVE_XINPUT2
+  if (event->type == GenericEvent)
+    {
+      rec.x = xev->event_x / scale;
+      rec.y = xev->event_y / scale;
+    }
+  else
+    {
+#else
+      rec.x = event->xbutton.x / scale;
+      rec.y = event->xbutton.y / scale;
+#endif
+#ifdef HAVE_XINPUT2
+    }
+#endif
   rec.width = 1;
   rec.height = 1;
 
@@ -3667,6 +4102,7 @@ xg_event_is_for_menubar (struct frame *f, const XEvent 
*event)
   g_list_free (list);
   return iter != 0;
 }
+#endif
 
 
 
@@ -3822,6 +4258,7 @@ xg_get_default_scrollbar_height (struct frame *f)
   return scroll_bar_width_for_theme * xg_get_scale (f);
 }
 
+#ifndef HAVE_PGTK
 /* Return the scrollbar id for X Window WID on display DPY.
    Return -1 if WID not in id_to_widget.  */
 
@@ -3842,6 +4279,7 @@ xg_get_scroll_id_for_window (Display *dpy, Window wid)
 
   return -1;
 }
+#endif
 
 /* Callback invoked when scroll bar WIDGET is destroyed.
    DATA is the index into id_to_widget for WIDGET.
@@ -3891,7 +4329,7 @@ xg_finish_scroll_bar_creation (struct frame *f,
      also, which causes flicker.  Put an event box between the edit widget
      and the scroll bar, so the scroll bar instead draws itself on the
      event box window.  */
-  gtk_fixed_put (GTK_FIXED (f->output_data.x->edit_widget), webox, -1, -1);
+  gtk_fixed_put (GTK_FIXED (f->output_data.xp->edit_widget), webox, -1, -1);
   gtk_container_add (GTK_CONTAINER (webox), wscroll);
 
   xg_set_widget_bg (f, webox, FRAME_BACKGROUND_PIXEL (f));
@@ -3901,11 +4339,28 @@ xg_finish_scroll_bar_creation (struct frame *f,
      real X window, it and its scroll-bar child try to draw on the
      Emacs main window, which we draw over using Xlib.  */
   gtk_widget_realize (webox);
+#ifdef HAVE_PGTK
+  gtk_widget_show_all (webox);
+#endif
+#ifndef HAVE_PGTK
   GTK_WIDGET_TO_X_WIN (webox);
+#endif
 
   /* Set the cursor to an arrow.  */
   xg_set_cursor (webox, FRAME_DISPLAY_INFO (f)->xg_cursor);
 
+#ifdef HAVE_PGTK
+  GtkStyleContext *ctxt = gtk_widget_get_style_context (wscroll);
+  gtk_style_context_add_provider (ctxt,
+                                 GTK_STYLE_PROVIDER (FRAME_OUTPUT_DATA (f)->
+                                                     
scrollbar_foreground_css_provider),
+                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
+  gtk_style_context_add_provider (ctxt,
+                                 GTK_STYLE_PROVIDER (FRAME_OUTPUT_DATA (f)->
+                                                     
scrollbar_background_css_provider),
+                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
+#endif
+
   bar->x_window = scroll_id;
 }
 
@@ -4006,7 +4461,7 @@ xg_update_scrollbar_pos (struct frame *f,
   GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
   if (wscroll)
     {
-      GtkWidget *wfixed = f->output_data.x->edit_widget;
+      GtkWidget *wfixed = f->output_data.xp->edit_widget;
       GtkWidget *wparent = gtk_widget_get_parent (wscroll);
       gint msl;
       int scale = xg_get_scale (f);
@@ -4046,7 +4501,11 @@ xg_update_scrollbar_pos (struct frame *f,
           /* Clear under old scroll bar position.  */
           oldw += (scale - 1) * oldw;
          oldx -= (scale - 1) * oldw;
+#ifndef HAVE_PGTK
           x_clear_area (f, oldx, oldy, oldw, oldh);
+#else
+          pgtk_clear_area (f, oldx, oldy, oldw, oldh);
+#endif
         }
 
       if (!hidden)
@@ -4054,15 +4513,23 @@ xg_update_scrollbar_pos (struct frame *f,
          GtkWidget *scrollbar = xg_get_widget_from_map (scrollbar_id);
          GtkWidget *webox = gtk_widget_get_parent (scrollbar);
 
+#ifndef HAVE_PGTK
          /* Don't obscure any child frames.  */
          XLowerWindow (FRAME_X_DISPLAY (f), GTK_WIDGET_TO_X_WIN (webox));
+#else
+         gdk_window_lower (gtk_widget_get_window (webox));
+#endif
        }
 
       /* GTK does not redraw until the main loop is entered again, but
          if there are no X events pending we will not enter it.  So we sync
          here to get some events.  */
 
+#ifndef HAVE_PGTK
       x_sync (f);
+#else
+      gdk_flush ();
+#endif
       SET_FRAME_GARBAGED (f);
       cancel_mouse_face (f);
     }
@@ -4087,7 +4554,7 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
 
   if (wscroll)
     {
-      GtkWidget *wfixed = f->output_data.x->edit_widget;
+      GtkWidget *wfixed = f->output_data.xp->edit_widget;
       GtkWidget *wparent = gtk_widget_get_parent (wscroll);
       gint msl;
       int scale = xg_get_scale (f);
@@ -4123,7 +4590,11 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
         }
       if (oldx != -1 && oldw > 0 && oldh > 0)
         /* Clear under old scroll bar position.  */
+#ifndef HAVE_PGTK
         x_clear_area (f, oldx, oldy, oldw, oldh);
+#else
+        pgtk_clear_area (f, oldx, oldy, oldw, oldh);
+#endif
 
       /* GTK does not redraw until the main loop is entered again, but
          if there are no X events pending we will not enter it.  So we sync
@@ -4134,11 +4605,19 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
          xg_get_widget_from_map (scrollbar_id);
        GtkWidget *webox = gtk_widget_get_parent (scrollbar);
 
+#ifndef HAVE_PGTK
        /* Don't obscure any child frames.  */
        XLowerWindow (FRAME_X_DISPLAY (f), GTK_WIDGET_TO_X_WIN (webox));
+#else
+       gdk_window_lower (gtk_widget_get_window (webox));
+#endif
       }
 
+#ifndef HAVE_PGTK
       x_sync (f);
+#else
+      gdk_flush ();
+#endif
       SET_FRAME_GARBAGED (f);
       cancel_mouse_face (f);
     }
@@ -4282,7 +4761,7 @@ xg_set_toolkit_horizontal_scroll_bar_thumb (struct 
scroll_bar *bar,
    frame.  This function does additional checks.  */
 
 bool
-xg_event_is_for_scrollbar (struct frame *f, const XEvent *event)
+xg_event_is_for_scrollbar (struct frame *f, const EVENT *event)
 {
   bool retval = 0;
 
@@ -4298,11 +4777,21 @@ xg_event_is_for_scrollbar (struct frame *f, const 
XEvent *event)
            || (event->type == ButtonPress
                && event->xbutton.button < 4)))
 #else
-  if (f && event->type == ButtonPress && event->xbutton.button < 4)
+  if (f
+#ifndef HAVE_PGTK
+      && event->type == ButtonPress && event->xbutton.button < 4
+#else
+      && event->type == GDK_BUTTON_PRESS && event->button.button < 4
+#endif
+      )
 #endif /* HAVE_XINPUT2 */
     {
       /* Check if press occurred outside the edit widget.  */
+#ifndef HAVE_PGTK
       GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
+#else
+      GdkDisplay *gdpy = FRAME_X_DISPLAY (f);
+#endif
       GdkWindow *gwin;
 #ifdef HAVE_GTK3
 #if GTK_CHECK_VERSION (3, 20, 0)
@@ -4316,7 +4805,13 @@ xg_event_is_for_scrollbar (struct frame *f, const XEvent 
*event)
 #else
       gwin = gdk_display_get_window_at_pointer (gdpy, NULL, NULL);
 #endif
-      retval = gwin != gtk_widget_get_window (f->output_data.x->edit_widget);
+#ifndef HAVE_XINPUT2
+      retval = gwin != gtk_widget_get_window (f->output_data.xp->edit_widget);
+#else
+      retval = (gwin
+               && (gwin
+                   != gtk_widget_get_window (f->output_data.xp->edit_widget)));
+#endif
 #ifdef HAVE_XINPUT2
       GtkWidget *grab = gtk_grab_get_current ();
       if (event->type == GenericEvent
@@ -4337,8 +4832,14 @@ xg_event_is_for_scrollbar (struct frame *f, const XEvent 
*event)
                     || event->type == MotionNotify)))
 #else
   else if (f
+#ifndef HAVE_PGTK
            && ((event->type == ButtonRelease && event->xbutton.button < 4)
-               || event->type == MotionNotify))
+               || event->type == MotionNotify)
+#else
+           && ((event->type == GDK_BUTTON_RELEASE && event->button.button < 4)
+               || event->type == GDK_MOTION_NOTIFY)
+#endif
+          )
 #endif /* HAVE_XINPUT2 */
     {
       /* If we are releasing or moving the scroll bar, it has the grab.  */
@@ -4417,7 +4918,11 @@ draw_page (GtkPrintOperation *operation, GtkPrintContext 
*context,
   struct frame *f = XFRAME (Fnth (make_fixnum (page_nr), frames));
   cairo_t *cr = gtk_print_context_get_cairo_context (context);
 
+#ifndef HAVE_PGTK
   x_cr_draw_frame (cr, f);
+#else
+  pgtk_cr_draw_frame (cr, f);
+#endif
 }
 
 void
@@ -4518,7 +5023,11 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
   /* Convert between the modifier bits GDK uses and the modifier bits
      Emacs uses.  This assumes GDK and X masks are the same, which they are 
when
      this is written.  */
+#ifndef HAVE_PGTK
   event.modifiers = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), mod);
+#else
+  event.modifiers = pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), mod);
+#endif
   kbd_buffer_store_event (&event);
 
   /* Return focus to the frame after we have clicked on a detached
@@ -4615,7 +5124,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
 static void
 xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
   GtkWidget *top_widget = x->toolbar_widget;
 
@@ -4671,7 +5180,7 @@ tb_size_cb (GtkWidget    *widget,
 static void
 xg_create_tool_bar (struct frame *f)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
 #ifdef HAVE_GTK3
   GtkStyleContext *gsty;
 #endif
@@ -4910,7 +5419,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char 
*stock_name,
 static bool
 xg_update_tool_bar_sizes (struct frame *f)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   GtkRequisition req;
   int nl = 0, nr = 0, nt = 0, nb = 0;
   GtkWidget *top_widget = x->toolbar_widget;
@@ -4996,7 +5505,7 @@ void
 update_frame_tool_bar (struct frame *f)
 {
   int i, j;
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   int hmargin = 0, vmargin = 0;
   GtkToolbar *wtoolbar;
   GtkToolItem *ti;
@@ -5011,6 +5520,11 @@ update_frame_tool_bar (struct frame *f)
   if (! FRAME_GTK_WIDGET (f))
     return;
 
+#ifdef HAVE_PGTK
+  if (! FRAME_GTK_OUTER_WIDGET (f))
+    return;
+#endif
+
   block_input ();
 
   if (RANGED_FIXNUMP (1, Vtool_bar_button_margin, INT_MAX))
@@ -5306,7 +5820,7 @@ update_frame_tool_bar (struct frame *f)
 void
 free_frame_tool_bar (struct frame *f)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
 
   if (x->toolbar_widget)
     {
@@ -5351,7 +5865,7 @@ free_frame_tool_bar (struct frame *f)
 void
 xg_change_toolbar_position (struct frame *f, Lisp_Object pos)
 {
-  struct x_output *x = f->output_data.x;
+  xp_output *x = f->output_data.xp;
   GtkWidget *top_widget = x->toolbar_widget;
 
   if (! x->toolbar_widget || ! top_widget)
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 95dd75b7fa..5a91825928 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -1,6 +1,6 @@
 /* Definitions and headers for GTK widgets.
 
-Copyright (C) 2003-2021 Free Software Foundation, Inc.
+Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -25,7 +25,13 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include <gtk/gtk.h>
 #include "../lwlib/lwlib-widget.h"
+#ifdef HAVE_PGTK
+#include "pgtkterm.h"
+#define EVENT GdkEvent
+#else
 #include "xterm.h"
+#define EVENT XEvent
+#endif
 
 /* Minimum and maximum values used for GTK scroll bars  */
 
@@ -105,7 +111,7 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar,
 
 extern void xg_update_frame_menubar (struct frame *f);
 
-extern bool xg_event_is_for_menubar (struct frame *, const XEvent *);
+extern bool xg_event_is_for_menubar (struct frame *, const EVENT *);
 
 extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
 
@@ -142,7 +148,7 @@ extern void xg_set_toolkit_horizontal_scroll_bar_thumb 
(struct scroll_bar *bar,
                                                        int portion,
                                                        int position,
                                                        int whole);
-extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent *);
+extern bool xg_event_is_for_scrollbar (struct frame *, const EVENT *);
 extern int xg_get_default_scrollbar_width (struct frame *f);
 extern int xg_get_default_scrollbar_height (struct frame *f);
 
@@ -157,9 +163,15 @@ extern void xg_frame_set_char_size (struct frame *f, int 
width, int height);
 extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
 
 extern int xg_get_scale (struct frame *f);
+#ifndef HAVE_PGTK
 extern void xg_display_open (char *display_name, Display **dpy);
 extern void xg_display_close (Display *dpy);
 extern GdkCursor * xg_create_default_cursor (Display *dpy);
+#else
+extern void xg_display_open (char *display_name, GdkDisplay **dpy);
+extern void xg_display_close (GdkDisplay *gdpy);
+extern GdkCursor * xg_create_default_cursor (GdkDisplay *gdpy);
+#endif
 
 extern bool xg_create_frame_widgets (struct frame *f);
 extern void xg_free_frame_widgets (struct frame *f);
@@ -167,10 +179,15 @@ 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,
                                     Emacs_Color *color);
+#ifdef HAVE_PGTK
+extern void xg_create_frame_outer_widgets (struct frame *f);
+#endif
 
+#ifndef HAVE_PGTK
 extern void xg_set_frame_icon (struct frame *f,
                                Pixmap icon_pixmap,
                                Pixmap icon_mask);
+#endif
 
 extern void xg_set_undecorated (struct frame *f, Lisp_Object undecorated);
 extern void xg_frame_restack (struct frame *f1, struct frame *f2, bool above);
@@ -183,7 +200,11 @@ extern bool xg_prepare_tooltip (struct frame *f,
                                Lisp_Object string,
                                int *width,
                                int *height);
+#ifndef HAVE_PGTK
 extern void xg_show_tooltip (struct frame *f, int root_x, int root_y);
+#else
+extern void xg_show_tooltip (struct frame *f, Lisp_Object string);
+#endif
 extern bool xg_hide_tooltip (struct frame *f);
 
 #ifdef USE_CAIRO
diff --git a/src/haiku.c b/src/haiku.c
index 485d86983c..1c78601255 100644
--- a/src/haiku.c
+++ b/src/haiku.c
@@ -1,5 +1,5 @@
 /* Haiku subroutines that are general to the Haiku operating system.
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haiku_draw_support.cc b/src/haiku_draw_support.cc
index 5b1eccfbe6..5d355ac205 100644
--- a/src/haiku_draw_support.cc
+++ b/src/haiku_draw_support.cc
@@ -1,5 +1,5 @@
 /* Haiku window system support.  Hey, Emacs, this is -*- C++ -*-
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -310,9 +310,10 @@ BView_DrawBitmapWithEraseOp (void *view, void *bitmap, int 
x,
   if (bm->ColorSpace () == B_GRAY1)
     {
       rgb_color low_color = vw->LowColor ();
-      for (int y = 0; y <= bc.Bounds ().Height (); ++y)
+      BRect bounds = bc.Bounds ();
+      for (int y = 0; y < BE_RECT_HEIGHT (bounds); ++y)
        {
-         for (int x = 0; x <= bc.Bounds ().Width (); ++x)
+         for (int x = 0; x <= BE_RECT_WIDTH (bounds); ++x)
            {
              if (bits[y * (stride / 4) + x] == 0xFF000000)
                bits[y * (stride / 4) + x] = RGB_COLOR_UINT32 (low_color);
@@ -336,11 +337,13 @@ BView_DrawMask (void *src, void *view,
 {
   BBitmap *source = (BBitmap *) src;
   BBitmap bm (source->Bounds (), B_RGBA32);
+  BRect bounds = bm.Bounds ();
+
   if (bm.InitCheck () != B_OK)
     return;
-  for (int y = 0; y <= bm.Bounds ().Height (); ++y)
+  for (int y = 0; y < BE_RECT_HEIGHT (bounds); ++y)
     {
-      for (int x = 0; x <= bm.Bounds ().Width (); ++x)
+      for (int x = 0; x < BE_RECT_WIDTH (bounds); ++x)
        {
          int bit = haiku_get_pixel ((void *) source, x, y);
 
@@ -364,8 +367,8 @@ rotate_bitmap_270 (BBitmap *bmp)
                             bmp->ColorSpace (), true);
   if (bm->InitCheck () != B_OK)
     gui_abort ("Failed to init bitmap for rotate");
-  int w = bmp->Bounds ().Width () + 1;
-  int h = bmp->Bounds ().Height () + 1;
+  int w = BE_RECT_WIDTH (r);
+  int h = BE_RECT_HEIGHT (r);
 
   for (int y = 0; y < h; ++y)
     for (int x = 0; x < w; ++x)
@@ -383,8 +386,8 @@ rotate_bitmap_90 (BBitmap *bmp)
                             bmp->ColorSpace (), true);
   if (bm->InitCheck () != B_OK)
     gui_abort ("Failed to init bitmap for rotate");
-  int w = bmp->Bounds ().Width () + 1;
-  int h = bmp->Bounds ().Height () + 1;
+  int w = BE_RECT_WIDTH (r);
+  int h = BE_RECT_HEIGHT (r);
 
   for (int y = 0; y < h; ++y)
     for (int x = 0; x < w; ++x)
@@ -418,45 +421,42 @@ BBitmap_transform_bitmap (void *bitmap, void *mask, 
uint32_t m_color,
        mk = rotate_bitmap_270 (mk);
     }
 
-  BRect r = bm->Bounds ();
-  if (r.Width () != desw || r.Height () != desh)
-    {
-      BRect n = BRect (0, 0, desw - 1, desh - 1);
-      BView vw (n, NULL, B_FOLLOW_NONE, 0);
-      BBitmap *dst = new BBitmap (n, bm->ColorSpace (), true);
-      if (dst->InitCheck () != B_OK)
-       if (bm->InitCheck () != B_OK)
-         gui_abort ("Failed to init bitmap for scale");
-      dst->AddChild (&vw);
-
-      if (!vw.LockLooper ())
-       gui_abort ("Failed to lock offscreen view for scale");
-
-      if (rot != 90 && rot != 270)
-       {
-         BAffineTransform tr;
-         tr.RotateBy (BPoint (desw / 2, desh / 2), rot * M_PI / 180.0);
-         vw.SetTransform (tr);
-       }
+  BRect n = BRect (0, 0, desw - 1, desh - 1);
+  BView vw (n, NULL, B_FOLLOW_NONE, 0);
+  BBitmap *dst = new BBitmap (n, bm->ColorSpace (), true);
+  if (dst->InitCheck () != B_OK)
+    if (bm->InitCheck () != B_OK)
+      gui_abort ("Failed to init bitmap for scale");
+  dst->AddChild (&vw);
 
-      vw.MovePenTo (0, 0);
-      vw.DrawBitmap (bm, n);
-      if (mk)
-       BView_DrawMask ((void *) mk, (void *) &vw,
-                       0, 0, mk->Bounds ().Width (),
-                       mk->Bounds ().Height (),
-                       0, 0, desw, desh, m_color);
-      vw.Sync ();
-      vw.RemoveSelf ();
-
-      if (copied_p)
-       delete bm;
-      if (copied_p && mk)
-       delete mk;
-      return dst;
+  if (!vw.LockLooper ())
+    gui_abort ("Failed to lock offscreen view for scale");
+
+  if (rot != 90 && rot != 270)
+    {
+      BAffineTransform tr;
+      tr.RotateBy (BPoint (desw / 2, desh / 2), rot * M_PI / 180.0);
+      vw.SetTransform (tr);
     }
 
-  return bm;
+  vw.MovePenTo (0, 0);
+  vw.DrawBitmap (bm, n);
+  if (mk)
+    {
+      BRect k = mk->Bounds ();
+      BView_DrawMask ((void *) mk, (void *) &vw,
+                     0, 0, BE_RECT_WIDTH (k),
+                     BE_RECT_HEIGHT (k),
+                     0, 0, desw, desh, m_color);
+    }
+  vw.Sync ();
+  vw.RemoveSelf ();
+
+  if (copied_p)
+    delete bm;
+  if (copied_p && mk)
+    delete mk;
+  return dst;
 }
 
 void
diff --git a/src/haiku_font_support.cc b/src/haiku_font_support.cc
index 9ac0400969..6ea10b2e47 100644
--- a/src/haiku_font_support.cc
+++ b/src/haiku_font_support.cc
@@ -1,5 +1,5 @@
 /* Haiku window system support.  Hey, Emacs, this is -*- C++ -*-
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -126,9 +126,28 @@ BFont_have_char_block (void *font, int32_t beg, int32_t 
end)
   return ft->IncludesBlock (beg, end);
 }
 
-/* Compute bounds for MB_STR, a character in multibyte encoding,
-   used with font.  The width (in pixels) is returned in ADVANCE,
-   the left bearing in LB, and the right bearing in RB.  */
+/* Compute bounds for MB_STR, a character in multibyte encoding, used
+   with FONT.  The distance to move rightwards before reaching to the
+   next character's left escapement boundary is returned in ADVANCE,
+   the left bearing in LB, and the right bearing in RB.
+
+   The left bearing is the amount of pixels from the left escapement
+   boundary (origin) to the left-most pixel that constitutes the glyph
+   corresponding to mb_str, and RB is the amount of pixels from the
+   origin to the right-most pixel constituting the glyph.
+
+   Both the left and right bearings are positive values measured
+   towards the right, which means that the left bearing will only be
+   negative if the left-most pixel is to the left of the origin.
+
+   The bearing values correspond to X11 XCharStruct semantics, which
+   is what Emacs code operates on.  Haiku itself uses a slightly
+   different scheme, where the "left edge" is the distance from the
+   origin to the left-most pixel, where leftwards is negative and
+   rightwards is positive, and the "right edge" is the distance (where
+   leftwards is similarly negative) between the right-most pixel and
+   the right escapement boundary, which is the left escapement
+   boundary plus the advance.  */
 void
 BFont_char_bounds (void *font, const char *mb_str, int *advance,
                   int *lb, int *rb)
@@ -140,9 +159,9 @@ BFont_char_bounds (void *font, const char *mb_str, int 
*advance,
 
   ft->GetEdges (mb_str, 1, &edge_info);
   ft->GetEscapements (mb_str, 1, &escapement);
-  *advance = std::lrint (escapement * size);
-  *lb = std::lrint (edge_info.left * size);
-  *rb = *advance + std::lrint (edge_info.right * size);
+  *advance = std::ceil (escapement * size);
+  *lb =  std::ceil (edge_info.left * size);
+  *rb = *advance + std::ceil (edge_info.right * size);
 }
 
 /* The same, but for a variable amount of chars.  */
diff --git a/src/haiku_io.c b/src/haiku_io.c
index c152d9b086..cb7750634c 100644
--- a/src/haiku_io.c
+++ b/src/haiku_io.c
@@ -1,5 +1,5 @@
 /* Haiku window system support.
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haiku_select.cc b/src/haiku_select.cc
index 6cd6ee879e..041e244f3e 100644
--- a/src/haiku_select.cc
+++ b/src/haiku_select.cc
@@ -1,5 +1,5 @@
 /* Haiku window system selection support. Hey Emacs, this is -*- C++ -*-
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index b8f6e84d2c..2e9eff4067 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1,5 +1,5 @@
 /* Haiku window system support.  Hey, Emacs, this is -*- C++ -*-
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -85,6 +85,37 @@ static key_map *key_map = NULL;
 static char *key_chars = NULL;
 static BLocker key_map_lock;
 
+/* The locking semantics of BWindows running in multiple threads are
+   so complex that child frame state (which is the only state that is
+   shared between different BWindows at runtime) does best with a
+   single global lock.  */
+
+static BLocker child_frame_lock;
+
+/* A LeaveNotify event (well, the closest equivalent on Haiku, which
+   is a B_MOUSE_MOVED event with `transit' set to B_EXITED_VIEW) might
+   be sent out-of-order with regards to motion events from other
+   windows, such as when the mouse pointer rapidly moves from an
+   undecorated child frame to its parent.  This can cause a failure to
+   clear the mouse face on the former if an event for the latter is
+   read by Emacs first and ends up showing the mouse face there.
+
+   While this lock doesn't really ensure that the events will be
+   delivered in the correct order, it makes them arrive in the correct
+   order "most of the time" on my machine, which is good enough and
+   preferable to adding a lot of extra complexity to the event
+   handling code to sort motion events by their timestamps.
+
+   Obviously this depends on the number of execution units that are
+   available, and the scheduling priority of each thread involved in
+   the input handling, but it will be good enough for most people.  */
+
+static BLocker movement_locker;
+
+/* This could be a private API, but it's used by (at least) the Qt
+   port, so it's probably here to stay.  */
+extern status_t get_subpixel_antialiasing (bool *);
+
 extern "C"
 {
   extern _Noreturn void emacs_abort (void);
@@ -104,28 +135,6 @@ gui_abort (const char *msg)
   emacs_abort ();
 }
 
-#ifdef USE_BE_CAIRO
-static cairo_format_t
-cairo_format_from_color_space (color_space space)
-{
-  switch (space)
-    {
-    case B_RGBA32:
-      return CAIRO_FORMAT_ARGB32;
-    case B_RGB32:
-      return CAIRO_FORMAT_RGB24;
-    case B_RGB16:
-      return CAIRO_FORMAT_RGB16_565;
-    case B_GRAY8:
-      return CAIRO_FORMAT_A8;
-    case B_GRAY1:
-      return CAIRO_FORMAT_A1;
-    default:
-      gui_abort ("Unsupported color space");
-    }
-}
-#endif
-
 static void
 map_key (char *chars, int32 offset, uint32_t *c)
 {
@@ -242,7 +251,7 @@ public:
   }
 };
 
-class EmacsWindow : public BDirectWindow
+class EmacsWindow : public BWindow
 {
 public:
   struct child_frame
@@ -260,41 +269,33 @@ public:
   int fullscreen_p = 0;
   int zoomed_p = 0;
   int shown_flag = 0;
+  volatile int was_shown_p = 0;
+  bool menu_bar_active_p = false;
 
-#ifdef USE_BE_CAIRO
-  BLocker surface_lock;
-  cairo_surface_t *cr_surface = NULL;
-#endif
-
-  EmacsWindow () : BDirectWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK,
-                                 B_NORMAL_WINDOW_FEEL, 
B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
+  EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK,
+                           B_NORMAL_WINDOW_FEEL, 
B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
   {
 
   }
 
   ~EmacsWindow ()
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
     struct child_frame *next;
     for (struct child_frame *f = subset_windows; f; f = next)
       {
+       if (f->window->LockLooper ())
+         gui_abort ("Failed to lock looper for unparent");
        f->window->Unparent ();
+       f->window->UnlockLooper ();
        next = f->next;
        delete f;
       }
 
     if (this->parent)
       UnparentAndUnlink ();
-
-#ifdef USE_BE_CAIRO
-    if (!surface_lock.Lock ())
-      gui_abort ("Failed to lock cairo surface");
-    if (cr_surface)
-      {
-       cairo_surface_destroy (cr_surface);
-       cr_surface = NULL;
-      }
-    surface_lock.Unlock ();
-#endif
+    child_frame_lock.Unlock ();
   }
 
   void
@@ -307,10 +308,16 @@ public:
   void
   UpwardsSubsetChildren (EmacsWindow *w)
   {
+    if (!LockLooper ())
+      gui_abort ("Failed to lock looper for subset");
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
     UpwardsSubset (w);
     for (struct child_frame *f = subset_windows; f;
         f = f->next)
       f->window->UpwardsSubsetChildren (w);
+    child_frame_lock.Unlock ();
+    UnlockLooper ();
   }
 
   void
@@ -323,15 +330,23 @@ public:
   void
   UpwardsUnSubsetChildren (EmacsWindow *w)
   {
+    if (!LockLooper ())
+      gui_abort ("Failed to lock looper for unsubset");
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
     UpwardsUnSubset (w);
     for (struct child_frame *f = subset_windows; f;
         f = f->next)
       f->window->UpwardsUnSubsetChildren (w);
+    child_frame_lock.Unlock ();
+    UnlockLooper ();
   }
 
   void
   Unparent (void)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
     this->SetFeel (B_NORMAL_WINDOW_FEEL);
     UpwardsUnSubsetChildren (parent);
     this->RemoveFromSubset (this);
@@ -341,13 +356,17 @@ public:
        fullscreen_p = 0;
        MakeFullscreen (1);
       }
+    child_frame_lock.Unlock ();
   }
 
   void
   UnparentAndUnlink (void)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
     this->parent->UnlinkChild (this);
     this->Unparent ();
+    child_frame_lock.Unlock ();
   }
 
   void
@@ -362,8 +381,8 @@ public:
          {
            if (last)
              last->next = tem->next;
-           if (tem == subset_windows)
-             subset_windows = NULL;
+           else
+             subset_windows = tem->next;
            delete tem;
            return;
          }
@@ -375,6 +394,9 @@ public:
   void
   ParentTo (EmacsWindow *window)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
     if (this->parent)
       UnparentAndUnlink ();
 
@@ -390,6 +412,8 @@ public:
       }
     this->Sync ();
     window->LinkChild (this);
+
+    child_frame_lock.Unlock ();
   }
 
   void
@@ -418,7 +442,6 @@ public:
     BRect frame = this->Frame ();
     f->window->MoveTo (frame.left + f->xoff,
                       frame.top + f->yoff);
-    this->Sync ();
   }
 
   void
@@ -431,6 +454,9 @@ public:
   MoveChild (EmacsWindow *window, int xoff, int yoff,
             int weak_p)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
     for (struct child_frame *f = subset_windows; f;
         f = f->next)
       {
@@ -440,10 +466,13 @@ public:
            f->yoff = yoff;
            if (!weak_p)
              DoMove (f);
+
+           child_frame_lock.Unlock ();
            return;
          }
       }
 
+    child_frame_lock.Unlock ();
     gui_abort ("Trying to move a child frame that doesn't exist");
   }
 
@@ -457,43 +486,6 @@ public:
     haiku_write (ACTIVATION, &rq);
   }
 
-  void
-  DirectConnected (direct_buffer_info *info)
-  {
-#ifdef USE_BE_CAIRO
-    if (!surface_lock.Lock ())
-      gui_abort ("Failed to lock window direct cr surface");
-    if (cr_surface)
-      {
-       cairo_surface_destroy (cr_surface);
-       cr_surface = NULL;
-      }
-
-    if (info->buffer_state != B_DIRECT_STOP)
-      {
-       int left, top, right, bottom;
-       left = info->clip_bounds.left;
-       top = info->clip_bounds.top;
-       right = info->clip_bounds.right;
-       bottom = info->clip_bounds.bottom;
-
-       unsigned char *bits = (unsigned char *) info->bits;
-       if ((info->bits_per_pixel % 8) == 0)
-         {
-           bits += info->bytes_per_row * top;
-           bits += (left * info->bits_per_pixel / 8);
-           cr_surface = cairo_image_surface_create_for_data
-             (bits,
-              cairo_format_from_color_space (info->pixel_format),
-              right - left + 1,
-              bottom - top + 1,
-              info->bytes_per_row);
-         }
-      }
-    surface_lock.Unlock ();
-#endif
-  }
-
   void
   MessageReceived (BMessage *msg)
   {
@@ -567,7 +559,7 @@ public:
        haiku_write (FILE_PANEL_EVENT, &rq);
       }
     else
-      BDirectWindow::MessageReceived (msg);
+      BWindow::MessageReceived (msg);
   }
 
   void
@@ -576,6 +568,15 @@ public:
     if (msg->what == B_KEY_DOWN || msg->what == B_KEY_UP)
       {
        struct haiku_key_event rq;
+
+       /* Pass through key events to the regular dispatch mechanism
+          if the menu bar active, so that key navigation can work.  */
+       if (menu_bar_active_p)
+         {
+           BWindow::DispatchMessage (msg, handler);
+           return;
+         }
+
        rq.window = this;
 
        int32_t code = msg->GetInt32 ("raw_char", 0);
@@ -638,7 +639,7 @@ public:
          };
       }
     else
-      BDirectWindow::DispatchMessage (msg, handler);
+      BWindow::DispatchMessage (msg, handler);
   }
 
   void
@@ -648,6 +649,7 @@ public:
     rq.window = this;
 
     haiku_write (MENU_BAR_OPEN, &rq);
+    menu_bar_active_p = true;
   }
 
   void
@@ -657,6 +659,7 @@ public:
     rq.window = this;
 
     haiku_write (MENU_BAR_CLOSE, &rq);
+    menu_bar_active_p = false;
   }
 
   void
@@ -668,7 +671,7 @@ public:
     rq.px_widthf = newWidth + 1.0f;
 
     haiku_write (FRAME_RESIZED, &rq);
-    BDirectWindow::FrameResized (newWidth, newHeight);
+    BWindow::FrameResized (newWidth, newHeight);
   }
 
   void
@@ -681,27 +684,39 @@ public:
 
     haiku_write (MOVE_EVENT, &rq);
 
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
     for (struct child_frame *f = subset_windows;
         f; f = f->next)
       DoMove (f);
-    BDirectWindow::FrameMoved (newPosition);
+    child_frame_lock.Unlock ();
+
+    Sync ();
+    BWindow::FrameMoved (newPosition);
   }
 
   void
   WorkspacesChanged (uint32_t old, uint32_t n)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frames for changing workspaces");
     for (struct child_frame *f = subset_windows;
         f; f = f->next)
       DoUpdateWorkspace (f);
+    child_frame_lock.Unlock ();
   }
 
   void
   EmacsMoveTo (int x, int y)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
     if (!this->parent)
       this->MoveTo (x, y);
     else
       this->parent->MoveChild (this, x, y, 0);
+    child_frame_lock.Unlock ();
   }
 
   bool
@@ -716,7 +731,7 @@ public:
   void
   Minimize (bool minimized_p)
   {
-    BDirectWindow::Minimize (minimized_p);
+    BWindow::Minimize (minimized_p);
     struct haiku_iconification_event rq;
     rq.window = this;
     rq.iconified_p = !parent && minimized_p;
@@ -729,9 +744,14 @@ public:
   {
     if (this->IsHidden ())
       return;
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
     Hide ();
     if (this->parent)
       UpwardsUnSubsetChildren (this->parent);
+
+    child_frame_lock.Unlock ();
   }
 
   void
@@ -739,11 +759,29 @@ public:
   {
     if (!this->IsHidden ())
       return;
+
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
+    if (!was_shown_p)
+      {
+       /* This window is being shown for the first time, which means
+          Show will unlock the looper.  In this case, it should be
+          locked again, since the looper is unlocked when the window
+          is first created.  */
+
+       if (!LockLooper ())
+         gui_abort ("Failed to lock looper during first window show");
+       was_shown_p = true;
+      }
+
     if (this->parent)
       shown_flag = 1;
     Show ();
     if (this->parent)
       UpwardsSubsetChildren (this->parent);
+
+    child_frame_lock.Unlock ();
   }
 
   void
@@ -776,7 +814,7 @@ public:
        x_before_zoom = y_before_zoom = INT_MIN;
       }
 
-    BDirectWindow::Zoom (o, w, h);
+    BWindow::Zoom (o, w, h);
   }
 
   void
@@ -787,29 +825,40 @@ public:
     zoomed_p = 0;
 
     EmacsMoveTo (pre_zoom_rect.left, pre_zoom_rect.top);
-    ResizeTo (pre_zoom_rect.Width (),
-             pre_zoom_rect.Height ());
+    ResizeTo (BE_RECT_WIDTH (pre_zoom_rect),
+             BE_RECT_HEIGHT (pre_zoom_rect));
   }
 
   void
   GetParentWidthHeight (int *width, int *height)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
     if (parent)
       {
-       *width = parent->Frame ().Width ();
-       *height = parent->Frame ().Height ();
+       BRect frame = parent->Frame ();
+       *width = BE_RECT_WIDTH (frame);
+       *height = BE_RECT_HEIGHT (frame);
       }
     else
       {
        BScreen s (this);
-       *width = s.Frame ().Width ();
-       *height = s.Frame ().Height ();
+       BRect frame = s.Frame ();
+
+       *width = BE_RECT_WIDTH (frame);
+       *height = BE_RECT_HEIGHT (frame);
       }
+
+    child_frame_lock.Unlock ();
   }
 
   void
   OffsetChildRect (BRect *r, EmacsWindow *c)
   {
+    if (!child_frame_lock.Lock ())
+      gui_abort ("Failed to lock child frame state lock");
+
     for (struct child_frame *f; f; f = f->next)
       if (f->window == c)
        {
@@ -817,9 +866,11 @@ public:
          r->bottom -= f->yoff;
          r->left -= f->xoff;
          r->right -= f->xoff;
+         child_frame_lock.Unlock ();
          return;
        }
 
+    child_frame_lock.Lock ();
     gui_abort ("Trying to calculate offsets for a child frame that doesn't 
exist");
   }
 
@@ -828,8 +879,8 @@ public:
   {
     BScreen screen (this);
 
-      if (!screen.IsValid ())
-       gui_abort ("Trying to make a window fullscreen without a screen");
+    if (!screen.IsValid ())
+      gui_abort ("Trying to make a window fullscreen without a screen");
 
     if (make_fullscreen_p == fullscreen_p)
       return;
@@ -843,9 +894,15 @@ public:
 
        flags |= B_NOT_MOVABLE | B_NOT_ZOOMABLE;
        pre_fullscreen_rect = Frame ();
+
+       if (!child_frame_lock.Lock ())
+         gui_abort ("Failed to lock child frame state lock");
+
        if (parent)
          parent->OffsetChildRect (&pre_fullscreen_rect, this);
 
+       child_frame_lock.Unlock ();
+
        int w, h;
        EmacsMoveTo (0, 0);
        GetParentWidthHeight (&w, &h);
@@ -856,8 +913,8 @@ public:
        flags &= ~(B_NOT_MOVABLE | B_NOT_ZOOMABLE);
        EmacsMoveTo (pre_fullscreen_rect.left,
                     pre_fullscreen_rect.top);
-       ResizeTo (pre_fullscreen_rect.Width (),
-                 pre_fullscreen_rect.Height ());
+       ResizeTo (BE_RECT_WIDTH (pre_fullscreen_rect),
+                 BE_RECT_HEIGHT (pre_fullscreen_rect));
       }
     SetFlags (flags);
   }
@@ -870,6 +927,14 @@ public:
   {
   }
 
+  void
+  AttachedToWindow (void)
+  {
+    BWindow *window = Window ();
+
+    window->SetKeyMenuBar (this);
+  }
+
   void
   FrameResized (float newWidth, float newHeight)
   {
@@ -940,10 +1005,12 @@ public:
       gui_abort ("Could not lock cr surface during attachment");
     if (cr_surface)
       gui_abort ("Trying to attach cr surface when one already exists");
+    BRect bounds = offscreen_draw_bitmap_1->Bounds ();
+
     cr_surface = cairo_image_surface_create_for_data
       ((unsigned char *) offscreen_draw_bitmap_1->Bits (),
-       CAIRO_FORMAT_ARGB32, offscreen_draw_bitmap_1->Bounds ().Width (),
-       offscreen_draw_bitmap_1->Bounds ().Height (),
+       CAIRO_FORMAT_ARGB32, BE_RECT_WIDTH (bounds),
+       BE_RECT_HEIGHT (bounds),
        offscreen_draw_bitmap_1->BytesPerRow ());
     if (!cr_surface)
       gui_abort ("Cr surface allocation failed for double-buffered view");
@@ -997,8 +1064,11 @@ public:
        if (offscreen_draw_bitmap_1->InitCheck () != B_OK)
          gui_abort ("Offscreen draw bitmap initialization failed");
 
-       offscreen_draw_view->MoveTo (Frame ().left, Frame ().top);
-       offscreen_draw_view->ResizeTo (Frame ().Width (), Frame ().Height ());
+       BRect frame = Frame ();
+
+       offscreen_draw_view->MoveTo (frame.left, frame.top);
+       offscreen_draw_view->ResizeTo (BE_RECT_WIDTH (frame),
+                                      BE_RECT_HEIGHT (frame));
        offscreen_draw_bitmap_1->AddChild (offscreen_draw_view);
 #ifdef USE_BE_CAIRO
        AttachCairoSurface ();
@@ -1037,7 +1107,7 @@ public:
        return;
       }
 
-    if (w->shown_flag)
+    if (w->shown_flag && offscreen_draw_view)
       {
        PushState ();
        SetDrawingMode (B_OP_ERASE);
@@ -1140,7 +1210,7 @@ public:
     if (looper_locked_count)
       {
        if (!offscreen_draw_bitmap_1->Lock ())
-         gui_abort ("Failed to lock bitmap after double buffering was set 
up.");
+         gui_abort ("Failed to lock bitmap after double buffering was set up");
       }
 
     UnlockLooper ();
@@ -1162,7 +1232,11 @@ public:
       ToolTip ()->SetMouseRelativeLocation (BPoint (-(point.x - tt_absl_pos.x),
                                                    -(point.y - 
tt_absl_pos.y)));
 
-    haiku_write (MOUSE_MOTION, &rq);
+    if (movement_locker.Lock ())
+      {
+       haiku_write (MOUSE_MOTION, &rq);
+       movement_locker.Unlock ();
+      }
   }
 
   void
@@ -1383,7 +1457,7 @@ public:
       {
        BRect r = menu->Frame ();
        int w = menu->StringWidth (key);
-       menu->MovePenTo (BPoint (r.Width () - w - 4,
+       menu->MovePenTo (BPoint (BE_RECT_WIDTH (r) - w - 4,
                                 menu->PenLocation ().y));
        menu->DrawString (key);
       }
@@ -1551,10 +1625,18 @@ BWindow_new (void *_view)
   if (!vw)
     {
       *v = NULL;
-      window->Lock ();
+      window->LockLooper ();
       window->Quit ();
       return NULL;
     }
+
+  /* Windows are created locked by the current thread, but calling
+     Show for the first time causes them to be unlocked.  To avoid a
+     deadlock when a frame is created invisible in one thread, and
+     another thread later tries to lock it, the window is unlocked
+     here, and EmacsShow will lock it manually if it's being shown for
+     the first time.  */
+  window->UnlockLooper ();
   window->AddChild (vw);
   *v = vw;
   return window;
@@ -1563,7 +1645,7 @@ BWindow_new (void *_view)
 void
 BWindow_quit (void *window)
 {
-  ((BWindow *) window)->Lock ();
+  ((BWindow *) window)->LockLooper ();
   ((BWindow *) window)->Quit ();
 }
 
@@ -1610,7 +1692,6 @@ BWindow_set_visible (void *window, int visible_p)
        win->Minimize (false);
       win->EmacsHide ();
     }
-  win->Sync ();
 }
 
 /* Change the title of WINDOW to the multibyte string TITLE.  */
@@ -2224,8 +2305,14 @@ BMenuBar_delete (void *menubar)
 {
   BView *vw = (BView *) menubar;
   BView *p = vw->Parent ();
+  EmacsWindow *window = (EmacsWindow *) p->Window ();
+
   if (!p->LockLooper ())
     gui_abort ("Failed to lock menu bar parent while removing menubar");
+  window->SetKeyMenuBar (NULL);
+  /* MenusEnded isn't called if the menu bar is destroyed
+     before it closes.  */
+  window->menu_bar_active_p = false;
   vw->RemoveSelf ();
   p->UnlockLooper ();
   delete vw;
@@ -2597,7 +2684,8 @@ char *
 be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, 
int dir_only_p,
                      void *window, const char *save_text, const char *prompt,
                      void (*block_input_function) (void),
-                     void (*unblock_input_function) (void))
+                     void (*unblock_input_function) (void),
+                     void (*maybe_quit_function) (void))
 {
   ptrdiff_t idx = c_specpdl_idx_from_cxx ();
   /* setjmp/longjmp is UB with automatic objects. */
@@ -2608,7 +2696,6 @@ be_popup_file_dialog (int open_p, const char 
*default_dir, int must_match_p, int
   BMessage *msg = new BMessage ('FPSE');
   BFilePanel *panel = new BFilePanel (open_p ? B_OPEN_PANEL : B_SAVE_PANEL,
                                      NULL, NULL, mode);
-  unblock_input_function ();
 
   struct popup_file_dialog_data dat;
   dat.entry = path;
@@ -2632,7 +2719,7 @@ be_popup_file_dialog (int open_p, const char 
*default_dir, int must_match_p, int
   be_popup_file_dialog_safe_set_target (panel, w);
 
   panel->Show ();
-  panel->Window ()->Show ();
+  unblock_input_function ();
 
   void *buf = alloca (200);
   while (1)
@@ -2642,19 +2729,26 @@ be_popup_file_dialog (int open_p, const char 
*default_dir, int must_match_p, int
 
       if (!haiku_read_with_timeout (&type, buf, 200, 100000))
        {
+         block_input_function ();
          if (type != FILE_PANEL_EVENT)
            haiku_write (type, buf);
          else if (!ptr)
            ptr = (char *) ((struct haiku_file_panel_event *) buf)->ptr;
+         unblock_input_function ();
+
+         maybe_quit_function ();
        }
 
       ssize_t b_s;
+      block_input_function ();
       haiku_read_size (&b_s);
-      if (!b_s || b_s == -1 || ptr || panel->Window ()->IsHidden ())
+      if (!b_s || ptr || panel->Window ()->IsHidden ())
        {
          c_unbind_to_nil_from_cxx (idx);
+         unblock_input_function ();
          return ptr;
        }
+      unblock_input_function ();
     }
 }
 
@@ -2816,8 +2910,7 @@ cairo_surface_t *
 EmacsView_cairo_surface (void *view)
 {
   EmacsView *vw = (EmacsView *) view;
-  EmacsWindow *wn = (EmacsWindow *) vw->Window ();
-  return vw->cr_surface ? vw->cr_surface : wn->cr_surface;
+  return vw->cr_surface;
 }
 
 /* Transfer each clip rectangle in VIEW to the cairo context
@@ -2832,8 +2925,9 @@ BView_cr_dump_clipping (void *view, cairo_t *ctx)
   for (int i = 0; i < cr.CountRects (); ++i)
     {
       BRect r = cr.RectAt (i);
-      cairo_rectangle (ctx, r.left, r.top, r.Width () + 1,
-                      r.Height () + 1);
+      cairo_rectangle (ctx, r.left, r.top,
+                      BE_RECT_WIDTH (r),
+                      BE_RECT_HEIGHT (r));
     }
 
   cairo_clip (ctx);
@@ -2843,10 +2937,7 @@ BView_cr_dump_clipping (void *view, cairo_t *ctx)
 void
 EmacsWindow_begin_cr_critical_section (void *window)
 {
-  EmacsWindow *w = (EmacsWindow *) window;
-  if (!w->surface_lock.Lock ())
-    gui_abort ("Couldn't lock cairo surface");
-
+  BWindow *w = (BWindow *) window;
   BView *vw = (BView *) w->FindView ("Emacs");
   EmacsView *ev = dynamic_cast <EmacsView *> (vw);
   if (ev && !ev->cr_surface_lock.Lock ())
@@ -2857,8 +2948,7 @@ EmacsWindow_begin_cr_critical_section (void *window)
 void
 EmacsWindow_end_cr_critical_section (void *window)
 {
-  EmacsWindow *w = (EmacsWindow *) window;
-  w->surface_lock.Unlock ();
+  BWindow *w = (BWindow *) window;
   BView *vw = (BView *) w->FindView ("Emacs");
   EmacsView *ev = dynamic_cast <EmacsView *> (vw);
   if (ev)
@@ -2910,6 +3000,18 @@ BWindow_set_min_size (void *window, int width, int 
height)
   w->UnlockLooper ();
 }
 
+/* Synchronize WINDOW's connection to the App Server.  */
+void
+BWindow_sync (void *window)
+{
+  BWindow *w = (BWindow *) window;
+
+  if (!w->LockLooper ())
+    gui_abort ("Failed to lock window looper for sync");
+  w->Sync ();
+  w->UnlockLooper ();
+}
+
 /* Set the alignment of WINDOW's dimensions.  */
 void
 BWindow_set_size_alignment (void *window, int align_width, int align_height)
@@ -2926,3 +3028,33 @@ BWindow_set_size_alignment (void *window, int 
align_width, int align_height)
 #endif
   w->UnlockLooper ();
 }
+
+void
+BWindow_send_behind (void *window, void *other_window)
+{
+  BWindow *w = (BWindow *) window;
+  BWindow *other = (BWindow *) other_window;
+
+  if (!w->LockLooper ())
+    gui_abort ("Failed to lock window in order to send it behind another");
+  w->SendBehind (other);
+  w->UnlockLooper ();
+}
+
+bool
+BWindow_is_active (void *window)
+{
+  BWindow *w = (BWindow *) window;
+  return w->IsActive ();
+}
+
+bool
+be_use_subpixel_antialiasing (void)
+{
+  bool current_subpixel_antialiasing;
+
+  if (get_subpixel_antialiasing (&current_subpixel_antialiasing) != B_OK)
+    return false;
+
+  return current_subpixel_antialiasing;
+}
diff --git a/src/haiku_support.h b/src/haiku_support.h
index 9f5f3c77e3..6a99eb245d 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -1,5 +1,5 @@
 /* Haiku window system support.  Hey Emacs, this is -*- C++ -*-
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -32,6 +32,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <cairo.h>
 #endif
 
+#include <math.h>
+
 enum haiku_cursor
   {
     CURSOR_ID_NO_CURSOR = 12,
@@ -310,6 +312,28 @@ struct haiku_menu_bar_state_event
 #define HAIKU_BLACK 1000
 #define HAIKU_MEDIUM 2000
 
+#ifdef __cplusplus
+/* Haiku's built in Height and Width functions for calculating
+   rectangle sizes are broken, probably for compatibility with BeOS:
+   they do not round up in a reasonable fashion, and they return the
+   numerical difference between the end and start sides in both
+   directions, instead of the actual size.
+
+   For example:
+
+     BRect (1, 1, 5, 5).IntegerWidth ()
+
+   Will return 4, when in reality the rectangle is 5 pixels wide,
+   since the left corner is also a pixel!
+
+   All code in Emacs should use the macros below to calculate the
+   dimensions of a BRect, instead of relying on the broken Width and
+   Height functions.  */
+
+#define BE_RECT_HEIGHT(rect) (ceil (((rect).bottom - (rect).top) + 1))
+#define BE_RECT_WIDTH(rect) (ceil (((rect).right - (rect).left) + 1))
+#endif /* __cplusplus */
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -740,7 +764,8 @@ extern "C"
                        int dir_only_p, void *window, const char *save_text,
                        const char *prompt,
                        void (*block_input_function) (void),
-                       void (*unblock_input_function) (void));
+                       void (*unblock_input_function) (void),
+                       void (*maybe_quit_function) (void));
 
   extern void
   record_c_unwind_protect_from_cxx (void (*) (void *), void *);
@@ -819,6 +844,18 @@ extern "C"
   extern void
   BWindow_set_size_alignment (void *window, int align_width, int align_height);
 
+  extern void
+  BWindow_sync (void *window);
+
+  extern void
+  BWindow_send_behind (void *window, void *other_window);
+
+  extern bool
+  BWindow_is_active (void *window);
+
+  extern bool
+  be_use_subpixel_antialiasing (void);
+
 #ifdef __cplusplus
   extern void *
   find_appropriate_view_for_draw (void *vw);
diff --git a/src/haikufns.c b/src/haikufns.c
index 868fc71f97..4a0d2272d0 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -1,5 +1,5 @@
 /* Haiku window system support
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1238,7 +1238,7 @@ haiku_get_pixel (haiku bitmap, int x, int y)
   BBitmap_dimensions (bitmap, &left, &top, &right, &bottom,
                      &bytes_per_row, &mono_p);
 
-  if (x < left || x > right || y < top || y > bottom)
+  if (x < 0 || x > right - left || y < 0 || y > bottom - top)
     emacs_abort ();
 
   if (!mono_p)
@@ -1263,7 +1263,7 @@ haiku_put_pixel (haiku bitmap, int x, int y, unsigned 
long pixel)
   BBitmap_dimensions (bitmap, &left, &top, &right, &bottom,
                      &bytes_per_row, &mono_p);
 
-  if (x < left || x > right || y < top || y > bottom)
+  if (x < 0 || x > right - left || y < 0 || y > bottom - top)
     emacs_abort ();
 
   if (mono_p)
@@ -1291,8 +1291,8 @@ haiku_free_frame_resources (struct frame *f)
   Lisp_Object bar;
   struct scroll_bar *b;
 
-  block_input ();
   check_window_system (f);
+  block_input ();
 
   hlinfo = MOUSE_HL_INFO (f);
   window = FRAME_HAIKU_WINDOW (f);
@@ -1393,6 +1393,7 @@ haiku_visualize_frame (struct frame *f)
       if (FRAME_NO_FOCUS_ON_MAP (f) &&
          !FRAME_NO_ACCEPT_FOCUS (f))
        BWindow_set_avoid_focus (FRAME_HAIKU_WINDOW (f), 0);
+      BWindow_sync (FRAME_HAIKU_WINDOW (f));
 
       haiku_set_offset (f, f->left_pos, f->top_pos, 0);
 
@@ -1409,6 +1410,7 @@ haiku_unvisualize_frame (struct frame *f)
   block_input ();
 
   BWindow_set_visible (FRAME_HAIKU_WINDOW (f), 0);
+  BWindow_sync (FRAME_HAIKU_WINDOW (f));
   SET_FRAME_VISIBLE (f, 0);
   SET_FRAME_ICONIFIED (f, 0);
 
@@ -1510,20 +1512,24 @@ haiku_set_inhibit_double_buffering (struct frame *f,
                                    Lisp_Object old_value)
 {
   block_input ();
+#ifndef USE_BE_CAIRO
   if (FRAME_HAIKU_WINDOW (f))
     {
       if (NILP (new_value))
        {
+#endif
          EmacsView_set_up_double_buffering (FRAME_HAIKU_VIEW (f));
          if (!NILP (old_value))
            {
              SET_FRAME_GARBAGED (f);
              expose_frame (f, 0, 0, 0, 0);
            }
+#ifndef USE_BE_CAIRO
        }
       else
        EmacsView_disable_double_buffering (FRAME_HAIKU_VIEW (f));
     }
+#endif
   unblock_input ();
 }
 
@@ -1970,7 +1976,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
   /* Calculate size of tooltip window.  */
   size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
-                                 make_fixnum (w->pixel_height), Qnil);
+                                 make_fixnum (w->pixel_height), Qnil,
+                                 Qnil);
   /* Add the frame's internal border to calculated size.  */
   width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
   height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
@@ -2231,7 +2238,7 @@ Optional arg SAVE_TEXT, if non-nil, specifies some text 
to show in the entry fie
                                   FRAME_HAIKU_WINDOW (f),
                                   !NILP (save_text) ? SSDATA (ENCODE_UTF_8 
(save_text)) : NULL,
                                   SSDATA (ENCODE_UTF_8 (prompt)),
-                                  block_input, unblock_input);
+                                  block_input, unblock_input, maybe_quit);
 
   unbind_to (idx, Qnil);
 
@@ -2314,6 +2321,67 @@ DEFUN ("x-display-save-under", Fx_display_save_under,
   return Qnil;
 }
 
+DEFUN ("haiku-frame-restack", Fhaiku_frame_restack, Shaiku_frame_restack, 2, 
3, 0,
+       doc: /* Restack FRAME1 below FRAME2.
+This means that if both frames are visible and the display areas of
+these frames overlap, FRAME2 (partially) obscures FRAME1.  If optional
+third argument ABOVE is non-nil, restack FRAME1 above FRAME2.  This
+means that if both frames are visible and the display areas of these
+frames overlap, FRAME1 (partially) obscures FRAME2.
+
+Some window managers may refuse to restack windows.  */)
+     (Lisp_Object frame1, Lisp_Object frame2, Lisp_Object above)
+{
+  struct frame *f1 = decode_live_frame (frame1);
+  struct frame *f2 = decode_live_frame (frame2);
+
+  check_window_system (f1);
+  check_window_system (f2);
+
+  block_input ();
+
+  if (NILP (above))
+    {
+      /* If the window that is currently active will be sent behind
+        another window, make the window that it is being sent behind
+        active first, to avoid both windows being moved to the back of
+        the display.  */
+
+      if (BWindow_is_active (FRAME_HAIKU_WINDOW (f1))
+         /* But don't do this if any of the frames involved have
+            child frames, since they are guaranteed to be in front of
+            their toplevel parents.  */
+         && !FRAME_PARENT_FRAME (f1)
+         && !FRAME_PARENT_FRAME (f2))
+       {
+         BWindow_activate (FRAME_HAIKU_WINDOW (f2));
+         BWindow_sync (FRAME_HAIKU_WINDOW (f2));
+       }
+
+      BWindow_send_behind (FRAME_HAIKU_WINDOW (f1),
+                          FRAME_HAIKU_WINDOW (f2));
+    }
+  else
+    {
+      if (BWindow_is_active (FRAME_HAIKU_WINDOW (f2))
+         && !FRAME_PARENT_FRAME (f1)
+         && !FRAME_PARENT_FRAME (f2))
+       {
+         BWindow_activate (FRAME_HAIKU_WINDOW (f1));
+         BWindow_sync (FRAME_HAIKU_WINDOW (f1));
+       }
+
+      BWindow_send_behind (FRAME_HAIKU_WINDOW (f2),
+                          FRAME_HAIKU_WINDOW (f1));
+    }
+  BWindow_sync (FRAME_HAIKU_WINDOW (f1));
+  BWindow_sync (FRAME_HAIKU_WINDOW (f2));
+
+  unblock_input ();
+
+  return Qnil;
+}
+
 frame_parm_handler haiku_frame_parm_handlers[] =
   {
     gui_set_autoraise,
@@ -2408,6 +2476,7 @@ syms_of_haikufns (void)
   defsubr (&Shaiku_put_resource);
   defsubr (&Shaiku_frame_list_z_order);
   defsubr (&Sx_display_save_under);
+  defsubr (&Shaiku_frame_restack);
 
   tip_timer = Qnil;
   staticpro (&tip_timer);
diff --git a/src/haikufont.c b/src/haikufont.c
index 811fa62a84..e08792be4b 100644
--- a/src/haikufont.c
+++ b/src/haikufont.c
@@ -1,6 +1,6 @@
 /* Font support for Haiku windowing
 
-Copyright (C) 2021 Free Software Foundation, Inc.
+Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -956,7 +956,6 @@ haikufont_draw (struct glyph_string *s, int from, int to,
   prepare_face_for_display (s->f, face);
 
   BView_draw_lock (view);
-  BView_StartClip (view);
   if (with_background)
     {
       int height = FONT_HEIGHT (s->font), ascent = FONT_BASE (s->font);
@@ -984,13 +983,6 @@ haikufont_draw (struct glyph_string *s, int from, int to,
       s->background_filled_p = 1;
     }
 
-  if (s->left_overhang && s->clip_head && !s->for_overlaps)
-    {
-      /* XXX: Why is this neccessary? */
-      BView_ClipToRect (view, s->clip_head->x, 0,
-                       FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
-    }
-
   if (s->hl == DRAW_CURSOR)
     BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
   else
@@ -1022,7 +1014,6 @@ haikufont_draw (struct glyph_string *s, int from, int to,
       BView_DrawString (view, b, b_len);
       xfree (b);
     }
-  BView_EndClip (view);
   BView_draw_unlock (view);
   unblock_input ();
   return 1;
diff --git a/src/haikugui.h b/src/haikugui.h
index cfc693fb55..b744885a42 100644
--- a/src/haikugui.h
+++ b/src/haikugui.h
@@ -1,5 +1,5 @@
 /* Haiku window system support
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haikuimage.c b/src/haikuimage.c
index 138e5b84e6..4ffa214f1c 100644
--- a/src/haikuimage.c
+++ b/src/haikuimage.c
@@ -1,5 +1,5 @@
 /* Haiku window system support.
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haikumenu.c b/src/haikumenu.c
index 698da9d639..f335bdacb4 100644
--- a/src/haikumenu.c
+++ b/src/haikumenu.c
@@ -1,5 +1,5 @@
 /* Haiku window system support
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -59,10 +59,17 @@ digest_menu_items (void *first_menu, int start, int 
menu_items_used,
   menus[0] = first_menu;
 
   void *window = NULL;
+  void *view = NULL;
   if (FRAMEP (Vmenu_updating_frame) &&
       FRAME_LIVE_P (XFRAME (Vmenu_updating_frame)) &&
       FRAME_HAIKU_P (XFRAME (Vmenu_updating_frame)))
-    window = FRAME_HAIKU_WINDOW (XFRAME (Vmenu_updating_frame));
+    {
+      window = FRAME_HAIKU_WINDOW (XFRAME (Vmenu_updating_frame));
+      view = FRAME_HAIKU_VIEW (XFRAME (Vmenu_updating_frame));
+    }
+
+  if (view)
+    BView_draw_lock (view);
 
   while (i < menu_items_used)
     {
@@ -161,6 +168,9 @@ digest_menu_items (void *first_menu, int start, int 
menu_items_used,
          i += MENU_ITEMS_ITEM_LENGTH;
        }
     }
+
+  if (view)
+    BView_draw_unlock (view);
 }
 
 static Lisp_Object
@@ -314,9 +324,8 @@ haiku_menu_show (struct frame *f, int x, int y, int 
menuflags,
     }
   digest_menu_items (menu, 0, menu_items_used, 0);
   BView_convert_to_screen (view, &x, &y);
-  unblock_input ();
-
   menu_item_selection = BMenu_run (menu, x, y);
+  unblock_input ();
 
   FRAME_DISPLAY_INFO (f)->grabbed = 0;
 
@@ -366,7 +375,9 @@ haiku_menu_show (struct frame *f, int x, int y, int 
menuflags,
                        if (!NILP (subprefix_stack[j]))
                          entry = Fcons (subprefix_stack[j], entry);
                    }
+                 block_input ();
                  BPopUpMenu_delete (menu);
+                 unblock_input ();
                  return entry;
                }
              i += MENU_ITEMS_ITEM_LENGTH;
@@ -375,10 +386,14 @@ haiku_menu_show (struct frame *f, int x, int y, int 
menuflags,
     }
   else if (!(menuflags & MENU_FOR_CLICK))
     {
+      block_input ();
       BPopUpMenu_delete (menu);
+      unblock_input ();
       quit ();
     }
+  block_input ();
   BPopUpMenu_delete (menu);
+  unblock_input ();
   return Qnil;
 }
 
@@ -615,12 +630,12 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, 
Smenu_or_popup_active_
 }
 
 DEFUN ("haiku-menu-bar-open", Fhaiku_menu_bar_open, Shaiku_menu_bar_open, 0, 
1, "i",
-       doc: /* Show the menu bar in FRAME.
-
-Move the mouse pointer onto the first element of FRAME's menu bar, and
-cause it to be opened.  If FRAME is nil or not given, use the selected
-frame.  If FRAME has no menu bar, a pop-up is displayed at the position
-of the last non-menu event instead.  */)
+       doc: /* Show and start key navigation of the menu bar in FRAME.
+This initially opens the first menu bar item and you can then navigate
+with the arrow keys, select a menu entry with the return key, or
+cancel with the escape key.  If FRAME is nil or not given, use the
+selected frame.  If FRAME has no menu bar, a pop-up is displayed at
+the position of the last non-menu event instead.  */)
   (Lisp_Object frame)
 {
   struct frame *f = decode_window_system_frame (frame);
diff --git a/src/haikuselect.c b/src/haikuselect.c
index 38cceb1de7..1b94fb97e6 100644
--- a/src/haikuselect.c
+++ b/src/haikuselect.c
@@ -1,5 +1,5 @@
 /* Haiku window system selection support.
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haikuselect.h b/src/haikuselect.h
index 1a3a945f98..80f33c6ed2 100644
--- a/src/haikuselect.h
+++ b/src/haikuselect.h
@@ -1,5 +1,5 @@
 /* Haiku window system selection support. Hey Emacs, this is -*- C++ -*-
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/haikuterm.c b/src/haikuterm.c
index f95a013867..928b571855 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -1,5 +1,5 @@
 /* Haiku window system support
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -145,15 +145,32 @@ haiku_clip_to_string (struct glyph_string *s)
   int n = get_glyph_string_clip_rects (s, (struct haiku_rect *) &r, 2);
 
   if (n)
-    BView_ClipToRect (FRAME_HAIKU_VIEW (s->f), r[0].x, r[0].y,
-                     r[0].width, r[0].height);
-  if (n > 1)
     {
-      BView_ClipToRect (FRAME_HAIKU_VIEW (s->f), r[1].x, r[1].y,
-                       r[1].width, r[1].height);
+      /* If n[FOO].width is 0, it means to not draw at all, so set the
+        clipping to some impossible value.  */
+      if (r[0].width <= 0)
+       BView_ClipToRect (FRAME_HAIKU_VIEW (s->f),
+                         FRAME_PIXEL_WIDTH (s->f),
+                         FRAME_PIXEL_HEIGHT (s->f),
+                         10, 10);
+      else
+       BView_ClipToRect (FRAME_HAIKU_VIEW (s->f), r[0].x,
+                         r[0].y, r[0].width, r[0].height);
     }
 
-  s->num_clips = n;
+  if (n > 1)
+    {
+      /* If n[FOO].width is 0, it means to not draw at all, so set the
+        clipping to some impossible value.  */
+      if (r[1].width <= 0)
+       BView_ClipToRect (FRAME_HAIKU_VIEW (s->f),
+                         FRAME_PIXEL_WIDTH (s->f),
+                         FRAME_PIXEL_HEIGHT (s->f),
+                         10, 10);
+      else
+       BView_ClipToRect (FRAME_HAIKU_VIEW (s->f), r[1].x, r[1].y,
+                         r[1].width, r[1].height);
+    }
 }
 
 static void
@@ -161,7 +178,6 @@ haiku_clip_to_string_exactly (struct glyph_string *s, 
struct glyph_string *dst)
 {
   BView_ClipToRect (FRAME_HAIKU_VIEW (s->f), s->x, s->y,
                    s->width, s->height);
-  dst->num_clips = 1;
 }
 
 static void
@@ -346,7 +362,7 @@ haiku_frame_raise_lower (struct frame *f, bool raise_p)
     {
       block_input ();
       BWindow_activate (FRAME_HAIKU_WINDOW (f));
-      flush_frame (f);
+      BWindow_sync (FRAME_HAIKU_WINDOW (f));
       unblock_input ();
     }
 }
@@ -413,6 +429,7 @@ haiku_draw_box_rect (struct glyph_string *s,
   struct face *face = s->face;
 
   BView_StartClip (view);
+  haiku_clip_to_string (s);
   BView_SetHighColor (view, face->box_color);
   if (clip_rect)
     BView_ClipToRect (view, clip_rect->x, clip_rect->y, clip_rect->width,
@@ -468,7 +485,7 @@ haiku_draw_relief_rect (struct glyph_string *s,
 
   void *view = FRAME_HAIKU_VIEW (s->f);
   BView_StartClip (view);
-
+  haiku_clip_to_string (s);
   BView_SetHighColor (view, raised_p ? color_white : color_black);
   if (clip_rect)
     BView_ClipToRect (view, clip_rect->x, clip_rect->y, clip_rect->width,
@@ -550,6 +567,7 @@ haiku_draw_underwave (struct glyph_string *s, int width, 
int x)
   void *view = FRAME_HAIKU_VIEW (s->f);
 
   BView_StartClip (view);
+  haiku_clip_to_string (s);
   BView_ClipToRect (view, x, y, width, wave_height);
   ax = x - ((int) (x) % dx) + (float) 0.5;
   bx = ax + dx;
@@ -581,6 +599,7 @@ haiku_draw_text_decoration (struct glyph_string *s, struct 
face *face,
   void *view = FRAME_HAIKU_VIEW (s->f);
   BView_draw_lock (view);
   BView_StartClip (view);
+  haiku_clip_to_string (s);
 
   if (face->underline)
     {
@@ -805,7 +824,6 @@ haiku_draw_plain_background (struct glyph_string *s, struct 
face *face,
                             int box_line_hwidth, int box_line_vwidth)
 {
   void *view = FRAME_HAIKU_VIEW (s->f);
-  BView_StartClip (view);
   if (s->hl == DRAW_CURSOR)
     BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
   else
@@ -817,7 +835,6 @@ haiku_draw_plain_background (struct glyph_string *s, struct 
face *face,
                       s->y + box_line_hwidth,
                       s->background_width,
                       s->height - 2 * box_line_hwidth);
-  BView_EndClip (view);
 }
 
 static void
@@ -893,7 +910,6 @@ haiku_draw_glyph_string_foreground (struct glyph_string *s)
 
   if (s->font_not_found_p)
     {
-      BView_StartClip (view);
       if (s->hl == DRAW_CURSOR)
        BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
       else
@@ -905,7 +921,6 @@ haiku_draw_glyph_string_foreground (struct glyph_string *s)
                                 s->height);
          x += g->pixel_width;
        }
-      BView_EndClip (view);
     }
   else
     {
@@ -996,13 +1011,11 @@ haiku_draw_glyphless_glyph_string_foreground (struct 
glyph_string *s)
                                 s->ybase + glyph->slice.glyphless.lower_yoff,
                                 false);
        }
-      BView_StartClip (FRAME_HAIKU_VIEW (s->f));
       if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
        BView_FillRectangle (FRAME_HAIKU_VIEW (s->f),
                             x, s->ybase - glyph->ascent,
                             glyph->pixel_width - 1,
                             glyph->ascent + glyph->descent - 1);
-      BView_EndClip (FRAME_HAIKU_VIEW (s->f));
       x += glyph->pixel_width;
    }
 }
@@ -1044,10 +1057,8 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
        x -= width;
 
       void *view = FRAME_HAIKU_VIEW (s->f);
-      BView_StartClip (view);
       BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
       BView_FillRectangle (view, x, s->y, width, s->height);
-      BView_EndClip (view);
 
       if (width < background_width)
        {
@@ -1062,17 +1073,13 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
          if (!face->stipple)
            {
              uint32_t bkg;
-             if (s->hl == DRAW_MOUSE_FACE || (s->hl == DRAW_CURSOR
-                                              && s->row->mouse_face_p
-                                              && cursor_in_mouse_face_p 
(s->w)))
-                 haiku_mouse_face_colors (s, NULL, &bkg);
+             if (s->row->mouse_face_p && cursor_in_mouse_face_p (s->w))
+               haiku_mouse_face_colors (s, NULL, &bkg);
              else
                bkg = face->background;
 
-             BView_StartClip (view);
              BView_SetHighColor (view, bkg);
              BView_FillRectangle (view, x, y, w, h);
-             BView_EndClip (view);
            }
        }
     }
@@ -1093,18 +1100,14 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
       if (background_width > 0)
        {
          void *view = FRAME_HAIKU_VIEW (s->f);
-         BView_StartClip (view);
          uint32_t bkg;
-         if (s->hl == DRAW_MOUSE_FACE)
-           haiku_mouse_face_colors (s, NULL, &bkg);
-         else if (s->hl == DRAW_CURSOR)
+         if (s->hl == DRAW_CURSOR)
            bkg = FRAME_CURSOR_COLOR (s->f).pixel;
          else
            bkg = s->face->background;
 
          BView_SetHighColor (view, bkg);
          BView_FillRectangle (view, x, s->y, background_width, s->height);
-         BView_EndClip (view);
        }
     }
   s->background_filled_p = 1;
@@ -1183,13 +1186,11 @@ haiku_draw_composite_glyph_string_foreground (struct 
glyph_string *s)
 
   if (s->font_not_found_p && !s->cmp_from)
     {
-      BView_StartClip (view);
       if (s->hl == DRAW_CURSOR)
        BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
       else
        BView_SetHighColor (view, s->face->foreground);
       BView_StrokeRectangle (view, s->x, s->y, s->width - 1, s->height - 1);
-      BView_EndClip (view);
     }
   else if (!s->first_glyph->u.cmp.automatic)
     {
@@ -1379,12 +1380,8 @@ haiku_draw_image_glyph_string (struct glyph_string *s)
 
   s->stippled_p = face->stipple != 0;
 
-  BView_draw_lock (view);
-  BView_StartClip (view);
   BView_SetHighColor (view, face->background);
   BView_FillRectangle (view, x, y, width, height);
-  BView_EndClip (view);
-  BView_draw_unlock (view);
 
   if (bitmap)
     {
@@ -1416,10 +1413,6 @@ haiku_draw_image_glyph_string (struct glyph_string *s)
 
       if (gui_intersect_rectangles (&cr, &ir, &r))
        {
-         BView_draw_lock (view);
-         BView_StartClip (view);
-
-         haiku_clip_to_string (s);
          if (s->img->have_be_transforms_p)
            {
              bitmap = BBitmap_transform_bitmap (bitmap,
@@ -1448,19 +1441,13 @@ haiku_draw_image_glyph_string (struct glyph_string *s)
 
          if (s->img->have_be_transforms_p)
            BBitmap_free (bitmap);
-         BView_EndClip (view);
-         BView_draw_unlock (view);
        }
 
       if (s->hl == DRAW_CURSOR)
        {
-         BView_draw_lock (view);
-         BView_StartClip (view);
          BView_SetPenSize (view, 1);
          BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
          BView_StrokeRectangle (view, r.x, r.y, r.width, r.height);
-         BView_EndClip (view);
-         BView_draw_unlock (view);
        }
     }
 
@@ -1497,7 +1484,6 @@ haiku_draw_glyph_string (struct glyph_string *s)
              haiku_maybe_draw_background (s->next, 1);
             else
              haiku_draw_stretch_glyph_string (s->next);
-            next->num_clips = 0;
            haiku_end_clip (s);
           }
     }
@@ -1515,9 +1501,13 @@ haiku_draw_glyph_string (struct glyph_string *s)
       box_filled_p = 1;
       haiku_draw_string_box (s, 0);
     }
-  else if (!s->clip_head && !s->clip_tail &&
-          ((s->prev && s->left_overhang && s->prev->hl != s->hl) ||
-           (s->next && s->right_overhang && s->next->hl != s->hl)))
+  else if (!s->clip_head /* draw_glyphs didn't specify a clip mask. */
+          && !s->clip_tail
+          && ((s->prev && s->prev->hl != s->hl && s->left_overhang)
+              || (s->next && s->next->hl != s->hl && s->right_overhang)))
+    /* We must clip just this glyph.  left_overhang part has already
+       drawn when s->prev was drawn, and right_overhang part will be
+       drawn later when s->next is drawn. */
     haiku_clip_to_string_exactly (s, s);
   else
     haiku_clip_to_string (s);
@@ -1555,15 +1545,18 @@ haiku_draw_glyph_string (struct glyph_string *s)
        haiku_maybe_draw_background (s, 1);
       haiku_draw_glyphless_glyph_string_foreground (s);
       break;
+    default:
+      emacs_abort ();
     }
 
-  if (!box_filled_p && face->box != FACE_NO_BOX)
-    haiku_draw_string_box (s, 1);
-  else
-    haiku_draw_text_decoration (s, face, face->foreground, s->width, s->x);
-
   if (!s->for_overlaps)
     {
+      if (!box_filled_p && face->box != FACE_NO_BOX)
+       haiku_draw_string_box (s, 1);
+      else
+       haiku_draw_text_decoration (s, face, face->foreground,
+                                   s->width, s->x);
+
       if (s->prev)
        {
          struct glyph_string *prev;
@@ -1575,11 +1568,10 @@ haiku_draw_glyph_string (struct glyph_string *s)
                /* As prev was drawn while clipped to its own area, we
                   must draw the right_overhang part using s->hl now.  */
                enum draw_glyphs_face save = prev->hl;
-               struct face *save_face = prev->face;
 
                prev->hl = s->hl;
-               prev->face = s->face;
                haiku_start_clip (s);
+               haiku_clip_to_string (s);
                haiku_clip_to_string_exactly (s, prev);
                if (prev->first_glyph->type == CHAR_GLYPH)
                  haiku_draw_glyph_string_foreground (prev);
@@ -1587,8 +1579,6 @@ haiku_draw_glyph_string (struct glyph_string *s)
                  haiku_draw_composite_glyph_string_foreground (prev);
                haiku_end_clip (s);
                prev->hl = save;
-               prev->face = save_face;
-               prev->num_clips = 0;
              }
        }
 
@@ -1603,11 +1593,10 @@ haiku_draw_glyph_string (struct glyph_string *s)
                /* As next will be drawn while clipped to its own area,
                   we must draw the left_overhang part using s->hl now.  */
                enum draw_glyphs_face save = next->hl;
-               struct face *save_face = next->face;
 
                next->hl = s->hl;
-               next->face = s->face;
                haiku_start_clip (s);
+               haiku_clip_to_string (s);
                haiku_clip_to_string_exactly (s, next);
                if (next->first_glyph->type == CHAR_GLYPH)
                  haiku_draw_glyph_string_foreground (next);
@@ -1615,15 +1604,11 @@ haiku_draw_glyph_string (struct glyph_string *s)
                  haiku_draw_composite_glyph_string_foreground (next);
                haiku_end_clip (s);
 
-               next->background_filled_p = 0;
                next->hl = save;
-               next->face = save_face;
-               next->clip_head = next;
-               next->num_clips = 0;
+               next->clip_head = s->next;
              }
        }
     }
-  s->num_clips = 0;
   haiku_end_clip (s);
   unblock_input ();
 }
@@ -2571,6 +2556,25 @@ haiku_make_fullscreen_consistent (struct frame *f)
   store_frame_param (f, Qfullscreen, lval);
 }
 
+static void
+flush_dirty_back_buffers (void)
+{
+  block_input ();
+  Lisp_Object tail, frame;
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_LIVE_P (f) &&
+          FRAME_HAIKU_P (f) &&
+          FRAME_HAIKU_WINDOW (f) &&
+          !FRAME_GARBAGED_P (f) &&
+          !buffer_flipping_blocked_p () &&
+          FRAME_DIRTY_P (f))
+        haiku_flip_buffers (f);
+    }
+  unblock_input ();
+}
+
 static int
 haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
 {
@@ -2580,6 +2584,7 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
   ssize_t b_size;
   struct unhandled_event *unhandled_events = NULL;
   int button_or_motion_p;
+  int need_flush = 0;
 
   if (!buf)
     buf = xmalloc (200);
@@ -2673,11 +2678,24 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
        case KEY_DOWN:
          {
            struct haiku_key_event *b = buf;
+           Mouse_HLInfo *hlinfo = &x_display_list->mouse_highlight;
            struct frame *f = haiku_window_to_frame (b->window);
            int non_ascii_p;
            if (!f)
              continue;
 
+           /* If mouse-highlight is an integer, input clears out
+              mouse highlighting.  */
+           if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
+               && (f == 0
+                   || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)
+                   || !EQ (f->tab_bar_window, hlinfo->mouse_face_window)))
+             {
+               clear_mouse_face (hlinfo);
+               hlinfo->mouse_face_hidden = true;
+               need_flush = 1;
+             }
+
            inev.code = b->unraw_mb_char;
 
            BMapKey (b->kc, &non_ascii_p, &inev.code);
@@ -2718,6 +2736,7 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
          {
            struct haiku_mouse_motion_event *b = buf;
            struct frame *f = haiku_window_to_frame (b->window);
+           Mouse_HLInfo *hlinfo = &x_display_list->mouse_highlight;
 
            if (!f)
              continue;
@@ -2728,6 +2747,13 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
            x_display_list->last_mouse_movement_time = time (NULL);
            button_or_motion_p = 1;
 
+           if (hlinfo->mouse_face_hidden)
+             {
+               hlinfo->mouse_face_hidden = false;
+               clear_mouse_face (hlinfo);
+               need_flush = 1;
+             }
+
            if (b->just_exited_p)
              {
                Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
@@ -2737,6 +2763,8 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
                       certainly no longer on any text in the frame.  */
                    clear_mouse_face (hlinfo);
                    hlinfo->mouse_face_mouse_frame = 0;
+
+                   need_flush = 1;
                  }
 
                haiku_new_focus_frame (x_display_list->focused_frame);
@@ -2755,6 +2783,27 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
                previous_help_echo_string = help_echo_string;
                help_echo_string = Qnil;
 
+               /* A LeaveNotify event (well, the closest equivalent on Haiku, 
which
+                  is a B_MOUSE_MOVED event with `transit' set to 
B_EXITED_VIEW) might
+                  be sent out-of-order with regards to motion events from other
+                  windows, such as when the mouse pointer rapidly moves from an
+                  undecorated child frame to its parent.  This can cause a 
failure to
+                  clear the mouse face on the former if an event for the 
latter is
+                  read by Emacs first and ends up showing the mouse face there.
+
+                  In case the `movement_locker' (also see the comment
+                  there) doesn't take care of the problem, work
+                  around it by clearing the mouse face now, if it is
+                  currently shown on a different frame.  */
+
+               if (hlinfo->mouse_face_hidden
+                   || (f != hlinfo->mouse_face_mouse_frame
+                       && !NILP (hlinfo->mouse_face_window)))
+                 {
+                   hlinfo->mouse_face_hidden = 0;
+                   clear_mouse_face (hlinfo);
+                 }
+
                if (f != dpyinfo->last_mouse_glyph_frame
                    || b->x < r.x || b->x >= r.x + r.width
                    || b->y < r.y || b->y >= r.y + r.height)
@@ -2769,12 +2818,6 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
                                    help_echo_object, help_echo_pos);
                  }
 
-               if (MOUSE_HL_INFO (f)->mouse_face_hidden)
-                 {
-                   MOUSE_HL_INFO (f)->mouse_face_hidden = 0;
-                   clear_mouse_face (MOUSE_HL_INFO (f));
-                 }
-
                if (!NILP (Vmouse_autoselect_window))
                  {
                    static Lisp_Object last_mouse_window;
@@ -2827,8 +2870,11 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
                tab_bar_p = EQ (window, f->tab_bar_window);
 
                if (tab_bar_p)
-                 tab_bar_arg = handle_tab_bar_click
-                   (f, x, y, type == BUTTON_DOWN, inev.modifiers);
+                 {
+                   tab_bar_arg = handle_tab_bar_click
+                     (f, x, y, type == BUTTON_DOWN, inev.modifiers);
+                   need_flush = 1;
+                 }
              }
 
            if (WINDOWP (f->tool_bar_window)
@@ -2845,7 +2891,7 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
                  {
                    handle_tool_bar_click
                      (f, x, y, type == BUTTON_DOWN, inev.modifiers);
-                   redisplay ();
+                   need_flush = 1;
                  }
              }
 
@@ -3223,6 +3269,9 @@ haiku_read_socket (struct terminal *terminal, struct 
input_event *hold_quit)
       xfree (old);
     }
 
+  if (need_flush)
+    flush_dirty_back_buffers ();
+
   unblock_input ();
   return message_count;
 }
diff --git a/src/haikuterm.h b/src/haikuterm.h
index 7ed7485ef5..3e39403ab4 100644
--- a/src/haikuterm.h
+++ b/src/haikuterm.h
@@ -1,5 +1,5 @@
 /* Haiku window system support
-   Copyright (C) 2021 Free Software Foundation, Inc.
+   Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/hbfont.c b/src/hbfont.c
index e9f4085b1a..2721a66120 100644
--- a/src/hbfont.c
+++ b/src/hbfont.c
@@ -1,5 +1,5 @@
 /* hbfont.c -- Platform-independent support for HarfBuzz font driver.
-   Copyright (C) 2019-2021 Free Software Foundation, Inc.
+   Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/image.c b/src/image.c
index 49b14c4915..439348759f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1,6 +1,6 @@
 /* Functions for image support on window system.
 
-Copyright (C) 1989, 1992-2021 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -80,14 +80,7 @@ typedef struct x_bitmap_record Bitmap_Record;
 #endif /* !USE_CAIRO */
 #endif /* HAVE_X_WINDOWS */
 
-#ifdef USE_CAIRO
-#define GET_PIXEL image_pix_context_get_pixel
-#define PUT_PIXEL image_pix_container_put_pixel
-#define NO_PIXMAP 0
-
-#define PIX_MASK_RETAIN        0
-#define PIX_MASK_DRAW  255
-
+#if defined(USE_CAIRO) || defined(HAVE_NS)
 #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
 #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | 
(b))
 #define RED_FROM_ULONG(color)  (((color) >> 16) & 0xff)
@@ -96,11 +89,29 @@ typedef struct x_bitmap_record Bitmap_Record;
 #define RED16_FROM_ULONG(color)                (RED_FROM_ULONG (color) * 0x101)
 #define GREEN16_FROM_ULONG(color)      (GREEN_FROM_ULONG (color) * 0x101)
 #define BLUE16_FROM_ULONG(color)       (BLUE_FROM_ULONG (color) * 0x101)
+#endif
+
+#ifdef USE_CAIRO
+#define GET_PIXEL image_pix_context_get_pixel
+#define PUT_PIXEL image_pix_container_put_pixel
+#define NO_PIXMAP 0
+
+#define PIX_MASK_RETAIN        0
+#define PIX_MASK_DRAW  255
 
 static unsigned long image_alloc_image_color (struct frame *, struct image *,
                                              Lisp_Object, unsigned long);
 #endif /* USE_CAIRO */
 
+#if defined HAVE_PGTK && defined HAVE_IMAGEMAGICK
+/* In pgtk, we don't want to create scaled image.  If we create scaled
+ * image on scale=2.0 environment, the created image is half size and
+ * Gdk scales it back, and the result is blurry.  To avoid this, we
+ * hold original size image as far as we can, and let Gdk to scale it
+ * when it is shown.  */
+# define DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE
+#endif
+
 #ifdef HAVE_NTGUI
 
 /* We need (or want) w32.h only when we're _not_ compiling for Cygwin.  */
@@ -131,6 +142,10 @@ typedef struct ns_bitmap_record Bitmap_Record;
 
 #endif /* HAVE_NS */
 
+#ifdef HAVE_PGTK
+typedef struct pgtk_bitmap_record Bitmap_Record;
+#endif /* HAVE_PGTK */
+
 #if (defined HAVE_X_WINDOWS \
      && ! (defined HAVE_NTGUI || defined USE_CAIRO || defined HAVE_NS))
 /* W32_TODO : Color tables on W32.  */
@@ -419,6 +434,34 @@ image_reference_bitmap (struct frame *f, ptrdiff_t id)
   ++FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
 }
 
+#ifdef HAVE_PGTK
+static cairo_pattern_t *
+image_create_pattern_from_pixbuf (struct frame *f, GdkPixbuf * pixbuf)
+{
+  GdkPixbuf *pb = gdk_pixbuf_add_alpha (pixbuf, TRUE, 255, 255, 255);
+  cairo_surface_t *surface =
+    cairo_surface_create_similar_image (cairo_get_target
+                                       (f->output_data.pgtk->cr_context),
+                                       CAIRO_FORMAT_A1,
+                                       gdk_pixbuf_get_width (pb),
+                                       gdk_pixbuf_get_height (pb));
+
+  cairo_t *cr = cairo_create (surface);
+  gdk_cairo_set_source_pixbuf (cr, pb, 0, 0);
+  cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+  cairo_paint (cr);
+  cairo_destroy (cr);
+
+  cairo_pattern_t *pat = cairo_pattern_create_for_surface (surface);
+  cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT);
+
+  cairo_surface_destroy (surface);
+  g_object_unref (pb);
+
+  return pat;
+}
+#endif
+
 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS.  */
 
 ptrdiff_t
@@ -453,6 +496,49 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
       return -1;
 #endif
 
+#ifdef HAVE_PGTK
+  GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+                                     FALSE,
+                                     8,
+                                     width,
+                                     height);
+  {
+    char *sp = bits;
+    int mask = 0x01;
+    unsigned char *buf = gdk_pixbuf_get_pixels (pixbuf);
+    int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+    for (int y = 0; y < height; y++)
+      {
+       unsigned char *dp = buf + rowstride * y;
+       for (int x = 0; x < width; x++)
+         {
+           if (*sp & mask)
+             {
+               *dp++ = 0xff;
+               *dp++ = 0xff;
+               *dp++ = 0xff;
+             }
+           else
+             {
+               *dp++ = 0x00;
+               *dp++ = 0x00;
+               *dp++ = 0x00;
+             }
+           if ((mask <<= 1) >= 0x100)
+             {
+               mask = 0x01;
+               sp++;
+             }
+         }
+       if (mask != 0x01)
+         {
+           mask = 0x01;
+           sp++;
+         }
+      }
+  }
+#endif /* HAVE_PGTK */
+
 #ifdef HAVE_HAIKU
   void *bitmap = BBitmap_new (width, height, 1);
   BBitmap_import_mono_bits (bitmap, bits, width, height);
@@ -465,6 +551,13 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
   dpyinfo->bitmaps[id - 1].depth = 1;
 #endif
 
+#ifdef HAVE_PGTK
+  dpyinfo->bitmaps[id - 1].img = pixbuf;
+  dpyinfo->bitmaps[id - 1].depth = 1;
+  dpyinfo->bitmaps[id - 1].pattern =
+    image_create_pattern_from_pixbuf (f, pixbuf);
+#endif
+
 #ifdef HAVE_HAIKU
   dpyinfo->bitmaps[id - 1].img = bitmap;
   dpyinfo->bitmaps[id - 1].depth = 1;
@@ -522,6 +615,30 @@ image_create_bitmap_from_file (struct frame *f, 
Lisp_Object file)
   return id;
 #endif
 
+#ifdef HAVE_PGTK
+  GError *err = NULL;
+  ptrdiff_t id;
+  void * bitmap = gdk_pixbuf_new_from_file (SSDATA (file), &err);
+
+  if (!bitmap)
+    {
+      g_error_free (err);
+      return -1;
+    }
+
+  id = image_allocate_bitmap_record (f);
+
+  dpyinfo->bitmaps[id - 1].img = bitmap;
+  dpyinfo->bitmaps[id - 1].refcount = 1;
+  dpyinfo->bitmaps[id - 1].file = xlispstrdup (file);
+  //dpyinfo->bitmaps[id - 1].depth = 1;
+  dpyinfo->bitmaps[id - 1].height = gdk_pixbuf_get_width (bitmap);
+  dpyinfo->bitmaps[id - 1].width = gdk_pixbuf_get_height (bitmap);
+  dpyinfo->bitmaps[id - 1].pattern
+    = image_create_pattern_from_pixbuf (f, bitmap);
+  return id;
+#endif
+
 #ifdef HAVE_X_WINDOWS
   unsigned int width, height;
   Pixmap bitmap;
@@ -594,6 +711,11 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record 
*bm)
   ns_release_object (bm->img);
 #endif
 
+#ifdef HAVE_PGTK
+  if (bm->pattern != NULL)
+    cairo_pattern_destroy (bm->pattern);
+#endif
+
 #ifdef HAVE_HAIKU
   BBitmap_free (bm->img);
 #endif
@@ -1358,7 +1480,6 @@ image_ascent (struct image *img, struct face *face, 
struct glyph_slice *slice)
   return ascent;
 }
 
-
 
 /* Image background colors.  */
 
@@ -1382,6 +1503,7 @@ four_corners_best (Emacs_Pix_Context pimg, int *corners,
       corner_pixels[3] = GET_PIXEL (pimg, corners[LEFT_CORNER], 
corners[BOT_CORNER] - 1);
     }
   else
+
     {
       /* Get the colors at the corner_pixels of pimg.  */
       corner_pixels[0] = GET_PIXEL (pimg, 0, 0);
@@ -2250,7 +2372,8 @@ compute_image_rotation (struct image *img, double 
*rotation)
 static void
 image_set_transform (struct frame *f, struct image *img)
 {
-# ifdef HAVE_IMAGEMAGICK
+# if (defined HAVE_IMAGEMAGICK \
+      && !defined DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE)
   /* ImageMagick images already have the correct transform.  */
   if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick))
     return;
@@ -2503,8 +2626,8 @@ lookup_image (struct frame *f, Lisp_Object spec, int 
face_id)
     face_id = DEFAULT_FACE_ID;
 
   struct face *face = FACE_FROM_ID (f, face_id);
-  unsigned long foreground = FACE_COLOR_TO_PIXEL (face->foreground, f);
-  unsigned long background = FACE_COLOR_TO_PIXEL (face->background, f);
+  unsigned long foreground = face->foreground;
+  unsigned long background = face->background;
   int font_size = face->font->pixel_size;
   char *font_family = SSDATA (face->lface[LFACE_FAMILY_INDEX]);
 
@@ -4097,6 +4220,13 @@ xbm_load (struct frame *f, struct image *img)
                              XPM images
  ***********************************************************************/
 
+#if defined (HAVE_XPM) || defined (HAVE_NS) || defined (HAVE_PGTK)
+
+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.  */
@@ -4140,7 +4270,7 @@ enum xpm_keyword_index
   XPM_LAST
 };
 
-#if defined HAVE_XPM || defined HAVE_NS || defined HAVE_HAIKU
+#if defined HAVE_XPM || defined HAVE_NS || defined HAVE_HAIKU || defined 
HAVE_PGTK
 /* Vector of image_keyword structures describing the format
    of valid XPM image specifications.  */
 
@@ -4158,7 +4288,7 @@ static const struct image_keyword xpm_format[XPM_LAST] =
   {":color-symbols",   IMAGE_DONT_CHECK_VALUE_TYPE,            0},
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
-#endif /* HAVE_XPM || HAVE_NS || HAVE_HAIKU */
+#endif /* HAVE_XPM || HAVE_NS || HAVE_HAIKU || HAVE_PGTK */
 
 #if defined HAVE_X_WINDOWS && !defined USE_CAIRO
 
@@ -4382,7 +4512,7 @@ init_xpm_functions (void)
 
 #endif /* WINDOWSNT */
 
-#if defined HAVE_XPM || defined HAVE_NS || defined HAVE_HAIKU
+#if defined HAVE_XPM || defined HAVE_NS || defined HAVE_HAIKU || defined 
HAVE_PGTK
 /* Value is true if COLOR_SYMBOLS is a valid color symbols list
    for XPM images.  Such a list must consist of conses whose car and
    cdr are strings.  */
@@ -4418,7 +4548,7 @@ xpm_image_p (Lisp_Object object)
          && (! fmt[XPM_COLOR_SYMBOLS].count
              || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value)));
 }
-#endif /* HAVE_XPM || HAVE_NS || HAVE_HAIKU */
+#endif /* HAVE_XPM || HAVE_NS || HAVE_HAIKU || HAVE_PGTK */
 
 #endif /* HAVE_XPM || USE_CAIRO || HAVE_NS || HAVE_HAIKU */
 
@@ -4790,7 +4920,8 @@ xpm_load (struct frame *f, struct image *img)
 
 #if (defined USE_CAIRO && defined HAVE_XPM)    \
   || (defined HAVE_NS && !defined HAVE_XPM)    \
-  || (defined HAVE_HAIKU && !defined HAVE_XPM)
+  || (defined HAVE_HAIKU && !defined HAVE_XPM)  \
+  || (defined HAVE_PGTK && !defined HAVE_XPM)
 
 /* XPM support functions for NS and Haiku where libxpm is not available, and 
for
    Cairo.  Only XPM version 3 (without any extensions) is supported.  */
@@ -4989,7 +5120,7 @@ xpm_load_image (struct frame *f,
   Lisp_Object (*get_color_table) (Lisp_Object, const char *, int);
   Lisp_Object frame, color_symbols, color_table;
   int best_key;
-#ifndef HAVE_NS
+#if !defined (HAVE_NS)
   bool have_mask = false;
 #endif
   Emacs_Pix_Container ximg = NULL, mask_img = NULL;
@@ -9511,11 +9642,15 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
   PixelWand **pixels, *bg_wand = NULL;
   MagickPixelPacket  pixel;
   Lisp_Object image;
+#ifndef DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE
   Lisp_Object value;
+#endif
   Lisp_Object crop;
   EMACS_INT ino;
   int desired_width, desired_height;
+#ifndef DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE
   double rotation;
+#endif
   char hint_buffer[MaxTextExtent];
   char *filename_hint = NULL;
   imagemagick_initialize ();
@@ -9632,9 +9767,13 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
     PixelSetBlue  (bg_wand, (double) bgcolor.blue  / 65535);
   }
 
+#ifndef DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE
   compute_image_size (MagickGetImageWidth (image_wand),
                      MagickGetImageHeight (image_wand),
                      img, &desired_width, &desired_height);
+#else
+  desired_width = desired_height = -1;
+#endif
 
   if (desired_width != -1 && desired_height != -1)
     {
@@ -9678,6 +9817,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
        }
     }
 
+#ifndef DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE
   /* Furthermore :rotation. we need background color and angle for
      rotation.  */
   /*
@@ -9696,6 +9836,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
           goto imagemagick_error;
         }
     }
+#endif
 
   /* Set the canvas background color to the frame or specified
      background, and flatten the image.  Note: as of ImageMagick
@@ -9827,8 +9968,8 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
                                           color_scale * pixel.red,
                                           color_scale * pixel.green,
                                           color_scale * pixel.blue));
-            }
-        }
+           }
+       }
       DestroyPixelIterator (iterator);
     }
 
@@ -11140,7 +11281,7 @@ static struct image_type const image_types[] =
  { 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 || defined HAVE_HAIKU
+#if defined HAVE_XPM || defined HAVE_NS || defined HAVE_HAIKU || defined 
HAVE_PGTK
  { SYMBOL_INDEX (Qxpm), xpm_image_p, xpm_load, image_clear_image,
    IMAGE_TYPE_INIT (init_xpm_functions) },
 #endif
@@ -11288,7 +11429,8 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
   DEFSYM (Qxbm, "xbm");
   add_image_type (Qxbm);
 
-#if defined (HAVE_XPM) || defined (HAVE_NS) || defined (HAVE_HAIKU)
+#if defined (HAVE_XPM) || defined (HAVE_NS) \
+  || defined (HAVE_HAIKU) || defined (HAVE_PGTK)
   DEFSYM (Qxpm, "xpm");
   add_image_type (Qxpm);
 #endif
@@ -11339,6 +11481,11 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
 #endif /* HAVE_NTGUI  */
 #endif /* HAVE_RSVG  */
 
+#ifdef HAVE_NS
+  DEFSYM (Qheic, "heic");
+  add_image_type (Qheic);
+#endif
+
 #if HAVE_NATIVE_IMAGE_API
   DEFSYM (Qnative_image, "native-image");
 # ifdef HAVE_NTGUI
diff --git a/src/indent.c b/src/indent.c
index 914dabf1e7..5c21cd8f99 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1,5 +1,5 @@
 /* Indentation functions.
-   Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2021 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/indent.h b/src/indent.h
index 776fe7ba4b..cc4365f41f 100644
--- a/src/indent.h
+++ b/src/indent.h
@@ -1,5 +1,5 @@
 /* Definitions for interface to indent.c
-   Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/inotify.c b/src/inotify.c
index df6145d702..e92ad40abc 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -1,6 +1,6 @@
 /* Inotify support for Emacs
 
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/insdel.c b/src/insdel.c
index 40674e15e4..d9ba222b1d 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1,5 +1,5 @@
 /* Buffer insertion/deletion and gap motion for GNU Emacs. -*- coding: utf-8 
-*-
-   Copyright (C) 1985-1986, 1993-1995, 1997-2021 Free Software
+   Copyright (C) 1985-1986, 1993-1995, 1997-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/intervals.c b/src/intervals.c
index 11d5b6bbb6..ed374f16b5 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1,5 +1,5 @@
 /* Code for doing intervals.
-   Copyright (C) 1993-1995, 1997-1998, 2001-2021 Free Software
+   Copyright (C) 1993-1995, 1997-1998, 2001-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/intervals.h b/src/intervals.h
index c1b19345d2..484fca2e75 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -1,5 +1,5 @@
 /* Definitions and global variables for intervals.
-   Copyright (C) 1993-1994, 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/json.c b/src/json.c
index b0779b912a..21a6df6785 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1,6 +1,6 @@
 /* JSON parsing and serialization.
 
-Copyright (C) 2017-2021 Free Software Foundation, Inc.
+Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/keyboard.c b/src/keyboard.c
index 899c9109c2..ec1b7cd85d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1,6 +1,6 @@
 /* Keyboard and mouse input; editor command loop.
 
-Copyright (C) 1985-1989, 1993-1997, 1999-2021 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1997, 1999-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -65,6 +65,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <sys/types.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <math.h>
 
 #include <ignore-value.h>
 
@@ -3972,6 +3973,9 @@ kbd_buffer_get_event (KBOARD **kbp,
          *used_mouse_menu = true;
        FALLTHROUGH;
 #endif
+#ifdef HAVE_PGTK
+      case PGTK_PREEDIT_TEXT_EVENT:
+#endif
 #ifdef HAVE_NTGUI
       case END_SESSION_EVENT:
       case LANGUAGE_CHANGE_EVENT:
@@ -4034,6 +4038,61 @@ kbd_buffer_get_event (KBOARD **kbp,
             and build a real event from the queue entry.  */
          if (NILP (obj))
            {
+             double pinch_dx, pinch_dy, pinch_angle;
+
+             /* Pinch events are often sent in rapid succession, so
+                large amounts of such events have the potential to
+                queue up inside the keyboard buffer.  In that case,
+                find the last pinch event in succession on the same
+                frame with the same modifiers, and send that instead.  */
+
+             if (event->ie.kind == PINCH_EVENT
+                 /* Ignore if this is the start of a pinch sequence.
+                    These events should always be sent so that we
+                    never miss a sequence starting, and they don't
+                    have the potential to queue up.  */
+                 && ((pinch_dx
+                      = XFLOAT_DATA (XCAR (event->ie.arg))) != 0.0
+                     || XFLOAT_DATA (XCAR (XCDR (event->ie.arg))) != 0.0
+                     || XFLOAT_DATA (Fnth (make_fixnum (3), event->ie.arg)) != 
0.0))
+               {
+                 union buffered_input_event *maybe_event = next_kbd_event 
(event);
+
+                 pinch_dy = XFLOAT_DATA (XCAR (XCDR (event->ie.arg)));
+                 pinch_angle = XFLOAT_DATA (Fnth (make_fixnum (3), 
event->ie.arg));
+
+                 while (maybe_event != kbd_store_ptr
+                        && maybe_event->ie.kind == PINCH_EVENT
+                        /* Make sure we never miss an event that has
+                           different modifiers.  */
+                        && maybe_event->ie.modifiers == event->ie.modifiers
+                        /* Make sure that the event is for the same
+                           frame.  */
+                        && EQ (maybe_event->ie.frame_or_window,
+                               event->ie.frame_or_window)
+                        /* Make sure that the event isn't the start
+                           of a new pinch gesture sequence.  */
+                        && (XFLOAT_DATA (XCAR (maybe_event->ie.arg)) != 0.0
+                            || XFLOAT_DATA (XCAR (XCDR (maybe_event->ie.arg))) 
!= 0.0
+                            || XFLOAT_DATA (Fnth (make_fixnum (3),
+                                                  maybe_event->ie.arg)) != 
0.0))
+                   {
+                     event = maybe_event;
+                     /* Add up relative deltas inside events we skip.  */
+                     pinch_dx += XFLOAT_DATA (XCAR (maybe_event->ie.arg));
+                     pinch_dy += XFLOAT_DATA (XCAR (XCDR 
(maybe_event->ie.arg)));
+                     pinch_angle += XFLOAT_DATA (Fnth (make_fixnum (3),
+                                                       maybe_event->ie.arg));
+
+                     XSETCAR (maybe_event->ie.arg, make_float (pinch_dx));
+                     XSETCAR (XCDR (maybe_event->ie.arg), make_float 
(pinch_dy));
+                     XSETCAR (Fnthcdr (make_fixnum (3),
+                                       maybe_event->ie.arg),
+                              make_float (fmod (pinch_angle, 360.0)));
+                     maybe_event = next_kbd_event (event);
+                   }
+               }
+
              obj = make_lispy_event (&event->ie);
 
 #ifdef HAVE_EXT_MENU_BAR
@@ -4463,6 +4522,7 @@ static Lisp_Object func_key_syms;
 static Lisp_Object mouse_syms;
 static Lisp_Object wheel_syms;
 static Lisp_Object drag_n_drop_syms;
+static Lisp_Object pinch_syms;
 
 /* This is a list of keysym codes for special "accent" characters.
    It parallels lispy_accent_keys.  */
@@ -6010,6 +6070,62 @@ make_lispy_event (struct input_event *event)
        return list2 (Qtouch_end, position);
       }
 
+    case TOUCHSCREEN_BEGIN_EVENT:
+    case TOUCHSCREEN_END_EVENT:
+      {
+       Lisp_Object x, y, id, position;
+       struct frame *f = XFRAME (event->frame_or_window);
+
+       id = event->arg;
+       x = event->x;
+       y = event->y;
+
+       position = make_lispy_position (f, x, y, event->timestamp);
+
+       return list2 (((event->kind
+                       == TOUCHSCREEN_BEGIN_EVENT)
+                      ? Qtouchscreen_begin
+                      : Qtouchscreen_end),
+                     Fcons (id, position));
+      }
+
+    case PINCH_EVENT:
+      {
+       Lisp_Object x, y, position;
+       struct frame *f = XFRAME (event->frame_or_window);
+
+       x = event->x;
+       y = event->y;
+
+       position = make_lispy_position (f, x, y, event->timestamp);
+
+       return Fcons (modify_event_symbol (0, event->modifiers, Qpinch,
+                                          Qnil, (const char *[]) {"pinch"},
+                                          &pinch_syms, 1),
+                     Fcons (position, event->arg));
+      }
+
+    case TOUCHSCREEN_UPDATE_EVENT:
+      {
+       Lisp_Object x, y, id, position, tem, it, evt;
+       struct frame *f = XFRAME (event->frame_or_window);
+       evt = Qnil;
+
+       for (tem = event->arg; CONSP (tem); tem = XCDR (tem))
+         {
+           it = XCAR (tem);
+
+           x = XCAR (it);
+           y = XCAR (XCDR (it));
+           id = XCAR (XCDR (XCDR (it)));
+
+           position = make_lispy_position (f, x, y, event->timestamp);
+           evt = Fcons (Fcons (id, position), evt);
+         }
+
+       return list2 (Qtouchscreen_update, evt);
+      }
+
 #ifdef USE_TOOLKIT_SCROLL_BARS
 
       /* We don't have down and up events if using toolkit scroll bars,
@@ -6172,6 +6288,12 @@ make_lispy_event (struct input_event *event)
     case CONFIG_CHANGED_EVENT:
        return list3 (Qconfig_changed_event,
                      event->arg, event->frame_or_window);
+
+#ifdef HAVE_PGTK
+    case PGTK_PREEDIT_TEXT_EVENT:
+      return list2 (intern ("pgtk-preedit-text"), event->arg);
+#endif
+
       /* The 'kind' field of the event is something we don't recognize.  */
     default:
       emacs_abort ();
@@ -11921,6 +12043,9 @@ syms_of_keyboard (void)
   drag_n_drop_syms = Qnil;
   staticpro (&drag_n_drop_syms);
 
+  pinch_syms = Qnil;
+  staticpro (&pinch_syms);
+
   unread_switch_frame = Qnil;
   staticpro (&unread_switch_frame);
 
@@ -12257,6 +12382,10 @@ See also `pre-command-hook'.  */);
               doc: /* Normal hook run when clearing the echo area.  */);
 #endif
   DEFSYM (Qecho_area_clear_hook, "echo-area-clear-hook");
+  DEFSYM (Qtouchscreen_begin, "touchscreen-begin");
+  DEFSYM (Qtouchscreen_end, "touchscreen-end");
+  DEFSYM (Qtouchscreen_update, "touchscreen-update");
+  DEFSYM (Qpinch, "pinch");
   Fset (Qecho_area_clear_hook, Qnil);
 
   DEFVAR_LISP ("lucid-menu-bar-dirty-flag", Vlucid_menu_bar_dirty_flag,
@@ -12642,6 +12771,8 @@ keys_of_keyboard (void)
                            "ns-put-working-text");
   initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
                            "ns-unput-working-text");
+  initial_define_lispy_key (Vspecial_event_map, "pgtk-preedit-text",
+                           "pgtk-preedit-text");
   /* Here we used to use `ignore-event' which would simple set prefix-arg to
      current-prefix-arg, as is done in `handle-switch-frame'.
      But `handle-switch-frame is not run from the special-map.
diff --git a/src/keyboard.h b/src/keyboard.h
index 21c51ec386..167b7d79e8 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -1,5 +1,5 @@
 /* Declarations useful when processing input.
-   Copyright (C) 1985-1987, 1993, 2001-2021 Free Software Foundation,
+   Copyright (C) 1985-1987, 1993, 2001-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -491,7 +491,7 @@ extern void process_pending_signals (void);
 extern struct timespec timer_check (void);
 extern void mark_kboards (void);
 
-#if defined HAVE_NTGUI || defined HAVE_X_WINDOWS
+#if defined HAVE_NTGUI || defined HAVE_X_WINDOWS || defined HAVE_PGTK
 extern const char *const lispy_function_keys[];
 #endif
 
diff --git a/src/keymap.c b/src/keymap.c
index 0b882958b9..ed69b1c427 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,5 +1,5 @@
 /* Manipulation of keymaps
-   Copyright (C) 1985-1988, 1993-1995, 1998-2021 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1998-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/keymap.h b/src/keymap.h
index f417301c8f..3c6aede9f1 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -1,5 +1,5 @@
 /* Functions to manipulate keymaps.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/kqueue.c b/src/kqueue.c
index 0a0650d208..c3c4631784 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -1,6 +1,6 @@
 /* Filesystem notifications support with kqueue API.
 
-Copyright (C) 2015-2021 Free Software Foundation, Inc.
+Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/lastfile.c b/src/lastfile.c
index 7df6cf10b1..4960131a47 100644
--- a/src/lastfile.c
+++ b/src/lastfile.c
@@ -1,5 +1,5 @@
 /* Mark end of data space to dump as pure, for GNU Emacs.
-   Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/lcms.c b/src/lcms.c
index b998c8c4eb..78001c9cbc 100644
--- a/src/lcms.c
+++ b/src/lcms.c
@@ -1,5 +1,5 @@
 /* Interface to Little CMS
-   Copyright (C) 2017-2021 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/lisp.h b/src/lisp.h
index 92ab05b422..f8fe2a6906 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1,6 +1,6 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter. -*- coding: utf-8 
-*-
 
-Copyright (C) 1985-1987, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -954,7 +954,7 @@ typedef EMACS_UINT Lisp_Word_tag;
                        ? ((y) - 1 + (x)) & ~ ((y) - 1)                 \
                        : ((y) - 1 + (x)) - ((y) - 1 + (x)) % (y))
 
-#include "globals.h"
+#include <globals.h>
 
 /* Header of vector-like objects.  This documents the layout constraints on
    vectors and pseudovectors (objects of PVEC_xxx subtype).  It also prevents
diff --git a/src/lread.c b/src/lread.c
index 5a2f1bc54e..2eff20f15d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1,6 +1,6 @@
 /* Lisp parsing and input streams.
 
-Copyright (C) 1985-1989, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -1545,7 +1545,7 @@ Return t if the file exists and loads successfully.  */)
        message_with_string ("Loading %s...", file, 1);
     }
 
-  specbind (Qload_file_name, found_eff);
+  specbind (Qload_file_name, hist_file_name);
   specbind (Qload_true_file_name, found);
   specbind (Qinhibit_file_name_operation, Qnil);
   specbind (Qload_in_progress, Qt);
@@ -2209,6 +2209,7 @@ readevalloop (Lisp_Object readcharfun,
   specbind (Qinternal_interpreter_environment,
            (NILP (lex_bound) || EQ (lex_bound, Qunbound)
             ? Qnil : list1 (Qt)));
+  specbind (Qmacroexp__dynvars, Vmacroexp__dynvars);
 
   /* Ensure sourcename is absolute, except whilst preloading.  */
   if (!will_dump_p ()
@@ -3223,23 +3224,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                    Fstring_as_unibyte (AREF (tmp, COMPILED_BYTECODE)));
            }
 
-         if (COMPILED_DOC_STRING < ASIZE (tmp)
-             && EQ (AREF (tmp, COMPILED_DOC_STRING), make_fixnum (0)))
-           {
-             /* read_list found a docstring like '(#$ . 5521)' and treated it
-                as 0.  This placeholder 0 would lead to accidental sharing in
-                purecopy's hash-consing, so replace it with a (hopefully)
-                unique integer placeholder, which is negative so that it is
-                not confused with a DOC file offset (the USE_LSB_TAG shift
-                relies on the fact that VALMASK is one bit narrower than
-                INTMASK).  Eventually Snarf-documentation should replace the
-                placeholder with the actual docstring.  */
-             verify (INTMASK & ~VALMASK);
-             EMACS_UINT hash = ((XHASH (tmp) >> USE_LSB_TAG)
-                                | (INTMASK - INTMASK / 2));
-             ASET (tmp, COMPILED_DOC_STRING, make_ufixnum (hash));
-           }
-
          XSETPVECTYPE (vec, PVEC_COMPILED);
          return tmp;
        }
@@ -4207,31 +4191,13 @@ read_list (bool flag, Lisp_Object readcharfun)
 
       /* While building, if the list starts with #$, treat it specially.  */
       if (EQ (elt, Vload_file_name)
-         && ! NILP (elt)
-         && !NILP (Vpurify_flag))
+         && ! NILP (elt))
        {
-         if (NILP (Vdoc_file_name))
-           /* We have not yet called Snarf-documentation, so assume
-              this file is described in the DOC file
-              and Snarf-documentation will fill in the right value later.
-              For now, replace the whole list with 0.  */
-           doc_reference = 1;
-         else
-           /* We have already called Snarf-documentation, so make a relative
-              file name for this file, so it can be found properly
-              in the installed Lisp directory.
-              We don't use Fexpand_file_name because that would make
-              the directory absolute now.  */
-           {
-             AUTO_STRING (dot_dot_lisp, "../lisp/");
-             elt = concat2 (dot_dot_lisp, Ffile_name_nondirectory (elt));
-           }
+         if (!NILP (Vpurify_flag))
+           doc_reference = 0;
+         else if (load_force_doc_strings)
+           doc_reference = 2;
        }
-      else if (EQ (elt, Vload_file_name)
-              && ! NILP (elt)
-              && load_force_doc_strings)
-       doc_reference = 2;
-
       if (ch)
        {
          if (flag > 0)
@@ -4252,8 +4218,6 @@ read_list (bool flag, Lisp_Object readcharfun)
 
              if (ch == ')')
                {
-                 if (doc_reference == 1)
-                   return make_fixnum (0);
                  if (doc_reference == 2 && FIXNUMP (XCDR (val)))
                    {
                      char *saved = NULL;
@@ -5469,4 +5433,10 @@ This variable's value can only be set via file-local 
variables.
 See Info node `(elisp)Shorthands' for more details.  */);
   Vread_symbol_shorthands = Qnil;
   DEFSYM (Qobarray_cache, "obarray-cache");
+
+  DEFSYM (Qmacroexp__dynvars, "macroexp--dynvars");
+  DEFVAR_LISP ("macroexp--dynvars", Vmacroexp__dynvars,
+        doc:   /* List of variables declared dynamic in the current scope.
+Only valid during macro-expansion.  Internal use only. */);
+  Vmacroexp__dynvars = Qnil;
 }
diff --git a/src/macfont.h b/src/macfont.h
index 0ec11f513c..e57d0193fb 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -1,5 +1,5 @@
 /* Interface definition for macOS Core text font backend.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/macfont.m b/src/macfont.m
index ce7a5ec8cd..f623c3ca2f 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1,5 +1,5 @@
 /* Font driver on macOS Core text.
-   Copyright (C) 2009-2021 Free Software Foundation, Inc.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -598,9 +598,9 @@ mac_screen_font_shape (ScreenFontRef font, CFStringRef 
string,
 }
 
 static CGColorRef
-get_cgcolor(unsigned long idx, struct frame *f)
+get_cgcolor(unsigned long color)
 {
-  NSColor *nsColor = ns_lookup_indexed_color (idx, f);
+  NSColor *nsColor = [NSColor colorWithUnsignedLong:color];
   [nsColor set];
   CGColorSpaceRef colorSpace = [[nsColor colorSpace] CGColorSpace];
   NSInteger noc = [nsColor numberOfComponents];
@@ -628,21 +628,21 @@ get_cgcolor_from_nscolor (NSColor *nsColor, struct frame 
*f)
   return cgColor;
 }
 
-#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face, f)        \
+#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face)           \
   do {                                                                  \
-    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f);    \
+    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face));       \
     CGContextSetFillColorWithColor (context, refcol_) ;                 \
     CGColorRelease (refcol_);                                           \
   } while (0)
-#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face, f)        \
+#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face)           \
   do {                                                                  \
-    CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face), f);    \
+    CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face));       \
     CGContextSetFillColorWithColor (context, refcol_);                  \
     CGColorRelease (refcol_);                                           \
   } while (0)
-#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face, f)      \
+#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face)         \
   do {                                                                  \
-    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f);    \
+    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face));       \
     CGContextSetStrokeColorWithColor (context, refcol_);                \
     CGColorRelease (refcol_);                                           \
   } while (0)
@@ -2933,7 +2933,7 @@ macfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
          CGColorRelease (colorref);
         }
       else
-       CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f);
+        CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face);
       CGContextFillRects (context, &background_rect, 1);
     }
 
@@ -2949,7 +2949,7 @@ macfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
          CGColorRelease (colorref);
         }
       else
-       CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f);
+        CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face);
       if (macfont_info->synthetic_italic_p)
         atfm = synthetic_italic_atfm;
       else
@@ -2978,7 +2978,7 @@ macfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
             CGContextSetLineWidth (context, synthetic_bold_factor * font_size);
 #endif
-          CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f);
+          CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face);
         }
       if (no_antialias_p)
         CGContextSetShouldAntialias (context, false);
diff --git a/src/macros.c b/src/macros.c
index 0752a5bb6f..3d00c28838 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -1,6 +1,6 @@
 /* Keyboard macros.
 
-Copyright (C) 1985-1986, 1993, 2000-2021 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/macros.h b/src/macros.h
index 23167a0763..10f4207b72 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -1,5 +1,5 @@
 /* Definitions for keyboard macro interpretation in GNU Emacs.
-   Copyright (C) 1985, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/marker.c b/src/marker.c
index 2b137b14c8..3c8e628762 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -1,5 +1,5 @@
 /* Markers: examining, setting and deleting.
-   Copyright (C) 1985, 1997-1998, 2001-2021 Free Software Foundation,
+   Copyright (C) 1985, 1997-1998, 2001-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/menu.c b/src/menu.c
index 96d1c5208a..18ecaf0b0b 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,6 +1,6 @@
 /* Platform-independent code for terminal communications.
 
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2021 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -424,7 +424,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, 
Lisp_Object dummy, void *sk
                  AREF (item_properties, ITEM_PROPERTY_HELP));
 
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) \
-  || defined (HAVE_NTGUI) || defined (HAVE_HAIKU)
+  || defined (HAVE_NTGUI) || defined (HAVE_HAIKU) || defined (HAVE_PGTK)
   /* Display a submenu using the toolkit.  */
   if (FRAME_WINDOW_P (XFRAME (Vmenu_updating_frame))
       && ! (NILP (map) || NILP (enabled)))
diff --git a/src/menu.h b/src/menu.h
index 6c67ab20bb..836172b58f 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -1,5 +1,5 @@
 /* Functions to manipulate menus.
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -59,6 +59,12 @@ extern Lisp_Object ns_menu_show (struct frame *, int, int, 
int,
                                 Lisp_Object, const char **);
 extern void ns_activate_menubar (struct frame *);
 #endif
+#ifdef HAVE_PGTK
+extern Lisp_Object pgtk_menu_show (struct frame *, int, int, int,
+                                Lisp_Object, const char **);
+extern void pgtk_activate_menubar (struct frame *);
+#endif
+
 extern Lisp_Object tty_menu_show (struct frame *, int, int, int,
                                  Lisp_Object, const char **);
 extern ptrdiff_t menu_item_width (const unsigned char *);
diff --git a/src/minibuf.c b/src/minibuf.c
index 6c0cd358c5..d0e58b61f2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1,6 +1,6 @@
 /* Minibuffer input and completion.
 
-Copyright (C) 1985-1986, 1993-2021 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/msdos.c b/src/msdos.c
index 2272aba6fd..f126d28c98 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1,6 +1,6 @@
 /* MS-DOS specific C utilities.          -*- coding: cp850 -*-
 
-Copyright (C) 1993-1997, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1997, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/msdos.h b/src/msdos.h
index d58b60ef5d..7e57c7c110 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -1,5 +1,5 @@
 /* MS-DOS specific C utilities, interface.
-   Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/nsfns.m b/src/nsfns.m
index 81019fce09..11132a294a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1,6 +1,6 @@
 /* Functions for the NeXT/Open/GNUstep and macOS window system.
 
-Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2021 Free Software
+Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -236,7 +236,6 @@ static void
 ns_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSColor *col;
-  EmacsCGFloat r, g, b, alpha;
 
   /* Must block_input, because ns_lisp_to_color does block/unblock_input
      which means that col may be deallocated in its unblock_input if there
@@ -253,12 +252,7 @@ ns_set_foreground_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
   [f->output_data.ns->foreground_color release];
   f->output_data.ns->foreground_color = col;
 
-  [col getRed: &r green: &g blue: &b alpha: &alpha];
-  FRAME_FOREGROUND_PIXEL (f) =
-    ARGB_TO_ULONG ((unsigned long) (alpha * 0xff),
-                   (unsigned long) (r * 0xff),
-                   (unsigned long) (g * 0xff),
-                   (unsigned long) (b * 0xff));
+  FRAME_FOREGROUND_PIXEL (f) = [col unsignedLong];
 
   if (FRAME_NS_VIEW (f))
     {
@@ -277,7 +271,7 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
   struct face *face;
   NSColor *col;
   NSView *view = FRAME_NS_VIEW (f);
-  EmacsCGFloat r, g, b, alpha;
+  EmacsCGFloat alpha;
 
   block_input ();
   if (ns_lisp_to_color (arg, &col))
@@ -291,12 +285,8 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
   [f->output_data.ns->background_color release];
   f->output_data.ns->background_color = col;
 
-  [col getRed: &r green: &g blue: &b alpha: &alpha];
-  FRAME_BACKGROUND_PIXEL (f) =
-    ARGB_TO_ULONG ((unsigned long) (alpha * 0xff),
-                   (unsigned long) (r * 0xff),
-                   (unsigned long) (g * 0xff),
-                   (unsigned long) (b * 0xff));
+  FRAME_BACKGROUND_PIXEL (f) = [col unsignedLong];
+  alpha = [col alphaComponent];
 
   if (view != nil)
     {
@@ -310,9 +300,9 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
       face = FRAME_DEFAULT_FACE (f);
       if (face)
         {
-          col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f);
-          face->background = ns_index_color
-            ([col colorWithAlphaComponent: alpha], f);
+          col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)];
+          face->background = [[col colorWithAlphaComponent: alpha]
+                               unsignedLong];
 
           update_face_from_frame_parameter (f, Qbackground_color, arg);
         }
@@ -3150,6 +3140,9 @@ all_nonzero_ascii (unsigned char *str, ptrdiff_t n)
    encoded form (e.g. UTF-8).  */
 + (NSString *)stringWithLispString:(Lisp_Object)string
 {
+  if (!STRINGP (string))
+    return nil;
+
   /* Shortcut for the common case.  */
   if (all_nonzero_ascii (SDATA (string), SBYTES (string)))
     return [NSString stringWithCString: SSDATA (string)
diff --git a/src/nsfont.m b/src/nsfont.m
index b3224629f0..d4ea4fa504 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -1,6 +1,6 @@
 /* Font back-end driver for the GNUstep window system.
    See font.h
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1196,7 +1196,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
        {
          if (s->hl != DRAW_CURSOR)
            [(NS_FACE_BACKGROUND (face) != 0
-             ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
+             ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
              : FRAME_BACKGROUND_COLOR (s->f)) set];
          else
            [FRAME_CURSOR_COLOR (s->f) set];
@@ -1216,7 +1216,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
     col = FRAME_BACKGROUND_COLOR (s->f);
   else
     col = (NS_FACE_FOREGROUND (face) != 0
-          ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f)
+          ? [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)]
           : FRAME_FOREGROUND_COLOR (s->f));
 
   /* render under GNUstep using DPS */
diff --git a/src/nsgui.h b/src/nsgui.h
index e4038d3226..0ba1fce80b 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication on the NeXT/Open/GNUstep API.
-   Copyright (C) 1995, 2005, 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2005, 2008-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -58,9 +58,6 @@ typedef struct _XCharStruct
   int descent;
 } XCharStruct;
 
-/* Used in xdisp.c when comparing faces and frame colors.  */
-extern unsigned long ns_color_index_to_rgba(int idx, struct frame *f);
-
 #ifdef __OBJC__
 typedef id Emacs_Pixmap;
 #else
diff --git a/src/nsimage.m b/src/nsimage.m
index dd2bb3b0d7..2fff987f9f 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -1,5 +1,5 @@
 /* Image support for the NeXT/Open/GNUstep and macOS window system.
-   Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2021 Free Software
+   Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -76,6 +76,8 @@ ns_can_use_native_image_api (Lisp_Object type)
     imageType = @"public.tiff";
   else if (EQ (type, Qsvg))
     imageType = @"public.svg-image";
+  else if (EQ (type, Qheic))
+    imageType = @"public.heic";
 
   /* NSImage also supports a host of other types such as PDF and BMP,
      but we don't yet support these in image.c.  */
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 29201e6907..4d3c752816 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep and macOS Cocoa menu and toolbar module.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1081,9 +1081,7 @@ update_frame_tool_bar_1 (struct frame *f, EmacsToolbar 
*toolbar)
       struct image *img;
       Lisp_Object image;
       Lisp_Object labelObj;
-      const char *labelText;
       Lisp_Object helpObj;
-      const char *helpText;
 
       /* Check if this is a separator.  */
       if (EQ (TOOLPROP (TOOL_BAR_ITEM_TYPE), Qt))
@@ -1109,11 +1107,9 @@ update_frame_tool_bar_1 (struct frame *f, EmacsToolbar 
*toolbar)
           idx = -1;
         }
       labelObj = TOOLPROP (TOOL_BAR_ITEM_LABEL);
-      labelText = NILP (labelObj) ? "" : SSDATA (labelObj);
       helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP);
       if (NILP (helpObj))
         helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION);
-      helpText = NILP (helpObj) ? "" : SSDATA (helpObj);
 
       /* Ignore invalid image specifications.  */
       if (!valid_image_p (image))
@@ -1135,8 +1131,8 @@ update_frame_tool_bar_1 (struct frame *f, EmacsToolbar 
*toolbar)
       [toolbar addDisplayItemWithImage: img->pixmap
                                    idx: k++
                                    tag: i
-                             labelText: labelText
-                              helpText: helpText
+                             labelText: [NSString 
stringWithLispString:labelObj]
+                              helpText: [NSString stringWithLispString:helpObj]
                                enabled: enabled_p];
 #undef TOOLPROP
     }
@@ -1252,15 +1248,15 @@ update_frame_tool_bar (struct frame *f)
 - (void) addDisplayItemWithImage: (EmacsImage *)img
                              idx: (int)idx
                              tag: (int)tag
-                       labelText: (const char *)label
-                        helpText: (const char *)help
+                       labelText: (NSString *)label
+                        helpText: (NSString *)help
                          enabled: (BOOL)enabled
 {
   NSTRACE ("[EmacsToolbar addDisplayItemWithImage: ...]");
 
   /* 1) come up w/identifier */
-  NSString *identifier
-    = [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]];
+  NSString *identifier = [NSString stringWithFormat: @"%lu%@",
+                                   (unsigned long)[img hash], label];
   [activeIdentifiers addObject: identifier];
 
   /* 2) create / reuse item */
@@ -1270,8 +1266,8 @@ update_frame_tool_bar (struct frame *f)
       item = [[[NSToolbarItem alloc] initWithItemIdentifier: identifier]
                autorelease];
       [item setImage: img];
-      [item setLabel: [NSString stringWithUTF8String: label]];
-      [item setToolTip: [NSString stringWithUTF8String: help]];
+      [item setLabel: label];
+      [item setToolTip: help];
       [item setTarget: emacsView];
       [item setAction: @selector (toolbarClicked:)];
       [identifierToItem setObject: item forKey: identifier];
diff --git a/src/nsselect.m b/src/nsselect.m
index 8b23f6f51a..13ca9b9c44 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep / macOS Cocoa selection processing for emacs.
-   Copyright (C) 1993-1994, 2005-2006, 2008-2021 Free Software
+   Copyright (C) 1993-1994, 2005-2006, 2008-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/nsterm.h b/src/nsterm.h
index ce8f594902..f027646123 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1,6 +1,6 @@
 /* -*- objc -*- */
 /* Definitions and headers for communication with NeXT/Open/GNUstep API.
-   Copyright (C) 1989, 1993, 2005, 2008-2021 Free Software Foundation,
+   Copyright (C) 1989, 1993, 2005, 2008-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -357,8 +357,9 @@ typedef id instancetype;
 @interface NSColor (EmacsColor)
 + (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
                          blue:(CGFloat)blue alpha:(CGFloat)alpha;
++ (NSColor *)colorWithUnsignedLong:(unsigned long)c;
 - (NSColor *)colorUsingDefaultColorSpace;
-
+- (unsigned long)unsignedLong;
 @end
 
 
@@ -550,8 +551,8 @@ typedef id instancetype;
 - (void) addDisplayItemWithImage: (EmacsImage *)img
                              idx: (int)idx
                              tag: (int)tag
-                       labelText: (const char *)label
-                        helpText: (const char *)help
+                       labelText: (NSString *)label
+                        helpText: (NSString *)help
                          enabled: (BOOL)enabled;
 
 /* delegate methods */
@@ -766,35 +767,6 @@ struct ns_bitmap_record
   int height, width, depth;
 };
 
-/* This maps between emacs color indices and NSColor objects.  */
-struct ns_color_table
-{
-  ptrdiff_t size;
-  ptrdiff_t avail;
-#ifdef __OBJC__
-  NSColor **colors;
-  NSMutableSet *empty_indices;
-#else
-  void **items;
-  void *availIndices;
-#endif
-};
-#define NS_COLOR_CAPACITY 256
-
-#define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
-#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | 
(b))
-
-#define ALPHA_FROM_ULONG(color) ((color) >> 24)
-#define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
-#define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
-#define BLUE_FROM_ULONG(color) ((color) & 0xff)
-
-/* Do not change `* 0x101' in the following lines to `<< 8'.  If
-   changed, image masks in 1-bit depth will not work.  */
-#define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101)
-#define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101)
-#define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101)
-
 #ifdef NS_IMPL_GNUSTEP
 /* this extends font backend font */
 struct nsfont_info
@@ -850,8 +822,6 @@ struct ns_display_info
   ptrdiff_t bitmaps_size;
   ptrdiff_t bitmaps_last;
 
-  struct ns_color_table *color_table;
-
   /* DPI resolution of this screen */
   double resx, resy;
 
@@ -1127,13 +1097,9 @@ ns_defined_color (struct frame *f,
                   const char *name,
                   Emacs_Color *color_def, bool alloc,
                   bool makeIndex);
-extern void
-ns_query_color (void *col, Emacs_Color *color_def, bool setPixel);
 
 #ifdef __OBJC__
 extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
-extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f);
-extern unsigned long ns_index_color (NSColor *color, struct frame *f);
 extern const char *ns_get_pending_menu_title (void);
 #endif
 
diff --git a/src/nsterm.m b/src/nsterm.m
index 4e5ce5ef70..41c311e04d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1,6 +1,6 @@
 /* NeXT/Open/GNUstep / macOS communication module.      -*- coding: utf-8 -*-
 
-Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2021 Free Software
+Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -166,6 +166,27 @@ char const * nstrace_fullscreen_type_name (int fs_type)
   return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]];
 }
 
++ (NSColor *)colorWithUnsignedLong:(unsigned long)c
+{
+  EmacsCGFloat a = (double)((c >> 24) & 0xff) / 255.0;
+  EmacsCGFloat r = (double)((c >> 16) & 0xff) / 255.0;
+  EmacsCGFloat g = (double)((c >> 8) & 0xff) / 255.0;
+  EmacsCGFloat b = (double)(c & 0xff) / 255.0;
+
+  return [NSColor colorForEmacsRed:r green:g blue:b alpha:a];
+}
+
+- (unsigned long)unsignedLong
+{
+  EmacsCGFloat r, g, b, a;
+  [self getRed:&r green:&g blue:&b alpha:&a];
+
+  return (((unsigned long) (a * 255)) << 24)
+    | (((unsigned long) (r * 255)) << 16)
+    | (((unsigned long) (g * 255)) << 8)
+    | ((unsigned long) (b * 255));
+}
+
 @end
 
 /* ==========================================================================
@@ -432,14 +453,6 @@ ev_modifiers_helper (unsigned int flags, unsigned int 
left_mask,
     }
 
 
-/* These flags will be OR'd or XOR'd with the NSWindow's styleMask
-   property depending on what we're doing.  */
-#define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled              \
-                               | NSWindowStyleMaskResizable         \
-                               | NSWindowStyleMaskMiniaturizable    \
-                               | NSWindowStyleMaskClosable)
-#define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless
-
 /* TODO: Get rid of need for these forward declarations.  */
 static void ns_condemn_scroll_bars (struct frame *f);
 static void ns_judge_scroll_bars (struct frame *f);
@@ -1949,59 +1962,6 @@ ns_fullscreen_hook (struct frame *f)
    ========================================================================== 
*/
 
 
-NSColor *
-ns_lookup_indexed_color (unsigned long idx, struct frame *f)
-{
-  struct ns_color_table *color_table = FRAME_DISPLAY_INFO (f)->color_table;
-  if (idx < 1 || idx >= color_table->avail)
-    return nil;
-  return color_table->colors[idx];
-}
-
-
-unsigned long
-ns_index_color (NSColor *color, struct frame *f)
-{
-  struct ns_color_table *color_table = FRAME_DISPLAY_INFO (f)->color_table;
-  ptrdiff_t idx;
-  ptrdiff_t i;
-
-  if (!color_table->colors)
-    {
-      color_table->size = NS_COLOR_CAPACITY;
-      color_table->avail = 1; /* skip idx=0 as marker */
-      color_table->colors = xmalloc (color_table->size * sizeof (NSColor *));
-      color_table->colors[0] = nil;
-      color_table->empty_indices = [[NSMutableSet alloc] init];
-    }
-
-  /* Do we already have this color?  */
-  for (i = 1; i < color_table->avail; i++)
-    if (color_table->colors[i] && [color_table->colors[i] isEqual: color])
-      return i;
-
-  if ([color_table->empty_indices count] > 0)
-    {
-      NSNumber *index = [color_table->empty_indices anyObject];
-      [color_table->empty_indices removeObject: index];
-      idx = [index unsignedLongValue];
-    }
-  else
-    {
-      if (color_table->avail == color_table->size)
-       color_table->colors =
-         xpalloc (color_table->colors, &color_table->size, 1,
-                  min (ULONG_MAX, PTRDIFF_MAX), sizeof *color_table->colors);
-      idx = color_table->avail++;
-    }
-
-  color_table->colors[idx] = color;
-  [color retain];
-  /* fprintf(stderr, "color_table: allocated %d\n",idx); */
-  return idx;
-}
-
-
 static int
 ns_get_color (const char *name, NSColor **col)
 /* --------------------------------------------------------------------------
@@ -2126,31 +2086,11 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
   return 1;
 }
 
-/* Convert an index into the color table into an RGBA value.  Used in
-   xdisp.c:extend_face_to_end_of_line when comparing faces and frame
-   color values.  */
-
-unsigned long
-ns_color_index_to_rgba(int idx, struct frame *f)
-{
-  NSColor *col;
-  col = ns_lookup_indexed_color (idx, f);
-
-  EmacsCGFloat r, g, b, a;
-  [col getRed: &r green: &g blue: &b alpha: &a];
-
-  return ARGB_TO_ULONG((unsigned long) (a * 255),
-                       (unsigned long) (r * 255),
-                       (unsigned long) (g * 255),
-                       (unsigned long) (b * 255));
-}
-
 void
-ns_query_color(void *col, Emacs_Color *color_def, bool setPixel)
+ns_query_color(void *col, Emacs_Color *color_def)
 /* --------------------------------------------------------------------------
-         Get ARGB values out of NSColor col and put them into color_def.
-         If setPixel, set the pixel to a concatenated version.
-         and set color_def pixel to the resulting index.
+         Get ARGB values out of NSColor col and put them into color_def
+         and set color_def pixel to the ARGB color.
    -------------------------------------------------------------------------- 
*/
 {
   EmacsCGFloat r, g, b, a;
@@ -2160,12 +2100,7 @@ ns_query_color(void *col, Emacs_Color *color_def, bool 
setPixel)
   color_def->green = g * 65535;
   color_def->blue  = b * 65535;
 
-  if (setPixel == YES)
-    color_def->pixel
-      = ARGB_TO_ULONG((unsigned long) (a * 255),
-                      (unsigned long) (r * 255),
-                      (unsigned long) (g * 255),
-                      (unsigned long) (b * 255));
+  color_def->pixel = [(NSColor *)col unsignedLong];
 }
 
 bool
@@ -2173,12 +2108,9 @@ ns_defined_color (struct frame *f,
                   const char *name,
                   Emacs_Color *color_def,
                   bool alloc,
-                  bool makeIndex)
+                  bool _makeIndex)
 /* --------------------------------------------------------------------------
          Return true if named color found, and set color_def rgb accordingly.
-         If makeIndex and alloc are nonzero put the color in the color_table,
-         and set color_def pixel to the resulting index.
-         If makeIndex is zero, set color_def pixel to ARGB.
          Return false if not found.
    -------------------------------------------------------------------------- 
*/
 {
@@ -2191,9 +2123,7 @@ ns_defined_color (struct frame *f,
       unblock_input ();
       return 0;
     }
-  if (makeIndex && alloc)
-    color_def->pixel = ns_index_color (col, f);
-  ns_query_color (col, color_def, !makeIndex);
+  ns_query_color (col, color_def);
   unblock_input ();
   return 1;
 }
@@ -2204,7 +2134,7 @@ ns_query_frame_background_color (struct frame *f, 
Emacs_Color *bgcolor)
      External (hook): Store F's background color into *BGCOLOR
    -------------------------------------------------------------------------- 
*/
 {
-  ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, true);
+  ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor);
 }
 
 static void
@@ -2623,8 +2553,8 @@ ns_clear_frame (struct frame *f)
 
   block_input ();
   ns_focus (f, &r, 1);
-  [ns_lookup_indexed_color (NS_FACE_BACKGROUND
-                           (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) set];
+  [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
+                           (FACE_FROM_ID (f, DEFAULT_FACE_ID))] set];
   NSRectFill (r);
   ns_unfocus (f);
 
@@ -2652,7 +2582,7 @@ ns_clear_frame_area (struct frame *f, int x, int y, int 
width, int height)
 
   r = NSIntersectionRect (r, [view frame]);
   ns_focus (f, &r, 1);
-  [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+  [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
 
   NSRectFill (r);
 
@@ -2755,8 +2685,7 @@ ns_clear_under_internal_border (struct frame *f)
         return;
 
       ns_focus (f, NULL, 1);
-      [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
-
+      [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
       NSRectFill (NSMakeRect (0, margin, width, border));
       NSRectFill (NSMakeRect (0, 0, border, height));
       NSRectFill (NSMakeRect (0, margin, width, border));
@@ -2807,7 +2736,7 @@ ns_after_update_window_line (struct window *w, struct 
glyph_row *desired_row)
           NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height);
           ns_focus (f, &r, 1);
 
-          [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+          [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
           NSRectFill (NSMakeRect (0, y, width, height));
           NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width,
                                   y, width, height));
@@ -2975,7 +2904,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row 
*row,
     {
       NSTRACE_RECT ("clearRect", clearRect);
 
-      [ns_lookup_indexed_color(face->background, f) set];
+      [[NSColor colorWithUnsignedLong:face->background] set];
       NSRectFill (clearRect);
     }
 
@@ -2992,9 +2921,9 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row 
*row,
       [bmp transformUsingAffineTransform:transform];
 
       if (!p->cursor_p)
-        bm_color = ns_lookup_indexed_color(face->foreground, f);
+        bm_color = [NSColor colorWithUnsignedLong:face->foreground];
       else if (p->overlay_p)
-        bm_color = ns_lookup_indexed_color(face->background, f);
+        bm_color = [NSColor colorWithUnsignedLong:face->background];
       else
         bm_color = f->output_data.ns->cursor_color;
 
@@ -3145,7 +3074,7 @@ ns_draw_vertical_window_border (struct window *w, int x, 
int y0, int y1)
 
   ns_focus (f, &r, 1);
   if (face)
-    [ns_lookup_indexed_color(face->foreground, f) set];
+    [[NSColor colorWithUnsignedLong:face->foreground] set];
 
   NSRectFill(r);
   ns_unfocus (f);
@@ -3181,29 +3110,29 @@ ns_draw_window_divider (struct window *w, int x0, int 
x1, int y0, int y1)
     /* A vertical divider, at least three pixels wide: Draw first and
        last pixels differently.  */
     {
-      [ns_lookup_indexed_color(color_first, f) set];
+      [[NSColor colorWithUnsignedLong:color_first] set];
       NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0));
-      [ns_lookup_indexed_color(color, f) set];
+      [[NSColor colorWithUnsignedLong:color] set];
       NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0));
-      [ns_lookup_indexed_color(color_last, f) set];
+      [[NSColor colorWithUnsignedLong:color_last] set];
       NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0));
     }
   else if ((x1 - x0 > y1 - y0) && (y1 - y0 >= 3))
     /* A horizontal divider, at least three pixels high: Draw first and
        last pixels differently.  */
     {
-      [ns_lookup_indexed_color(color_first, f) set];
+      [[NSColor colorWithUnsignedLong:color_first] set];
       NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1));
-      [ns_lookup_indexed_color(color, f) set];
+      [[NSColor colorWithUnsignedLong:color] set];
       NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2));
-      [ns_lookup_indexed_color(color_last, f) set];
+      [[NSColor colorWithUnsignedLong:color_last] set];
       NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1));
     }
   else
     {
       /* In any other case do not draw the first and last pixels
          differently.  */
-      [ns_lookup_indexed_color(color, f) set];
+      [[NSColor colorWithUnsignedLong:color] set];
       NSRectFill(divider);
     }
 
@@ -3316,7 +3245,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct 
face *face,
       if (s->face->underline == FACE_UNDER_WAVE)
         {
           if (!face->underline_defaulted_p)
-            [ns_lookup_indexed_color (face->underline_color, s->f) set];
+            [[NSColor colorWithUnsignedLong:face->underline_color] set];
 
           ns_draw_underwave (s, width, x);
         }
@@ -3390,7 +3319,8 @@ ns_draw_text_decoration (struct glyph_string *s, struct 
face *face,
           r = NSMakeRect (x, s->ybase + position, width, thickness);
 
           if (!face->underline_defaulted_p)
-            [ns_lookup_indexed_color (face->underline_color, s->f) set];
+            [[NSColor colorWithUnsignedLong:face->underline_color] set];
+
           NSRectFill (r);
         }
     }
@@ -3402,7 +3332,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct 
face *face,
       r = NSMakeRect (x, s->y, width, 1);
 
       if (!face->overline_color_defaulted_p)
-        [ns_lookup_indexed_color (face->overline_color, s->f) set];
+        [[NSColor colorWithUnsignedLong:face->overline_color] set];
 
       NSRectFill (r);
     }
@@ -3427,7 +3357,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct 
face *face,
       r = NSMakeRect (x, glyph_y + dy, width, 1);
 
       if (!face->strike_through_color_defaulted_p)
-        [ns_lookup_indexed_color (face->strike_through_color, s->f) set];
+        [[NSColor colorWithUnsignedLong:face->strike_through_color] set];
 
       NSRectFill (r);
     }
@@ -3486,7 +3416,7 @@ ns_draw_relief (NSRect outer, int hthickness, int 
vthickness, char raised_p,
 
   if (s->face->use_box_color_for_shadows_p)
     {
-      newBaseCol = ns_lookup_indexed_color (s->face->box_color, s->f);
+      newBaseCol = [NSColor colorWithUnsignedLong:s->face->box_color];
     }
 /*     else if (s->first_glyph->type == IMAGE_GLYPH
           && s->img->pixmap
@@ -3496,7 +3426,7 @@ ns_draw_relief (NSRect outer, int hthickness, int 
vthickness, char raised_p,
        } */
   else
     {
-      newBaseCol = ns_lookup_indexed_color (s->face->background, s->f);
+      newBaseCol = [NSColor colorWithUnsignedLong:s->face->background];
     }
 
   if (newBaseCol == nil)
@@ -3618,7 +3548,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
   if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color)
     {
       ns_draw_box (r, abs (hthickness), abs (vthickness),
-                   ns_lookup_indexed_color (face->box_color, s->f),
+                   [NSColor colorWithUnsignedLong:face->box_color],
                    left_p, right_p);
     }
   else
@@ -3655,7 +3585,7 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, 
char force_p)
            {
              if (s->hl != DRAW_CURSOR)
                [(NS_FACE_BACKGROUND (face) != 0
-                 ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
+                 ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
                  : FRAME_BACKGROUND_COLOR (s->f)) set];
              else
                [FRAME_CURSOR_COLOR (s->f) set];
@@ -3712,7 +3642,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
      otherwise, since we composite the image under NS (instead of mucking
      with its background color), we must clear just the image area.  */
 
-  [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
+  [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
 
   if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin
       || s->img->mask || s->img->pixmap == 0 || s->width != 
s->background_width)
@@ -3782,11 +3712,11 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
   if (s->hl == DRAW_CURSOR)
     {
       [FRAME_CURSOR_COLOR (s->f) set];
-      tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
+      tdCol = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)];
     }
   else
     {
-      tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+      tdCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)];
     }
 
   /* Draw underline, overline, strike-through.  */
@@ -3843,8 +3773,8 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
 
       face = s->face;
 
-      bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
-      fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+      bgCol = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)];
+      fgCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)];
 
       if (s->hl == DRAW_CURSOR)
        {
@@ -3863,7 +3793,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
          then decorations will be drawn after drawing the box in
          ns_draw_glyph_string, in order to prevent them from being
          overwritten by the box.  */
-      if (s->face->box != FACE_NO_BOX)
+      if (s->face->box == FACE_NO_BOX)
        ns_draw_text_decoration (s, face, fgCol, NSWidth (glyphRect),
                                 NSMinX (glyphRect));
 
@@ -4078,8 +4008,7 @@ ns_draw_glyph_string (struct glyph_string *s)
 
        {
          NSColor *col = (NS_FACE_FOREGROUND (s->face) != 0
-                         ? ns_lookup_indexed_color (NS_FACE_FOREGROUND 
(s->face),
-                                                    s->f)
+                         ? [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND 
(s->face)]
                          : FRAME_FOREGROUND_COLOR (s->f));
 
          /* Draw underline, overline, strike-through. */
@@ -4114,7 +4043,7 @@ ns_draw_glyph_string (struct glyph_string *s)
     {
       NSColor *fg_color;
 
-      fg_color = ns_lookup_indexed_color (NS_FACE_FOREGROUND (s->face), s->f);
+      fg_color = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (s->face)];
       ns_draw_text_decoration (s, s->face, fg_color,
                               s->background_width, s->x);
     }
@@ -4933,8 +4862,6 @@ ns_initialize_display_info (struct ns_display_info 
*dpyinfo)
                 && ![NSCalibratedWhiteColorSpace isEqualToString:
                                                  NSColorSpaceFromDepth 
(depth)];
     dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth);
-    dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table);
-    dpyinfo->color_table->colors = NULL;
     dpyinfo->root_window = 42; /* A placeholder.  */
     dpyinfo->highlight_frame = dpyinfo->ns_focus_frame = NULL;
     dpyinfo->n_fonts = 0;
@@ -5222,11 +5149,9 @@ ns_term_init (Lisp_Object display_name)
             color = XCAR (color_map);
             name = XCAR (color);
             c = XFIXNUM (XCDR (color));
+            c |= 0xFF000000;
             [cl setColor:
-                  [NSColor colorForEmacsRed: RED_FROM_ULONG (c) / 255.0
-                                      green: GREEN_FROM_ULONG (c) / 255.0
-                                       blue: BLUE_FROM_ULONG (c) / 255.0
-                                      alpha: 1.0]
+                  [NSColor colorWithUnsignedLong:c]
                   forKey: [NSString stringWithLispString: name]];
           }
 
@@ -6896,6 +6821,42 @@ not_in_argv (NSString *arg)
   [self mouseMoved: e];
 }
 
+#ifdef NS_IMPL_COCOA
+- (void) magnifyWithEvent: (NSEvent *) event
+{
+  NSPoint pt = [self convertPoint: [event locationInWindow] fromView: nil];
+  static CGFloat last_scale;
+
+  NSTRACE ("[EmacsView magnifyWithEvent]");
+  if (emacs_event)
+    {
+      emacs_event->kind = PINCH_EVENT;
+      emacs_event->modifiers = EV_MODIFIERS (event);
+      XSETINT (emacs_event->x, lrint (pt.x));
+      XSETINT (emacs_event->y, lrint (pt.y));
+      XSETFRAME (emacs_event->frame_or_window, emacsframe);
+
+      if ([event phase] == NSEventPhaseBegan)
+       {
+         last_scale = 1.0 + [event magnification];
+         emacs_event->arg = list4 (make_float (0.0),
+                                   make_float (0.0),
+                                   make_float (last_scale),
+                                   make_float (0.0));
+       }
+      else
+       /* Report a tiny change so that Lisp code doesn't think this
+          is the beginning of an event sequence.  This is the best we
+          can do because NS doesn't report pinch events in as much
+          detail as XInput 2 or GTK+ do.  */
+       emacs_event->arg = list4 (make_float (0.01),
+                                 make_float (0.0),
+                                 make_float (last_scale += [event 
magnification]),
+                                 make_float (0.0));
+      EV_TRAILER (event);
+    }
+}
+#endif
 
 - (BOOL)windowShouldClose: (id)sender
 {
@@ -7624,9 +7585,8 @@ not_in_argv (NSString *arg)
   onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
   f = emacsframe;
   wr = [w frame];
-  col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
-                                (FACE_FROM_ID (f, DEFAULT_FACE_ID)),
-                                 f);
+  col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
+                                (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
 
   if (fs_state != FULLSCREEN_BOTH)
     {
@@ -8306,10 +8266,17 @@ not_in_argv (NSString *arg)
   if (fullscreen)
     styleMask = NSWindowStyleMaskBorderless;
   else if (FRAME_UNDECORATED (f))
-    styleMask = FRAME_UNDECORATED_FLAGS;
+    {
+      styleMask = NSWindowStyleMaskBorderless;
+#ifdef NS_IMPL_COCOA
+      styleMask |= NSWindowStyleMaskResizable;
+#endif
+    }
   else
-    styleMask = FRAME_DECORATED_FLAGS;
-
+    styleMask = NSWindowStyleMaskTitled
+      | NSWindowStyleMaskResizable
+      | NSWindowStyleMaskMiniaturizable
+      | NSWindowStyleMaskClosable;
 
   self = [super initWithContentRect:
                   NSMakeRect (0, 0,
@@ -8374,9 +8341,8 @@ not_in_argv (NSString *arg)
 
       f->border_width = [self borderWidth];
 
-      col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
-                                     (FACE_FROM_ID (f, DEFAULT_FACE_ID)),
-                                     f);
+      col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
+                                     (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
       [self setBackgroundColor:col];
       if ([col alphaComponent] != (EmacsCGFloat) 1.0)
         [self setOpaque:NO];
@@ -8469,6 +8435,15 @@ not_in_argv (NSString *arg)
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
   [ourView updateCollectionBehavior];
 #endif
+
+  /* Child frames are often used in ways that may mean they should
+     "disappear" into the contents of the parent frame.  macOs's
+     drop-shadows break this effect, so remove them on undecorated
+     child frames.  */
+  if (parentFrame && FRAME_UNDECORATED (ourFrame))
+    [self setHasShadow:NO];
+  else
+    [self setHasShadow:YES];
 #endif
 
 
diff --git a/src/nsxwidget.h b/src/nsxwidget.h
index 9cc90b0d09..666509744a 100644
--- a/src/nsxwidget.h
+++ b/src/nsxwidget.h
@@ -1,6 +1,6 @@
 /* Header for NS Cocoa part of xwidget and webkit widget.
 
-Copyright (C) 2019-2021 Free Software Foundation, Inc.
+Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/nsxwidget.m b/src/nsxwidget.m
index eff5f0a9ce..f79873235c 100644
--- a/src/nsxwidget.m
+++ b/src/nsxwidget.m
@@ -1,6 +1,6 @@
 /* NS Cocoa part implementation of xwidget and webkit widget.
 
-Copyright (C) 2019-2021 Free Software Foundation, Inc.
+Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/pdumper.c b/src/pdumper.c
index c758bc8929..eeebb7ed0e 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -3177,7 +3177,7 @@ dump_charset (struct dump_context *ctx, int cs_i)
   DUMP_FIELD_COPY (&out, cs, hash_index);
   DUMP_FIELD_COPY (&out, cs, dimension);
   memcpy (out.code_space, &cs->code_space, sizeof (cs->code_space));
-  if (cs->code_space_mask)
+  if (cs_i < charset_table_used && cs->code_space_mask)
     dump_field_fixup_later (ctx, &out, cs, &cs->code_space_mask);
   DUMP_FIELD_COPY (&out, cs, code_linear_p);
   DUMP_FIELD_COPY (&out, cs, iso_chars_96);
@@ -3198,7 +3198,7 @@ dump_charset (struct dump_context *ctx, int cs_i)
   memcpy (out.fast_map, &cs->fast_map, sizeof (cs->fast_map));
   DUMP_FIELD_COPY (&out, cs, code_offset);
   dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
-  if (cs->code_space_mask)
+  if (cs_i < charset_table_used && cs->code_space_mask)
     dump_remember_cold_op (ctx, COLD_OP_CHARSET,
                            Fcons (dump_off_to_lisp (cs_i),
                                   dump_off_to_lisp (offset)));
@@ -5353,7 +5353,7 @@ dump_do_dump_relocation (const uintptr_t dump_base,
           their file names through expand-file-name and
           decode-coding-string.  */
        comp_u->file = eln_fname;
-       comp_u->handle = dynlib_open (SSDATA (eln_fname));
+       comp_u->handle = dynlib_open_for_eln (SSDATA (eln_fname));
        if (!comp_u->handle)
          {
            fprintf (stderr, "Error using execdir %s:\n",
diff --git a/src/pdumper.h b/src/pdumper.h
index 7f1f5e46ad..ffc743df42 100644
--- a/src/pdumper.h
+++ b/src/pdumper.h
@@ -1,6 +1,6 @@
 /* Header file for the portable dumper.
 
-Copyright (C) 2016, 2018-2021 Free Software Foundation, Inc.
+Copyright (C) 2016, 2018-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
new file mode 100644
index 0000000000..e94c2dfb30
--- /dev/null
+++ b/src/pgtkfns.c
@@ -0,0 +1,4107 @@
+/* Functions for the pure Gtk+-3.
+
+Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2020, 2022 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/>.  */
+
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
+#include <config.h>
+
+#include <math.h>
+#include <c-strcase.h>
+
+#include "lisp.h"
+#include "blockinput.h"
+#include "gtkutil.h"
+#include "window.h"
+#include "character.h"
+#include "buffer.h"
+#include "keyboard.h"
+#include "termhooks.h"
+#include "fontset.h"
+#include "font.h"
+#include "xsettings.h"
+#include "atimer.h"
+
+
+#ifdef HAVE_PGTK
+
+/* Static variables to handle applescript execution.  */
+static Lisp_Object as_script, *as_result;
+static int as_status;
+
+static ptrdiff_t image_cache_refcount;
+
+static int x_decode_color (struct frame *f, Lisp_Object color_name,
+                          int mono_color);
+static struct pgtk_display_info *pgtk_display_info_for_name (Lisp_Object);
+
+static const char *pgtk_app_name = "Emacs";
+
+/* Scale factor manually set per monitor.  */
+static Lisp_Object monitor_scale_factor_alist;
+
+/* ==========================================================================
+
+    Internal utility functions
+
+   ========================================================================== 
*/
+
+static double
+pgtk_get_monitor_scale_factor (const char *model)
+{
+  if (model == NULL)
+    return 0.0;
+
+  Lisp_Object mdl = build_string (model);
+  Lisp_Object tem = Fassoc (mdl, monitor_scale_factor_alist, Qnil);
+  if (NILP (tem))
+    return 0;
+  Lisp_Object cdr = Fcdr (tem);
+  if (NILP (cdr))
+    return 0;
+  if (FIXNUMP (cdr))
+    return XFIXNUM (cdr);
+  else if (FLOATP (cdr))
+    return XFLOAT_DATA (cdr);
+  else
+    error ("unknown type of scale-factor");
+}
+
+struct pgtk_display_info *
+check_pgtk_display_info (Lisp_Object object)
+{
+  struct pgtk_display_info *dpyinfo = NULL;
+
+  if (NILP (object))
+    {
+      struct frame *sf = XFRAME (selected_frame);
+
+      if (FRAME_PGTK_P (sf) && FRAME_LIVE_P (sf))
+       dpyinfo = FRAME_DISPLAY_INFO (sf);
+      else if (x_display_list != 0)
+       dpyinfo = x_display_list;
+      else
+       error ("Frames are not in use or not initialized");
+    }
+  else if (TERMINALP (object))
+    {
+      struct terminal *t = decode_live_terminal (object);
+
+      if (t->type != output_pgtk)
+       error ("Terminal %d is not a display", t->id);
+
+      dpyinfo = t->display_info.pgtk;
+    }
+  else if (STRINGP (object))
+    dpyinfo = pgtk_display_info_for_name (object);
+  else
+    {
+      struct frame *f = decode_window_system_frame (object);
+      dpyinfo = FRAME_DISPLAY_INFO (f);
+    }
+
+  return dpyinfo;
+}
+
+/* On Wayland, even if without WAYLAND_DISPLAY, --display DISPLAY
+   works, but gdk_display_get_name always return "wayland-0", which
+   may be different from DISPLAY.  If with WAYLAND_DISPLAY, then it
+   always returns WAYLAND_DISPLAY.  So pgtk Emacs is confused and
+   enters multi display environment.  To workaround this situation,
+   treat all the wayland-* as the same display.  */
+static Lisp_Object
+is_wayland_display (Lisp_Object dpyname)
+{
+  const char *p = SSDATA (dpyname);
+  if (strncmp (p, "wayland-", 8) != 0)
+    return Qnil;
+  p += 8;
+  do {
+    if (*p < '0' || *p > '9')
+      return Qnil;
+  } while (*++p != '\0');
+  return Qt;
+}
+
+/* Return the X display structure for the display named NAME.
+   Open a new connection if necessary.  */
+static struct pgtk_display_info *
+pgtk_display_info_for_name (Lisp_Object name)
+{
+  struct pgtk_display_info *dpyinfo;
+
+  CHECK_STRING (name);
+
+  if (!NILP (is_wayland_display (name)))
+    {
+      for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+       if (!NILP (is_wayland_display (XCAR (dpyinfo->name_list_element))))
+         return dpyinfo;
+    }
+  else
+    {
+      for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+       if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
+         return dpyinfo;
+    }
+
+  /* Use this general default value to start with.  */
+  Vx_resource_name = Vinvocation_name;
+
+  validate_x_resource_name ();
+
+  dpyinfo = pgtk_term_init (name, SSDATA (Vx_resource_name));
+
+  if (dpyinfo == 0)
+    error ("Cannot connect to display server %s", SDATA (name));
+
+  XSETFASTINT (Vwindow_system_version, 11);
+
+  return dpyinfo;
+}
+
+/* ==========================================================================
+
+    Frame parameter setters
+
+   ========================================================================== 
*/
+
+
+static void
+x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  unsigned long fg;
+
+  fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
+  FRAME_FOREGROUND_PIXEL (f) = fg;
+  FRAME_X_OUTPUT (f)->foreground_color = fg;
+
+  if (FRAME_GTK_WIDGET (f))
+    {
+      update_face_from_frame_parameter (f, Qforeground_color, arg);
+      if (FRAME_VISIBLE_P (f))
+       SET_FRAME_GARBAGED (f);
+    }
+}
+
+
+static void
+x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  unsigned long bg;
+
+  bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
+  FRAME_BACKGROUND_PIXEL (f) = bg;
+
+  /* Clear the frame.  */
+  if (FRAME_VISIBLE_P (f))
+    pgtk_clear_frame (f);
+
+  FRAME_X_OUTPUT (f)->background_color = bg;
+
+  xg_set_background_color (f, bg);
+  update_face_from_frame_parameter (f, Qbackground_color, arg);
+
+  if (FRAME_VISIBLE_P (f))
+    SET_FRAME_GARBAGED (f);
+}
+
+static void
+x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  int pix;
+
+  CHECK_STRING (arg);
+  pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
+  FRAME_X_OUTPUT (f)->border_pixel = pix;
+  pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (f));
+}
+
+static void
+x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  unsigned long fore_pixel, pixel;
+  struct pgtk_output *x = f->output_data.pgtk;
+
+  if (!NILP (Vx_cursor_fore_pixel))
+    {
+      fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
+                                  WHITE_PIX_DEFAULT (f));
+    }
+  else
+    fore_pixel = FRAME_BACKGROUND_PIXEL (f);
+
+  pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
+
+  /* Make sure that the cursor color differs from the background color.  */
+  if (pixel == FRAME_BACKGROUND_PIXEL (f))
+    {
+      pixel = x->mouse_color;
+      if (pixel == fore_pixel)
+       {
+         fore_pixel = FRAME_BACKGROUND_PIXEL (f);
+       }
+    }
+
+  x->cursor_foreground_color = fore_pixel;
+  x->cursor_color = pixel;
+
+  if (FRAME_X_WINDOW (f) != 0)
+    {
+      x->cursor_xgcv.background = x->cursor_color;
+      x->cursor_xgcv.foreground = fore_pixel;
+
+      if (FRAME_VISIBLE_P (f))
+       {
+         gui_update_cursor (f, false);
+         gui_update_cursor (f, true);
+       }
+    }
+
+  update_face_from_frame_parameter (f, Qcursor_color, arg);
+}
+
+static void
+pgtk_set_name_internal (struct frame *f, Lisp_Object name)
+{
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      block_input ();
+      {
+       Lisp_Object encoded_name;
+
+       /* As ENCODE_UTF_8 may cause GC and relocation of string data,
+          we use it before x_encode_text that may return string data.  */
+       encoded_name = ENCODE_UTF_8 (name);
+
+       gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                             SSDATA (encoded_name));
+      }
+      unblock_input ();
+    }
+}
+
+static void
+pgtk_set_name (struct frame *f, Lisp_Object name, int explicit)
+{
+  /* Make sure that requests from lisp code override requests from
+     Emacs redisplay code.  */
+  if (explicit)
+    {
+      /* If we're switching from explicit to implicit, we had better
+         update the mode lines and thereby update the title.  */
+      if (f->explicit_name && NILP (name))
+       update_mode_lines = 12;
+
+      f->explicit_name = !NILP (name);
+    }
+  else if (f->explicit_name)
+    return;
+
+  if (NILP (name))
+    name = build_string (pgtk_app_name);
+  else
+    CHECK_STRING (name);
+
+  /* Don't change the name if it's already NAME.  */
+  if (!NILP (Fstring_equal (name, f->name)))
+    return;
+
+  fset_name (f, name);
+
+  /* Title overrides explicit name.  */
+  if (!NILP (f->title))
+    name = f->title;
+
+  pgtk_set_name_internal (f, name);
+}
+
+
+/* This function should be called when the user's lisp code has
+   specified a name for the frame; the name will override any set by the
+   redisplay code.  */
+static void
+x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  pgtk_set_name (f, arg, true);
+}
+
+
+/* This function should be called by Emacs redisplay code to set the
+   name; names set this way will never override names set by the user's
+   lisp code.  */
+void
+pgtk_implicitly_set_name (struct frame *f, Lisp_Object arg,
+                         Lisp_Object oldval)
+{
+  pgtk_set_name (f, arg, false);
+}
+
+
+/* Change the title of frame F to NAME.
+   If NAME is nil, use the frame name as the title.  */
+
+static void
+x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
+{
+  /* Don't change the title if it's already NAME.  */
+  if (EQ (name, f->title))
+    return;
+
+  update_mode_lines = 22;
+
+  fset_title (f, name);
+
+  if (NILP (name))
+    name = f->name;
+  else
+    CHECK_STRING (name);
+
+  pgtk_set_name_internal (f, name);
+}
+
+
+void
+pgtk_set_doc_edited (void)
+{
+}
+
+
+static void
+x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
+{
+  int nlines;
+  /* Right now, menu bars don't work properly in minibuf-only frames;
+     most of the commands try to apply themselves to the minibuffer
+     frame itself, and get an error because you can't switch buffers
+     in or split the minibuffer window.  */
+  if (FRAME_MINIBUF_ONLY_P (f) || FRAME_PARENT_FRAME (f))
+    return;
+
+  if (TYPE_RANGED_FIXNUMP (int, value))
+    nlines = XFIXNUM (value);
+  else
+    nlines = 0;
+
+  /* Make sure we redisplay all windows in this frame.  */
+  fset_redisplay (f);
+
+  FRAME_MENU_BAR_LINES (f) = 0;
+  FRAME_MENU_BAR_HEIGHT (f) = 0;
+  if (nlines)
+    {
+      FRAME_EXTERNAL_MENU_BAR (f) = 1;
+      if (FRAME_PGTK_P (f) && f->output_data.pgtk->menubar_widget == 0)
+       /* Make sure next redisplay shows the menu bar.  */
+       XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = true;
+    }
+  else
+    {
+      if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
+       free_frame_menubar (f);
+      FRAME_EXTERNAL_MENU_BAR (f) = 0;
+      if (FRAME_X_P (f))
+       f->output_data.pgtk->menubar_widget = 0;
+    }
+
+  adjust_frame_glyphs (f);
+}
+
+/* Set the number of lines used for the tab bar of frame F to VALUE.
+   VALUE not an integer, or < 0 means set the lines to zero.  OLDVAL
+   is the old number of tab bar lines.  This function changes the
+   height of all windows on frame F to match the new tab bar height.
+   The frame's height doesn't change.  */
+
+static void
+x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
+{
+  int nlines;
+
+  /* Treat tab bars like menu bars.  */
+  if (FRAME_MINIBUF_ONLY_P (f))
+    return;
+
+  /* Use VALUE only if an int >= 0.  */
+  if (RANGED_FIXNUMP (0, value, INT_MAX))
+    nlines = XFIXNAT (value);
+  else
+    nlines = 0;
+
+  x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
+}
+
+
+/* Set the pixel height of the tab bar of frame F to HEIGHT.  */
+void
+x_change_tab_bar_height (struct frame *f, int height)
+{
+  int unit = FRAME_LINE_HEIGHT (f);
+  int old_height = FRAME_TAB_BAR_HEIGHT (f);
+  int lines = (height + unit - 1) / unit;
+  Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
+
+  /* Make sure we redisplay all windows in this frame.  */
+  fset_redisplay (f);
+
+  /* Recalculate tab bar and frame text sizes.  */
+  FRAME_TAB_BAR_HEIGHT (f) = height;
+  FRAME_TAB_BAR_LINES (f) = lines;
+  store_frame_param (f, Qtab_bar_lines, make_fixnum (lines));
+
+  if (FRAME_X_WINDOW (f) && FRAME_TAB_BAR_HEIGHT (f) == 0)
+    {
+      clear_frame (f);
+      clear_current_matrices (f);
+    }
+
+  if ((height < old_height) && WINDOWP (f->tab_bar_window))
+    clear_glyph_matrix (XWINDOW (f->tab_bar_window)->current_matrix);
+
+  if (!f->tab_bar_resized)
+    {
+      /* As long as tab_bar_resized is false, effectively try to change
+        F's native height.  */
+      if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
+       adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
+                          1, false, Qtab_bar_lines);
+      else
+       adjust_frame_size (f, -1, -1, 4, false, Qtab_bar_lines);
+
+      f->tab_bar_resized = f->tab_bar_redisplayed;
+    }
+  else
+    /* Any other change may leave the native size of F alone.  */
+    adjust_frame_size (f, -1, -1, 3, false, Qtab_bar_lines);
+
+  /* adjust_frame_size might not have done anything, garbage frame
+     here.  */
+  adjust_frame_glyphs (f);
+  SET_FRAME_GARBAGED (f);
+  if (FRAME_X_WINDOW (f))
+    pgtk_clear_under_internal_border (f);
+}
+
+/* Set the pixel height of the tool bar of frame F to HEIGHT.  */
+static void
+x_change_tool_bar_height (struct frame *f, int height)
+{
+  FRAME_TOOL_BAR_LINES (f) = 0;
+  FRAME_TOOL_BAR_HEIGHT (f) = 0;
+  if (height)
+    {
+      FRAME_EXTERNAL_TOOL_BAR (f) = true;
+      if (FRAME_X_P (f) && f->output_data.pgtk->toolbar_widget == 0)
+       /* Make sure next redisplay shows the tool bar.  */
+       XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = true;
+      update_frame_tool_bar (f);
+    }
+  else
+    {
+      if (FRAME_EXTERNAL_TOOL_BAR (f))
+       free_frame_tool_bar (f);
+      FRAME_EXTERNAL_TOOL_BAR (f) = false;
+    }
+}
+
+/* Toolbar support.  */
+static void
+x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
+{
+  int nlines;
+
+  /* Treat tool bars like menu bars.  */
+  if (FRAME_MINIBUF_ONLY_P (f))
+    return;
+
+  /* Use VALUE only if an int >= 0.  */
+  if (RANGED_FIXNUMP (0, value, INT_MAX))
+    nlines = XFIXNAT (value);
+  else
+    nlines = 0;
+
+  x_change_tool_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
+
+}
+
+static void
+x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object 
oldval)
+{
+  int border = check_int_nonnegative (arg);
+
+  if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
+    {
+      f->child_frame_border_width = border;
+
+      if (FRAME_X_WINDOW (f))
+       {
+         adjust_frame_size (f, -1, -1, 3, false, Qchild_frame_border_width);
+         pgtk_clear_under_internal_border (f);
+       }
+    }
+
+}
+
+static void
+x_set_internal_border_width (struct frame *f, Lisp_Object arg,
+                            Lisp_Object oldval)
+{
+  int border = check_int_nonnegative (arg);
+
+  if (border != FRAME_INTERNAL_BORDER_WIDTH (f))
+    {
+      f->internal_border_width = border;
+
+      if (FRAME_X_WINDOW (f))
+       {
+         adjust_frame_size (f, -1, -1, 3, false, Qinternal_border_width);
+         pgtk_clear_under_internal_border (f);
+       }
+    }
+}
+
+static void
+x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  bool result;
+
+  if (STRINGP (arg))
+    {
+      if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
+       return;
+    }
+  else if (!STRINGP (oldval) && NILP (oldval) == NILP (arg))
+    return;
+
+  block_input ();
+  if (NILP (arg))
+    result = pgtk_text_icon (f,
+                            SSDATA ((!NILP (f->icon_name)
+                                     ? f->icon_name : f->name)));
+  else
+    result = FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, arg);
+
+  if (result)
+    {
+      unblock_input ();
+      error ("No icon window available");
+    }
+
+  unblock_input ();
+}
+
+static void
+x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  bool result;
+
+  if (STRINGP (arg))
+    {
+      if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
+       return;
+    }
+  else if (!NILP (arg) || NILP (oldval))
+    return;
+
+  fset_icon_name (f, arg);
+
+  block_input ();
+
+  result = pgtk_text_icon (f,
+                          SSDATA ((!NILP (f->icon_name)
+                                   ? f->icon_name
+                                   : !NILP (f->title)
+                                   ? f->title : f->name)));
+
+  if (result)
+    {
+      unblock_input ();
+      error ("No icon window available");
+    }
+
+  unblock_input ();
+}
+
+/* This is the same as the xfns.c definition.  */
+static void
+x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  set_frame_cursor_types (f, arg);
+}
+
+/* called to set mouse pointer color, but all other terms use it to
+   initialize pointer types (and don't set the color ;) */
+static void
+x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+}
+
+
+static void
+x_icon (struct frame *f, Lisp_Object parms)
+/* --------------------------------------------------------------------------
+   Strangely-named function to set icon position parameters in frame.
+   This is irrelevant under macOS, but might be needed under GNUstep,
+   depending on the window manager used.  Note, this is not a standard
+   frame parameter-setter; it is called directly from x-create-frame.
+   -------------------------------------------------------------------------- 
*/
+{
+#if 0
+  Lisp_Object icon_x, icon_y;
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (Qnil);
+
+  FRAME_X_OUTPUT (f)->icon_top = -1;
+  FRAME_X_OUTPUT (f)->icon_left = -1;
+
+  /* Set the position of the icon.  */
+  icon_x =
+    gui_display_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER);
+  icon_y =
+    gui_display_get_arg (dpyinfo, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
+  if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
+    {
+      CHECK_NUMBER (icon_x);
+      CHECK_NUMBER (icon_y);
+      FRAME_X_OUTPUT (f)->icon_top = XFIXNUM (icon_y);
+      FRAME_X_OUTPUT (f)->icon_left = XFIXNUM (icon_x);
+    }
+  else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
+    error ("Both left and top icon corners of icon must be specified");
+#endif
+}
+
+/**
+ * x_set_undecorated:
+ *
+ * Set frame F's `undecorated' parameter.  If non-nil, F's window-system
+ * window is drawn without decorations, title, minimize/maximize boxes
+ * and external borders.  This usually means that the window cannot be
+ * dragged, resized, iconified, maximized or deleted with the mouse.  If
+ * nil, draw the frame with all the elements listed above unless these
+ * have been suspended via window manager settings.
+ *
+ * Some window managers may not honor this parameter.
+ */
+static void
+x_set_undecorated (struct frame *f, Lisp_Object new_value,
+                  Lisp_Object old_value)
+{
+  if (!EQ (new_value, old_value))
+    {
+      FRAME_UNDECORATED (f) = NILP (new_value) ? false : true;
+      xg_set_undecorated (f, new_value);
+    }
+}
+
+/**
+ * x_set_skip_taskbar:
+ *
+ * Set frame F's `skip-taskbar' parameter.  If non-nil, this should
+ * remove F's icon from the taskbar associated with the display of F's
+ * window-system window and inhibit switching to F's window via
+ * <Alt>-<TAB>.  If nil, lift these restrictions.
+ *
+ * Some window managers may not honor this parameter.
+ */
+static void
+x_set_skip_taskbar (struct frame *f, Lisp_Object new_value,
+                   Lisp_Object old_value)
+{
+  if (!EQ (new_value, old_value))
+    {
+      xg_set_skip_taskbar (f, new_value);
+      FRAME_SKIP_TASKBAR (f) = !NILP (new_value);
+    }
+}
+
+/**
+ * x_set_override_redirect:
+ *
+ * Set frame F's `override_redirect' parameter which, if non-nil, hints
+ * that the window manager doesn't want to deal with F.  Usually, such
+ * frames have no decorations and always appear on top of all frames.
+ *
+ * Some window managers may not honor this parameter.
+ */
+static void
+x_set_override_redirect (struct frame *f, Lisp_Object new_value,
+                        Lisp_Object old_value)
+{
+  if (!EQ (new_value, old_value))
+    {
+      /* Here (xfwm) override_redirect can be changed for invisible
+         frames only.  */
+      pgtk_make_frame_invisible (f);
+
+      xg_set_override_redirect (f, new_value);
+
+      pgtk_make_frame_visible (f);
+      FRAME_OVERRIDE_REDIRECT (f) = !NILP (new_value);
+    }
+}
+
+/* Set icon from FILE for frame F.  By using GTK functions the icon
+   may be any format that GdkPixbuf knows about, i.e. not just bitmaps.  */
+
+bool
+xg_set_icon (struct frame *f, Lisp_Object file)
+{
+  bool result = false;
+  Lisp_Object found;
+
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return false;
+
+  found = image_find_image_file (file);
+
+  if (!NILP (found))
+    {
+      GdkPixbuf *pixbuf;
+      GError *err = NULL;
+      char *filename = SSDATA (ENCODE_FILE (found));
+      block_input ();
+
+      pixbuf = gdk_pixbuf_new_from_file (filename, &err);
+
+      if (pixbuf)
+       {
+         gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                              pixbuf);
+         g_object_unref (pixbuf);
+
+         result = true;
+       }
+      else
+       g_error_free (err);
+
+      unblock_input ();
+    }
+
+  return result;
+}
+
+bool
+xg_set_icon_from_xpm_data (struct frame *f, const char **data)
+{
+  GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
+
+  if (!pixbuf)
+    return false;
+
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return false;
+
+  gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), pixbuf);
+  g_object_unref (pixbuf);
+  return true;
+}
+
+static void
+pgtk_set_sticky (struct frame *f, Lisp_Object new_value,
+                Lisp_Object old_value)
+{
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return;
+
+  if (!NILP (new_value))
+    gtk_window_stick (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+  else
+    gtk_window_unstick (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+}
+
+static void
+pgtk_set_tool_bar_position (struct frame *f,
+                           Lisp_Object new_value, Lisp_Object old_value)
+{
+  Lisp_Object choice = list4 (Qleft, Qright, Qtop, Qbottom);
+
+  if (!NILP (Fmemq (new_value, choice)))
+    {
+      if (!EQ (new_value, old_value))
+       {
+         xg_change_toolbar_position (f, new_value);
+         fset_tool_bar_position (f, new_value);
+       }
+    }
+  else
+    wrong_choice (choice, new_value);
+}
+
+static void
+pgtk_set_scroll_bar_foreground (struct frame *f, Lisp_Object new_value,
+                               Lisp_Object old_value)
+{
+  GtkCssProvider *css_provider =
+    FRAME_X_OUTPUT (f)->scrollbar_foreground_css_provider;
+
+  if (NILP (new_value))
+    {
+      gtk_css_provider_load_from_data (css_provider, "", -1, NULL);
+      update_face_from_frame_parameter (f, Qscroll_bar_foreground, new_value);
+    }
+  else if (STRINGP (new_value))
+    {
+      Emacs_Color rgb;
+
+      if (!pgtk_parse_color (f, SSDATA (new_value), &rgb))
+       error ("Unknown color.");
+
+      /* On pgtk, this frame parameter should be ignored, and honor gtk theme. 
*/
+#if 0
+      char css[64];
+      sprintf (css, "scrollbar slider { background-color: #%06x; }",
+              (unsigned int) rgb.pixel & 0xffffff);
+      gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
+#endif
+      update_face_from_frame_parameter (f, Qscroll_bar_foreground, new_value);
+
+    }
+  else
+    error ("Invalid scroll-bar-foreground.");
+}
+
+static void
+pgtk_set_scroll_bar_background (struct frame *f, Lisp_Object new_value,
+                               Lisp_Object old_value)
+{
+  GtkCssProvider *css_provider =
+    FRAME_X_OUTPUT (f)->scrollbar_background_css_provider;
+
+  if (NILP (new_value))
+    {
+      gtk_css_provider_load_from_data (css_provider, "", -1, NULL);
+      update_face_from_frame_parameter (f, Qscroll_bar_background, new_value);
+    }
+  else if (STRINGP (new_value))
+    {
+      Emacs_Color rgb;
+
+      if (!pgtk_parse_color (f, SSDATA (new_value), &rgb))
+       error ("Unknown color.");
+
+      /* On pgtk, this frame parameter should be ignored, and honor gtk theme. 
*/
+#if 0
+      char css[64];
+      sprintf (css, "scrollbar trough { background-color: #%06x; }",
+              (unsigned int) rgb.pixel & 0xffffff);
+      gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
+#endif
+      update_face_from_frame_parameter (f, Qscroll_bar_background, new_value);
+
+    }
+  else
+    error ("Invalid scroll-bar-background.");
+}
+
+
+/***********************************************************************
+                              Printing
+ ***********************************************************************/
+
+
+DEFUN ("x-export-frames", Fx_export_frames, Sx_export_frames, 0, 2, 0,
+       doc: /* Return image data of FRAMES in TYPE format.
+FRAMES should be nil (the selected frame), a frame, or a list of
+frames (each of which corresponds to one page).  Each frame should be
+visible.  Optional arg TYPE should be either `pdf' (default), `png',
+`postscript', or `svg'.  Supported types are determined by the
+compile-time configuration of cairo.
+
+Note: Text drawn with the `x' font backend is shown with hollow boxes
+unless TYPE is `png'.  */)
+     (Lisp_Object frames, Lisp_Object type)
+{
+  Lisp_Object rest, tmp;
+  cairo_surface_type_t surface_type;
+
+  if (!CONSP (frames))
+    frames = list1 (frames);
+
+  tmp = Qnil;
+  for (rest = frames; CONSP (rest); rest = XCDR (rest))
+    {
+      struct frame *f = decode_window_system_frame (XCAR (rest));
+      Lisp_Object frame;
+
+      XSETFRAME (frame, f);
+      if (!FRAME_VISIBLE_P (f))
+       error ("Frames to be exported must be visible.");
+      tmp = Fcons (frame, tmp);
+    }
+  frames = Fnreverse (tmp);
+
+#ifdef CAIRO_HAS_PDF_SURFACE
+  if (NILP (type) || EQ (type, Qpdf))
+    surface_type = CAIRO_SURFACE_TYPE_PDF;
+  else
+#endif
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
+  if (EQ (type, Qpng))
+    {
+      if (!NILP (XCDR (frames)))
+       error ("PNG export cannot handle multiple frames.");
+      surface_type = CAIRO_SURFACE_TYPE_IMAGE;
+    }
+  else
+#endif
+#ifdef CAIRO_HAS_PS_SURFACE
+  if (EQ (type, Qpostscript))
+    surface_type = CAIRO_SURFACE_TYPE_PS;
+  else
+#endif
+#ifdef CAIRO_HAS_SVG_SURFACE
+  if (EQ (type, Qsvg))
+    {
+      /* For now, we stick to SVG 1.1.  */
+      if (!NILP (XCDR (frames)))
+       error ("SVG export cannot handle multiple frames.");
+      surface_type = CAIRO_SURFACE_TYPE_SVG;
+    }
+  else
+#endif
+    error ("Unsupported export type");
+
+  return pgtk_cr_export_frames (frames, surface_type);
+}
+
+
+/* Note: see frame.c for template, also where generic functions are impl */
+frame_parm_handler pgtk_frame_parm_handlers[] = {
+  gui_set_autoraise,           /* generic OK */
+  gui_set_autolower,           /* generic OK */
+  x_set_background_color,
+  x_set_border_color,
+  gui_set_border_width,
+  x_set_cursor_color,
+  x_set_cursor_type,
+  gui_set_font,                        /* generic OK */
+  x_set_foreground_color,
+  x_set_icon_name,
+  x_set_icon_type,
+  x_set_child_frame_border_width,
+  x_set_internal_border_width, /* generic OK */
+  gui_set_right_divider_width,
+  gui_set_bottom_divider_width,
+  x_set_menu_bar_lines,
+  x_set_mouse_color,
+  x_explicitly_set_name,
+  gui_set_scroll_bar_width,    /* generic OK */
+  gui_set_scroll_bar_height,   /* generic OK */
+  x_set_title,
+  gui_set_unsplittable,                /* generic OK */
+  gui_set_vertical_scroll_bars,        /* generic OK */
+  gui_set_horizontal_scroll_bars,      /* generic OK */
+  gui_set_visibility,          /* generic OK */
+  x_set_tab_bar_lines,
+  x_set_tool_bar_lines,
+  pgtk_set_scroll_bar_foreground,
+  pgtk_set_scroll_bar_background,
+  gui_set_screen_gamma,                /* generic OK */
+  gui_set_line_spacing,                /* generic OK, sets 
f->extra_line_spacing to int */
+  gui_set_left_fringe,         /* generic OK */
+  gui_set_right_fringe,                /* generic OK */
+  0,                           /* x_set_wait_for_wm */
+  gui_set_fullscreen,          /* generic OK */
+  gui_set_font_backend,                /* generic OK */
+  gui_set_alpha,
+  pgtk_set_sticky,
+  pgtk_set_tool_bar_position,
+  0,                           /* x_set_inhibit_double_buffering */
+  x_set_undecorated,
+  x_set_parent_frame,
+  x_set_skip_taskbar,
+  x_set_no_focus_on_map,
+  x_set_no_accept_focus,
+  x_set_z_group,
+  x_set_override_redirect,
+  gui_set_no_special_glyphs,
+};
+
+
+/* Handler for signals raised during x_create_frame and
+   x_create_tip_frame.  FRAME is the frame which is partially
+   constructed.  */
+
+static Lisp_Object
+unwind_create_frame (Lisp_Object frame)
+{
+  struct frame *f = XFRAME (frame);
+
+  /* If frame is already dead, nothing to do.  This can happen if the
+     display is disconnected after the frame has become official, but
+     before x_create_frame removes the unwind protect.  */
+  if (!FRAME_LIVE_P (f))
+    return Qnil;
+
+  /* If frame is ``official'', nothing to do.  */
+  if (NILP (Fmemq (frame, Vframe_list)))
+    {
+      /* If the frame's image cache refcount is still the same as our
+         private shadow variable, it means we are unwinding a frame
+         for which we didn't yet call init_frame_faces, where the
+         refcount is incremented.  Therefore, we increment it here, so
+         that free_frame_faces, called in x_free_frame_resources
+         below, will not mistakenly decrement the counter that was not
+         incremented yet to account for this new frame.  */
+      if (FRAME_IMAGE_CACHE (f) != NULL
+         && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount)
+       FRAME_IMAGE_CACHE (f)->refcount++;
+
+      x_free_frame_resources (f);
+      free_glyphs (f);
+      return Qt;
+    }
+
+  return Qnil;
+}
+
+static void
+do_unwind_create_frame (Lisp_Object frame)
+{
+  unwind_create_frame (frame);
+}
+
+/* Return the pixel color value for color COLOR_NAME on frame F.  If F
+   is a monochrome frame, return MONO_COLOR regardless of what ARG says.
+   Signal an error if color can't be allocated.  */
+
+static int
+x_decode_color (struct frame *f, Lisp_Object color_name, int mono_color)
+{
+  Emacs_Color cdef;
+
+  CHECK_STRING (color_name);
+
+  /* Return MONO_COLOR for monochrome frames.  */
+  if (FRAME_DISPLAY_INFO (f)->n_planes == 1)
+    return mono_color;
+
+  /* x_defined_color is responsible for coping with failures
+     by looking for a near-miss.  */
+  if (pgtk_defined_color (f, SSDATA (color_name), &cdef, true, 0))
+    return cdef.pixel;
+
+  signal_error ("Undefined color", color_name);
+}
+
+void
+pgtk_default_font_parameter (struct frame *f, Lisp_Object parms)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  Lisp_Object font_param =
+    gui_display_get_arg (dpyinfo, parms, Qfont, NULL, NULL,
+                        RES_TYPE_STRING);
+  Lisp_Object font = Qnil;
+  if (EQ (font_param, Qunbound))
+    font_param = Qnil;
+
+  if (NILP (font_param))
+    {
+      /* System font should take precedence over X resources.  We suggest this
+         regardless of font-use-system-font because .emacs may not have been
+         read yet.  */
+      const char *system_font = xsettings_get_system_font ();
+      if (system_font)
+       font = font_open_by_name (f, build_unibyte_string (system_font));
+    }
+
+  if (NILP (font))
+    font = !NILP (font_param) ? font_param
+      : gui_display_get_arg (dpyinfo, parms, Qfont, "font", "Font",
+                            RES_TYPE_STRING);
+
+  if (!FONTP (font) && !STRINGP (font))
+    {
+      const char *names[] = {
+       "monospace-10",
+       "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
+       "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
+       "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
+       /* This was formerly the first thing tried, but it finds
+          too many fonts and takes too long.  */
+       "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
+       /* If those didn't work, look for something which will
+          at least work.  */
+       "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
+       "fixed",
+       NULL
+      };
+      int i;
+
+      for (i = 0; names[i]; i++)
+       {
+         font = font_open_by_name (f, build_unibyte_string (names[i]));
+         if (!NILP (font))
+           break;
+       }
+      if (NILP (font))
+       error ("No suitable font was found");
+    }
+  else if (!NILP (font_param))
+    {
+      /* Remember the explicit font parameter, so we can re-apply it after
+         we've applied the `default' face settings.  */
+      AUTO_FRAME_ARG (arg, Qfont_parameter, font_param);
+      gui_set_frame_parameters (f, arg);
+    }
+
+  /* This call will make X resources override any system font setting.  */
+  gui_default_parameter (f, parms, Qfont, font, "font", "Font",
+                        RES_TYPE_STRING);
+}
+
+static void
+update_watched_scale_factor (struct atimer *timer)
+{
+  struct frame *f = timer->client_data;
+  double scale_factor = FRAME_SCALE_FACTOR (f);
+
+  if (scale_factor != FRAME_X_OUTPUT (f)->watched_scale_factor)
+    {
+      FRAME_X_OUTPUT (f)->watched_scale_factor = scale_factor;
+      pgtk_cr_update_surface_desired_size (f,
+                                          FRAME_CR_SURFACE_DESIRED_WIDTH (f),
+                                          FRAME_CR_SURFACE_DESIRED_HEIGHT (f),
+                                          true);
+    }
+}
+
+/* ==========================================================================
+
+    Lisp definitions
+
+   ========================================================================== 
*/
+
+DEFUN ("pgtk-set-monitor-scale-factor", Fpgtk_set_monitor_scale_factor,
+       Spgtk_set_monitor_scale_factor, 2, 2, 0,
+       doc: /* Set monitor MONITOR-MODEL's scale factor to SCALE-FACTOR.
+Since Gdk's scale factor is integer, physical pixel width/height is
+incorrect when you specify fractional scale factor in compositor.
+If you set scale factor by this function, it is used instead of Gdk's one.
+
+Pass nil as SCALE-FACTOR if you want to reset the specified monitor's
+scale factor. */ )
+  (Lisp_Object monitor_model, Lisp_Object scale_factor)
+{
+  CHECK_STRING (monitor_model);
+  if (!NILP (scale_factor))
+    {
+      CHECK_NUMBER (scale_factor);
+      if (FIXNUMP (scale_factor))
+       {
+         if (XFIXNUM (scale_factor) <= 0)
+           error ("scale factor must be > 0.");
+       }
+      else if (FLOATP (scale_factor))
+       {
+         if (XFLOAT_DATA (scale_factor) <= 0.0)
+           error ("scale factor must be > 0.");
+       }
+      else
+       error ("unknown type of scale-factor");
+    }
+
+  Lisp_Object tem = Fassoc (monitor_model, monitor_scale_factor_alist, Qnil);
+  if (NILP (tem))
+    {
+      if (!NILP (scale_factor))
+       monitor_scale_factor_alist = Fcons (Fcons (monitor_model, scale_factor),
+                                           monitor_scale_factor_alist);
+    }
+  else
+    Fsetcdr (tem, scale_factor);
+
+  return scale_factor;
+}
+
+DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 1, 1, 0,
+       doc: /* Make a new X window, which is called a "frame" in Emacs terms.
+Return an Emacs frame object.  PARMS is an alist of frame parameters.
+If the parameters specify that the frame should not have a minibuffer,
+and do not specify a specific minibuffer window to use, then
+`default-minibuffer-frame' must be a frame whose minibuffer can be
+shared by the new frame.
+
+This function is an internal primitive--use `make-frame' instead.  */ )
+  (Lisp_Object parms)
+{
+  struct frame *f;
+  Lisp_Object frame, tem;
+  Lisp_Object name;
+  bool minibuffer_only = false;
+  bool undecorated = false, override_redirect = false;
+  long window_prompting = 0;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  Lisp_Object display;
+  struct pgtk_display_info *dpyinfo = NULL;
+  Lisp_Object parent, parent_frame;
+  struct kboard *kb;
+
+  parms = Fcopy_alist (parms);
+
+  /* Use this general default value to start with
+     until we know if this frame has a specified name.  */
+  Vx_resource_name = Vinvocation_name;
+
+  display =
+    gui_display_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_NUMBER);
+  if (EQ (display, Qunbound))
+    display =
+      gui_display_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING);
+  if (EQ (display, Qunbound))
+    display = Qnil;
+  dpyinfo = check_pgtk_display_info (display);
+  kb = dpyinfo->terminal->kboard;
+
+  if (!dpyinfo->terminal->name)
+    error ("Terminal is not live, can't create new frames on it");
+
+  name =
+    gui_display_get_arg (dpyinfo, parms, Qname, "name", "Name",
+                        RES_TYPE_STRING);
+  if (!STRINGP (name) && !EQ (name, Qunbound) && !NILP (name))
+    error ("Invalid frame name--not a string or nil");
+
+  if (STRINGP (name))
+    Vx_resource_name = name;
+
+  /* See if parent window is specified.  */
+  parent =
+    gui_display_get_arg (dpyinfo, parms, Qparent_id, NULL, NULL,
+                        RES_TYPE_NUMBER);
+  if (EQ (parent, Qunbound))
+    parent = Qnil;
+  if (!NILP (parent))
+    CHECK_NUMBER (parent);
+
+  frame = Qnil;
+  tem =
+    gui_display_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer",
+                        "Minibuffer", RES_TYPE_SYMBOL);
+  if (EQ (tem, Qnone) || NILP (tem))
+    f = make_frame_without_minibuffer (Qnil, kb, display);
+  else if (EQ (tem, Qonly))
+    {
+      f = make_minibuffer_frame ();
+      minibuffer_only = true;
+    }
+  else if (WINDOWP (tem))
+    f = make_frame_without_minibuffer (tem, kb, display);
+  else
+    f = make_frame (true);
+
+  parent_frame =
+    gui_display_get_arg (dpyinfo, parms, Qparent_frame, NULL, NULL,
+                        RES_TYPE_SYMBOL);
+  /* Accept parent-frame iff parent-id was not specified.  */
+  if (!NILP (parent)
+      || EQ (parent_frame, Qunbound)
+      || NILP (parent_frame)
+      || !FRAMEP (parent_frame)
+      || !FRAME_LIVE_P (XFRAME (parent_frame))
+      || !FRAME_PGTK_P (XFRAME (parent_frame)))
+    parent_frame = Qnil;
+
+  fset_parent_frame (f, parent_frame);
+  store_frame_param (f, Qparent_frame, parent_frame);
+
+  if (!NILP
+      (tem =
+       (gui_display_get_arg
+       (dpyinfo, parms, Qundecorated, NULL, NULL, RES_TYPE_BOOLEAN)))
+      && !(EQ (tem, Qunbound)))
+    undecorated = true;
+
+  FRAME_UNDECORATED (f) = undecorated;
+  store_frame_param (f, Qundecorated, undecorated ? Qt : Qnil);
+
+  if (!NILP
+      (tem =
+       (gui_display_get_arg
+       (dpyinfo, parms, Qoverride_redirect, NULL, NULL, RES_TYPE_BOOLEAN)))
+      && !(EQ (tem, Qunbound)))
+    override_redirect = true;
+
+  FRAME_OVERRIDE_REDIRECT (f) = override_redirect;
+  store_frame_param (f, Qoverride_redirect, override_redirect ? Qt : Qnil);
+
+  XSETFRAME (frame, f);
+
+  f->terminal = dpyinfo->terminal;
+
+  f->output_method = output_pgtk;
+  FRAME_X_OUTPUT (f) = xzalloc (sizeof *FRAME_X_OUTPUT (f));
+#if 0
+  FRAME_X_OUTPUT (f)->icon_bitmap = -1;
+#endif
+  FRAME_FONTSET (f) = -1;
+  FRAME_X_OUTPUT (f)->white_relief.pixel = -1;
+  FRAME_X_OUTPUT (f)->black_relief.pixel = -1;
+
+  FRAME_X_OUTPUT (f)->scrollbar_foreground_css_provider =
+    gtk_css_provider_new ();
+  FRAME_X_OUTPUT (f)->scrollbar_background_css_provider =
+    gtk_css_provider_new ();
+
+  fset_icon_name (f,
+                 gui_display_get_arg (dpyinfo, parms, Qicon_name, "iconName",
+                                      "Title", RES_TYPE_STRING));
+  if (!STRINGP (f->icon_name))
+    fset_icon_name (f, Qnil);
+
+  FRAME_DISPLAY_INFO (f) = dpyinfo;
+
+  /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe.  */
+  record_unwind_protect (do_unwind_create_frame, frame);
+
+  /* These colors will be set anyway later, but it's important
+     to get the color reference counts right, so initialize them!  */
+  {
+    Lisp_Object black;
+
+    /* Function x_decode_color can signal an error.  Make
+       sure to initialize color slots so that we won't try
+       to free colors we haven't allocated.  */
+    FRAME_FOREGROUND_PIXEL (f) = -1;
+    FRAME_BACKGROUND_PIXEL (f) = -1;
+    FRAME_X_OUTPUT (f)->cursor_color = -1;
+    FRAME_X_OUTPUT (f)->cursor_foreground_color = -1;
+    FRAME_X_OUTPUT (f)->border_pixel = -1;
+    FRAME_X_OUTPUT (f)->mouse_color = -1;
+
+    black = build_string ("black");
+    FRAME_FOREGROUND_PIXEL (f)
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    FRAME_BACKGROUND_PIXEL (f)
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    FRAME_X_OUTPUT (f)->cursor_color
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    FRAME_X_OUTPUT (f)->cursor_foreground_color
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    FRAME_X_OUTPUT (f)->border_pixel
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    FRAME_X_OUTPUT (f)->mouse_color
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+  }
+
+  /* Specify the parent under which to make this X window.  */
+  if (!NILP (parent))
+    {
+      FRAME_X_OUTPUT (f)->parent_desc = (Window) XFIXNAT (parent);
+      FRAME_X_OUTPUT (f)->explicit_parent = true;
+    }
+  else
+    {
+      FRAME_X_OUTPUT (f)->parent_desc = FRAME_DISPLAY_INFO (f)->root_window;
+      FRAME_X_OUTPUT (f)->explicit_parent = false;
+    }
+
+  /* Set the name; the functions to which we pass f expect the name to
+     be set.  */
+  if (EQ (name, Qunbound) || NILP (name))
+    {
+      fset_name (f, build_string (dpyinfo->x_id_name));
+      f->explicit_name = false;
+    }
+  else
+    {
+      fset_name (f, name);
+      f->explicit_name = true;
+      /* Use the frame's title when getting resources for this frame.  */
+      specbind (Qx_resource_name, name);
+    }
+
+  register_font_driver (&ftcrfont_driver, f);
+#ifdef HAVE_HARFBUZZ
+  register_font_driver (&ftcrhbfont_driver, f);
+#endif /* HAVE_HARFBUZZ */
+
+  image_cache_refcount =
+    FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
+
+  gui_default_parameter (f, parms, Qfont_backend, Qnil,
+                        "fontBackend", "FontBackend", RES_TYPE_STRING);
+
+  /* Extract the window parameters from the supplied values
+     that are needed to determine window geometry.  */
+  pgtk_default_font_parameter (f, parms);
+  if (!FRAME_FONT (f))
+    {
+      delete_frame (frame, Qnoelisp);
+      error ("Invalid frame font");
+    }
+
+  /* Frame contents get displaced if an embedded X window has a border.  */
+#if 0
+  if (!FRAME_X_EMBEDDED_P (f))
+#endif
+    gui_default_parameter (f, parms, Qborder_width, make_fixnum (0),
+                          "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
+
+  if (NILP (Fassq (Qinternal_border_width, parms)))
+    {
+      Lisp_Object value;
+
+      value = gui_display_get_arg (dpyinfo, parms, Qinternal_border_width,
+                                  "internalBorder", "internalBorder",
+                                  RES_TYPE_NUMBER);
+      if (!EQ (value, Qunbound))
+       parms = Fcons (Fcons (Qinternal_border_width, value), parms);
+    }
+
+  gui_default_parameter (f, parms, Qinternal_border_width,
+                        make_fixnum (0),
+                        "internalBorderWidth", "internalBorderWidth",
+                        RES_TYPE_NUMBER);
+
+  /* Same for child frames.  */
+  if (NILP (Fassq (Qchild_frame_border_width, parms)))
+    {
+      Lisp_Object value;
+
+      value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width,
+                                   "childFrameBorder", "childFrameBorder",
+                                   RES_TYPE_NUMBER);
+      if (! EQ (value, Qunbound))
+       parms = Fcons (Fcons (Qchild_frame_border_width, value),
+                      parms);
+
+    }
+
+  gui_default_parameter (f, parms, Qchild_frame_border_width,
+                        make_fixnum (0),
+                        "childFrameBorderWidth", "childFrameBorderWidth",
+                        RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
+                        NULL, NULL, RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),
+                        NULL, NULL, RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qvertical_scroll_bars,
+                        Qright,
+                        "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
+  gui_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil,
+                        "horizontalScrollBars", "ScrollBars",
+                        RES_TYPE_SYMBOL);
+  /* Also do the stuff which must be set before the window exists.  */
+  gui_default_parameter (f, parms, Qforeground_color, build_string ("black"),
+                        "foreground", "Foreground", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qbackground_color, build_string ("white"),
+                        "background", "Background", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qmouse_color, build_string ("black"),
+                        "pointerColor", "Foreground", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qborder_color, build_string ("black"),
+                        "borderColor", "BorderColor", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qscreen_gamma, Qnil,
+                        "screenGamma", "ScreenGamma", RES_TYPE_FLOAT);
+  gui_default_parameter (f, parms, Qline_spacing, Qnil,
+                        "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qleft_fringe, Qnil,
+                        "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qright_fringe, Qnil,
+                        "rightFringe", "RightFringe", RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qno_special_glyphs, Qnil,
+                        NULL, NULL, RES_TYPE_BOOLEAN);
+
+  gui_default_parameter (f, parms, Qscroll_bar_foreground, Qnil,
+                        "scrollBarForeground", "ScrollBarForeground",
+                        RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qscroll_bar_background, Qnil,
+                        "scrollBarBackground", "ScrollBarBackground",
+                        RES_TYPE_STRING);
+
+  /* Init faces before gui_default_parameter is called for the
+     scroll-bar-width parameter because otherwise we end up in
+     init_iterator with a null face cache, which should not happen.  */
+  init_frame_faces (f);
+
+  /* We have to call adjust_frame_size here since otherwise
+     x_set_tool_bar_lines will already work with the character sizes
+     installed by init_frame_faces while the frame's pixel size is still
+     calculated from a character size of 1 and we subsequently hit the
+     (height >= 0) assertion in window_box_height.
+
+     The non-pixelwise code apparently worked around this because it
+     had one frame line vs one toolbar line which left us with a zero
+     root window height which was obviously wrong as well ...
+
+     Also process `min-width' and `min-height' parameters right here
+     because `frame-windows-min-size' needs them.  */
+  tem =
+    gui_display_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL,
+                        RES_TYPE_NUMBER);
+  if (NUMBERP (tem))
+    store_frame_param (f, Qmin_width, tem);
+  tem =
+    gui_display_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL,
+                        RES_TYPE_NUMBER);
+  if (NUMBERP (tem))
+    store_frame_param (f, Qmin_height, tem);
+  adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+                    FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
+                    Qx_create_frame_1);
+
+  /* Set the menu-bar-lines and tool-bar-lines parameters.  We don't
+     look up the X resources controlling the menu-bar and tool-bar
+     here; they are processed specially at startup, and reflected in
+     the values of the mode variables.  */
+
+  gui_default_parameter (f, parms, Qmenu_bar_lines,
+                        NILP (Vmenu_bar_mode)
+                        ? make_fixnum (0) : make_fixnum (1),
+                        NULL, NULL, RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qtab_bar_lines,
+                        NILP (Vtab_bar_mode)
+                        ? make_fixnum (0) : make_fixnum (1),
+                        NULL, NULL, RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qtool_bar_lines,
+                        NILP (Vtool_bar_mode)
+                        ? make_fixnum (0) : make_fixnum (1),
+                        NULL, NULL, RES_TYPE_NUMBER);
+
+  gui_default_parameter (f, parms, Qbuffer_predicate, Qnil,
+                        "bufferPredicate", "BufferPredicate",
+                        RES_TYPE_SYMBOL);
+  gui_default_parameter (f, parms, Qtitle, Qnil,
+                        "title", "Title", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qwait_for_wm, Qt,
+                        "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN);
+  gui_default_parameter (f, parms, Qtool_bar_position,
+                        FRAME_TOOL_BAR_POSITION (f), 0, 0, RES_TYPE_SYMBOL);
+  gui_default_parameter (f, parms, Qinhibit_double_buffering, Qnil,
+                        "inhibitDoubleBuffering", "InhibitDoubleBuffering",
+                        RES_TYPE_BOOLEAN);
+
+  /* Compute the size of the X window.  */
+  window_prompting =
+    gui_figure_window_size (f, parms, true, true);
+
+  tem =
+    gui_display_get_arg (dpyinfo, parms, Qunsplittable, 0, 0,
+                        RES_TYPE_BOOLEAN);
+  f->no_split = minibuffer_only || EQ (tem, Qt);
+
+#if 0
+  x_icon_verify (f, parms);
+#endif
+
+  /* Create the X widget or window.  */
+  /* x_window (f); */
+  xg_create_frame_widgets (f);
+  pgtk_set_event_handler (f);
+
+
+#define INSTALL_CURSOR(FIELD, NAME) \
+  FRAME_X_OUTPUT (f)->FIELD = gdk_cursor_new_for_display (FRAME_X_DISPLAY (f), 
GDK_ ## NAME)
+
+  INSTALL_CURSOR (text_cursor, XTERM);
+  INSTALL_CURSOR (nontext_cursor, LEFT_PTR);
+  INSTALL_CURSOR (modeline_cursor, XTERM);
+  INSTALL_CURSOR (hand_cursor, HAND2);
+  INSTALL_CURSOR (hourglass_cursor, WATCH);
+  INSTALL_CURSOR (horizontal_drag_cursor, SB_H_DOUBLE_ARROW);
+  INSTALL_CURSOR (vertical_drag_cursor, SB_V_DOUBLE_ARROW);
+  INSTALL_CURSOR (left_edge_cursor, LEFT_SIDE);
+  INSTALL_CURSOR (right_edge_cursor, RIGHT_SIDE);
+  INSTALL_CURSOR (top_edge_cursor, TOP_SIDE);
+  INSTALL_CURSOR (bottom_edge_cursor, BOTTOM_SIDE);
+  INSTALL_CURSOR (top_left_corner_cursor, TOP_LEFT_CORNER);
+  INSTALL_CURSOR (top_right_corner_cursor, TOP_RIGHT_CORNER);
+  INSTALL_CURSOR (bottom_right_corner_cursor, BOTTOM_RIGHT_CORNER);
+  INSTALL_CURSOR (bottom_left_corner_cursor, BOTTOM_LEFT_CORNER);
+
+#undef INSTALL_CURSOR
+
+  x_icon (f, parms);
+#if 0
+  x_make_gc (f);
+#endif
+
+  /* Now consider the frame official.  */
+  f->terminal->reference_count++;
+  FRAME_DISPLAY_INFO (f)->reference_count++;
+  Vframe_list = Fcons (frame, Vframe_list);
+
+  /* We need to do this after creating the X window, so that the
+     icon-creation functions can say whose icon they're describing.  */
+  gui_default_parameter (f, parms, Qicon_type, Qt,
+                        "bitmapIcon", "BitmapIcon", RES_TYPE_BOOLEAN);
+
+  gui_default_parameter (f, parms, Qauto_raise, Qnil,
+                        "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
+  gui_default_parameter (f, parms, Qauto_lower, Qnil,
+                        "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
+  gui_default_parameter (f, parms, Qcursor_type, Qbox,
+                        "cursorType", "CursorType", RES_TYPE_SYMBOL);
+  gui_default_parameter (f, parms, Qscroll_bar_width, Qnil,
+                        "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qscroll_bar_height, Qnil,
+                        "scrollBarHeight", "ScrollBarHeight",
+                        RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qalpha, Qnil,
+                        "alpha", "Alpha", RES_TYPE_NUMBER);
+
+  if (!NILP (parent_frame))
+    {
+      struct frame *p = XFRAME (parent_frame);
+
+      block_input ();
+
+      GtkWidget *fixed = FRAME_GTK_WIDGET (f);
+      GtkWidget *fixed_of_p = FRAME_GTK_WIDGET (p);
+      GtkWidget *whbox_of_f = gtk_widget_get_parent (fixed);
+      g_object_ref (fixed);
+      gtk_container_remove (GTK_CONTAINER (whbox_of_f), fixed);
+      gtk_fixed_put (GTK_FIXED (fixed_of_p), fixed, f->left_pos, f->top_pos);
+      gtk_widget_show_all (fixed);
+      g_object_unref (fixed);
+
+      gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
+      FRAME_GTK_OUTER_WIDGET (f) = NULL;
+      FRAME_OUTPUT_DATA (f)->vbox_widget = NULL;
+      FRAME_OUTPUT_DATA (f)->hbox_widget = NULL;
+      FRAME_OUTPUT_DATA (f)->menubar_widget = NULL;
+      FRAME_OUTPUT_DATA (f)->toolbar_widget = NULL;
+      FRAME_OUTPUT_DATA (f)->ttip_widget = NULL;
+      FRAME_OUTPUT_DATA (f)->ttip_lbl = NULL;
+      FRAME_OUTPUT_DATA (f)->ttip_window = NULL;
+
+      unblock_input ();
+    }
+
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      GList *w = gtk_container_get_children (GTK_CONTAINER 
(FRAME_GTK_OUTER_WIDGET (f)));
+      for (; w != NULL; w = w->next)
+       gtk_widget_show_all (GTK_WIDGET (w->data));
+    }
+
+  gui_default_parameter (f, parms, Qno_focus_on_map, Qnil,
+                        NULL, NULL, RES_TYPE_BOOLEAN);
+  gui_default_parameter (f, parms, Qno_accept_focus, Qnil,
+                        NULL, NULL, RES_TYPE_BOOLEAN);
+
+  /* Create the menu bar.  */
+  if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
+    {
+      /* If this signals an error, we haven't set size hints for the
+         frame and we didn't make it visible.  */
+      initialize_frame_menubar (f);
+
+    }
+
+  /* Consider frame official, now.  */
+  f->can_set_window_size = true;
+
+  /* Tell the server what size and position, etc, we want, and how
+     badly we want them.  This should be done after we have the menu
+     bar so that its size can be taken into account.  */
+  block_input ();
+  x_wm_set_size_hint (f, window_prompting, false);
+  unblock_input ();
+
+  adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
+                    0, true, Qx_create_frame_2);
+
+  /* Process fullscreen parameter here in the hope that normalizing a
+     fullheight/fullwidth frame will produce the size set by the last
+     adjust_frame_size call.  */
+  gui_default_parameter (f, parms, Qfullscreen, Qnil,
+                        "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
+
+  /* Make the window appear on the frame and enable display, unless
+     the caller says not to.  However, with explicit parent, Emacs
+     cannot control visibility, so don't try.  */
+  if (!FRAME_X_OUTPUT (f)->explicit_parent)
+    {
+      Lisp_Object visibility
+       =
+       gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0,
+                            RES_TYPE_SYMBOL);
+
+      if (EQ (visibility, Qicon))
+       pgtk_iconify_frame (f);
+      else
+       {
+         if (EQ (visibility, Qunbound))
+           visibility = Qt;
+
+         if (!NILP (visibility))
+           pgtk_make_frame_visible (f);
+       }
+
+      store_frame_param (f, Qvisibility, visibility);
+    }
+
+  /* Works iff frame has been already mapped.  */
+  gui_default_parameter (f, parms, Qskip_taskbar, Qnil,
+                        NULL, NULL, RES_TYPE_BOOLEAN);
+  /* The `z-group' parameter works only for visible frames.  */
+  gui_default_parameter (f, parms, Qz_group, Qnil,
+                        NULL, NULL, RES_TYPE_SYMBOL);
+
+  /* Initialize `default-minibuffer-frame' in case this is the first
+     frame on this terminal.  */
+  if (FRAME_HAS_MINIBUF_P (f)
+      && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
+         || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
+    kset_default_minibuffer_frame (kb, frame);
+
+  /* All remaining specified parameters, which have not been "used"
+     by gui_display_get_arg and friends, now go in the misc. alist of the 
frame.  */
+  for (tem = parms; CONSP (tem); tem = XCDR (tem))
+    if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
+      fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
+
+  FRAME_X_OUTPUT (f)->border_color_css_provider = NULL;
+
+  FRAME_X_OUTPUT (f)->cr_surface_visible_bell = NULL;
+  FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
+  FRAME_X_OUTPUT (f)->watched_scale_factor = 1.0;
+  struct timespec ts = make_timespec (1, 0);
+  FRAME_X_OUTPUT (f)->scale_factor_atimer = start_atimer(ATIMER_CONTINUOUS,
+                                                        ts,
+                                                        
update_watched_scale_factor,
+                                                        f);
+
+  /* Make sure windows on this frame appear in calls to next-window
+     and similar functions.  */
+  Vwindow_list = Qnil;
+
+  return unbind_to (count, frame);
+}
+
+
+#if 0
+static int
+pgtk_window_is_ancestor (PGTKWindow * win, PGTKWindow * candidate)
+/* Test whether CANDIDATE is an ancestor window of WIN. */
+{
+  if (candidate == NULL)
+    return 0;
+  else if (win == candidate)
+    return 1;
+  else
+    return pgtk_window_is_ancestor (win,[candidate parentWindow]);
+}
+#endif
+
+/**
+ * x_frame_restack:
+ *
+ * Restack frame F1 below frame F2, above if ABOVE_FLAG is non-nil.  In
+ * practice this is a two-step action: The first step removes F1's
+ * window-system window from the display.  The second step reinserts
+ * F1's window below (above if ABOVE_FLAG is true) that of F2.
+ */
+static void
+pgtk_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
+{
+  block_input ();
+  xg_frame_restack (f1, f2, above_flag);
+  unblock_input ();
+}
+
+
+DEFUN ("pgtk-frame-restack", Fpgtk_frame_restack, Spgtk_frame_restack, 2, 3, 0,
+       doc: /* Restack FRAME1 below FRAME2.
+This means that if both frames are visible and the display areas of
+these frames overlap, FRAME2 (partially) obscures FRAME1.  If optional
+third argument ABOVE is non-nil, restack FRAME1 above FRAME2.  This
+means that if both frames are visible and the display areas of these
+frames overlap, FRAME1 (partially) obscures FRAME2.
+
+This may be thought of as an atomic action performed in two steps: The
+first step removes FRAME1's window-step window from the display.  The
+second step reinserts FRAME1's window below (above if ABOVE is true)
+that of FRAME2.  Hence the position of FRAME2 in its display's Z
+\(stacking) order relative to all other frames excluding FRAME1 remains
+unaltered.
+
+Some window managers may refuse to restack windows.  */)
+  (Lisp_Object frame1, Lisp_Object frame2, Lisp_Object above)
+{
+  struct frame *f1 = decode_live_frame (frame1);
+  struct frame *f2 = decode_live_frame (frame2);
+
+  if (!(FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2)))
+    error ("Cannot restack frames");
+  pgtk_frame_restack (f1, f2, !NILP (above));
+  return Qt;
+}
+
+#ifdef HAVE_GSETTINGS
+
+#define RESOURCE_KEY_MAX_LEN 128
+#define SCHEMA_ID "org.gnu.emacs.defaults"
+#define PATH_FOR_CLASS_TYPE "/org/gnu/emacs/defaults-by-class/"
+#define PATH_PREFIX_FOR_NAME_TYPE "/org/gnu/emacs/defaults-by-name/"
+
+static inline int
+pgtk_is_lower_char (int c)
+{
+  return c >= 'a' && c <= 'z';
+}
+
+static inline int
+pgtk_is_upper_char (int c)
+{
+  return c >= 'A' && c <= 'Z';
+}
+
+static inline int
+pgtk_is_numeric_char (int c)
+{
+  return c >= '0' && c <= '9';
+}
+
+static GSettings *
+parse_resource_key (const char *res_key, char *setting_key)
+{
+  char path[32 + RESOURCE_KEY_MAX_LEN];
+  const char *sp = res_key;
+  char *dp;
+
+  /*
+   * res_key="emacs.cursorBlink"
+   *   -> path="/org/gnu/emacs/defaults-by-name/emacs/"
+   *      setting_key="cursor-blink"
+   *
+   * res_key="Emacs.CursorBlink"
+   *   -> path="/org/gnu/emacs/defaults-by-class/"
+   *      setting_key="cursor-blink"
+   *
+   * Returns GSettings* if setting_key exists in schema, otherwise NULL.
+   */
+
+  /* generate path */
+  if (pgtk_is_upper_char (*sp))
+    {
+      /* First letter is upper case. It should be "Emacs",
+       * but don't care.
+       */
+      strcpy (path, PATH_FOR_CLASS_TYPE);
+      while (*sp != '\0')
+       {
+         if (*sp == '.')
+           break;
+         sp++;
+       }
+    }
+  else
+    {
+      strcpy (path, PATH_PREFIX_FOR_NAME_TYPE);
+      dp = path + strlen (path);
+      while (*sp != '\0')
+       {
+         int c = *sp;
+         if (c == '.')
+           break;
+         if (pgtk_is_lower_char (c))
+           (void) 0;           /* lower -> NOP */
+         else if (pgtk_is_upper_char (c))
+           c = c - 'A' + 'a';  /* upper -> lower */
+         else if (pgtk_is_numeric_char (c))
+           (void) 0;           /* numeric -> NOP */
+         else
+           return NULL;        /* invalid */
+         *dp++ = c;
+         sp++;
+       }
+      *dp++ = '/';             /* must ends with '/' */
+      *dp = '\0';
+    }
+
+  if (*sp++ != '.')
+    return NULL;
+
+  /* generate setting_key */
+  dp = setting_key;
+  while (*sp != '\0')
+    {
+      int c = *sp;
+      if (pgtk_is_lower_char (c))
+       (void) 0;               /* lower -> NOP */
+      else if (pgtk_is_upper_char (c))
+       {
+         c = c - 'A' + 'a';    /* upper -> lower */
+         if (dp != setting_key)
+           *dp++ = '-';        /* store '-' unless first char */
+       }
+      else if (pgtk_is_numeric_char (c))
+       (void) 0;               /* numeric -> NOP */
+      else
+       return NULL;            /* invalid */
+
+      *dp++ = c;
+      sp++;
+    }
+  *dp = '\0';
+
+  /* check existence of setting_key */
+  GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default ();
+  GSettingsSchema *scm = g_settings_schema_source_lookup (ssrc, SCHEMA_ID, 
FALSE);
+  if (!scm)
+    return NULL;       /* *.schema.xml is not installed. */
+  if (!g_settings_schema_has_key (scm, setting_key))
+    {
+      g_settings_schema_unref (scm);
+      return NULL;
+    }
+
+  /* create GSettings, and return it */
+  GSettings *gs = g_settings_new_full (scm, NULL, path);
+
+  g_settings_schema_unref (scm);
+  return gs;
+}
+
+const char *
+pgtk_get_defaults_value (const char *key)
+{
+  char skey[(RESOURCE_KEY_MAX_LEN + 1) * 2];
+
+  if (strlen (key) >= RESOURCE_KEY_MAX_LEN)
+    error ("resource key too long.");
+
+  GSettings *gs = parse_resource_key (key, skey);
+  if (gs == NULL)
+    {
+      return NULL;
+    }
+
+  gchar *str = g_settings_get_string (gs, skey);
+
+  /* There is no timing to free str.
+   * So, copy it here and free it.
+   *
+   * MEMO: Resource values for emacs shouldn't need such a long string value.
+   */
+  static char holder[128];
+  strncpy (holder, str, 128);
+  holder[127] = '\0';
+
+  g_object_unref (gs);
+  g_free (str);
+  return holder[0] != '\0' ? holder : NULL;
+}
+
+static void
+pgtk_set_defaults_value (const char *key, const char *value)
+{
+  char skey[(RESOURCE_KEY_MAX_LEN + 1) * 2];
+
+  if (strlen (key) >= RESOURCE_KEY_MAX_LEN)
+    error ("resource key too long.");
+
+  GSettings *gs = parse_resource_key (key, skey);
+  if (gs == NULL)
+    error ("unknown resource key.");
+
+  if (value != NULL)
+    {
+      g_settings_set_string (gs, skey, value);
+    }
+  else
+    {
+      g_settings_reset (gs, skey);
+    }
+
+  g_object_unref (gs);
+}
+
+#undef RESOURCE_KEY_MAX_LEN
+#undef SCHEMA_ID
+#undef PATH_FOR_CLASS_TYPE
+#undef PATH_PREFIX_FOR_NAME_TYPE
+
+#else /* not HAVE_GSETTINGS */
+
+const char *
+pgtk_get_defaults_value (const char *key)
+{
+  return NULL;
+}
+
+static void
+pgtk_set_defaults_value (const char *key, const char *value)
+{
+  error ("gsettings not supported.");
+}
+
+#endif
+
+
+DEFUN ("pgtk-set-resource", Fpgtk_set_resource, Spgtk_set_resource, 2, 2, 0,
+       doc: /* Set the value of ATTRIBUTE, of class CLASS, as VALUE, into 
defaults database. */ )
+  (Lisp_Object attribute, Lisp_Object value)
+{
+  check_window_system (NULL);
+
+  CHECK_STRING (attribute);
+  if (!NILP (value))
+    CHECK_STRING (value);
+
+  char *res = SSDATA (Vx_resource_name);
+  char *attr = SSDATA (attribute);
+  if (attr[0] >= 'A' && attr[0] <= 'Z')
+    res = SSDATA (Vx_resource_class);
+
+  char *key = g_strdup_printf ("%s.%s", res, attr);
+
+  pgtk_set_defaults_value (key, NILP (value) ? NULL : SSDATA (value));
+
+  return Qnil;
+}
+
+
+DEFUN ("x-server-max-request-size", Fx_server_max_request_size, 
Sx_server_max_request_size, 0, 1, 0,
+       doc: /* This function is a no-op.  It is only present for completeness. 
 */ )
+  (Lisp_Object terminal)
+{
+  check_pgtk_display_info (terminal);
+  /* This function has no real equivalent under PGTK.  Return nil to
+     indicate this. */
+  return Qnil;
+}
+
+
+DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
+       doc: /* Return the number of screens on the display server TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+Note: "screen" here is not in X11's.  For the number of physical monitors,
+use `(length \(display-monitor-attributes-list TERMINAL))' instead.  */)
+  (Lisp_Object terminal)
+{
+  check_pgtk_display_info (terminal);
+  return make_fixnum (1);
+}
+
+
+DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 
1, 0,
+       doc: /* Return the height in millimeters of the the display TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+On \"multi-monitor\" setups this refers to the height in millimeters for
+all physical monitors associated with TERMINAL.  To get information
+for each physical monitor, use `display-monitor-attributes-list'.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  GdkDisplay *gdpy;
+  gint n_monitors, i;
+  int height_mm_at_0 = 0, height_mm_at_other = 0;
+
+  block_input ();
+  gdpy = dpyinfo->gdpy;
+  n_monitors = gdk_display_get_n_monitors (gdpy);
+
+  for (i = 0; i < n_monitors; ++i)
+    {
+      GdkRectangle rec;
+
+      GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
+      gdk_monitor_get_geometry (monitor, &rec);
+
+      int mm = gdk_monitor_get_height_mm (monitor);
+
+      if (rec.y == 0)
+       height_mm_at_0 = max (height_mm_at_0, mm);
+      else
+       height_mm_at_other += mm;
+    }
+
+  unblock_input ();
+
+  return make_fixnum (height_mm_at_0 + height_mm_at_other);
+}
+
+
+DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
+       doc: /* Return the width in millimeters of the the display TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+On \"multi-monitor\" setups this refers to the width in millimeters for
+all physical monitors associated with TERMINAL.  To get information
+for each physical monitor, use `display-monitor-attributes-list'.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  GdkDisplay *gdpy;
+  gint n_monitors, i;
+  int width_mm_at_0 = 0, width_mm_at_other = 0;
+
+  block_input ();
+  gdpy = dpyinfo->gdpy;
+  n_monitors = gdk_display_get_n_monitors (gdpy);
+
+  for (i = 0; i < n_monitors; ++i)
+    {
+      GdkRectangle rec;
+
+      GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
+      gdk_monitor_get_geometry (monitor, &rec);
+
+      int mm = gdk_monitor_get_width_mm (monitor);
+
+      if (rec.x == 0)
+       width_mm_at_0 = max (width_mm_at_0, mm);
+      else
+       width_mm_at_other += mm;
+    }
+
+  unblock_input ();
+
+  return make_fixnum (width_mm_at_0 + width_mm_at_other);
+}
+
+
+DEFUN ("x-display-backing-store", Fx_display_backing_store, 
Sx_display_backing_store, 0, 1, 0,
+       doc: /* Return an indication of whether the the display TERMINAL does 
backing store.
+The value may be `buffered', `retained', or `non-retained'.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.  */)
+  (Lisp_Object terminal)
+{
+  check_pgtk_display_info (terminal);
+  return Qnil;
+}
+
+
+DEFUN ("x-display-visual-class", Fx_display_visual_class, 
Sx_display_visual_class, 0, 1, 0,
+       doc: /* Return the visual class of the the display TERMINAL.
+The value is one of the symbols `static-gray', `gray-scale',
+`static-color', `pseudo-color', `true-color', or `direct-color'.
+
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+On PGTK, always return true-color.  */)
+  (Lisp_Object terminal)
+{
+  return intern ("true-color");
+}
+
+
+DEFUN ("x-display-save-under", Fx_display_save_under, Sx_display_save_under, 
0, 1, 0,
+       doc: /* Return t if TERMINAL supports the save-under feature.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.  */)
+  (Lisp_Object terminal)
+{
+  check_pgtk_display_info (terminal);
+  return Qnil;
+}
+
+
+DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 1, 3, 0,
+       doc: /* Open a connection to a display server.
+DISPLAY is the name of the display to connect to.
+Optional second arg XRM-STRING is a string of resources in xrdb format.
+If the optional third arg MUST-SUCCEED is non-nil,
+terminate Emacs if we can't open the connection.  */)
+  (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed)
+{
+  struct pgtk_display_info *dpyinfo;
+
+  if (NILP (display))
+    display = build_string ("");
+
+  CHECK_STRING (display);
+
+  nxatoms_of_pgtkselect ();
+  dpyinfo = pgtk_term_init (display, SSDATA (Vx_resource_name));
+  if (dpyinfo == 0)
+    {
+      if (!NILP (must_succeed))
+       fatal ("Display on %s not responding.\n", SSDATA (display));
+      else
+       error ("Display on %s not responding.\n", SSDATA (display));
+    }
+
+  return Qnil;
+}
+
+
+DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, 1, 1, 0,
+       doc: /* Close the connection to TERMINAL's display server.
+For TERMINAL, specify a terminal object, a frame or a display name (a
+string).  If TERMINAL is nil, that stands for the selected frame's
+terminal.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+
+  if (dpyinfo->reference_count > 0)
+    error ("Display still has frames on it");
+
+  pgtk_delete_terminal (dpyinfo->terminal);
+
+  return Qnil;
+}
+
+
+DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
+       doc: /* Return the list of display names that Emacs has connections to. 
 */)
+  (void)
+{
+  Lisp_Object result = Qnil;
+  struct pgtk_display_info *ndi;
+
+  for (ndi = x_display_list; ndi; ndi = ndi->next)
+    result = Fcons (XCAR (ndi->name_list_element), result);
+
+  return result;
+}
+
+
+DEFUN ("pgtk-hide-others", Fpgtk_hide_others, Spgtk_hide_others, 0, 0, 0,
+       doc: /* Hides all applications other than Emacs.  */)
+  (void)
+{
+  check_window_system (NULL);
+  return Qnil;
+}
+
+DEFUN ("pgtk-hide-emacs", Fpgtk_hide_emacs, Spgtk_hide_emacs, 1, 1, 0,
+       doc: /* If ON is non-nil, the entire Emacs application is hidden.
+Otherwise if Emacs is hidden, it is unhidden.
+If ON is equal to `activate', Emacs is unhidden and becomes
+the active application.  */)
+  (Lisp_Object on)
+{
+  check_window_system (NULL);
+  return Qnil;
+}
+
+
+DEFUN ("pgtk-font-name", Fpgtk_font_name, Spgtk_font_name, 1, 1, 0,
+       doc: /* Determine font PostScript or family name for font NAME.
+NAME should be a string containing either the font name or an XLFD
+font descriptor.  If string contains `fontset' and not
+`fontset-startup', it is left alone. */)
+  (Lisp_Object name)
+{
+  char *nm;
+  CHECK_STRING (name);
+  nm = SSDATA (name);
+
+  if (nm[0] != '-')
+    return name;
+  if (strstr (nm, "fontset") && !strstr (nm, "fontset-startup"))
+    return name;
+
+  char *str = pgtk_xlfd_to_fontname (SSDATA (name));
+  name = build_string (str);
+  xfree (str);
+  return name;
+}
+
+/* ==========================================================================
+
+    Miscellaneous functions not called through hooks
+
+   ========================================================================== 
*/
+
+/* Called from frame.c.  */
+struct pgtk_display_info *
+check_x_display_info (Lisp_Object frame)
+{
+  return check_pgtk_display_info (frame);
+}
+
+
+void
+pgtk_set_scroll_bar_default_width (struct frame *f)
+{
+  int unit = FRAME_COLUMN_WIDTH (f);
+  int minw = xg_get_default_scrollbar_width (f);
+  /* A minimum width of 14 doesn't look good for toolkit scroll bars.  */
+  FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + unit - 1) / unit;
+  FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = minw;
+}
+
+void
+pgtk_set_scroll_bar_default_height (struct frame *f)
+{
+  int height = FRAME_LINE_HEIGHT (f);
+  int min_height = xg_get_default_scrollbar_height (f);
+  /* A minimum height of 14 doesn't look good for toolkit scroll bars.  */
+  FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = min_height;
+  FRAME_CONFIG_SCROLL_BAR_LINES (f) = (min_height + height - 1) / height;
+}
+
+/* Terminals implement this instead of x-get-resource directly.  */
+const char *
+pgtk_get_string_resource (XrmDatabase rdb, const char *name,
+                         const char *class)
+{
+  check_window_system (NULL);
+
+  if (inhibit_x_resources)
+    /* --quick was passed, so this is a no-op.  */
+    return NULL;
+
+  const char *res = pgtk_get_defaults_value (name);
+  if (res == NULL)
+    res = pgtk_get_defaults_value (class);
+
+  if (res == NULL)
+    return NULL;
+
+  if (c_strncasecmp (res, "YES", 3) == 0)
+    return "true";
+
+  if (c_strncasecmp (res, "NO", 2) == 0)
+    return "false";
+
+  return res;
+}
+
+
+Lisp_Object
+x_get_focus_frame (struct frame *frame)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
+  Lisp_Object focus;
+
+  if (!dpyinfo->x_focus_frame)
+    return Qnil;
+
+  XSETFRAME (focus, dpyinfo->x_focus_frame);
+  return focus;
+}
+
+/* ==========================================================================
+
+    Lisp definitions that, for whatever reason, we can't alias as 'ns-XXX'.
+
+   ========================================================================== 
*/
+
+
+DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
+       doc: /* Internal function called by `color-defined-p', which see.  */)
+  (Lisp_Object color, Lisp_Object frame)
+{
+  Emacs_Color col;
+  struct frame *f = decode_window_system_frame (frame);
+
+  CHECK_STRING (color);
+
+  if (pgtk_defined_color (f, SSDATA (color), &col, false, false))
+    return Qt;
+  else
+    return Qnil;
+}
+
+
+DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
+       doc: /* Internal function called by `color-values', which see.  */)
+  (Lisp_Object color, Lisp_Object frame)
+{
+  Emacs_Color col;
+  struct frame *f = decode_window_system_frame (frame);
+
+  CHECK_STRING (color);
+
+  if (pgtk_defined_color (f, SSDATA (color), &col, false, false))
+    return list3i (col.red, col.green, col.blue);
+  else
+    return Qnil;
+}
+
+
+DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
+       doc: /* Internal function called by `display-color-p', which see.  */)
+  (Lisp_Object terminal)
+{
+  check_pgtk_display_info (terminal);
+  return Qt;
+}
+
+
+DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, 
Sx_display_grayscale_p, 0, 1, 0,
+       doc: /* Return t if the display supports shades of gray.
+Note that color displays do support shades of gray.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.  */)
+  (Lisp_Object terminal)
+{
+  return Qnil;
+}
+
+
+DEFUN ("x-display-pixel-width", Fx_display_pixel_width, 
Sx_display_pixel_width, 0, 1, 0,
+       doc: /* Return the width in pixels of the display TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+On \"multi-monitor\" setups this refers to the pixel width for all
+physical monitors associated with TERMINAL.  To get information for
+each physical monitor, use `display-monitor-attributes-list'.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  GdkDisplay *gdpy;
+  gint n_monitors, i;
+  int width = 0;
+
+  block_input ();
+  gdpy = dpyinfo->gdpy;
+  n_monitors = gdk_display_get_n_monitors (gdpy);
+
+  for (i = 0; i < n_monitors; ++i)
+    {
+      GdkRectangle rec;
+      double scale = 1;
+
+      GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
+      gdk_monitor_get_geometry (monitor, &rec);
+
+      /* GTK returns scaled sizes for the workareas.  */
+      scale = pgtk_get_monitor_scale_factor (gdk_monitor_get_model (monitor));
+      if (scale == 0.0)
+       scale = gdk_monitor_get_scale_factor (monitor);
+      rec.x = rec.x * scale + 0.5;
+      rec.y = rec.y * scale + 0.5;
+      rec.width = rec.width * scale + 0.5;
+      rec.height = rec.height * scale + 0.5;
+
+      width = max (width, rec.x + rec.width);
+    }
+
+  unblock_input ();
+
+  return make_fixnum (width);
+}
+
+
+DEFUN ("x-display-pixel-height", Fx_display_pixel_height, 
Sx_display_pixel_height, 0, 1, 0,
+       doc: /* Return the height in pixels of the display TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+On \"multi-monitor\" setups this refers to the pixel height for all
+physical monitors associated with TERMINAL.  To get information for
+each physical monitor, use `display-monitor-attributes-list'.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  GdkDisplay *gdpy;
+  gint n_monitors, i;
+  int height = 0;
+
+  block_input ();
+  gdpy = dpyinfo->gdpy;
+  n_monitors = gdk_display_get_n_monitors (gdpy);
+
+  for (i = 0; i < n_monitors; ++i)
+    {
+      GdkRectangle rec;
+      double scale = 1;
+
+      GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
+      gdk_monitor_get_geometry (monitor, &rec);
+
+      /* GTK returns scaled sizes for the workareas.  */
+      scale = pgtk_get_monitor_scale_factor (gdk_monitor_get_model (monitor));
+      if (scale == 0.0)
+       scale = gdk_monitor_get_scale_factor (monitor);
+      rec.x = rec.x * scale + 0.5;
+      rec.y = rec.y * scale + 0.5;
+      rec.width = rec.width * scale + 0.5;
+      rec.height = rec.height * scale + 0.5;
+
+      height = max (height, rec.y + rec.height);
+    }
+
+  unblock_input ();
+
+  return make_fixnum (height);
+}
+
+DEFUN ("pgtk-display-monitor-attributes-list", 
Fpgtk_display_monitor_attributes_list,
+       Spgtk_display_monitor_attributes_list,
+       0, 1, 0,
+       doc: /* Return a list of physical monitor attributes on the X display 
TERMINAL.
+
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.
+
+In addition to the standard attribute keys listed in
+`display-monitor-attributes-list', the following keys are contained in
+the attributes:
+
+ source -- String describing the source from which multi-monitor
+          information is obtained, \"Gdk\"
+
+Internal use only, use `display-monitor-attributes-list' instead.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  Lisp_Object attributes_list = Qnil;
+
+  GdkDisplay *gdpy;
+  gint primary_monitor = 0, n_monitors, i;
+  Lisp_Object monitor_frames, rest, frame;
+  static const char *source = "Gdk";
+  struct MonitorInfo *monitors;
+
+  block_input ();
+  gdpy = dpyinfo->gdpy;
+  n_monitors = gdk_display_get_n_monitors (gdpy);
+  monitor_frames = make_nil_vector (n_monitors);
+  monitors = xzalloc (n_monitors * sizeof *monitors);
+
+  FOR_EACH_FRAME (rest, frame)
+    {
+      struct frame *f = XFRAME (frame);
+
+      if (FRAME_PGTK_P (f)
+         && FRAME_DISPLAY_INFO (f) == dpyinfo
+         && !FRAME_TOOLTIP_P (f))
+       {
+         GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
+
+          for (i = 0; i < n_monitors; i++)
+            if (gdk_display_get_monitor_at_window (gdpy, gwin)
+                == gdk_display_get_monitor (gdpy, i))
+              break;
+         ASET (monitor_frames, i, Fcons (frame, AREF (monitor_frames, i)));
+       }
+    }
+
+  for (i = 0; i < n_monitors; ++i)
+    {
+      gint width_mm, height_mm;
+      GdkRectangle rec, work;
+      struct MonitorInfo *mi = &monitors[i];
+      double scale = 1;
+
+      GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
+      if (gdk_monitor_is_primary (monitor))
+        primary_monitor = i;
+      gdk_monitor_get_geometry (monitor, &rec);
+
+      width_mm = gdk_monitor_get_width_mm (monitor);
+      height_mm = gdk_monitor_get_height_mm (monitor);
+      gdk_monitor_get_workarea (monitor, &work);
+
+      /* GTK returns scaled sizes for the workareas.  */
+      scale = pgtk_get_monitor_scale_factor (gdk_monitor_get_model (monitor));
+      if (scale == 0.0)
+       scale = gdk_monitor_get_scale_factor (monitor);
+      rec.x = rec.x * scale + 0.5;
+      rec.y = rec.y * scale + 0.5;
+      rec.width = rec.width * scale + 0.5;
+      rec.height = rec.height * scale + 0.5;
+      work.x = work.x * scale + 0.5;
+      work.y = work.y * scale + 0.5;
+      work.width = work.width * scale + 0.5;
+      work.height = work.height * scale + 0.5;
+
+      mi->geom.x = rec.x;
+      mi->geom.y = rec.y;
+      mi->geom.width = rec.width;
+      mi->geom.height = rec.height;
+      mi->work.x = work.x;
+      mi->work.y = work.y;
+      mi->work.width = work.width;
+      mi->work.height = work.height;
+      mi->mm_width = width_mm;
+      mi->mm_height = height_mm;
+      mi->scale_factor = scale;
+
+      dupstring (&mi->name, (gdk_monitor_get_model (monitor)));
+    }
+
+  attributes_list = make_monitor_attribute_list (monitors,
+                                                 n_monitors,
+                                                 primary_monitor,
+                                                 monitor_frames,
+                                                 source);
+  free_monitors (monitors, n_monitors);
+  unblock_input ();
+
+  return attributes_list;
+}
+
+double
+pgtk_frame_scale_factor (struct frame *f)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  GdkDisplay *gdpy = dpyinfo->gdpy;
+
+  block_input ();
+
+  GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
+  GdkMonitor *gmon = gdk_display_get_monitor_at_window (gdpy, gwin);
+
+  /* GTK returns scaled sizes for the workareas.  */
+  double scale = pgtk_get_monitor_scale_factor (gdk_monitor_get_model (gmon));
+  if (scale == 0.0)
+    scale = gdk_monitor_get_scale_factor (gmon);
+
+  unblock_input ();
+
+  return scale;
+}
+
+DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, 0, 1, 0,
+       doc: /* Return the number of bitplanes of the display TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.  */)
+  (Lisp_Object terminal)
+{
+  check_pgtk_display_info (terminal);
+  return make_fixnum (32);
+}
+
+
+DEFUN ("x-display-color-cells", Fx_display_color_cells, 
Sx_display_color_cells, 0, 1, 0,
+       doc: /* Returns the number of color cells of the display TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
+  return make_fixnum (1 << min (dpyinfo->n_planes, 24));
+}
+
+/***********************************************************************
+                               Tool tips
+ ***********************************************************************/
+
+/* The frame of the currently visible tooltip.  */
+static Lisp_Object tip_frame;
+
+/* The window-system window corresponding to the frame of the
+   currently visible tooltip.  */
+GtkWidget *tip_window;
+
+/* A timer that hides or deletes the currently visible tooltip when it
+   fires.  */
+static Lisp_Object tip_timer;
+
+/* STRING argument of last `x-show-tip' call.  */
+static Lisp_Object tip_last_string;
+
+/* Normalized FRAME argument of last `x-show-tip' call.  */
+static Lisp_Object tip_last_frame;
+
+/* PARMS argument of last `x-show-tip' call.  */
+static Lisp_Object tip_last_parms;
+
+
+static void
+unwind_create_tip_frame (Lisp_Object frame)
+{
+  Lisp_Object deleted;
+
+  deleted = unwind_create_frame (frame);
+  if (EQ (deleted, Qt))
+    {
+      tip_window = NULL;
+      tip_frame = Qnil;
+    }
+}
+
+
+/* Create a frame for a tooltip on the display described by DPYINFO.
+   PARMS is a list of frame parameters.  TEXT is the string to
+   display in the tip frame.  Value is the frame.
+
+   Note that functions called here, esp. gui_default_parameter can
+   signal errors, for instance when a specified color name is
+   undefined.  We have to make sure that we're in a consistent state
+   when this happens.  */
+
+static Lisp_Object
+x_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, 
struct frame *p)
+{
+  struct frame *f;
+  Lisp_Object frame;
+  Lisp_Object name;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  bool face_change_before = face_change;
+
+  if (!dpyinfo->terminal->name)
+    error ("Terminal is not live, can't create new frames on it");
+
+  parms = Fcopy_alist (parms);
+
+  /* Get the name of the frame to use for resource lookup.  */
+  name = gui_display_get_arg (dpyinfo, parms, Qname, "name", "Name",
+                              RES_TYPE_STRING);
+  if (!STRINGP (name)
+      && !EQ (name, Qunbound)
+      && !NILP (name))
+    error ("Invalid frame name--not a string or nil");
+
+  frame = Qnil;
+  f = make_frame (false);
+  f->wants_modeline = false;
+  XSETFRAME (frame, f);
+  record_unwind_protect (unwind_create_tip_frame, frame);
+
+  f->terminal = dpyinfo->terminal;
+
+  /* By setting the output method, we're essentially saying that
+     the frame is live, as per FRAME_LIVE_P.  If we get a signal
+     from this point on, x_destroy_window might screw up reference
+     counts etc.  */
+  f->output_method = output_pgtk;
+  f->output_data.pgtk = xzalloc (sizeof *f->output_data.pgtk);
+#if 0
+  f->output_data.pgtk->icon_bitmap = -1;
+#endif
+  FRAME_FONTSET (f) = -1;
+  f->output_data.pgtk->white_relief.pixel = -1;
+  f->output_data.pgtk->black_relief.pixel = -1;
+
+  f->tooltip = true;
+  fset_icon_name (f, Qnil);
+  FRAME_DISPLAY_INFO (f) = dpyinfo;
+  f->output_data.pgtk->parent_desc = FRAME_DISPLAY_INFO (f)->root_window;
+  f->output_data.pgtk->explicit_parent = false;
+
+  /* These colors will be set anyway later, but it's important
+     to get the color reference counts right, so initialize them!  */
+  {
+    Lisp_Object black;
+
+    /* Function x_decode_color can signal an error.  Make
+       sure to initialize color slots so that we won't try
+       to free colors we haven't allocated.  */
+    FRAME_FOREGROUND_PIXEL (f) = -1;
+    FRAME_BACKGROUND_PIXEL (f) = -1;
+    f->output_data.pgtk->border_pixel = -1;
+
+    black = build_string ("black");
+    FRAME_FOREGROUND_PIXEL (f)
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    FRAME_BACKGROUND_PIXEL (f)
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+    f->output_data.pgtk->border_pixel
+      = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
+  }
+
+  /* Set the name; the functions to which we pass f expect the name to
+     be set.  */
+  if (EQ (name, Qunbound) || NILP (name))
+    {
+      fset_name (f, build_string (dpyinfo->x_id_name));
+      f->explicit_name = false;
+    }
+  else
+    {
+      fset_name (f, name);
+      f->explicit_name = true;
+      /* use the frame's title when getting resources for this frame.  */
+      specbind (Qx_resource_name, name);
+    }
+
+  register_font_driver (&ftcrfont_driver, f);
+#ifdef HAVE_HARFBUZZ
+  register_font_driver (&ftcrhbfont_driver, f);
+#endif /* HAVE_HARFBUZZ */
+
+  image_cache_refcount =
+    FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
+
+  gui_default_parameter (f, parms, Qfont_backend, Qnil,
+                         "fontBackend", "FontBackend", RES_TYPE_STRING);
+
+  /* Extract the window parameters from the supplied values that are
+     needed to determine window geometry.  */
+  pgtk_default_font_parameter (f, parms);
+
+  gui_default_parameter (f, parms, Qborder_width, make_fixnum (0),
+                         "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
+
+  /* This defaults to 2 in order to match xterm.  We recognize either
+     internalBorderWidth or internalBorder (which is what xterm calls
+     it).  */
+  if (NILP (Fassq (Qinternal_border_width, parms)))
+    {
+      Lisp_Object value;
+
+      value = gui_display_get_arg (dpyinfo, parms, Qinternal_border_width,
+                                   "internalBorder", "internalBorder",
+                                   RES_TYPE_NUMBER);
+      if (! EQ (value, Qunbound))
+       parms = Fcons (Fcons (Qinternal_border_width, value),
+                      parms);
+    }
+
+  gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1),
+                         "internalBorderWidth", "internalBorderWidth",
+                         RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
+                         NULL, NULL, RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),
+                         NULL, NULL, RES_TYPE_NUMBER);
+
+  /* Also do the stuff which must be set before the window exists.  */
+  gui_default_parameter (f, parms, Qforeground_color, build_string ("black"),
+                         "foreground", "Foreground", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qbackground_color, build_string ("white"),
+                         "background", "Background", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qmouse_color, build_string ("black"),
+                         "pointerColor", "Foreground", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qcursor_color, build_string ("black"),
+                         "cursorColor", "Foreground", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qborder_color, build_string ("black"),
+                         "borderColor", "BorderColor", RES_TYPE_STRING);
+  gui_default_parameter (f, parms, Qno_special_glyphs, Qnil,
+                         NULL, NULL, RES_TYPE_BOOLEAN);
+
+  /* Init faces before gui_default_parameter is called for the
+     scroll-bar-width parameter because otherwise we end up in
+     init_iterator with a null face cache, which should not happen.  */
+  init_frame_faces (f);
+
+  f->output_data.pgtk->parent_desc = FRAME_DISPLAY_INFO (f)->root_window;
+
+  gui_default_parameter (f, parms, Qinhibit_double_buffering, Qnil,
+                         "inhibitDoubleBuffering", "InhibitDoubleBuffering",
+                         RES_TYPE_BOOLEAN);
+
+  gui_figure_window_size (f, parms, false, false);
+
+  xg_create_frame_widgets (f);
+  pgtk_set_event_handler (f);
+  tip_window = FRAME_GTK_OUTER_WIDGET (f);
+  gtk_window_set_transient_for (GTK_WINDOW (tip_window),
+                               GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (p)));
+  gtk_window_set_attached_to (GTK_WINDOW (tip_window), FRAME_GTK_WIDGET (p));
+  gtk_window_set_destroy_with_parent (GTK_WINDOW (tip_window), TRUE);
+  gtk_window_set_decorated (GTK_WINDOW (tip_window), FALSE);
+  gtk_window_set_type_hint (GTK_WINDOW (tip_window), 
GDK_WINDOW_TYPE_HINT_TOOLTIP);
+  f->output_data.pgtk->current_cursor = f->output_data.pgtk->text_cursor;
+
+#if 0
+  x_make_gc (f);
+#endif
+
+  gui_default_parameter (f, parms, Qauto_raise, Qnil,
+                         "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
+  gui_default_parameter (f, parms, Qauto_lower, Qnil,
+                         "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
+  gui_default_parameter (f, parms, Qcursor_type, Qbox,
+                         "cursorType", "CursorType", RES_TYPE_SYMBOL);
+  gui_default_parameter (f, parms, Qalpha, Qnil,
+                         "alpha", "Alpha", RES_TYPE_NUMBER);
+
+  /* Add `tooltip' frame parameter's default value. */
+  if (NILP (Fframe_parameter (frame, Qtooltip)))
+    {
+      AUTO_FRAME_ARG (arg, Qtooltip, Qt);
+      Fmodify_frame_parameters (frame, arg);
+    }
+
+  /* FIXME - can this be done in a similar way to normal frames?
+     https://lists.gnu.org/r/emacs-devel/2007-10/msg00641.html */
+
+  /* Set the `display-type' frame parameter before setting up faces. */
+  {
+    Lisp_Object disptype;
+
+    disptype = intern ("color");
+
+    if (NILP (Fframe_parameter (frame, Qdisplay_type)))
+      {
+       AUTO_FRAME_ARG (arg, Qdisplay_type, disptype);
+       Fmodify_frame_parameters (frame, arg);
+      }
+  }
+
+  /* Set up faces after all frame parameters are known.  This call
+     also merges in face attributes specified for new frames.
+
+     Frame parameters may be changed if .Xdefaults contains
+     specifications for the default font.  For example, if there is an
+     `Emacs.default.attributeBackground: pink', the `background-color'
+     attribute of the frame get's set, which let's the internal border
+     of the tooltip frame appear in pink.  Prevent this.  */
+  {
+    Lisp_Object bg = Fframe_parameter (frame, Qbackground_color);
+
+    call2 (Qface_set_after_frame_default, frame, Qnil);
+
+    if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
+      {
+       AUTO_FRAME_ARG (arg, Qbackground_color, bg);
+       Fmodify_frame_parameters (frame, arg);
+      }
+  }
+
+  f->no_split = true;
+
+  /* Now that the frame will be official, it counts as a reference to
+     its display and terminal.  */
+  FRAME_DISPLAY_INFO (f)->reference_count++;
+  f->terminal->reference_count++;
+
+  /* It is now ok to make the frame official even if we get an error
+     below.  And the frame needs to be on Vframe_list or making it
+     visible won't work.  */
+  Vframe_list = Fcons (frame, Vframe_list);
+  f->can_set_window_size = true;
+  adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
+                    0, true, Qtip_frame);
+
+  /* Setting attributes of faces of the tooltip frame from resources
+     and similar will set face_change, which leads to the clearing of
+     all current matrices.  Since this isn't necessary here, avoid it
+     by resetting face_change to the value it had before we created
+     the tip frame.  */
+  face_change = face_change_before;
+
+  /* Discard the unwind_protect.  */
+  return unbind_to (count, frame);
+}
+
+/* Compute where to display tip frame F.  PARMS is the list of frame
+   parameters for F.  DX and DY are specified offsets from the current
+   location of the mouse.  WIDTH and HEIGHT are the width and height
+   of the tooltip.  Return coordinates relative to the root window of
+   the display in *ROOT_X, and *ROOT_Y.  */
+
+static void
+compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx,
+               Lisp_Object dy, int width, int height, int *root_x,
+               int *root_y)
+{
+  Lisp_Object left, top, right, bottom;
+  int min_x, min_y, max_x, max_y = -1;
+
+  /* User-specified position?  */
+  left = Fcdr (Fassq (Qleft, parms));
+  top = Fcdr (Fassq (Qtop, parms));
+  right = Fcdr (Fassq (Qright, parms));
+  bottom = Fcdr (Fassq (Qbottom, parms));
+
+  /* Move the tooltip window where the mouse pointer is.  Resize and
+     show it.  */
+  if ((!INTEGERP (left) && !INTEGERP (right))
+      || (!INTEGERP (top) && !INTEGERP (bottom)))
+    {
+      Lisp_Object frame, attributes, monitor, geometry;
+      GdkSeat *seat =
+       gdk_display_get_default_seat (FRAME_DISPLAY_INFO (f)->gdpy);
+      GdkDevice *dev = gdk_seat_get_pointer (seat);
+      GdkScreen *scr;
+
+      block_input ();
+      gdk_device_get_position (dev, &scr, root_x, root_y);
+      unblock_input ();
+
+      XSETFRAME (frame, f);
+      attributes = Fpgtk_display_monitor_attributes_list (frame);
+
+      /* Try to determine the monitor where the mouse pointer is and
+         its geometry.  See bug#22549.  */
+      while (CONSP (attributes))
+       {
+         monitor = XCAR (attributes);
+         geometry = Fassq (Qgeometry, monitor);
+         if (CONSP (geometry))
+           {
+             min_x = XFIXNUM (Fnth (make_fixnum (1), geometry));
+             min_y = XFIXNUM (Fnth (make_fixnum (2), geometry));
+             max_x = min_x + XFIXNUM (Fnth (make_fixnum (3), geometry));
+             max_y = min_y + XFIXNUM (Fnth (make_fixnum (4), geometry));
+             if (min_x <= *root_x && *root_x < max_x
+                 && min_y <= *root_y && *root_y < max_y)
+               {
+                 break;
+               }
+             max_y = -1;
+           }
+
+         attributes = XCDR (attributes);
+       }
+    }
+
+  /* It was not possible to determine the monitor's geometry, so we
+     assign some sane defaults here: */
+  if (max_y < 0)
+    {
+      min_x = 0;
+      min_y = 0;
+      max_x = x_display_pixel_width (FRAME_DISPLAY_INFO (f));
+      max_y = x_display_pixel_height (FRAME_DISPLAY_INFO (f));
+    }
+
+  if (INTEGERP (top))
+    *root_y = XFIXNUM (top);
+  else if (INTEGERP (bottom))
+    *root_y = XFIXNUM (bottom) - height;
+  else if (*root_y + XFIXNUM (dy) <= min_y)
+    *root_y = min_y;           /* Can happen for negative dy */
+  else if (*root_y + XFIXNUM (dy) + height <= max_y)
+    /* It fits below the pointer */
+    *root_y += XFIXNUM (dy);
+  else if (height + XFIXNUM (dy) + min_y <= *root_y)
+    /* It fits above the pointer.  */
+    *root_y -= height + XFIXNUM (dy);
+  else
+    /* Put it on the top.  */
+    *root_y = min_y;
+
+  if (INTEGERP (left))
+    *root_x = XFIXNUM (left);
+  else if (INTEGERP (right))
+    *root_x = XFIXNUM (right) - width;
+  else if (*root_x + XFIXNUM (dx) <= min_x)
+    *root_x = 0;               /* Can happen for negative dx */
+  else if (*root_x + XFIXNUM (dx) + width <= max_x)
+    /* It fits to the right of the pointer.  */
+    *root_x += XFIXNUM (dx);
+  else if (width + XFIXNUM (dx) + min_x <= *root_x)
+    /* It fits to the left of the pointer.  */
+    *root_x -= width + XFIXNUM (dx);
+  else
+    /* Put it left justified on the screen -- it ought to fit that way.  */
+    *root_x = min_x;
+}
+
+
+/* Hide tooltip.  Delete its frame if DELETE is true.  */
+static Lisp_Object
+x_hide_tip (bool delete)
+{
+  if (!NILP (tip_timer))
+    {
+      call1 (Qcancel_timer, tip_timer);
+      tip_timer = Qnil;
+    }
+
+  /* Any GTK+ system tooltip can be found via the x_output structure of
+     tip_last_frame, provided that frame is still live.  Any Emacs
+     tooltip is found via the tip_frame variable.  Note that the current
+     value of x_gtk_use_system_tooltips might not be the same as used
+     for the tooltip we have to hide, see Bug#30399.  */
+  if ((NILP (tip_last_frame) && NILP (tip_frame))
+      || (!x_gtk_use_system_tooltips
+         && !delete
+         && FRAMEP (tip_frame)
+         && FRAME_LIVE_P (XFRAME (tip_frame))
+         && !FRAME_VISIBLE_P (XFRAME (tip_frame))))
+    /* Either there's no tooltip to hide or it's an already invisible
+       Emacs tooltip and we don't want to change its type.  Return
+       quickly.  */
+    return Qnil;
+  else
+    {
+      ptrdiff_t count;
+      Lisp_Object was_open = Qnil;
+
+      count = SPECPDL_INDEX ();
+      specbind (Qinhibit_redisplay, Qt);
+      specbind (Qinhibit_quit, Qt);
+
+      /* Try to hide the GTK+ system tip first.  */
+      if (FRAMEP (tip_last_frame))
+       {
+         struct frame *f = XFRAME (tip_last_frame);
+
+         if (FRAME_LIVE_P (f))
+           {
+             if (xg_hide_tooltip (f))
+               was_open = Qt;
+           }
+       }
+
+      /* When using GTK+ system tooltips (compare Bug#41200) reset
+        tip_last_frame.  It will be reassigned when showing the next
+        GTK+ system tooltip.  */
+      if (x_gtk_use_system_tooltips)
+       tip_last_frame = Qnil;
+
+      /* Now look whether there's an Emacs tip around.  */
+      if (FRAMEP (tip_frame))
+       {
+         struct frame *f = XFRAME (tip_frame);
+
+         if (FRAME_LIVE_P (f))
+           {
+             if (delete || x_gtk_use_system_tooltips)
+               {
+                 /* Delete the Emacs tooltip frame when DELETE is true
+                    or we change the tooltip type from an Emacs one to
+                    a GTK+ system one.  */
+                 delete_frame (tip_frame, Qnil);
+                 tip_frame = Qnil;
+               }
+             else
+               pgtk_make_frame_invisible (f);
+
+             was_open = Qt;
+           }
+         else
+           tip_frame = Qnil;
+       }
+      else
+       tip_frame = Qnil;
+
+      return unbind_to (count, was_open);
+    }
+}
+
+DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
+       doc: /* Show STRING in a "tooltip" window on frame FRAME.
+A tooltip window is a small X window displaying a string.
+
+This is an internal function; Lisp code should call `tooltip-show'.
+
+FRAME nil or omitted means use the selected frame.
+
+PARMS is an optional list of frame parameters which can be used to
+change the tooltip's appearance.
+
+Automatically hide the tooltip after TIMEOUT seconds.  TIMEOUT nil
+means use the default timeout of 5 seconds.
+
+If the list of frame parameters PARMS contains a `left' parameter,
+display the tooltip at that x-position.  If the list of frame parameters
+PARMS contains no `left' but a `right' parameter, display the tooltip
+right-adjusted at that x-position. Otherwise display it at the
+x-position of the mouse, with offset DX added (default is 5 if DX isn't
+specified).
+
+Likewise for the y-position: If a `top' frame parameter is specified, it
+determines the position of the upper edge of the tooltip window.  If a
+`bottom' parameter but no `top' frame parameter is specified, it
+determines the position of the lower edge of the tooltip window.
+Otherwise display the tooltip window at the y-position of the mouse,
+with offset DY added (default is -10).
+
+A tooltip's maximum size is specified by `x-max-tooltip-size'.
+Text larger than the specified size is clipped.  */)
+  (Lisp_Object string, Lisp_Object frame, Lisp_Object parms,
+   Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
+{
+  struct frame *f, *tip_f;
+  struct window *w;
+  int root_x, root_y;
+  struct buffer *old_buffer;
+  struct text_pos pos;
+  int width, height;
+  int old_windows_or_buffers_changed = windows_or_buffers_changed;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t count_1;
+  Lisp_Object window, size, tip_buf;
+  AUTO_STRING (tip, " *tip*");
+
+  specbind (Qinhibit_redisplay, Qt);
+
+  CHECK_STRING (string);
+  if (SCHARS (string) == 0)
+    string = make_unibyte_string (" ", 1);
+
+  if (NILP (frame))
+    frame = selected_frame;
+  f = decode_window_system_frame (frame);
+
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return unbind_to (count, Qnil);
+
+  if (NILP (timeout))
+    timeout = make_fixnum (5);
+  else
+    CHECK_FIXNAT (timeout);
+
+  if (NILP (dx))
+    dx = make_fixnum (5);
+  else
+    CHECK_FIXNUM (dx);
+
+  if (NILP (dy))
+    dy = make_fixnum (-10);
+  else
+    CHECK_FIXNUM (dy);
+
+  if (x_gtk_use_system_tooltips)
+    {
+      bool ok;
+
+      /* Hide a previous tip, if any.  */
+      Fx_hide_tip ();
+
+      block_input ();
+
+      ok = true;
+      xg_show_tooltip (f, string);
+      tip_last_frame = frame;
+
+      unblock_input ();
+      if (ok) goto start_timer;
+    }
+
+  if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)))
+    {
+      if (FRAME_VISIBLE_P (XFRAME (tip_frame))
+         && EQ (frame, tip_last_frame)
+         && !NILP (Fequal_including_properties (tip_last_string, string))
+         && !NILP (Fequal (tip_last_parms, parms)))
+       {
+         /* Only DX and DY have changed.  */
+         tip_f = XFRAME (tip_frame);
+         if (!NILP (tip_timer))
+           {
+             call1 (Qcancel_timer, tip_timer);
+             tip_timer = Qnil;
+           }
+
+         block_input ();
+         compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f),
+                         FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y);
+         gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (tip_f)), root_x, 
root_y);
+         unblock_input ();
+
+         goto start_timer;
+       }
+      else if (tooltip_reuse_hidden_frame && EQ (frame, tip_last_frame))
+       {
+         bool delete = false;
+         Lisp_Object tail, elt, parm, last;
+
+         /* Check if every parameter in PARMS has the same value in
+            tip_last_parms.  This may destruct tip_last_parms which,
+            however, will be recreated below.  */
+         for (tail = parms; CONSP (tail); tail = XCDR (tail))
+           {
+             elt = XCAR (tail);
+             parm = Fcar (elt);
+             /* The left, top, right and bottom parameters are handled
+                by compute_tip_xy so they can be ignored here.  */
+             if (!EQ (parm, Qleft) && !EQ (parm, Qtop)
+                 && !EQ (parm, Qright) && !EQ (parm, Qbottom))
+               {
+                 last = Fassq (parm, tip_last_parms);
+                 if (NILP (Fequal (Fcdr (elt), Fcdr (last))))
+                   {
+                     /* We lost, delete the old tooltip.  */
+                     delete = true;
+                     break;
+                   }
+                 else
+                   tip_last_parms =
+                     call2 (Qassq_delete_all, parm, tip_last_parms);
+               }
+             else
+               tip_last_parms =
+                 call2 (Qassq_delete_all, parm, tip_last_parms);
+           }
+
+         /* Now check if every parameter in what is left of
+            tip_last_parms with a non-nil value has an association in
+            PARMS.  */
+         for (tail = tip_last_parms; CONSP (tail); tail = XCDR (tail))
+           {
+             elt = XCAR (tail);
+             parm = Fcar (elt);
+             if (!EQ (parm, Qleft) && !EQ (parm, Qtop) && !EQ (parm, Qright)
+                 && !EQ (parm, Qbottom) && !NILP (Fcdr (elt)))
+               {
+                 /* We lost, delete the old tooltip.  */
+                 delete = true;
+                 break;
+               }
+           }
+
+         x_hide_tip (delete);
+       }
+      else
+       x_hide_tip (true);
+    }
+  else
+    x_hide_tip (true);
+
+  tip_last_frame = frame;
+  tip_last_string = string;
+  tip_last_parms = parms;
+
+  if (!FRAMEP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame)))
+    {
+      /* Add default values to frame parameters.  */
+      if (NILP (Fassq (Qname, parms)))
+       parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms);
+      if (NILP (Fassq (Qinternal_border_width, parms)))
+       parms = Fcons (Fcons (Qinternal_border_width, make_fixnum (3)), parms);
+      if (NILP (Fassq (Qborder_width, parms)))
+       parms = Fcons (Fcons (Qborder_width, make_fixnum (1)), parms);
+      if (NILP (Fassq (Qborder_color, parms)))
+       parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), 
parms);
+      if (NILP (Fassq (Qbackground_color, parms)))
+       parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")),
+                      parms);
+
+      /* Create a frame for the tooltip, and record it in the global
+        variable tip_frame.  */
+      if (NILP (tip_frame = x_create_tip_frame (FRAME_DISPLAY_INFO (f), parms, 
f)))
+       /* Creating the tip frame failed.  */
+       return unbind_to (count, Qnil);
+    }
+
+  tip_f = XFRAME (tip_frame);
+  window = FRAME_ROOT_WINDOW (tip_f);
+  tip_buf = Fget_buffer_create (tip, Qnil);
+  /* We will mark the tip window a "pseudo-window" below, and such
+     windows cannot have display margins.  */
+  bset_left_margin_cols (XBUFFER (tip_buf), make_fixnum (0));
+  bset_right_margin_cols (XBUFFER (tip_buf), make_fixnum (0));
+  set_window_buffer (window, tip_buf, false, false);
+  w = XWINDOW (window);
+  w->pseudo_window_p = true;
+
+  /* Set up the frame's root window.  Note: The following code does not
+     try to size the window or its frame correctly.  Its only purpose is
+     to make the subsequent text size calculations work.  The right
+     sizes should get installed when the toolkit gets back to us.  */
+  w->left_col = 0;
+  w->top_line = 0;
+  w->pixel_left = 0;
+  w->pixel_top = 0;
+
+  if (CONSP (Vx_max_tooltip_size)
+      && RANGED_FIXNUMP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
+      && RANGED_FIXNUMP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
+    {
+      w->total_cols = XFIXNAT (XCAR (Vx_max_tooltip_size));
+      w->total_lines = XFIXNAT (XCDR (Vx_max_tooltip_size));
+    }
+  else
+    {
+      w->total_cols = 80;
+      w->total_lines = 40;
+    }
+
+  w->pixel_width = w->total_cols * FRAME_COLUMN_WIDTH (tip_f);
+  w->pixel_height = w->total_lines * FRAME_LINE_HEIGHT (tip_f);
+  FRAME_TOTAL_COLS (tip_f) = w->total_cols;
+  adjust_frame_glyphs (tip_f);
+
+  /* Insert STRING into root window's buffer and fit the frame to the
+     buffer.  */
+  count_1 = SPECPDL_INDEX ();
+  old_buffer = current_buffer;
+  set_buffer_internal_1 (XBUFFER (w->contents));
+  bset_truncate_lines (current_buffer, Qnil);
+  specbind (Qinhibit_read_only, Qt);
+  specbind (Qinhibit_modification_hooks, Qt);
+  specbind (Qinhibit_point_motion_hooks, Qt);
+  Ferase_buffer ();
+  Finsert (1, &string);
+  clear_glyph_matrix (w->desired_matrix);
+  clear_glyph_matrix (w->current_matrix);
+  SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
+  try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+  /* Calculate size of tooltip window.  */
+  size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
+                                 make_fixnum (w->pixel_height), Qnil,
+                                 Qnil);
+  /* Add the frame's internal border to calculated size.  */
+  width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  width += FRAME_COLUMN_WIDTH (tip_f);
+
+  /* Calculate position of tooltip frame.  */
+  compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y);
+
+  /* Show tooltip frame.  */
+  block_input ();
+  gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (tip_f)), width, 
height);
+  gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (tip_f)), root_x, 
root_y);
+  gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (tip_f));
+  SET_FRAME_VISIBLE (tip_f, 1);
+  gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET 
(tip_f)),
+                        f->output_data.pgtk->current_cursor);
+
+  unblock_input ();
+
+  pgtk_cr_update_surface_desired_size (tip_f, width, height, false);
+
+  w->must_be_updated_p = true;
+  update_single_window (w);
+  flush_frame (tip_f);
+  set_buffer_internal_1 (old_buffer);
+  unbind_to (count_1, Qnil);
+  windows_or_buffers_changed = old_windows_or_buffers_changed;
+
+ start_timer:
+  /* Let the tip disappear after timeout seconds.  */
+  tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
+                    intern ("x-hide-tip"));
+
+  return unbind_to (count, Qnil);
+}
+
+
+DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
+       doc: /* Hide the current tooltip window, if there is any.
+Value is t if tooltip was open, nil otherwise.  */)
+  (void)
+{
+  return x_hide_tip (!tooltip_reuse_hidden_frame);
+}
+
+/* Return geometric attributes of FRAME.  According to the value of
+   ATTRIBUTES return the outer edges of FRAME (Qouter_edges), the inner
+   edges of FRAME, the root window edges of frame (Qroot_edges).  Any
+   other value means to return the geometry as returned by
+   Fx_frame_geometry.  */
+static Lisp_Object
+frame_geometry (Lisp_Object frame, Lisp_Object attribute)
+{
+  struct frame *f = decode_live_frame (frame);
+  Lisp_Object fullscreen_symbol = Fframe_parameter (frame, Qfullscreen);
+  bool fullscreen = (EQ (fullscreen_symbol, Qfullboth)
+                    || EQ (fullscreen_symbol, Qfullscreen));
+  int border = fullscreen ? 0 : f->border_width;
+  int title_height = 0;
+  int native_width = FRAME_PIXEL_WIDTH (f);
+  int native_height = FRAME_PIXEL_HEIGHT (f);
+  int outer_width = native_width + 2 * border;
+  int outer_height = native_height + 2 * border + title_height;
+
+  /* Get these here because they can't be got in configure_event(). */
+  int left_pos, top_pos;
+
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                              &left_pos, &top_pos);
+    }
+  else
+    {
+      GtkAllocation alloc;
+
+      if (FRAME_GTK_WIDGET (f) == NULL)
+       return Qnil;    /* This can occur while creating a frame.  */
+
+      gtk_widget_get_allocation (FRAME_GTK_WIDGET (f), &alloc);
+      left_pos = alloc.x;
+      top_pos = alloc.y;
+    }
+
+  int native_left = left_pos + border;
+  int native_top = top_pos + border + title_height;
+  int native_right = left_pos + outer_width - border;
+  int native_bottom = top_pos + outer_height - border;
+  int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+  int tab_bar_height = 0, tab_bar_width = 0;
+  int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
+  int tool_bar_width = (tool_bar_height
+                       ? outer_width - 2 * internal_border_width : 0);
+
+  tab_bar_height = FRAME_TAB_BAR_HEIGHT (f);
+  tab_bar_width = (tab_bar_height
+                  ? native_width - 2 * internal_border_width : 0);
+  /* inner_top += tab_bar_height; */
+
+  /* Construct list.  */
+  if (EQ (attribute, Qouter_edges))
+    return list4 (make_fixnum (left_pos), make_fixnum (top_pos),
+                 make_fixnum (left_pos + outer_width),
+                 make_fixnum (top_pos + outer_height));
+  else if (EQ (attribute, Qnative_edges))
+    return list4 (make_fixnum (native_left), make_fixnum (native_top),
+                 make_fixnum (native_right), make_fixnum (native_bottom));
+  else if (EQ (attribute, Qinner_edges))
+    return list4 (make_fixnum (native_left + internal_border_width),
+                 make_fixnum (native_top
+                              + tool_bar_height
+                              + internal_border_width),
+                 make_fixnum (native_right - internal_border_width),
+                 make_fixnum (native_bottom - internal_border_width));
+  else
+    return
+      list (Fcons (Qouter_position,
+                  Fcons (make_fixnum (left_pos),
+                         make_fixnum (top_pos))),
+           Fcons (Qouter_size,
+                  Fcons (make_fixnum (outer_width),
+                         make_fixnum (outer_height))),
+           Fcons (Qexternal_border_size,
+                  (fullscreen
+                   ? Fcons (make_fixnum (0), make_fixnum (0))
+                   : Fcons (make_fixnum (border), make_fixnum (border)))),
+           Fcons (Qtitle_bar_size,
+                  Fcons (make_fixnum (0), make_fixnum (title_height))),
+           Fcons (Qmenu_bar_external, Qnil),
+           Fcons (Qmenu_bar_size, Fcons (make_fixnum (0), make_fixnum (0))),
+           Fcons (Qtab_bar_size,
+                  Fcons (make_fixnum (tab_bar_width),
+                         make_fixnum (tab_bar_height))),
+           Fcons (Qtool_bar_external,
+                  FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
+           Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
+           Fcons (Qtool_bar_size,
+                  Fcons (make_fixnum (tool_bar_width),
+                         make_fixnum (tool_bar_height))),
+           Fcons (Qinternal_border_width,
+                  make_fixnum (internal_border_width)));
+}
+
+DEFUN ("pgtk-frame-geometry", Fpgtk_frame_geometry, Spgtk_frame_geometry, 0, 
1, 0,
+       doc: /* Return geometric attributes of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is an association list of the attributes listed below.  All height
+and width values are in pixels.
+
+`outer-position' is a cons of the outer left and top edges of FRAME
+relative to the origin - the position (0, 0) - of FRAME's display.
+
+`outer-size' is a cons of the outer width and height of FRAME.  The
+outer size includes the title bar and the external borders as well as
+any menu and/or tool bar of frame.
+
+`external-border-size' is a cons of the horizontal and vertical width of
+FRAME's external borders as supplied by the window manager.
+
+`title-bar-size' is a cons of the width and height of the title bar of
+FRAME as supplied by the window manager.  If both of them are zero,
+FRAME has no title bar.  If only the width is zero, Emacs was not
+able to retrieve the width information.
+
+`menu-bar-external', if non-nil, means the menu bar is external (never
+included in the inner edges of FRAME).
+
+`menu-bar-size' is a cons of the width and height of the menu bar of
+FRAME.
+
+`tool-bar-external', if non-nil, means the tool bar is external (never
+included in the inner edges of FRAME).
+
+`tool-bar-position' tells on which side the tool bar on FRAME is and can
+be one of `left', `top', `right' or `bottom'.  If this is nil, FRAME
+has no tool bar.
+
+`tool-bar-size' is a cons of the width and height of the tool bar of
+FRAME.
+
+`internal-border-width' is the width of the internal border of
+FRAME.  */)
+  (Lisp_Object frame)
+{
+  return frame_geometry (frame, Qnil);
+}
+
+DEFUN ("pgtk-frame-edges", Fpgtk_frame_edges, Spgtk_frame_edges, 0, 2, 0,
+       doc: /* Return edge coordinates of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is a list of the form (LEFT, TOP, RIGHT, BOTTOM).  All values are
+in pixels relative to the origin - the position (0, 0) - of FRAME's
+display.
+
+If optional argument TYPE is the symbol `outer-edges', return the outer
+edges of FRAME.  The outer edges comprise the decorations of the window
+manager (like the title bar or external borders) as well as any external
+menu or tool bar of FRAME.  If optional argument TYPE is the symbol
+`native-edges' or nil, return the native edges of FRAME.  The native
+edges exclude the decorations of the window manager and any external
+menu or tool bar of FRAME.  If TYPE is the symbol `inner-edges', return
+the inner edges of FRAME.  These edges exclude title bar, any borders,
+menu bar or tool bar of FRAME.  */)
+  (Lisp_Object frame, Lisp_Object type)
+{
+  return frame_geometry (frame, ((EQ (type, Qouter_edges)
+                                 || EQ (type, Qinner_edges))
+                                ? type : Qnative_edges));
+}
+
+DEFUN ("pgtk-set-mouse-absolute-pixel-position", 
Fpgtk_set_mouse_absolute_pixel_position, 
Spgtk_set_mouse_absolute_pixel_position, 2, 2, 0,
+       doc: /* Move mouse pointer to absolute pixel position (X, Y).
+The coordinates X and Y are interpreted in pixels relative to a position
+\(0, 0) of the selected frame's display.  */)
+  (Lisp_Object x, Lisp_Object y)
+{
+  struct frame *f = SELECTED_FRAME ();
+  GtkWidget *widget = gtk_widget_get_toplevel (FRAME_WIDGET (f));
+  GdkWindow *window = gtk_widget_get_window (widget);
+  GdkDisplay *gdpy = gdk_window_get_display (window);
+  GdkScreen *gscr = gdk_window_get_screen (window);
+  GdkSeat *seat = gdk_display_get_default_seat (gdpy);
+  GdkDevice *device = gdk_seat_get_pointer (seat);
+
+  gdk_device_warp (device, gscr, XFIXNUM (x), XFIXNUM (y));    /* No effect on 
wayland. */
+
+  return Qnil;
+}
+
+DEFUN ("pgtk-mouse-absolute-pixel-position", 
Fpgtk_mouse_absolute_pixel_position, Spgtk_mouse_absolute_pixel_position, 0, 0, 
0,
+       doc: /* Return absolute position of mouse cursor in pixels.
+The position is returned as a cons cell (X . Y) of the
+coordinates of the mouse cursor position in pixels relative to a
+position (0, 0) of the selected frame's terminal. */)
+  (void)
+{
+  struct frame *f = SELECTED_FRAME ();
+  GtkWidget *widget = gtk_widget_get_toplevel (FRAME_WIDGET (f));
+  GdkWindow *window = gtk_widget_get_window (widget);
+  GdkDisplay *gdpy = gdk_window_get_display (window);
+  GdkScreen *gscr;
+  GdkSeat *seat = gdk_display_get_default_seat (gdpy);
+  GdkDevice *device = gdk_seat_get_pointer (seat);
+  int x = 0, y = 0;
+
+  gdk_device_get_position (device, &gscr, &x, &y);     /* can't get on 
wayland? */
+
+  return Fcons (make_fixnum (x), make_fixnum (y));
+}
+
+
+DEFUN ("pgtk-page-setup-dialog", Fpgtk_page_setup_dialog, 
Spgtk_page_setup_dialog, 0, 0, 0,
+       doc: /* Pop up a page setup dialog.
+The current page setup can be obtained using `x-get-page-setup'.  */)
+  (void)
+{
+  block_input ();
+  xg_page_setup_dialog ();
+  unblock_input ();
+
+  return Qnil;
+}
+
+DEFUN ("pgtk-get-page-setup", Fpgtk_get_page_setup, Spgtk_get_page_setup, 0, 
0, 0,
+       doc: /* Return the value of the current page setup.
+The return value is an alist containing the following keys:
+
+orientation: page orientation (symbol `portrait', `landscape',
+`reverse-portrait', or `reverse-landscape').
+width, height: page width/height in points not including margins.
+left-margin, right-margin, top-margin, bottom-margin: print margins,
+which is the parts of the page that the printer cannot print
+on, in points.
+
+The paper width can be obtained as the sum of width, left-margin, and
+right-margin values if the page orientation is `portrait' or
+`reverse-portrait'.  Otherwise, it is the sum of width, top-margin,
+and bottom-margin values.  Likewise, the paper height is the sum of
+height, top-margin, and bottom-margin values if the page orientation
+is `portrait' or `reverse-portrait'.  Otherwise, it is the sum of
+height, left-margin, and right-margin values.  */)
+  (void)
+{
+  Lisp_Object result;
+
+  block_input ();
+  result = xg_get_page_setup ();
+  unblock_input ();
+
+  return result;
+}
+
+DEFUN ("pgtk-print-frames-dialog", Fpgtk_print_frames_dialog, 
Spgtk_print_frames_dialog, 0, 1, "",
+       doc: /* Pop up a print dialog to print the current contents of FRAMES.
+FRAMES should be nil (the selected frame), a frame, or a list of
+frames (each of which corresponds to one page).  Each frame should be
+visible.  */)
+  (Lisp_Object frames)
+{
+  Lisp_Object rest, tmp;
+  int count;
+
+  if (!CONSP (frames))
+    frames = list1 (frames);
+
+  tmp = Qnil;
+  for (rest = frames; CONSP (rest); rest = XCDR (rest))
+    {
+      struct frame *f = decode_window_system_frame (XCAR (rest));
+      Lisp_Object frame;
+
+      XSETFRAME (frame, f);
+      if (!FRAME_VISIBLE_P (f))
+       error ("Frames to be printed must be visible.");
+      tmp = Fcons (frame, tmp);
+    }
+  frames = Fnreverse (tmp);
+
+  /* Make sure the current matrices are up-to-date.  */
+  count = SPECPDL_INDEX ();
+  specbind (Qredisplay_dont_pause, Qt);
+  redisplay_preserve_echo_area (32);
+  unbind_to (count, Qnil);
+
+  block_input ();
+  xg_print_frames_dialog (frames);
+  unblock_input ();
+
+  return Qnil;
+}
+
+static void
+clean_up_dialog (void)
+{
+  pgtk_menu_set_in_use (false);
+}
+
+DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
+       doc: /* Read file name, prompting with PROMPT in directory DIR.
+Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
+selection box, if specified.  If MUSTMATCH is non-nil, the returned file
+or directory must exist.
+
+This function is defined only on PGTK, NS, MS Windows, and X Windows with the
+Motif or Gtk toolkits.  With the Motif toolkit, ONLY-DIR-P is ignored.
+Otherwise, if ONLY-DIR-P is non-nil, the user can select only directories.
+On MS Windows 7 and later, the file selection dialog "remembers" the last
+directory where the user selected a file, and will open that directory
+instead of DIR on subsequent invocations of this function with the same
+value of DIR as in previous invocations; this is standard MS Windows behavior. 
 */)
+  (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename,
+   Lisp_Object mustmatch, Lisp_Object only_dir_p)
+{
+  struct frame *f = SELECTED_FRAME ();
+  char *fn;
+  Lisp_Object file = Qnil;
+  Lisp_Object decoded_file;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  char *cdef_file;
+
+  check_window_system (f);
+
+  if (popup_activated ())
+    error ("Trying to use a menu from within a menu-entry");
+  else
+    pgtk_menu_set_in_use (true);
+
+  CHECK_STRING (prompt);
+  CHECK_STRING (dir);
+
+  /* Prevent redisplay.  */
+  specbind (Qinhibit_redisplay, Qt);
+  record_unwind_protect_void (clean_up_dialog);
+
+  block_input ();
+
+  if (STRINGP (default_filename))
+    cdef_file = SSDATA (default_filename);
+  else
+    cdef_file = SSDATA (dir);
+
+  fn = xg_get_file_name (f, SSDATA (prompt), cdef_file,
+                        !NILP (mustmatch), !NILP (only_dir_p));
+
+  if (fn)
+    {
+      file = build_string (fn);
+      xfree (fn);
+    }
+
+  unblock_input ();
+
+  /* Make "Cancel" equivalent to C-g.  */
+  if (NILP (file))
+    quit ();
+
+  decoded_file = DECODE_FILE (file);
+
+  return unbind_to (count, decoded_file);
+}
+
+DEFUN ("pgtk-backend-display-class", Fpgtk_backend_display_class, 
Spgtk_backend_display_class, 0, 1, "",
+       doc: /* Return the name of the Gdk backend display class of TERMINAL.
+The optional argument TERMINAL specifies which display to ask about.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If omitted or nil, that stands for the selected frame's display.  */)
+  (Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+  GdkDisplay *gdpy = dpyinfo->gdpy;
+  const gchar *type_name = G_OBJECT_TYPE_NAME (G_OBJECT (gdpy));
+  return build_string (type_name);
+}
+
+DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0,
+       doc: /* Read a font using a GTK dialog and return a font spec.
+
+FRAME is the frame on which to pop up the font chooser.  If omitted or
+nil, it defaults to the selected frame. */)
+  (Lisp_Object frame, Lisp_Object ignored)
+{
+  struct frame *f = decode_window_system_frame (frame);
+  Lisp_Object font;
+  Lisp_Object font_param;
+  char *default_name = NULL;
+  ptrdiff_t count = SPECPDL_INDEX ();
+
+  if (popup_activated ())
+    error ("Trying to use a menu from within a menu-entry");
+  else
+    pgtk_menu_set_in_use (true);
+
+  /* Prevent redisplay.  */
+  specbind (Qinhibit_redisplay, Qt);
+  record_unwind_protect_void (clean_up_dialog);
+
+  block_input ();
+
+  XSETFONT (font, FRAME_FONT (f));
+  font_param = Ffont_get (font, QCname);
+  if (STRINGP (font_param))
+    default_name = xlispstrdup (font_param);
+  else
+    {
+      font_param = Fframe_parameter (frame, Qfont_parameter);
+      if (STRINGP (font_param))
+        default_name = xlispstrdup (font_param);
+    }
+
+  font = xg_get_font (f, default_name);
+  xfree (default_name);
+
+  unblock_input ();
+
+  if (NILP (font))
+    quit ();
+
+  return unbind_to (count, font);
+}
+
+/* ==========================================================================
+
+    Lisp interface declaration
+
+   ========================================================================== 
*/
+
+void
+syms_of_pgtkfns (void)
+{
+  DEFSYM (Qfont_parameter, "font-parameter");
+  DEFSYM (Qfontsize, "fontsize");
+  DEFSYM (Qcancel_timer, "cancel-timer");
+  DEFSYM (Qframe_title_format, "frame-title-format");
+  DEFSYM (Qicon_title_format, "icon-title-format");
+  DEFSYM (Qdark, "dark");
+  DEFSYM (Qhide, "hide");
+  DEFSYM (Qresize_mode, "resize-mode");
+
+  DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel,
+              doc: /* A string indicating the foreground color of the cursor 
box.  */);
+  Vx_cursor_fore_pixel = Qnil;
+
+  DEFVAR_LISP ("pgtk-icon-type-alist", Vpgtk_icon_type_alist,
+              doc: /* Alist of elements (REGEXP . IMAGE) for images of icons 
associated to frames.
+If the title of a frame matches REGEXP, then IMAGE.tiff is
+selected as the image of the icon representing the frame when it's
+miniaturized.  If an element is t, then Emacs tries to select an icon
+based on the filetype of the visited file.
+
+The images have to be installed in a folder called English.lproj in the
+Emacs folder.  You have to restart Emacs after installing new icons.
+
+Example: Install an icon Gnus.tiff and execute the following code
+
+(setq pgtk-icon-type-alist
+(append pgtk-icon-type-alist
+\\='((\"^\\\\*\\\\(Group\\\\*$\\\\|Summary \\\\|Article\\\\*$\\\\)\"
+. \"Gnus\"))))
+
+When you miniaturize a Group, Summary or Article frame, Gnus.tiff will
+be used as the image of the icon representing the frame.  */);
+  Vpgtk_icon_type_alist = list1 (Qt);
+
+
+  /* Provide x-toolkit also for GTK.  Internally GTK does not use Xt so it
+     is not an X toolkit in that sense (USE_X_TOOLKIT is not defined).
+     But for a user it is a toolkit for X, and indeed, configure
+     accepts --with-x-toolkit=gtk.  */
+  Fprovide (intern_c_string ("x-toolkit"), Qnil);
+  Fprovide (intern_c_string ("gtk"), Qnil);
+  Fprovide (intern_c_string ("move-toolbar"), Qnil);
+
+  DEFVAR_LISP ("gtk-version-string", Vgtk_version_string,
+              doc: /* Version info for GTK+.  */);
+  {
+    char *ver = g_strdup_printf ("%d.%d.%d",
+                                GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
+                                GTK_MICRO_VERSION);
+    int len = strlen (ver);
+    Vgtk_version_string = make_pure_string (ver, len, len, false);
+    g_free (ver);
+  }
+
+
+  Fprovide (intern_c_string ("cairo"), Qnil);
+
+  DEFVAR_LISP ("cairo-version-string", Vcairo_version_string,
+              doc: /* Version info for cairo.  */);
+  {
+    char *ver = g_strdup_printf ("%d.%d.%d",
+                                CAIRO_VERSION_MAJOR, CAIRO_VERSION_MINOR,
+                                CAIRO_VERSION_MICRO);
+    int len = strlen (ver);
+    Vcairo_version_string = make_pure_string (ver, len, len, false);
+    g_free (ver);
+  }
+
+
+  defsubr (&Spgtk_set_resource);
+  defsubr (&Sxw_display_color_p);      /* this and next called directly by C 
code */
+  defsubr (&Sx_display_grayscale_p);
+  defsubr (&Spgtk_font_name);
+  defsubr (&Sxw_color_defined_p);
+  defsubr (&Sxw_color_values);
+  defsubr (&Sx_server_max_request_size);
+  defsubr (&Sx_display_pixel_width);
+  defsubr (&Sx_display_pixel_height);
+  defsubr (&Spgtk_display_monitor_attributes_list);
+  defsubr (&Spgtk_frame_geometry);
+  defsubr (&Spgtk_frame_edges);
+  defsubr (&Spgtk_frame_restack);
+  defsubr (&Spgtk_set_mouse_absolute_pixel_position);
+  defsubr (&Spgtk_mouse_absolute_pixel_position);
+  defsubr (&Sx_display_mm_width);
+  defsubr (&Sx_display_mm_height);
+  defsubr (&Sx_display_screens);
+  defsubr (&Sx_display_planes);
+  defsubr (&Sx_display_color_cells);
+  defsubr (&Sx_display_visual_class);
+  defsubr (&Sx_display_backing_store);
+  defsubr (&Sx_display_save_under);
+  defsubr (&Sx_create_frame);
+  defsubr (&Sx_open_connection);
+  defsubr (&Sx_close_connection);
+  defsubr (&Sx_display_list);
+
+  defsubr (&Spgtk_hide_others);
+  defsubr (&Spgtk_hide_emacs);
+
+  defsubr (&Sx_show_tip);
+  defsubr (&Sx_hide_tip);
+
+  defsubr (&Sx_export_frames);
+  defsubr (&Spgtk_page_setup_dialog);
+  defsubr (&Spgtk_get_page_setup);
+  defsubr (&Spgtk_print_frames_dialog);
+  defsubr (&Spgtk_backend_display_class);
+
+  defsubr (&Spgtk_set_monitor_scale_factor);
+
+  defsubr (&Sx_file_dialog);
+  defsubr (&Sx_select_font);
+
+  as_status = 0;
+  as_script = Qnil;
+  as_result = 0;
+
+  monitor_scale_factor_alist = Qnil;
+  staticpro (&monitor_scale_factor_alist);
+
+  tip_timer = Qnil;
+  staticpro (&tip_timer);
+  tip_frame = Qnil;
+  staticpro (&tip_frame);
+  tip_last_frame = Qnil;
+  staticpro (&tip_last_frame);
+  tip_last_string = Qnil;
+  staticpro (&tip_last_string);
+  tip_last_parms = Qnil;
+  staticpro (&tip_last_parms);
+
+  /* This is not ifdef:ed, so other builds than GTK can customize it.  */
+  DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog,
+              doc: /* Non-nil means prompt with the old GTK file selection 
dialog.
+If nil or if the file selection dialog is not available, the new GTK file
+chooser is used instead.  To turn off all file dialogs set the
+variable `use-file-dialog'.  */);
+  x_gtk_use_old_file_dialog = false;
+
+  DEFVAR_BOOL ("x-gtk-show-hidden-files", x_gtk_show_hidden_files,
+              doc: /* If non-nil, the GTK file chooser will by default show 
hidden files.
+Note that this is just the default, there is a toggle button on the file
+chooser to show or not show hidden files on a case by case basis.  */);
+  x_gtk_show_hidden_files = false;
+
+  DEFVAR_BOOL ("x-gtk-file-dialog-help-text", x_gtk_file_dialog_help_text,
+              doc: /* If non-nil, the GTK file chooser will show additional 
help text.
+If more space for files in the file chooser dialog is wanted, set this to nil
+to turn the additional text off.  */);
+  x_gtk_file_dialog_help_text = true;
+
+  DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips,
+              doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is 
used.
+Otherwise use Emacs own tooltip implementation.
+When using Gtk+ tooltips, the tooltip face is not used.  */);
+  x_gtk_use_system_tooltips = true;
+
+  DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
+    doc: /* Maximum size for tooltips.
+Value is a pair (COLUMNS . ROWS).  Text larger than this is clipped.  */);
+  Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
+
+  DEFVAR_LISP ("x-gtk-resize-child-frames", x_gtk_resize_child_frames,
+    doc: /* If non-nil, resize child frames specially with GTK builds.
+If this is nil, resize child frames like any other frames.  This is the
+default and usually works with most desktops.  Some desktop environments
+(GNOME shell in particular when using the mutter window manager),
+however, may refuse to resize a child frame when Emacs is built with
+GTK3.  For those environments, the two settings below are provided.
+
+If this equals the symbol 'hide', Emacs temporarily hides the child
+frame during resizing.  This approach seems to work reliably, may
+however induce some flicker when the frame is made visible again.
+
+If this equals the symbol 'resize-mode', Emacs uses GTK's resize mode to
+always trigger an immediate resize of the child frame.  This method is
+deprecated by GTK and may not work in future versions of that toolkit.
+It also may freeze Emacs when used with other desktop environments.  It
+avoids, however, the unpleasant flicker induced by the hiding approach.
+
+This variable is considered a temporary workaround and will be hopefully
+eliminated in future versions of Emacs.  */);
+  x_gtk_resize_child_frames = Qnil;
+
+
+  DEFSYM (Qmono, "mono");
+  DEFSYM (Qassq_delete_all, "assq-delete-all");
+
+  DEFSYM (Qpdf, "pdf");
+
+  DEFSYM (Qorientation, "orientation");
+  DEFSYM (Qtop_margin, "top-margin");
+  DEFSYM (Qbottom_margin, "bottom-margin");
+  DEFSYM (Qportrait, "portrait");
+  DEFSYM (Qlandscape, "landscape");
+  DEFSYM (Qreverse_portrait, "reverse-portrait");
+  DEFSYM (Qreverse_landscape, "reverse-landscape");
+}
+
+#endif
diff --git a/src/pgtkgui.h b/src/pgtkgui.h
new file mode 100644
index 0000000000..389052631c
--- /dev/null
+++ b/src/pgtkgui.h
@@ -0,0 +1,119 @@
+/* Definitions and headers for communication on the pure Gtk+3.
+   Copyright (C) 1995, 2005, 2008-2022 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/>.  */
+
+#ifndef __PGTKGUI_H__
+#define __PGTKGUI_H__
+
+/* Emulate XCharStruct.  */
+typedef struct _XCharStruct
+{
+  int rbearing;
+  int lbearing;
+  int width;
+  int ascent;
+  int descent;
+} XCharStruct;
+
+/* Fake structure from Xlib.h to represent two-byte characters.  */
+typedef unsigned short unichar;
+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)
+
+
+typedef struct _GdkCursor *Emacs_Cursor;
+
+typedef void *Color;
+typedef int Window;
+typedef struct _GdkDisplay Display;
+
+/* Xism */
+typedef void *XrmDatabase;
+
+
+/* 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;
+
+/* This stuff is needed by frame.c.  */
+#define ForgetGravity          0
+#define NorthWestGravity       1
+#define NorthGravity           2
+#define NorthEastGravity       3
+#define WestGravity            4
+#define CenterGravity          5
+#define EastGravity            6
+#define SouthWestGravity       7
+#define SouthGravity           8
+#define SouthEastGravity       9
+#define StaticGravity          10
+
+#define NoValue                0x0000
+#define XValue         0x0001
+#define YValue         0x0002
+#define WidthValue     0x0004
+#define HeightValue    0x0008
+#define AllValues      0x000F
+#define XNegative      0x0010
+#define YNegative      0x0020
+
+#define USPosition     (1L << 0)       /* user specified x, y */
+#define USSize         (1L << 1)       /* user specified width, height */
+
+#define PPosition      (1L << 2)       /* program specified position */
+#define PSize          (1L << 3)       /* program specified size */
+#define PMinSize       (1L << 4)       /* program specified minimum size */
+#define PMaxSize       (1L << 5)       /* program specified maximum size */
+#define PResizeInc     (1L << 6)       /* program specified resize increments 
*/
+#define PAspect                (1L << 7)       /* program specified min, max 
aspect ratios */
+#define PBaseSize      (1L << 8)       /* program specified base for 
incrementing */
+#define PWinGravity    (1L << 9)       /* program specified window gravity */
+
+
+#define NativeRectangle XRectangle
+
+#define CONVERT_TO_EMACS_RECT(xr, nr)          \
+  ((xr).x     = (nr).x,                                \
+   (xr).y     = (nr).y,                                \
+   (xr).width = (nr).width,                    \
+   (xr).height = (nr).height)
+
+#define CONVERT_FROM_EMACS_RECT(xr, nr)                \
+  ((nr).x      = (xr).x,                       \
+   (nr).y      = (xr).y,                       \
+   (nr).width  = (xr).width,                   \
+   (nr).height = (xr).height)
+
+#define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \
+  ((nr).x      = (px),                                 \
+   (nr).y      = (py),                                 \
+   (nr).width  = (pwidth),                             \
+   (nr).height = (pheight))
+
+#endif /* __PGTKGUI_H__ */
diff --git a/src/pgtkim.c b/src/pgtkim.c
new file mode 100644
index 0000000000..8577ba2116
--- /dev/null
+++ b/src/pgtkim.c
@@ -0,0 +1,311 @@
+/* Pure Gtk+-3 communication module.
+
+Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 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/>.  */
+
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
+#include <config.h>
+
+#include "pgtkterm.h"
+
+static void
+im_context_commit_cb (GtkIMContext * imc, gchar * str, gpointer user_data)
+{
+  struct pgtk_display_info *dpyinfo = user_data;
+  struct frame *f = dpyinfo->im.focused_frame;
+
+  if (dpyinfo->im.context == NULL)
+    return;
+  if (f == NULL)
+    return;
+
+  pgtk_enqueue_string (f, str);
+}
+
+static gboolean
+im_context_retrieve_surrounding_cb (GtkIMContext * imc, gpointer user_data)
+{
+  gtk_im_context_set_surrounding (imc, "", -1, 0);
+  return TRUE;
+}
+
+static gboolean
+im_context_delete_surrounding_cb (GtkIMContext * imc, int offset, int n_chars,
+                                 gpointer user_data)
+{
+  return TRUE;
+}
+
+static Lisp_Object
+make_color_string (PangoAttrColor * pac)
+{
+  char buf[256];
+  sprintf (buf, "#%02x%02x%02x",
+          pac->color.red >> 8, pac->color.green >> 8, pac->color.blue >> 8);
+  return build_string (buf);
+}
+
+static void
+im_context_preedit_changed_cb (GtkIMContext * imc, gpointer user_data)
+{
+  struct pgtk_display_info *dpyinfo = user_data;
+  struct frame *f = dpyinfo->im.focused_frame;
+  char *str;
+  PangoAttrList *attrs;
+  int pos;
+
+  if (dpyinfo->im.context == NULL)
+    return;
+  if (f == NULL)
+    return;
+
+  gtk_im_context_get_preedit_string (imc, &str, &attrs, &pos);
+
+
+  /*
+   * (
+   *   (TEXT (ul . COLOR) (bg . COLOR) (fg . COLOR))
+   *   ...
+   * )
+   */
+  Lisp_Object list = Qnil;
+
+  PangoAttrIterator *iter;
+  iter = pango_attr_list_get_iterator (attrs);
+  do
+    {
+      int st, ed;
+      int has_underline = 0;
+      Lisp_Object part = Qnil;
+
+      pango_attr_iterator_range (iter, &st, &ed);
+
+      if (ed > strlen (str))
+       ed = strlen (str);
+      if (st >= ed)
+       continue;
+
+      Lisp_Object text = make_string (str + st, ed - st);
+      part = Fcons (text, part);
+
+      PangoAttrInt *ul =
+       (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_UNDERLINE);
+      if (ul != NULL)
+       {
+         if (ul->value != PANGO_UNDERLINE_NONE)
+           has_underline = 1;
+       }
+
+      PangoAttrColor *pac;
+      if (has_underline)
+       {
+         pac =
+           (PangoAttrColor *) pango_attr_iterator_get (iter,
+                                                       
PANGO_ATTR_UNDERLINE_COLOR);
+         if (pac != NULL)
+           part = Fcons (Fcons (Qul, make_color_string (pac)), part);
+         else
+           part = Fcons (Fcons (Qul, Qt), part);
+       }
+
+      pac =
+       (PangoAttrColor *) pango_attr_iterator_get (iter,
+                                                   PANGO_ATTR_FOREGROUND);
+      if (pac != NULL)
+       part = Fcons (Fcons (Qfg, make_color_string (pac)), part);
+
+      pac =
+       (PangoAttrColor *) pango_attr_iterator_get (iter,
+                                                   PANGO_ATTR_BACKGROUND);
+      if (pac != NULL)
+       part = Fcons (Fcons (Qbg, make_color_string (pac)), part);
+
+      part = Fnreverse (part);
+      list = Fcons (part, list);
+    }
+  while (pango_attr_iterator_next (iter));
+
+  list = Fnreverse (list);
+  pgtk_enqueue_preedit (f, list);
+
+  g_free (str);
+  pango_attr_list_unref (attrs);
+}
+
+static void
+im_context_preedit_end_cb (GtkIMContext * imc, gpointer user_data)
+{
+  struct pgtk_display_info *dpyinfo = user_data;
+  struct frame *f = dpyinfo->im.focused_frame;
+
+  if (dpyinfo->im.context == NULL)
+    return;
+  if (f == NULL)
+    return;
+
+  pgtk_enqueue_preedit (f, Qnil);
+}
+
+static void
+im_context_preedit_start_cb (GtkIMContext * imc, gpointer user_data)
+{
+}
+
+void
+pgtk_im_focus_in (struct frame *f)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  if (dpyinfo->im.context != NULL)
+    {
+      gtk_im_context_reset (dpyinfo->im.context);
+      gtk_im_context_set_client_window (dpyinfo->im.context,
+                                       gtk_widget_get_window
+                                       (FRAME_GTK_WIDGET (f)));
+      gtk_im_context_focus_in (dpyinfo->im.context);
+    }
+  dpyinfo->im.focused_frame = f;
+}
+
+void
+pgtk_im_focus_out (struct frame *f)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  if (dpyinfo->im.focused_frame == f)
+    {
+      if (dpyinfo->im.context != NULL)
+       {
+         gtk_im_context_reset (dpyinfo->im.context);
+         gtk_im_context_focus_out (dpyinfo->im.context);
+         gtk_im_context_set_client_window (dpyinfo->im.context, NULL);
+       }
+      dpyinfo->im.focused_frame = NULL;
+    }
+}
+
+bool
+pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  if (dpyinfo->im.context != NULL)
+    {
+      if (gtk_im_context_filter_keypress (dpyinfo->im.context, ev))
+       return true;
+    }
+  return false;
+}
+
+void
+pgtk_im_set_cursor_location (struct frame *f, int x, int y, int width,
+                            int height)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  if (dpyinfo->im.context != NULL && dpyinfo->im.focused_frame == f)
+    {
+      GdkRectangle area = { x, y, width, height };
+      gtk_im_context_set_cursor_location (dpyinfo->im.context, &area);
+    }
+}
+
+static void
+pgtk_im_use_context (struct pgtk_display_info *dpyinfo, bool use_p)
+{
+  if (!use_p)
+    {
+      if (dpyinfo->im.context != NULL)
+       {
+         gtk_im_context_reset (dpyinfo->im.context);
+         gtk_im_context_focus_out (dpyinfo->im.context);
+         gtk_im_context_set_client_window (dpyinfo->im.context, NULL);
+
+         g_object_unref (dpyinfo->im.context);
+         dpyinfo->im.context = NULL;
+       }
+    }
+  else
+    {
+      if (dpyinfo->im.context == NULL)
+       {
+         dpyinfo->im.context = gtk_im_multicontext_new ();
+         g_signal_connect (dpyinfo->im.context, "commit",
+                           G_CALLBACK (im_context_commit_cb), dpyinfo);
+         g_signal_connect (dpyinfo->im.context, "retrieve-surrounding",
+                           G_CALLBACK (im_context_retrieve_surrounding_cb),
+                           dpyinfo);
+         g_signal_connect (dpyinfo->im.context, "delete-surrounding",
+                           G_CALLBACK (im_context_delete_surrounding_cb),
+                           dpyinfo);
+         g_signal_connect (dpyinfo->im.context, "preedit-changed",
+                           G_CALLBACK (im_context_preedit_changed_cb),
+                           dpyinfo);
+         g_signal_connect (dpyinfo->im.context, "preedit-end",
+                           G_CALLBACK (im_context_preedit_end_cb), dpyinfo);
+         g_signal_connect (dpyinfo->im.context, "preedit-start",
+                           G_CALLBACK (im_context_preedit_start_cb),
+                           dpyinfo);
+         gtk_im_context_set_use_preedit (dpyinfo->im.context, TRUE);
+
+         if (dpyinfo->im.focused_frame)
+           pgtk_im_focus_in (dpyinfo->im.focused_frame);
+       }
+    }
+}
+
+void
+pgtk_im_init (struct pgtk_display_info *dpyinfo)
+{
+  dpyinfo->im.context = NULL;
+
+  pgtk_im_use_context (dpyinfo, !NILP 
(Vpgtk_use_im_context_on_new_connection));
+}
+
+void
+pgtk_im_finish (struct pgtk_display_info *dpyinfo)
+{
+  if (dpyinfo->im.context != NULL)
+    g_object_unref (dpyinfo->im.context);
+  dpyinfo->im.context = NULL;
+}
+
+DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context, Spgtk_use_im_context, 1, 
2, 0,
+       doc: /* Set whether to use GtkIMContext. */)
+  (Lisp_Object use_p, Lisp_Object terminal)
+{
+  struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+
+  pgtk_im_use_context (dpyinfo, !NILP (use_p));
+
+  return Qnil;
+}
+
+void
+syms_of_pgtkim (void)
+{
+  defsubr (&Spgtk_use_im_context);
+
+  DEFSYM (Qpgtk_refresh_preedit, "pgtk-refresh-preedit");
+  DEFSYM (Qul, "ul");
+  DEFSYM (Qfg, "fg");
+  DEFSYM (Qbg, "bg");
+
+  DEFVAR_LISP ("pgtk-use-im-context-on-new-connection", 
Vpgtk_use_im_context_on_new_connection,
+              doc: /* Whether to use GtkIMContext on a new connection.
+If you want to change it after connection, use the `pgtk-use-im-context'
+function.  */ );
+  Vpgtk_use_im_context_on_new_connection = Qt;
+}
diff --git a/src/pgtkmenu.c b/src/pgtkmenu.c
new file mode 100644
index 0000000000..d1b1bfffb3
--- /dev/null
+++ b/src/pgtkmenu.c
@@ -0,0 +1,1159 @@
+/* Pure GTK3 menu and toolbar module.
+   Copyright (C) 2019-2022 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/>.  */
+
+/*
+ */
+
+
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes.  */
+#include <config.h>
+
+#include "lisp.h"
+#include "frame.h"
+#include "window.h"
+#include "character.h"
+#include "buffer.h"
+#include "keymap.h"
+#include "coding.h"
+#include "commands.h"
+#include "blockinput.h"
+#include "termhooks.h"
+#include "keyboard.h"
+#include "menu.h"
+#include "pdumper.h"
+#include "xgselect.h"
+
+#include "gtkutil.h"
+#include <gtk/gtk.h>
+
+/* Flag which when set indicates a dialog or menu has been posted by
+   Xt on behalf of one of the widget sets.  */
+static int popup_activated_flag;
+
+/* Set menu_items_inuse so no other popup menu or dialog is created.  */
+
+void
+pgtk_menu_set_in_use (bool in_use)
+{
+  Lisp_Object frames, frame;
+
+  menu_items_inuse = in_use;
+  popup_activated_flag = in_use;
+
+  /* Don't let frames in `above' z-group obscure popups.  */
+  FOR_EACH_FRAME (frames, frame)
+  {
+    struct frame *f = XFRAME (frame);
+
+    if (in_use && FRAME_Z_GROUP_ABOVE (f))
+      x_set_z_group (f, Qabove_suspended, Qabove);
+    else if (!in_use && FRAME_Z_GROUP_ABOVE_SUSPENDED (f))
+      x_set_z_group (f, Qabove, Qabove_suspended);
+  }
+}
+
+DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, 
Sx_menu_bar_open_internal, 0, 1, "i",
+       doc: /* Start key navigation of the menu bar in FRAME.
+       This initially opens the first menu bar item and you can then navigate 
with the
+       arrow keys, select a menu entry with the return key or cancel with the
+       escape key.  If FRAME has no menu bar this function does nothing.
+
+       If FRAME is nil or not given, use the selected frame.  */)
+  (Lisp_Object frame)
+{
+  GtkWidget *menubar;
+  struct frame *f;
+
+  block_input ();
+  f = decode_window_system_frame (frame);
+
+  if (FRAME_EXTERNAL_MENU_BAR (f))
+    set_frame_menubar (f, true);
+
+  menubar = FRAME_X_OUTPUT (f)->menubar_widget;
+  if (menubar)
+    {
+      /* Activate the first menu.  */
+      GList *children = gtk_container_get_children (GTK_CONTAINER (menubar));
+
+      if (children)
+       {
+         g_signal_emit_by_name (children->data, "activate_item");
+         g_list_free (children);
+       }
+    }
+  unblock_input ();
+
+  return Qnil;
+}
+
+/* Loop util popup_activated_flag is set to zero in a callback.
+   Used for popup menus and dialogs. */
+
+static void
+popup_widget_loop (bool do_timers, GtkWidget *widget)
+{
+  ++popup_activated_flag;
+
+  /* Process events in the Gtk event loop until done.  */
+  while (popup_activated_flag)
+    gtk_main_iteration ();
+}
+
+void
+pgtk_activate_menubar (struct frame *f)
+{
+  set_frame_menubar (f, true);
+
+  popup_activated_flag = 1;
+
+  /* f->output_data.pgtk->menubar_active = 1; */
+}
+
+/* This callback is invoked when a dialog or menu is finished being
+   used and has been unposted.  */
+
+static void
+popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
+{
+  popup_activated_flag = 0;
+}
+
+/* Function that finds the frame for WIDGET and shows the HELP text
+   for that widget.
+   F is the frame if known, or NULL if not known.  */
+static void
+show_help_event (struct frame *f, GtkWidget *widget, Lisp_Object help)
+{
+  /* Don't show this tooltip.
+   * Tooltips are always tied to main widget, so stacking order
+   * on Wayland is:
+   *   (above)
+   *   - menu
+   *   - tooltip
+   *   - main widget
+   *   (below)
+   * This is applicable to tooltips for menu, and menu tooltips
+   * are shown below menus.
+   * As a workaround, I entrust Gtk with menu tooltips, and
+   * let emacs not to show menu tooltips.
+   */
+
+#if 0
+  Lisp_Object frame;
+
+  if (f)
+    {
+      XSETFRAME (frame, f);
+      kbd_buffer_store_help_event (frame, help);
+    }
+  else
+    show_help_echo (help, Qnil, Qnil, Qnil);
+#endif
+}
+
+/* Callback called when menu items are highlighted/unhighlighted
+   while moving the mouse over them.  WIDGET is the menu bar or menu
+   popup widget.  ID is its LWLIB_ID.  CALL_DATA contains a pointer to
+   the data structure for the menu item, or null in case of
+   unhighlighting.  */
+
+static void
+menu_highlight_callback (GtkWidget *widget, gpointer call_data)
+{
+  xg_menu_item_cb_data *cb_data;
+  Lisp_Object help;
+
+  cb_data = g_object_get_data (G_OBJECT (widget), XG_ITEM_DATA);
+  if (!cb_data)
+    return;
+
+  help = call_data ? cb_data->help : Qnil;
+
+  /* If popup_activated_flag is greater than 1 we are in a popup menu.
+     Don't pass the frame to show_help_event for those.
+     Passing frame creates an Emacs event.  As we are looping in
+     popup_widget_loop, it won't be handled.  Passing NULL shows the tip
+     directly without using an Emacs event.  This is what the Lucid code
+     does below.  */
+  show_help_event (popup_activated_flag <= 1 ? cb_data->cl_data->f : NULL,
+                  widget, help);
+}
+
+/* Gtk calls callbacks just because we tell it what item should be
+   selected in a radio group.  If this variable is set to a non-zero
+   value, we are creating menus and don't want callbacks right now.
+*/
+static bool xg_crazy_callback_abort;
+
+/* This callback is called from the menu bar pulldown menu
+   when the user makes a selection.
+   Figure out what the user chose
+   and put the appropriate events into the keyboard buffer.  */
+static void
+menubar_selection_callback (GtkWidget *widget, gpointer client_data)
+{
+  xg_menu_item_cb_data *cb_data = client_data;
+
+  if (xg_crazy_callback_abort)
+    return;
+
+  if (!cb_data || !cb_data->cl_data || !cb_data->cl_data->f)
+    return;
+
+  /* For a group of radio buttons, GTK calls the selection callback first
+     for the item that was active before the selection and then for the one 
that
+     is active after the selection.  For C-h k this means we get the help on
+     the deselected item and then the selected item is executed.  Prevent that
+     by ignoring the non-active item.  */
+  if (GTK_IS_RADIO_MENU_ITEM (widget)
+      && !gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
+    return;
+
+  /* When a menu is popped down, X generates a focus event (i.e. focus
+     goes back to the frame below the menu).  Since GTK buffers events,
+     we force it out here before the menu selection event.  Otherwise
+     sit-for will exit at once if the focus event follows the menu selection
+     event.  */
+
+  block_input ();
+  while (gtk_events_pending ())
+    gtk_main_iteration ();
+  unblock_input ();
+
+  find_and_call_menu_selection (cb_data->cl_data->f,
+                               cb_data->cl_data->menu_bar_items_used,
+                               cb_data->cl_data->menu_bar_vector,
+                               cb_data->call_data);
+}
+
+/* Recompute all the widgets of frame F, when the menu bar has been
+   changed.  */
+
+static void
+update_frame_menubar (struct frame *f)
+{
+  xg_update_frame_menubar (f);
+}
+
+/* Set the contents of the menubar widgets of frame F.
+   The argument FIRST_TIME is currently ignored;
+   it is set the first time this is called, from initialize_frame_menubar.  */
+
+void
+set_frame_menubar (struct frame *f, bool deep_p)
+{
+  GtkWidget *menubar_widget;
+  Lisp_Object items;
+  widget_value *wv, *first_wv, *prev_wv = 0;
+  int i;
+  int *submenu_start, *submenu_end;
+  bool *submenu_top_level_items;
+  int *submenu_n_panes;
+
+
+  menubar_widget = f->output_data.pgtk->menubar_widget;
+
+  XSETFRAME (Vmenu_updating_frame, f);
+
+  if (!menubar_widget)
+    deep_p = true;
+
+  if (deep_p)
+    {
+      struct buffer *prev = current_buffer;
+      Lisp_Object buffer;
+      ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+      int previous_menu_items_used = f->menu_bar_items_used;
+      Lisp_Object *previous_items
+       = alloca (previous_menu_items_used * sizeof *previous_items);
+      int subitems;
+
+      /* If we are making a new widget, its contents are empty,
+         do always reinitialize them.  */
+      if (!menubar_widget)
+       previous_menu_items_used = 0;
+
+      buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents;
+      specbind (Qinhibit_quit, Qt);
+      /* Don't let the debugger step into this code
+         because it is not reentrant.  */
+      specbind (Qdebug_on_next_call, Qnil);
+
+      record_unwind_save_match_data ();
+      if (NILP (Voverriding_local_map_menu_flag))
+       {
+         specbind (Qoverriding_terminal_local_map, Qnil);
+         specbind (Qoverriding_local_map, Qnil);
+       }
+
+      set_buffer_internal_1 (XBUFFER (buffer));
+
+      /* Run the Lucid hook.  */
+      safe_run_hooks (Qactivate_menubar_hook);
+
+      /* If it has changed current-menubar from previous value,
+         really recompute the menubar from the value.  */
+      if (!NILP (Vlucid_menu_bar_dirty_flag))
+       call0 (Qrecompute_lucid_menubar);
+      safe_run_hooks (Qmenu_bar_update_hook);
+      fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
+
+      items = FRAME_MENU_BAR_ITEMS (f);
+
+      /* Save the frame's previous menu bar contents data.  */
+      if (previous_menu_items_used)
+       memcpy (previous_items, xvector_contents (f->menu_bar_vector),
+               previous_menu_items_used * word_size);
+
+      /* Fill in menu_items with the current menu bar contents.
+         This can evaluate Lisp code.  */
+      save_menu_items ();
+
+      menu_items = f->menu_bar_vector;
+      menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
+      subitems = ASIZE (items) / 4;
+      submenu_start = alloca ((subitems + 1) * sizeof *submenu_start);
+      submenu_end = alloca (subitems * sizeof *submenu_end);
+      submenu_n_panes = alloca (subitems * sizeof *submenu_n_panes);
+      submenu_top_level_items = alloca (subitems
+                                       * sizeof *submenu_top_level_items);
+      init_menu_items ();
+      for (i = 0; i < subitems; i++)
+       {
+         Lisp_Object key, string, maps;
+
+         key = AREF (items, 4 * i);
+         string = AREF (items, 4 * i + 1);
+         maps = AREF (items, 4 * i + 2);
+         if (NILP (string))
+           break;
+
+         submenu_start[i] = menu_items_used;
+
+         menu_items_n_panes = 0;
+         submenu_top_level_items[i]
+           = parse_single_submenu (key, string, maps);
+         submenu_n_panes[i] = menu_items_n_panes;
+
+         submenu_end[i] = menu_items_used;
+       }
+
+      submenu_start[i] = -1;
+      finish_menu_items ();
+
+      /* Convert menu_items into widget_value trees
+         to display the menu.  This cannot evaluate Lisp code.  */
+
+      wv = make_widget_value ("menubar", NULL, true, Qnil);
+      wv->button_type = BUTTON_TYPE_NONE;
+      first_wv = wv;
+
+      for (i = 0; submenu_start[i] >= 0; i++)
+       {
+         menu_items_n_panes = submenu_n_panes[i];
+         wv = digest_single_submenu (submenu_start[i], submenu_end[i],
+                                     submenu_top_level_items[i]);
+         if (prev_wv)
+           prev_wv->next = wv;
+         else
+           first_wv->contents = wv;
+         /* Don't set wv->name here; GC during the loop might relocate it.  */
+         wv->enabled = true;
+         wv->button_type = BUTTON_TYPE_NONE;
+         prev_wv = wv;
+       }
+
+      set_buffer_internal_1 (prev);
+
+      /* If there has been no change in the Lisp-level contents
+         of the menu bar, skip redisplaying it.  Just exit.  */
+
+      /* Compare the new menu items with the ones computed last time.  */
+      for (i = 0; i < previous_menu_items_used; i++)
+       if (menu_items_used == i
+           || (!EQ (previous_items[i], AREF (menu_items, i))))
+         break;
+      if (i == menu_items_used && i == previous_menu_items_used && i != 0)
+       {
+         /* The menu items have not changed.  Don't bother updating
+            the menus in any form, since it would be a no-op.  */
+         free_menubar_widget_value_tree (first_wv);
+         discard_menu_items ();
+         unbind_to (specpdl_count, Qnil);
+         return;
+       }
+
+      /* The menu items are different, so store them in the frame.  */
+      fset_menu_bar_vector (f, menu_items);
+      f->menu_bar_items_used = menu_items_used;
+
+      /* This undoes save_menu_items.  */
+      unbind_to (specpdl_count, Qnil);
+
+      /* Now GC cannot happen during the lifetime of the widget_value,
+         so it's safe to store data from a Lisp_String.  */
+      wv = first_wv->contents;
+      for (i = 0; i < ASIZE (items); i += 4)
+       {
+         Lisp_Object string;
+         string = AREF (items, i + 1);
+         if (NILP (string))
+           break;
+         wv->name = SSDATA (string);
+         update_submenu_strings (wv->contents);
+         wv = wv->next;
+       }
+
+    }
+  else
+    {
+      /* Make a widget-value tree containing
+         just the top level menu bar strings.  */
+
+      wv = make_widget_value ("menubar", NULL, true, Qnil);
+      wv->button_type = BUTTON_TYPE_NONE;
+      first_wv = wv;
+
+      items = FRAME_MENU_BAR_ITEMS (f);
+      for (i = 0; i < ASIZE (items); i += 4)
+       {
+         Lisp_Object string;
+
+         string = AREF (items, i + 1);
+         if (NILP (string))
+           break;
+
+         wv = make_widget_value (SSDATA (string), NULL, true, Qnil);
+         wv->button_type = BUTTON_TYPE_NONE;
+         /* This prevents lwlib from assuming this
+            menu item is really supposed to be empty.  */
+         /* The intptr_t cast avoids a warning.
+            This value just has to be different from small integers.  */
+         wv->call_data = (void *) (intptr_t) (-1);
+
+         if (prev_wv)
+           prev_wv->next = wv;
+         else
+           first_wv->contents = wv;
+         prev_wv = wv;
+       }
+
+      /* Forget what we thought we knew about what is in the
+         detailed contents of the menu bar menus.
+         Changing the top level always destroys the contents.  */
+      f->menu_bar_items_used = 0;
+    }
+
+  block_input ();
+
+  xg_crazy_callback_abort = true;
+  if (menubar_widget)
+    {
+      /* The fourth arg is DEEP_P, which says to consider the entire
+         menu trees we supply, rather than just the menu bar item names.  */
+      xg_modify_menubar_widgets (menubar_widget,
+                                f,
+                                first_wv,
+                                deep_p,
+                                G_CALLBACK (menubar_selection_callback),
+                                G_CALLBACK (popup_deactivate_callback),
+                                G_CALLBACK (menu_highlight_callback));
+    }
+  else
+    {
+      menubar_widget
+       = xg_create_widget ("menubar", "menubar", f, first_wv,
+                           G_CALLBACK (menubar_selection_callback),
+                           G_CALLBACK (popup_deactivate_callback),
+                           G_CALLBACK (menu_highlight_callback));
+
+      f->output_data.pgtk->menubar_widget = menubar_widget;
+    }
+
+  free_menubar_widget_value_tree (first_wv);
+  update_frame_menubar (f);
+
+  xg_crazy_callback_abort = false;
+
+  unblock_input ();
+}
+
+/* Called from Fx_create_frame to create the initial menubar of a frame
+   before it is mapped, so that the window is mapped with the menubar already
+   there instead of us tacking it on later and thrashing the window after it
+   is visible.  */
+
+void
+initialize_frame_menubar (struct frame *f)
+{
+  /* This function is called before the first chance to redisplay
+     the frame.  It has to be, so the frame will have the right size.  */
+  fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
+  set_frame_menubar (f, true);
+}
+
+
+/* x_menu_show actually displays a menu using the panes and items in menu_items
+   and returns the value selected from it.
+   There are two versions of x_menu_show, one for Xt and one for Xlib.
+   Both assume input is blocked by the caller.  */
+
+/* F is the frame the menu is for.
+   X and Y are the frame-relative specified position,
+   relative to the inside upper left corner of the frame F.
+   Bitfield MENUFLAGS bits are:
+   MENU_FOR_CLICK is set if this menu was invoked for a mouse click.
+   MENU_KEYMAPS is set if this menu was specified with keymaps;
+    in that case, we return a list containing the chosen item's value
+    and perhaps also the pane's prefix.
+   TITLE is the specified menu title.
+   ERROR is a place to store an error message string in case of failure.
+   (We return nil on failure, but the value doesn't actually matter.)  */
+
+/* The item selected in the popup menu.  */
+static Lisp_Object *volatile menu_item_selection;
+
+static void
+popup_selection_callback (GtkWidget *widget, gpointer client_data)
+{
+  xg_menu_item_cb_data *cb_data = client_data;
+
+  if (xg_crazy_callback_abort)
+    return;
+  if (cb_data)
+    menu_item_selection = cb_data->call_data;
+}
+
+static void
+pop_down_menu (void *arg)
+{
+  popup_activated_flag = 0;
+  block_input ();
+  gtk_widget_destroy (GTK_WIDGET (arg));
+  unblock_input ();
+}
+
+/* Pop up the menu for frame F defined by FIRST_WV at X/Y and loop until the
+   menu pops down.
+   menu_item_selection will be set to the selection.  */
+static void
+create_and_show_popup_menu (struct frame *f, widget_value * first_wv,
+                           int x, int y, bool for_click)
+{
+  GtkWidget *menu;
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+
+  eassert (FRAME_PGTK_P (f));
+
+  xg_crazy_callback_abort = true;
+  menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
+                          G_CALLBACK (popup_selection_callback),
+                          G_CALLBACK (popup_deactivate_callback),
+                          G_CALLBACK (menu_highlight_callback));
+  xg_crazy_callback_abort = false;
+
+  /* Display the menu.  */
+  gtk_widget_show_all (menu);
+
+  if (for_click)
+    gtk_menu_popup_at_pointer (GTK_MENU (menu),
+                              FRAME_DISPLAY_INFO (f)->last_click_event);
+  else
+    {
+      GdkRectangle rect;
+      rect.x = x;
+      rect.y = y;
+      rect.width = 1;
+      rect.height = 1;
+      gtk_menu_popup_at_rect (GTK_MENU (menu),
+                             gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
+                             &rect,
+                             GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST,
+                             FRAME_DISPLAY_INFO (f)->last_click_event);
+    }
+
+  record_unwind_protect_ptr (pop_down_menu, menu);
+
+  if (gtk_widget_get_mapped (menu))
+    {
+      /* Set this to one.  popup_widget_loop increases it by one, so it becomes
+         two.  show_help_echo uses this to detect popup menus.  */
+      popup_activated_flag = 1;
+      /* Process events that apply to the menu.  */
+      popup_widget_loop (true, menu);
+    }
+
+  unbind_to (specpdl_count, Qnil);
+
+  /* Must reset this manually because the button release event is not passed
+     to Emacs event loop. */
+  FRAME_DISPLAY_INFO (f)->grabbed = 0;
+}
+
+static void
+cleanup_widget_value_tree (void *arg)
+{
+  free_menubar_widget_value_tree (arg);
+}
+
+Lisp_Object
+pgtk_menu_show (struct frame *f, int x, int y, int menuflags,
+               Lisp_Object title, const char **error_name)
+{
+  int i;
+  widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
+  widget_value **submenu_stack
+    = alloca (menu_items_used * sizeof *submenu_stack);
+  Lisp_Object *subprefix_stack
+    = alloca (menu_items_used * sizeof *subprefix_stack);
+  int submenu_depth = 0;
+
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+
+  eassert (FRAME_PGTK_P (f));
+
+  *error_name = NULL;
+
+  if (!FRAME_GTK_OUTER_WIDGET (f)) {
+    *error_name = "Can't popup from child frames.";
+    return Qnil;
+  }
+
+  if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
+    {
+      *error_name = "Empty menu";
+      return Qnil;
+    }
+
+  block_input ();
+
+  /* Create a tree of widget_value objects
+     representing the panes and their items.  */
+  wv = make_widget_value ("menu", NULL, true, Qnil);
+  wv->button_type = BUTTON_TYPE_NONE;
+  first_wv = wv;
+  bool first_pane = true;
+
+  /* Loop over all panes and items, filling in the tree.  */
+  i = 0;
+  while (i < menu_items_used)
+    {
+      if (NILP (AREF (menu_items, i)))
+       {
+         submenu_stack[submenu_depth++] = save_wv;
+         save_wv = prev_wv;
+         prev_wv = 0;
+         first_pane = true;
+         i++;
+       }
+      else if (EQ (AREF (menu_items, i), Qlambda))
+       {
+         prev_wv = save_wv;
+         save_wv = submenu_stack[--submenu_depth];
+         first_pane = false;
+         i++;
+       }
+      else if (EQ (AREF (menu_items, i), Qt) && submenu_depth != 0)
+       i += MENU_ITEMS_PANE_LENGTH;
+      /* Ignore a nil in the item list.
+         It's meaningful only for dialog boxes.  */
+      else if (EQ (AREF (menu_items, i), Qquote))
+       i += 1;
+      else if (EQ (AREF (menu_items, i), Qt))
+       {
+         /* Create a new pane.  */
+         Lisp_Object pane_name, prefix;
+         const char *pane_string;
+
+         pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
+         prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
+
+#ifndef HAVE_MULTILINGUAL_MENU
+         if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
+           {
+             pane_name = ENCODE_MENU_STRING (pane_name);
+             ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
+           }
+#endif
+         pane_string = (NILP (pane_name) ? "" : SSDATA (pane_name));
+         /* If there is just one top-level pane, put all its items directly
+            under the top-level menu.  */
+         if (menu_items_n_panes == 1)
+           pane_string = "";
+
+         /* If the pane has a meaningful name,
+            make the pane a top-level menu item
+            with its items as a submenu beneath it.  */
+         if (!(menuflags & MENU_KEYMAPS) && strcmp (pane_string, ""))
+           {
+             wv = make_widget_value (pane_string, NULL, true, Qnil);
+             if (save_wv)
+               save_wv->next = wv;
+             else
+               first_wv->contents = wv;
+             if ((menuflags & MENU_KEYMAPS) && !NILP (prefix))
+               wv->name++;
+             wv->button_type = BUTTON_TYPE_NONE;
+             save_wv = wv;
+             prev_wv = 0;
+           }
+         else if (first_pane)
+           {
+             save_wv = wv;
+             prev_wv = 0;
+           }
+         first_pane = false;
+         i += MENU_ITEMS_PANE_LENGTH;
+       }
+      else
+       {
+         /* Create a new item within current pane.  */
+         Lisp_Object item_name, enable, descrip, def, type, selected, help;
+         item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
+         enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
+         descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
+         def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
+         type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
+         selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
+         help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
+
+#ifndef HAVE_MULTILINGUAL_MENU
+         if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
+           {
+             item_name = ENCODE_MENU_STRING (item_name);
+             ASET (menu_items, i + MENU_ITEMS_ITEM_NAME, item_name);
+           }
+
+         if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
+           {
+             descrip = ENCODE_MENU_STRING (descrip);
+             ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
+           }
+#endif /* not HAVE_MULTILINGUAL_MENU */
+
+         wv = make_widget_value (SSDATA (item_name), NULL, !NILP (enable),
+                                 STRINGP (help) ? help : Qnil);
+         if (prev_wv)
+           prev_wv->next = wv;
+         else
+           save_wv->contents = wv;
+         if (!NILP (descrip))
+           wv->key = SSDATA (descrip);
+         /* If this item has a null value,
+            make the call_data null so that it won't display a box
+            when the mouse is on it.  */
+         wv->call_data = !NILP (def) ? aref_addr (menu_items, i) : 0;
+
+         if (NILP (type))
+           wv->button_type = BUTTON_TYPE_NONE;
+         else if (EQ (type, QCtoggle))
+           wv->button_type = BUTTON_TYPE_TOGGLE;
+         else if (EQ (type, QCradio))
+           wv->button_type = BUTTON_TYPE_RADIO;
+         else
+           emacs_abort ();
+
+         wv->selected = !NILP (selected);
+
+         prev_wv = wv;
+
+         i += MENU_ITEMS_ITEM_LENGTH;
+       }
+    }
+
+  /* Deal with the title, if it is non-nil.  */
+  if (!NILP (title))
+    {
+      widget_value *wv_title;
+      widget_value *wv_sep1 = make_widget_value ("--", NULL, false, Qnil);
+      widget_value *wv_sep2 = make_widget_value ("--", NULL, false, Qnil);
+
+      wv_sep2->next = first_wv->contents;
+      wv_sep1->next = wv_sep2;
+
+#ifndef HAVE_MULTILINGUAL_MENU
+      if (STRING_MULTIBYTE (title))
+       title = ENCODE_MENU_STRING (title);
+#endif
+
+      wv_title = make_widget_value (SSDATA (title), NULL, true, Qnil);
+      wv_title->button_type = BUTTON_TYPE_NONE;
+      wv_title->next = wv_sep1;
+      first_wv->contents = wv_title;
+    }
+
+  /* No selection has been chosen yet.  */
+  menu_item_selection = 0;
+
+  /* Make sure to free the widget_value objects we used to specify the
+     contents even with longjmp.  */
+  record_unwind_protect_ptr (cleanup_widget_value_tree, first_wv);
+
+  /* Actually create and show the menu until popped down.  */
+  create_and_show_popup_menu (f, first_wv, x, y, menuflags & MENU_FOR_CLICK);
+
+  unbind_to (specpdl_count, Qnil);
+
+  /* Find the selected item, and its pane, to return
+     the proper value.  */
+  if (menu_item_selection != 0)
+    {
+      Lisp_Object prefix, entry;
+
+      prefix = entry = Qnil;
+      i = 0;
+      while (i < menu_items_used)
+       {
+         if (NILP (AREF (menu_items, i)))
+           {
+             subprefix_stack[submenu_depth++] = prefix;
+             prefix = entry;
+             i++;
+           }
+         else if (EQ (AREF (menu_items, i), Qlambda))
+           {
+             prefix = subprefix_stack[--submenu_depth];
+             i++;
+           }
+         else if (EQ (AREF (menu_items, i), Qt))
+           {
+             prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
+             i += MENU_ITEMS_PANE_LENGTH;
+           }
+         /* Ignore a nil in the item list.
+            It's meaningful only for dialog boxes.  */
+         else if (EQ (AREF (menu_items, i), Qquote))
+           i += 1;
+         else
+           {
+             entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
+             if (menu_item_selection == aref_addr (menu_items, i))
+               {
+                 if (menuflags & MENU_KEYMAPS)
+                   {
+                     int j;
+
+                     entry = list1 (entry);
+                     if (!NILP (prefix))
+                       entry = Fcons (prefix, entry);
+                     for (j = submenu_depth - 1; j >= 0; j--)
+                       if (!NILP (subprefix_stack[j]))
+                         entry = Fcons (subprefix_stack[j], entry);
+                   }
+                 unblock_input ();
+                 return entry;
+               }
+             i += MENU_ITEMS_ITEM_LENGTH;
+           }
+       }
+    }
+  else if (!(menuflags & MENU_FOR_CLICK))
+    {
+      unblock_input ();
+      /* Make "Cancel" equivalent to C-g.  */
+      quit ();
+    }
+
+  unblock_input ();
+  return Qnil;
+}
+
+static void
+dialog_selection_callback (GtkWidget *widget, gpointer client_data)
+{
+  /* Treat the pointer as an integer.  There's no problem
+     as long as pointers have enough bits to hold small integers.  */
+  if ((intptr_t) client_data != -1)
+    menu_item_selection = client_data;
+
+  popup_activated_flag = 0;
+}
+
+/* Pop up the dialog for frame F defined by FIRST_WV and loop until the
+   dialog pops down.
+   menu_item_selection will be set to the selection.  */
+static void
+create_and_show_dialog (struct frame *f, widget_value *first_wv)
+{
+  GtkWidget *menu;
+
+  eassert (FRAME_PGTK_P (f));
+
+  menu = xg_create_widget ("dialog", first_wv->name, f, first_wv,
+                          G_CALLBACK (dialog_selection_callback),
+                          G_CALLBACK (popup_deactivate_callback), 0);
+
+  if (menu)
+    {
+      ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+      record_unwind_protect_ptr (pop_down_menu, menu);
+
+      /* Display the menu.  */
+      gtk_widget_show_all (menu);
+
+      /* Process events that apply to the menu.  */
+      popup_widget_loop (true, menu);
+
+      unbind_to (specpdl_count, Qnil);
+    }
+}
+
+static const char *button_names[] = {
+  "button1", "button2", "button3", "button4", "button5",
+  "button6", "button7", "button8", "button9", "button10"
+};
+
+Lisp_Object
+pgtk_dialog_show (struct frame *f, Lisp_Object title,
+                 Lisp_Object header, const char **error_name)
+{
+  int i, nb_buttons = 0;
+  char dialog_name[6];
+
+  widget_value *wv, *first_wv = 0, *prev_wv = 0;
+
+  /* Number of elements seen so far, before boundary.  */
+  int left_count = 0;
+  /* Whether we've seen the boundary between left-hand elts and right-hand.  */
+  bool boundary_seen = false;
+
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+
+  eassert (FRAME_PGTK_P (f));
+
+  *error_name = NULL;
+
+  if (!FRAME_GTK_OUTER_WIDGET (f)) {
+    *error_name = "Can't popup from child frames.";
+    return Qnil;
+  }
+
+  if (menu_items_n_panes > 1)
+    {
+      *error_name = "Multiple panes in dialog box";
+      return Qnil;
+    }
+
+  /* Create a tree of widget_value objects
+     representing the text label and buttons.  */
+  {
+    Lisp_Object pane_name;
+    const char *pane_string;
+    pane_name = AREF (menu_items, MENU_ITEMS_PANE_NAME);
+    pane_string = (NILP (pane_name) ? "" : SSDATA (pane_name));
+    prev_wv = make_widget_value ("message", (char *) pane_string, true, Qnil);
+    first_wv = prev_wv;
+
+    /* Loop over all panes and items, filling in the tree.  */
+    i = MENU_ITEMS_PANE_LENGTH;
+    while (i < menu_items_used)
+      {
+
+       /* Create a new item within current pane.  */
+       Lisp_Object item_name, enable, descrip;
+       item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
+       enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
+       descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
+
+       if (NILP (item_name))
+         {
+           free_menubar_widget_value_tree (first_wv);
+           *error_name = "Submenu in dialog items";
+           return Qnil;
+         }
+       if (EQ (item_name, Qquote))
+         {
+           /* This is the boundary between left-side elts
+              and right-side elts.  Stop incrementing right_count.  */
+           boundary_seen = true;
+           i++;
+           continue;
+         }
+       if (nb_buttons >= 9)
+         {
+           free_menubar_widget_value_tree (first_wv);
+           *error_name = "Too many dialog items";
+           return Qnil;
+         }
+
+       wv = make_widget_value (button_names[nb_buttons],
+                               SSDATA (item_name), !NILP (enable), Qnil);
+       prev_wv->next = wv;
+       if (!NILP (descrip))
+         wv->key = SSDATA (descrip);
+       wv->call_data = aref_addr (menu_items, i);
+       prev_wv = wv;
+
+       if (!boundary_seen)
+         left_count++;
+
+       nb_buttons++;
+       i += MENU_ITEMS_ITEM_LENGTH;
+      }
+
+    /* If the boundary was not specified,
+       by default put half on the left and half on the right.  */
+    if (!boundary_seen)
+      left_count = nb_buttons - nb_buttons / 2;
+
+    wv = make_widget_value (dialog_name, NULL, false, Qnil);
+
+    /*  Frame title: 'Q' = Question, 'I' = Information.
+       Can also have 'E' = Error if, one day, we want
+       a popup for errors. */
+    if (NILP (header))
+      dialog_name[0] = 'Q';
+    else
+      dialog_name[0] = 'I';
+
+    /* Dialog boxes use a really stupid name encoding
+       which specifies how many buttons to use
+       and how many buttons are on the right. */
+    dialog_name[1] = '0' + nb_buttons;
+    dialog_name[2] = 'B';
+    dialog_name[3] = 'R';
+    /* Number of buttons to put on the right.  */
+    dialog_name[4] = '0' + nb_buttons - left_count;
+    dialog_name[5] = 0;
+    wv->contents = first_wv;
+    first_wv = wv;
+  }
+
+  /* No selection has been chosen yet.  */
+  menu_item_selection = 0;
+
+  /* Make sure to free the widget_value objects we used to specify the
+     contents even with longjmp.  */
+  record_unwind_protect_ptr (cleanup_widget_value_tree, first_wv);
+
+  /* Actually create and show the dialog.  */
+  create_and_show_dialog (f, first_wv);
+
+  unbind_to (specpdl_count, Qnil);
+
+  /* Find the selected item, and its pane, to return
+     the proper value.  */
+  if (menu_item_selection != 0)
+    {
+      i = 0;
+      while (i < menu_items_used)
+       {
+         Lisp_Object entry;
+
+         if (EQ (AREF (menu_items, i), Qt))
+           i += MENU_ITEMS_PANE_LENGTH;
+         else if (EQ (AREF (menu_items, i), Qquote))
+           {
+             /* This is the boundary between left-side elts and
+                right-side elts.  */
+             ++i;
+           }
+         else
+           {
+             entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
+             if (menu_item_selection == aref_addr (menu_items, i))
+               return entry;
+             i += MENU_ITEMS_ITEM_LENGTH;
+           }
+       }
+    }
+  else
+    /* Make "Cancel" equivalent to C-g.  */
+    quit ();
+
+  return Qnil;
+}
+
+Lisp_Object
+pgtk_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
+{
+  Lisp_Object title;
+  const char *error_name;
+  Lisp_Object selection;
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+
+  check_window_system (f);
+
+  /* Decode the dialog items from what was specified.  */
+  title = Fcar (contents);
+  CHECK_STRING (title);
+  record_unwind_protect_void (unuse_menu_items);
+
+  if (NILP (Fcar (Fcdr (contents))))
+    /* No buttons specified, add an "Ok" button so users can pop down
+       the dialog.  Also, the lesstif/motif version crashes if there are
+       no buttons.  */
+    contents = list2 (title, Fcons (build_string ("Ok"), Qt));
+
+  list_of_panes (list1 (contents));
+
+  /* Display them in a dialog box.  */
+  block_input ();
+  selection = pgtk_dialog_show (f, title, header, &error_name);
+  unblock_input ();
+
+  unbind_to (specpdl_count, Qnil);
+  discard_menu_items ();
+
+  if (error_name)
+    error ("%s", error_name);
+  return selection;
+}
+
+/* Detect if a dialog or menu has been posted.  MSDOS has its own
+   implementation on msdos.c.  */
+
+int
+popup_activated (void)
+{
+  return popup_activated_flag;
+}
+
+/* The following is used by delayed window autoselection.  */
+
+DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, 
Smenu_or_popup_active_p, 0, 0, 0,
+       doc: /* Return t if a menu or popup dialog is active.
+\(On MS Windows, this refers to the selected frame.)  */)
+  (void)
+{
+  return (popup_activated ())? Qt : Qnil;
+}
+
+static void syms_of_pgtkmenu_for_pdumper (void);
+
+void
+syms_of_pgtkmenu (void)
+{
+  DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
+  defsubr (&Smenu_or_popup_active_p);
+
+  DEFSYM (Qframe_monitor_workarea, "frame-monitor-workarea");
+
+  defsubr (&Sx_menu_bar_open_internal);
+  Ffset (intern_c_string ("accelerate-menu"),
+        intern_c_string (Sx_menu_bar_open_internal.s.symbol_name));
+
+  pdumper_do_now_and_after_load (syms_of_pgtkmenu_for_pdumper);
+}
+
+static void
+syms_of_pgtkmenu_for_pdumper (void)
+{
+}
diff --git a/src/pgtkselect.c b/src/pgtkselect.c
new file mode 100644
index 0000000000..23a79895d5
--- /dev/null
+++ b/src/pgtkselect.c
@@ -0,0 +1,632 @@
+/* Gtk selection processing for emacs.
+   Copyright (C) 1993-1994, 2005-2006, 2008-2022 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/>.  */
+
+/*
+Originally by Carl Edman
+Updated by Christian Limpach (chris@nice.ch)
+OpenStep/Rhapsody port by Scott Bender (sbender@harmony-ds.com)
+macOS/Aqua port by Christophe de Dinechin (descubes@earthlink.net)
+GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
+*/
+
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes.  */
+#include <config.h>
+
+#include "lisp.h"
+#include "pgtkterm.h"
+#include "termhooks.h"
+#include "keyboard.h"
+#include "pgtkselect.h"
+#include <gdk/gdk.h>
+
+#if 0
+static Lisp_Object Vselection_alist;
+#endif
+
+static GQuark quark_primary_data = 0;
+static GQuark quark_primary_size = 0;
+static GQuark quark_secondary_data = 0;
+static GQuark quark_secondary_size = 0;
+static GQuark quark_clipboard_data = 0;
+static GQuark quark_clipboard_size = 0;
+
+/* ==========================================================================
+
+    Internal utility functions
+
+   ========================================================================== 
*/
+
+/* From a Lisp_Object, return a suitable frame for selection
+   operations.  OBJECT may be a frame, a terminal object, or nil
+   (which stands for the selected frame--or, if that is not an pgtk
+   frame, the first pgtk display on the list).  If no suitable frame can
+   be found, return NULL.  */
+
+static struct frame *
+frame_for_pgtk_selection (Lisp_Object object)
+{
+  Lisp_Object tail, frame;
+  struct frame *f;
+
+  if (NILP (object))
+    {
+      f = XFRAME (selected_frame);
+      if (FRAME_PGTK_P (f) && FRAME_LIVE_P (f))
+       return f;
+
+      FOR_EACH_FRAME (tail, frame)
+      {
+       f = XFRAME (frame);
+       if (FRAME_PGTK_P (f) && FRAME_LIVE_P (f))
+         return f;
+      }
+    }
+  else if (TERMINALP (object))
+    {
+      struct terminal *t = decode_live_terminal (object);
+
+      if (t->type == output_pgtk)
+       FOR_EACH_FRAME (tail, frame)
+       {
+         f = XFRAME (frame);
+         if (FRAME_LIVE_P (f) && f->terminal == t)
+           return f;
+       }
+    }
+  else if (FRAMEP (object))
+    {
+      f = XFRAME (object);
+      if (FRAME_PGTK_P (f) && FRAME_LIVE_P (f))
+       return f;
+    }
+
+  return NULL;
+}
+
+static GtkClipboard *
+symbol_to_gtk_clipboard (GtkWidget * widget, Lisp_Object symbol)
+{
+  GdkAtom atom;
+
+  CHECK_SYMBOL (symbol);
+  if (NILP (symbol))
+    {
+      atom = GDK_SELECTION_PRIMARY;
+    }
+  else if (EQ (symbol, QCLIPBOARD))
+    {
+      atom = GDK_SELECTION_CLIPBOARD;
+    }
+  else if (EQ (symbol, QPRIMARY))
+    {
+      atom = GDK_SELECTION_PRIMARY;
+    }
+  else if (EQ (symbol, QSECONDARY))
+    {
+      atom = GDK_SELECTION_SECONDARY;
+    }
+  else if (EQ (symbol, Qt))
+    {
+      atom = GDK_SELECTION_SECONDARY;
+    }
+  else
+    {
+      atom = 0;
+      error ("Bad selection");
+    }
+
+  return gtk_widget_get_clipboard (widget, atom);
+}
+
+static void
+selection_type_to_quarks (GdkAtom type, GQuark * quark_data,
+                         GQuark * quark_size)
+{
+  if (type == GDK_SELECTION_PRIMARY)
+    {
+      *quark_data = quark_primary_data;
+      *quark_size = quark_primary_size;
+    }
+  else if (type == GDK_SELECTION_SECONDARY)
+    {
+      *quark_data = quark_secondary_data;
+      *quark_size = quark_secondary_size;
+    }
+  else if (type == GDK_SELECTION_CLIPBOARD)
+    {
+      *quark_data = quark_clipboard_data;
+      *quark_size = quark_clipboard_size;
+    }
+  else
+    {
+      /* fixme: Is it safe to use 'error' here? */
+      error ("Unknown selection type.");
+    }
+}
+
+static void
+get_func (GtkClipboard * cb, GtkSelectionData * data, guint info,
+         gpointer user_data_or_owner)
+{
+  GObject *obj = G_OBJECT (user_data_or_owner);
+  const char *str;
+  int size;
+  GQuark quark_data, quark_size;
+
+  selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
+                           &quark_size);
+
+  str = g_object_get_qdata (obj, quark_data);
+  size = GPOINTER_TO_SIZE (g_object_get_qdata (obj, quark_size));
+  gtk_selection_data_set_text (data, str, size);
+}
+
+static void
+clear_func (GtkClipboard * cb, gpointer user_data_or_owner)
+{
+  GObject *obj = G_OBJECT (user_data_or_owner);
+  GQuark quark_data, quark_size;
+
+  selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
+                           &quark_size);
+
+  g_object_set_qdata (obj, quark_data, NULL);
+  g_object_set_qdata (obj, quark_size, 0);
+}
+
+
+/* ==========================================================================
+
+    Functions used externally
+
+   ========================================================================== 
*/
+
+void
+pgtk_selection_init (void)
+{
+  if (quark_primary_data == 0)
+    {
+      quark_primary_data = g_quark_from_static_string ("pgtk-primary-data");
+      quark_primary_size = g_quark_from_static_string ("pgtk-primary-size");
+      quark_secondary_data =
+       g_quark_from_static_string ("pgtk-secondary-data");
+      quark_secondary_size =
+       g_quark_from_static_string ("pgtk-secondary-size");
+      quark_clipboard_data =
+       g_quark_from_static_string ("pgtk-clipboard-data");
+      quark_clipboard_size =
+       g_quark_from_static_string ("pgtk-clipboard-size");
+    }
+}
+
+void
+pgtk_selection_lost (GtkWidget * widget, GdkEventSelection * event,
+                    gpointer user_data)
+{
+  GQuark quark_data, quark_size;
+
+  selection_type_to_quarks (event->selection, &quark_data, &quark_size);
+
+  g_object_set_qdata (G_OBJECT (widget), quark_data, NULL);
+  g_object_set_qdata (G_OBJECT (widget), quark_size, 0);
+}
+
+static bool
+pgtk_selection_usable (void)
+{
+  if (pgtk_enable_selection_on_multi_display)
+    return true;
+
+  /*
+   * 
https://github.com/GNOME/gtk/blob/gtk-3-24/gdk/wayland/gdkselection-wayland.c#L1033
+   *
+   * Gdk uses gdk_display_get_default() when handling selections, so
+   * selections don't work properly on multi-display environment.
+   *
+   * ----------------
+   * #include <gtk/gtk.h>
+   *
+   * static GtkWidget *top1, *top2;
+   *
+   * int main (int argc, char **argv)
+   * {
+   *     GtkWidget *w;
+   *     GtkTextBuffer *buf;
+   *
+   *     gtk_init (&argc, &argv);
+   *
+   *     static char *text = "\
+   * It is fine today.\n\
+   * It will be fine tomorrow too.\n\
+   * It is too hot.";
+   *
+   *     top1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+   *     gtk_window_set_title (GTK_WINDOW (top1), "default");
+   *     gtk_widget_show (top1);
+   *     w = gtk_text_view_new ();
+   *     gtk_container_add (GTK_CONTAINER (top1), w);
+   *     gtk_widget_show (w);
+   *     buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
+   *     gtk_text_buffer_insert_at_cursor (buf, text, strlen (text));
+   *     gtk_text_buffer_add_selection_clipboard (buf, 
gtk_widget_get_clipboard (w, GDK_SELECTION_PRIMARY));
+   *
+   *     unsetenv ("GDK_BACKEND");
+   *     GdkDisplay *gdpy;
+   *     const char *dpyname2;
+   *     if (strcmp (G_OBJECT_TYPE_NAME (gtk_widget_get_window (top1)), 
"GdkWaylandWindow") == 0)
+   *         dpyname2 = ":0";
+   *     else
+   *         dpyname2 = "wayland-0";
+   *     gdpy = gdk_display_open (dpyname2);
+   *     top2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+   *     gtk_window_set_title (GTK_WINDOW (top2), dpyname2);
+   *     gtk_window_set_screen (GTK_WINDOW (top2), 
gdk_display_get_default_screen (gdpy));
+   *     gtk_widget_show (top2);
+   *     w = gtk_text_view_new ();
+   *     gtk_container_add (GTK_CONTAINER (top2), w);
+   *     gtk_widget_show (w);
+   *     buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
+   *     gtk_text_buffer_insert_at_cursor (buf, text, strlen (text));
+   *     gtk_text_buffer_add_selection_clipboard (buf, 
gtk_widget_get_clipboard (w, GDK_SELECTION_PRIMARY));
+   *
+   *     gtk_main ();
+   *
+   *     return 0;
+   * }
+   * ----------------
+   *
+   * This code fails if
+   *   GDK_BACKEND=x11 ./test
+   * and select on both of windows.
+   *
+   * ----------------
+   * (test:15345): GLib-GObject-CRITICAL **: 01:56:38.041: g_object_ref: 
assertion 'G_IS_OBJECT (object)' failed
+   *
+   * (test:15345): GLib-GObject-CRITICAL **: 01:56:38.042: g_object_ref: 
assertion 'G_IS_OBJECT (object)' failed
+   *
+   * (test:15345): GLib-GObject-CRITICAL **: 01:56:39.113: g_object_ref: 
assertion 'G_IS_OBJECT (object)' failed
+   *
+   * (test:15345): GLib-GObject-CRITICAL **: 01:56:39.113: g_object_ref: 
assertion 'G_IS_OBJECT (object)' failed
+   * ----------------
+   * (gtk-3.24.10)
+   *
+   * This function checks whether selections work by the number of displays.
+   * If you use more than 2 displays, then selection is disabled.
+   */
+
+  GdkDisplayManager *dpyman = gdk_display_manager_get ();
+  GSList *list = gdk_display_manager_list_displays (dpyman);
+  int len = g_slist_length (list);
+  g_slist_free (list);
+  return len < 2;
+}
+
+/* ==========================================================================
+
+    Lisp Defuns
+
+   ========================================================================== 
*/
+
+
+DEFUN ("pgtk-own-selection-internal", Fpgtk_own_selection_internal, 
Spgtk_own_selection_internal, 2, 3, 0,
+       doc: /* Assert an X selection of type SELECTION and value VALUE.
+SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+VALUE is typically a string, or a cons of two markers, but may be
+anything that the functions on `selection-converter-alist' know about.
+
+FRAME should be a frame that should own the selection.  If omitted or
+nil, it defaults to the selected frame. */)
+  (Lisp_Object selection, Lisp_Object value, Lisp_Object frame)
+{
+  Lisp_Object successful_p = Qnil;
+  Lisp_Object target_symbol, rest;
+  GtkClipboard *cb;
+  struct frame *f;
+  GQuark quark_data, quark_size;
+
+  check_window_system (NULL);
+
+  if (!pgtk_selection_usable ())
+    return Qnil;
+
+  if (NILP (frame))
+    frame = selected_frame;
+  if (!FRAME_LIVE_P (XFRAME (frame)) || !FRAME_PGTK_P (XFRAME (frame)))
+    error ("pgtk selection unavailable for this frame");
+  f = XFRAME (frame);
+
+  cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
+  selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
+                           &quark_size);
+
+  /* We only support copy of text.  */
+  target_symbol = QTEXT;
+  if (STRINGP (value))
+    {
+      GtkTargetList *list;
+      GtkTargetEntry *targets;
+      gint n_targets;
+      GtkWidget *widget;
+
+      list = gtk_target_list_new (NULL, 0);
+      gtk_target_list_add_text_targets (list, 0);
+
+      {
+       /* text/plain: Strings encoded by Gtk are not correctly decoded by 
Chromium(Wayland). */
+       GdkAtom atom_text_plain = gdk_atom_intern ("text/plain", false);
+       gtk_target_list_remove (list, atom_text_plain);
+      }
+
+      targets = gtk_target_table_new_from_list (list, &n_targets);
+
+      int size = SBYTES (value);
+      gchar *str = xmalloc (size + 1);
+      memcpy (str, SSDATA (value), size);
+      str[size] = '\0';
+
+      widget = FRAME_GTK_WIDGET (f);
+      g_object_set_qdata_full (G_OBJECT (widget), quark_data, str, xfree);
+      g_object_set_qdata_full (G_OBJECT (widget), quark_size,
+                              GSIZE_TO_POINTER (size), NULL);
+
+      if (gtk_clipboard_set_with_owner (cb,
+                                       targets, n_targets,
+                                       get_func, clear_func,
+                                       G_OBJECT (FRAME_GTK_WIDGET (f))))
+       {
+         successful_p = Qt;
+       }
+      gtk_clipboard_set_can_store (cb, NULL, 0);
+
+      gtk_target_table_free (targets, n_targets);
+      gtk_target_list_unref (list);
+    }
+
+  if (!EQ (Vpgtk_sent_selection_hooks, Qunbound))
+    {
+      /* FIXME: Use run-hook-with-args!  */
+      for (rest = Vpgtk_sent_selection_hooks; CONSP (rest);
+          rest = Fcdr (rest))
+       call3 (Fcar (rest), selection, target_symbol, successful_p);
+    }
+
+  return value;
+}
+
+
+DEFUN ("pgtk-disown-selection-internal", Fpgtk_disown_selection_internal, 
Spgtk_disown_selection_internal, 1, 3, 0,
+       doc: /* If we own the selection SELECTION, disown it.
+Disowning it means there is no such selection.
+
+Sets the last-change time for the selection to TIME-OBJECT (by default
+the time of the last event).
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, the TIME-OBJECT and TERMINAL arguments are unused.
+On MS-DOS, all this does is return non-nil if we own the selection.
+On PGTK, the TIME-OBJECT is unused.  */)
+  (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal)
+{
+  struct frame *f = frame_for_pgtk_selection (terminal);
+  GtkClipboard *cb;
+
+  if (!pgtk_selection_usable ())
+    return Qnil;
+
+  if (!f)
+    return Qnil;
+
+  cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
+
+  gtk_clipboard_clear (cb);
+
+  return Qt;
+}
+
+
+DEFUN ("pgtk-selection-exists-p", Fpgtk_selection_exists_p, 
Spgtk_selection_exists_p, 0, 2, 0,
+       doc: /* Whether there is an owner for the given X selection.
+SELECTION should be the name of the selection in question, typically
+one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.  (X expects
+these literal upper-case names.)  The symbol nil is the same as
+`PRIMARY', and t is the same as `SECONDARY'.
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, TERMINAL is unused.  */)
+  (Lisp_Object selection, Lisp_Object terminal)
+{
+  struct frame *f = frame_for_pgtk_selection (terminal);
+  GtkClipboard *cb;
+
+  if (!pgtk_selection_usable ())
+    return Qnil;
+
+  if (!f)
+    return Qnil;
+
+  cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
+
+  return gtk_clipboard_wait_is_text_available (cb) ? Qt : Qnil;
+}
+
+
+DEFUN ("pgtk-selection-owner-p", Fpgtk_selection_owner_p, 
Spgtk_selection_owner_p, 0, 2, 0,
+       doc: /* Whether the current Emacs process owns the given X Selection.
+The arg should be the name of the selection in question, typically one of
+the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+For convenience, the symbol nil is the same as `PRIMARY',
+and t is the same as `SECONDARY'.
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, TERMINAL is unused.  */)
+  (Lisp_Object selection, Lisp_Object terminal)
+{
+  struct frame *f = frame_for_pgtk_selection (terminal);
+  GtkClipboard *cb;
+  GObject *obj;
+  GQuark quark_data, quark_size;
+
+  if (!pgtk_selection_usable ())
+    return Qnil;
+
+  cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
+  selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
+                           &quark_size);
+
+  obj = gtk_clipboard_get_owner (cb);
+
+  return obj && g_object_get_qdata (obj, quark_data) != NULL ? Qt : Qnil;
+}
+
+
+DEFUN ("pgtk-get-selection-internal", Fpgtk_get_selection_internal, 
Spgtk_get_selection_internal, 2, 4, 0,
+       doc: /* Return text selected from some X window.
+SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+TARGET-TYPE is the type of data desired, typically `STRING'.
+
+TIME-STAMP is the time to use in the XConvertSelection call for foreign
+selections.  If omitted, defaults to the time for the last event.
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, TIME-STAMP and TERMINAL are unused.
+On PGTK, TIME-STAMP is unused.  */)
+  (Lisp_Object selection_symbol, Lisp_Object target_type,
+   Lisp_Object time_stamp, Lisp_Object terminal)
+{
+  struct frame *f = frame_for_pgtk_selection (terminal);
+  GtkClipboard *cb;
+
+  CHECK_SYMBOL (selection_symbol);
+  CHECK_SYMBOL (target_type);
+  if (EQ (target_type, QMULTIPLE))
+    error ("Retrieving MULTIPLE selections is currently unimplemented");
+  if (!f)
+    error ("PGTK selection unavailable for this frame");
+
+  if (!pgtk_selection_usable ())
+    return Qnil;
+
+  cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection_symbol);
+
+  GdkAtom target_atom = gdk_atom_intern (SSDATA (SYMBOL_NAME (target_type)), 
false);
+  GtkSelectionData *seldata = gtk_clipboard_wait_for_contents (cb, 
target_atom);
+
+  if (seldata == NULL)
+    return Qnil;
+
+  const guchar *sd_data = gtk_selection_data_get_data (seldata);
+  int sd_len = gtk_selection_data_get_length (seldata);
+  int sd_format = gtk_selection_data_get_format (seldata);
+  GdkAtom sd_type = gtk_selection_data_get_data_type (seldata);
+
+  if (sd_format == 8)
+    {
+      Lisp_Object str, lispy_type;
+
+      str = make_unibyte_string ((char *) sd_data, sd_len);
+      /* Indicate that this string is from foreign selection by a text
+        property `foreign-selection' so that the caller of
+        x-get-selection-internal (usually x-get-selection) can know
+        that the string must be decode.  */
+      if (sd_type == gdk_atom_intern ("COMPOUND_TEXT", false))
+       lispy_type = QCOMPOUND_TEXT;
+      else if (sd_type == gdk_atom_intern ("UTF8_STRING", false))
+       lispy_type = QUTF8_STRING;
+      else if (sd_type == gdk_atom_intern ("text/plain;charset=utf-8", false))
+       lispy_type = Qtext_plain_charset_utf_8;
+      else
+       lispy_type = QSTRING;
+      Fput_text_property (make_fixnum (0), make_fixnum (sd_len),
+                         Qforeign_selection, lispy_type, str);
+
+      gtk_selection_data_free (seldata);
+      return str;
+    }
+
+  gtk_selection_data_free (seldata);
+  return Qnil;
+}
+
+
+void
+nxatoms_of_pgtkselect (void)
+{
+}
+
+void
+syms_of_pgtkselect (void)
+{
+  DEFSYM (QCLIPBOARD, "CLIPBOARD");
+  DEFSYM (QSECONDARY, "SECONDARY");
+  DEFSYM (QTEXT, "TEXT");
+  DEFSYM (QFILE_NAME, "FILE_NAME");
+  DEFSYM (QMULTIPLE, "MULTIPLE");
+
+  DEFSYM (Qforeign_selection, "foreign-selection");
+  DEFSYM (QUTF8_STRING, "UTF8_STRING");
+  DEFSYM (QSTRING, "STRING");
+  DEFSYM (QCOMPOUND_TEXT, "COMPOUND_TEXT");
+  DEFSYM (Qtext_plain_charset_utf_8, "text/plain;charset=utf-8");
+
+  defsubr (&Spgtk_disown_selection_internal);
+  defsubr (&Spgtk_get_selection_internal);
+  defsubr (&Spgtk_own_selection_internal);
+  defsubr (&Spgtk_selection_exists_p);
+  defsubr (&Spgtk_selection_owner_p);
+
+#if 0
+  Vselection_alist = Qnil;
+  staticpro (&Vselection_alist);
+#endif
+
+  DEFVAR_LISP ("pgtk-sent-selection-hooks", Vpgtk_sent_selection_hooks,
+              "A list of functions to be called when Emacs answers a selection 
request.\n\
+The functions are called with four arguments:\n\
+  - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');\n\
+  - the selection-type which Emacs was asked to convert the\n\
+    selection into before sending (for example, `STRING' or `LENGTH');\n\
+  - a flag indicating success or failure for responding to the request.\n\
+We might have failed (and declined the request) for any number of reasons,\n\
+including being asked for a selection that we no longer own, or being asked\n\
+to convert into a type that we don't know about or that is inappropriate.\n\
+This hook doesn't let you change the behavior of Emacs's selection replies,\n\
+it merely informs you that they have happened.");
+  Vpgtk_sent_selection_hooks = Qnil;
+
+  DEFVAR_BOOL ("pgtk-enable-selection-on-multi-display", 
pgtk_enable_selection_on_multi_display,
+              doc: /* Enable selection on multi display environment.
+This may cause crash.  */);
+  pgtk_enable_selection_on_multi_display = false;
+}
diff --git a/src/xgselect.h b/src/pgtkselect.h
similarity index 62%
copy from src/xgselect.h
copy to src/pgtkselect.h
index 2142a236b2..0509c83bde 100644
--- a/src/xgselect.h
+++ b/src/pgtkselect.h
@@ -1,6 +1,6 @@
-/* Header for xg_select.
-
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+/* Definitions and headers for selection of pure Gtk+3.
+   Copyright (C) 1989, 1993, 2005, 2008-2022 Free Software Foundation,
+   Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,18 +17,17 @@ 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/>.  */
 
-#ifndef XGSELECT_H
-#define XGSELECT_H
 
-#include "lisp.h"
-#include "sysselect.h"
+#include "dispextern.h"
+#include "frame.h"
 
-struct timespec;
+#ifdef HAVE_PGTK
 
-extern int xg_select (int max_fds,
-                     fd_set *rfds, fd_set *wfds, fd_set *efds,
-                     struct timespec *timeout, sigset_t *sigmask);
+#include <gtk/gtk.h>
 
-extern void release_select_lock (void);
+extern void pgtk_selection_init (void);
+extern void pgtk_selection_lost (GtkWidget * widget,
+                                GdkEventSelection * event,
+                                gpointer user_data);
 
-#endif /* XGSELECT_H */
+#endif /* HAVE_PGTK */
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
new file mode 100644
index 0000000000..736fce09c4
--- /dev/null
+++ b/src/pgtkterm.c
@@ -0,0 +1,7227 @@
+/* Pure Gtk+-3 communication module.      -*- coding: utf-8 -*-
+
+Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 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/>.  */
+
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
+#include <config.h>
+
+#include <cairo.h>
+#include <fcntl.h>
+#include <math.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <time.h>
+#include <signal.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <c-ctype.h>
+#include <c-strcase.h>
+#include <ftoastr.h>
+
+#include "lisp.h"
+#include "blockinput.h"
+#include "frame.h"
+#include "sysselect.h"
+#include "gtkutil.h"
+#include "systime.h"
+#include "character.h"
+#include "xwidget.h"
+#include "fontset.h"
+#include "composite.h"
+#include "ccl.h"
+#include "dynlib.h"
+
+#include "termhooks.h"
+#include "termopts.h"
+#include "termchar.h"
+#include "emacs-icon.h"
+#include "menu.h"
+#include "window.h"
+#include "keyboard.h"
+#include "atimer.h"
+#include "buffer.h"
+#include "font.h"
+#include "xsettings.h"
+#include "pgtkselect.h"
+#include "emacsgtkfixed.h"
+
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+
+#define STORE_KEYSYM_FOR_DEBUG(keysym) ((void)0)
+
+#define FRAME_CR_CONTEXT(f) ((f)->output_data.pgtk->cr_context)
+#define FRAME_CR_ACTIVE_CONTEXT(f)     ((f)->output_data.pgtk->cr_active)
+#define FRAME_CR_SURFACE(f) (cairo_get_target (FRAME_CR_CONTEXT (f)))
+
+/* Non-zero means that a HELP_EVENT has been generated since Emacs
+   start.  */
+
+static bool any_help_event_p;
+
+struct pgtk_display_info *x_display_list;      /* Chain of existing displays */
+extern Lisp_Object tip_frame;
+
+static struct event_queue_t
+{
+  union buffered_input_event *q;
+  int nr, cap;
+} event_q = {
+  NULL, 0, 0,
+};
+
+/* Non-zero timeout value means ignore next mouse click if it arrives
+   before that timeout elapses (i.e. as part of the same sequence of
+   events resulting from clicking on a frame to select it).  */
+
+static Time ignore_next_mouse_click_timeout;
+
+static Lisp_Object xg_default_icon_file;
+
+static void pgtk_delete_display (struct pgtk_display_info *dpyinfo);
+static void pgtk_clear_frame_area (struct frame *f, int x, int y, int width,
+                                  int height);
+static void pgtk_fill_rectangle (struct frame *f, unsigned long color, int x,
+                                int y, int width, int height);
+static void pgtk_clip_to_row (struct window *w, struct glyph_row *row,
+                             enum glyph_row_area area, cairo_t * cr);
+static struct frame *pgtk_any_window_to_frame (GdkWindow * window);
+
+/*
+ * This is not a flip context in the same sense as gpu rendering
+ * scences, it only occurs when a new context was required due to a
+ * resize or other fundamental change.  This is called when that
+ * context's surface has completed drawing
+ */
+
+static void
+flip_cr_context (struct frame *f)
+{
+  cairo_t *cr = FRAME_CR_ACTIVE_CONTEXT (f);
+
+  block_input ();
+  if (cr != FRAME_CR_CONTEXT (f))
+    {
+      cairo_destroy (cr);
+      FRAME_CR_ACTIVE_CONTEXT (f) = cairo_reference (FRAME_CR_CONTEXT (f));
+
+    }
+  unblock_input ();
+}
+
+
+static void
+evq_enqueue (union buffered_input_event *ev)
+{
+  struct event_queue_t *evq = &event_q;
+  if (evq->cap == 0)
+    {
+      evq->cap = 4;
+      evq->q = xmalloc (sizeof *evq->q * evq->cap);
+    }
+
+  if (evq->nr >= evq->cap)
+    {
+      evq->cap += evq->cap / 2;
+      evq->q = xrealloc (evq->q, sizeof *evq->q * evq->cap);
+    }
+
+  evq->q[evq->nr++] = *ev;
+  raise (SIGIO);
+}
+
+static int
+evq_flush (struct input_event *hold_quit)
+{
+  struct event_queue_t *evq = &event_q;
+  int i, n = evq->nr;
+  for (i = 0; i < n; i++)
+    kbd_buffer_store_buffered_event (&evq->q[i], hold_quit);
+  evq->nr = 0;
+  return n;
+}
+
+void
+mark_pgtkterm (void)
+{
+  struct event_queue_t *evq = &event_q;
+  int i, n = evq->nr;
+  for (i = 0; i < n; i++)
+    {
+      union buffered_input_event *ev = &evq->q[i];
+      mark_object (ev->ie.x);
+      mark_object (ev->ie.y);
+      mark_object (ev->ie.frame_or_window);
+      mark_object (ev->ie.arg);
+    }
+}
+
+char *
+get_keysym_name (int keysym)
+/* --------------------------------------------------------------------------
+    Called by keyboard.c.  Not sure if the return val is important, except
+    that it be unique.
+   -------------------------------------------------------------------------- 
*/
+{
+  static char value[16];
+  sprintf (value, "%d", keysym);
+  return value;
+}
+
+void
+frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
+/* --------------------------------------------------------------------------
+     Programmatically reposition mouse pointer in pixel coordinates
+   -------------------------------------------------------------------------- 
*/
+{
+}
+
+/* Raise frame F.  */
+
+static void
+pgtk_raise_frame (struct frame *f)
+{
+  /* This works only for non-child frames on X.
+     It does not work for child frames on X, and it does not work
+     on Wayland too. */
+  block_input ();
+  if (FRAME_VISIBLE_P (f))
+    gdk_window_raise (gtk_widget_get_window (FRAME_WIDGET (f)));
+  unblock_input ();
+}
+
+/* Lower frame F.  */
+
+static void
+pgtk_lower_frame (struct frame *f)
+{
+  if (FRAME_VISIBLE_P (f))
+    {
+      block_input ();
+      gdk_window_lower (gtk_widget_get_window (FRAME_WIDGET (f)));
+      unblock_input ();
+    }
+}
+
+static void
+pgtk_frame_raise_lower (struct frame *f, bool raise_flag)
+{
+  if (raise_flag)
+    pgtk_raise_frame (f);
+  else
+    pgtk_lower_frame (f);
+}
+
+/* Free X resources of frame F.  */
+
+void
+x_free_frame_resources (struct frame *f)
+{
+  struct pgtk_display_info *dpyinfo;
+  Mouse_HLInfo *hlinfo;
+
+  check_window_system (f);
+  dpyinfo = FRAME_DISPLAY_INFO (f);
+  hlinfo = MOUSE_HL_INFO (f);
+
+  block_input ();
+
+#ifdef HAVE_XWIDGETS
+  kill_frame_xwidget_views (f);
+#endif
+  free_frame_faces (f);
+
+  if (FRAME_X_OUTPUT (f)->scale_factor_atimer != NULL)
+    {
+      cancel_atimer (FRAME_X_OUTPUT (f)->scale_factor_atimer);
+      FRAME_X_OUTPUT (f)->scale_factor_atimer = NULL;
+    }
+
+#define CLEAR_IF_EQ(FIELD)     \
+  do { if (f == dpyinfo->FIELD) dpyinfo->FIELD = 0; } while (false)
+
+  CLEAR_IF_EQ (x_focus_frame);
+  CLEAR_IF_EQ (highlight_frame);
+  CLEAR_IF_EQ (x_focus_event_frame);
+  CLEAR_IF_EQ (last_mouse_frame);
+  CLEAR_IF_EQ (last_mouse_motion_frame);
+  CLEAR_IF_EQ (last_mouse_glyph_frame);
+  CLEAR_IF_EQ (im.focused_frame);
+
+#undef CLEAR_IF_EQ
+
+  if (f == hlinfo->mouse_face_mouse_frame)
+    reset_mouse_highlight (hlinfo);
+
+  g_clear_object (&FRAME_X_OUTPUT (f)->text_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->nontext_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->modeline_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->hand_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->hourglass_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->horizontal_drag_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->vertical_drag_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->left_edge_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->right_edge_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->top_edge_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->bottom_edge_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->top_left_corner_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->top_right_corner_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->bottom_right_corner_cursor);
+  g_clear_object (&FRAME_X_OUTPUT (f)->bottom_left_corner_cursor);
+
+
+  if (FRAME_X_OUTPUT (f)->border_color_css_provider != NULL)
+    {
+      GtkStyleContext *ctxt = gtk_widget_get_style_context (FRAME_WIDGET (f));
+      GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider;
+      gtk_style_context_remove_provider (ctxt, GTK_STYLE_PROVIDER (old));
+      g_object_unref (old);
+      FRAME_X_OUTPUT (f)->border_color_css_provider = NULL;
+    }
+
+  if (FRAME_X_OUTPUT (f)->scrollbar_foreground_css_provider != NULL)
+    {
+      GtkCssProvider *old =
+       FRAME_X_OUTPUT (f)->scrollbar_foreground_css_provider;
+      g_object_unref (old);
+      FRAME_X_OUTPUT (f)->scrollbar_foreground_css_provider = NULL;
+    }
+
+  if (FRAME_X_OUTPUT (f)->scrollbar_background_css_provider != NULL)
+    {
+      GtkCssProvider *old =
+       FRAME_X_OUTPUT (f)->scrollbar_background_css_provider;
+      g_object_unref (old);
+      FRAME_X_OUTPUT (f)->scrollbar_background_css_provider = NULL;
+    }
+
+  gtk_widget_destroy (FRAME_WIDGET (f));
+
+  if (FRAME_X_OUTPUT (f)->cr_surface_visible_bell != NULL)
+    {
+      cairo_surface_destroy (FRAME_X_OUTPUT (f)->cr_surface_visible_bell);
+      FRAME_X_OUTPUT (f)->cr_surface_visible_bell = NULL;
+    }
+
+  if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
+    {
+      cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
+      FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
+    }
+
+  xfree (f->output_data.pgtk);
+  f->output_data.pgtk = NULL;
+
+  unblock_input ();
+}
+
+void
+x_destroy_window (struct frame *f)
+/* --------------------------------------------------------------------------
+     External: Delete the window
+   -------------------------------------------------------------------------- 
*/
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+
+  check_window_system (f);
+  if (dpyinfo->gdpy != NULL)
+    x_free_frame_resources (f);
+
+  dpyinfo->reference_count--;
+}
+
+/* Calculate the absolute position in frame F
+   from its current recorded position values and gravity.  */
+
+static void
+x_calc_absolute_position (struct frame *f)
+{
+  int flags = f->size_hint_flags;
+  struct frame *p = FRAME_PARENT_FRAME (f);
+
+  /* We have nothing to do if the current position
+     is already for the top-left corner.  */
+  if (! ((flags & XNegative) || (flags & YNegative)))
+    return;
+
+  /* Treat negative positions as relative to the leftmost bottommost
+     position that fits on the screen.  */
+  if ((flags & XNegative) && (f->left_pos <= 0))
+    {
+      int width = FRAME_PIXEL_WIDTH (f);
+
+      /* A frame that has been visible at least once should have outer
+        edges.  */
+      if (f->output_data.pgtk->has_been_visible && !p)
+       {
+         Lisp_Object frame;
+         Lisp_Object edges = Qnil;
+
+         XSETFRAME (frame, f);
+         edges = Fpgtk_frame_edges (frame, Qouter_edges);
+         if (!NILP (edges))
+           width = (XFIXNUM (Fnth (make_fixnum (2), edges))
+                    - XFIXNUM (Fnth (make_fixnum (0), edges)));
+       }
+
+      if (p)
+       f->left_pos = (FRAME_PIXEL_WIDTH (p) - width - 2 * f->border_width
+                      + f->left_pos);
+      else
+       f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
+                      - width + f->left_pos);
+
+    }
+
+  if ((flags & YNegative) && (f->top_pos <= 0))
+    {
+      int height = FRAME_PIXEL_HEIGHT (f);
+
+      if (f->output_data.pgtk->has_been_visible && !p)
+       {
+         Lisp_Object frame;
+         Lisp_Object edges = Qnil;
+
+         XSETFRAME (frame, f);
+         if (NILP (edges))
+           edges = Fpgtk_frame_edges (frame, Qouter_edges);
+         if (!NILP (edges))
+           height = (XFIXNUM (Fnth (make_fixnum (3), edges))
+                     - XFIXNUM (Fnth (make_fixnum (1), edges)));
+       }
+
+      if (p)
+       f->top_pos = (FRAME_PIXEL_HEIGHT (p) - height - 2 * f->border_width
+                      + f->top_pos);
+      else
+       f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
+                     - height + f->top_pos);
+  }
+
+  /* The left_pos and top_pos
+     are now relative to the top and left screen edges,
+     so the flags should correspond.  */
+  f->size_hint_flags &= ~ (XNegative | YNegative);
+}
+
+/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
+   to really change the position, and 0 when calling from
+   x_make_frame_visible (in that case, XOFF and YOFF are the current
+   position values).  It is -1 when calling from x_set_frame_parameters,
+   which means, do adjust for borders but don't change the gravity.  */
+
+static void
+x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
+/* --------------------------------------------------------------------------
+     External: Position the window
+   -------------------------------------------------------------------------- 
*/
+{
+  int modified_top, modified_left;
+
+  if (change_gravity > 0)
+    {
+      f->top_pos = yoff;
+      f->left_pos = xoff;
+      f->size_hint_flags &= ~ (XNegative | YNegative);
+      if (xoff < 0)
+       f->size_hint_flags |= XNegative;
+      if (yoff < 0)
+       f->size_hint_flags |= YNegative;
+      f->win_gravity = NorthWestGravity;
+    }
+
+  x_calc_absolute_position (f);
+
+  block_input ();
+  x_wm_set_size_hint (f, 0, false);
+
+  if (x_gtk_use_window_move)
+    {
+      if (change_gravity != 0)
+       {
+         if (FRAME_GTK_OUTER_WIDGET (f))
+           {
+             gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                              f->left_pos, f->top_pos);
+           }
+         else
+           {
+             GtkWidget *fixed = FRAME_GTK_WIDGET (f);
+             GtkWidget *parent = gtk_widget_get_parent (fixed);
+             gtk_fixed_move (GTK_FIXED (parent), fixed,
+                             f->left_pos, f->top_pos);
+           }
+       }
+      unblock_input ();
+      return;
+    }
+
+  modified_left = f->left_pos;
+  modified_top = f->top_pos;
+
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                      modified_left, modified_top);
+    }
+  else
+    {
+      GtkWidget *fixed = FRAME_GTK_WIDGET (f);
+      GtkWidget *parent = gtk_widget_get_parent (fixed);
+      gtk_fixed_move (GTK_FIXED (parent), fixed,
+                     modified_left, modified_top);
+    }
+
+  unblock_input ();
+}
+
+static void
+pgtk_set_window_size (struct frame *f, bool change_gravity,
+                     int width, int height)
+/* --------------------------------------------------------------------------
+     Adjust window pixel size based on given character grid size
+     Impl is a bit more complex than other terms, need to do some
+     internal clipping.
+   -------------------------------------------------------------------------- 
*/
+{
+  int pixelwidth, pixelheight;
+
+  block_input ();
+
+  gtk_widget_get_size_request (FRAME_GTK_WIDGET (f), &pixelwidth,
+                              &pixelheight);
+
+#if 0
+  if (pixelwise)
+    {
+      pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
+      pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height);
+    }
+  else
+    {
+      pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width);
+      pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height);
+    }
+#else
+  pixelwidth = width;
+  pixelheight = height;
+#endif
+
+#if 0
+  frame_size_history_add
+    (f, Qx_set_window_size_1, width, height,
+     list5 (Fcons (make_fixnum (pixelwidth), make_fixnum (pixelheight)),
+           Fcons (make_fixnum (pixelwidth), make_fixnum (pixelheight)),
+           make_fixnum (f->border_width),
+           make_fixnum (FRAME_PGTK_TITLEBAR_HEIGHT (f)),
+           make_fixnum (FRAME_TOOLBAR_HEIGHT (f))));
+#endif
+
+  for (GtkWidget * w = FRAME_GTK_WIDGET (f); w != NULL;
+       w = gtk_widget_get_parent (w))
+    {
+      gint wd, hi;
+      gtk_widget_get_size_request (w, &wd, &hi);
+    }
+
+  f->output_data.pgtk->preferred_width = pixelwidth;
+  f->output_data.pgtk->preferred_height = pixelheight;
+  x_wm_set_size_hint (f, 0, 0);
+  xg_frame_set_char_size (f, pixelwidth, pixelheight);
+  gtk_widget_queue_resize (FRAME_WIDGET (f));
+
+  unblock_input ();
+}
+
+void
+pgtk_iconify_frame (struct frame *f)
+/* --------------------------------------------------------------------------
+     External: Iconify window
+   -------------------------------------------------------------------------- 
*/
+{
+  /* Don't keep the highlight on an invisible frame.  */
+  if (FRAME_DISPLAY_INFO (f)->highlight_frame == f)
+    FRAME_DISPLAY_INFO (f)->highlight_frame = 0;
+
+  if (FRAME_ICONIFIED_P (f))
+    return;
+
+  block_input ();
+
+#if 0
+  x_set_bitmap_icon (f);
+#endif
+
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      if (!FRAME_VISIBLE_P (f))
+       gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
+
+      gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+      SET_FRAME_VISIBLE (f, 0);
+      SET_FRAME_ICONIFIED (f, true);
+      unblock_input ();
+      return;
+    }
+
+  /* Make sure the X server knows where the window should be positioned,
+     in case the user deiconifies with the window manager.  */
+  if (!FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)
+#if 0
+      && !FRAME_X_EMBEDDED_P (f)
+#endif
+    )
+    x_set_offset (f, f->left_pos, f->top_pos, 0);
+
+#if 0
+  if (!FRAME_VISIBLE_P (f))
+    {
+      /* If the frame was withdrawn, before, we must map it.  */
+      XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
+    }
+#endif
+
+  SET_FRAME_ICONIFIED (f, true);
+  SET_FRAME_VISIBLE (f, 0);
+
+  unblock_input ();
+}
+
+static gboolean
+pgtk_make_frame_visible_wait_for_map_event_cb (GtkWidget * widget,
+                                              GdkEventAny * event,
+                                              gpointer user_data)
+{
+  int *foundptr = user_data;
+  *foundptr = 1;
+  return FALSE;
+}
+
+static gboolean
+pgtk_make_frame_visible_wait_for_map_event_timeout (gpointer user_data)
+{
+  int *timedoutptr = user_data;
+  *timedoutptr = 1;
+  return FALSE;
+}
+
+static void
+pgtk_wait_for_map_event (struct frame *f, bool multiple_times)
+{
+  if (FLOATP (Vpgtk_wait_for_event_timeout))
+    {
+      guint msec =
+       (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000);
+      int found = 0;
+      int timed_out = 0;
+      gulong id =
+       g_signal_connect (FRAME_WIDGET (f), "map-event",
+                         G_CALLBACK
+                         (pgtk_make_frame_visible_wait_for_map_event_cb),
+                         &found);
+      guint src =
+       g_timeout_add (msec,
+                      pgtk_make_frame_visible_wait_for_map_event_timeout,
+                      &timed_out);
+
+      if (!multiple_times)
+       {
+         while (!found && !timed_out)
+           gtk_main_iteration ();
+       }
+      else
+       {
+         while (!timed_out)
+           gtk_main_iteration ();
+       }
+
+      g_signal_handler_disconnect (FRAME_WIDGET (f), id);
+      if (!timed_out)
+       g_source_remove (src);
+    }
+}
+
+void
+pgtk_make_frame_visible (struct frame *f)
+/* --------------------------------------------------------------------------
+     External: Show the window (X11 semantics)
+   -------------------------------------------------------------------------- 
*/
+{
+  GtkWidget *win = FRAME_GTK_OUTER_WIDGET (f);
+
+  if (!FRAME_VISIBLE_P (f))
+    {
+      gtk_widget_show (FRAME_WIDGET (f));
+      if (win)
+       gtk_window_deiconify (GTK_WINDOW (win));
+
+      pgtk_wait_for_map_event (f, false);
+    }
+}
+
+
+void
+pgtk_make_frame_invisible (struct frame *f)
+/* --------------------------------------------------------------------------
+     External: Hide the window (X11 semantics)
+   -------------------------------------------------------------------------- 
*/
+{
+  gtk_widget_hide (FRAME_WIDGET (f));
+
+  /* Map events are emitted many times, and
+   * map_event() do SET_FRAME_VISIBLE(f, 1).
+   * I expect visible = 0, so process those map events here and
+   * SET_FRAME_VISIBLE(f, 0) after that.
+   */
+  pgtk_wait_for_map_event (f, true);
+
+  SET_FRAME_VISIBLE (f, 0);
+  SET_FRAME_ICONIFIED (f, false);
+}
+
+static void
+pgtk_make_frame_visible_invisible (struct frame *f, bool visible)
+{
+  if (visible)
+    pgtk_make_frame_visible (f);
+  else
+    pgtk_make_frame_invisible (f);
+}
+
+static Lisp_Object
+pgtk_new_font (struct frame *f, Lisp_Object font_object, int fontset)
+{
+  struct font *font = XFONT_OBJECT (font_object);
+  int font_ascent, font_descent;
+
+  if (fontset < 0)
+    fontset = fontset_from_font (font_object);
+  FRAME_FONTSET (f) = fontset;
+
+  if (FRAME_FONT (f) == font)
+    {
+      /* This font is already set in frame F.  There's nothing more to
+         do.  */
+      return font_object;
+    }
+
+  FRAME_FONT (f) = font;
+
+  FRAME_BASELINE_OFFSET (f) = font->baseline_offset;
+  FRAME_COLUMN_WIDTH (f) = font->average_width;
+  get_font_ascent_descent (font, &font_ascent, &font_descent);
+  FRAME_LINE_HEIGHT (f) = font_ascent + font_descent;
+
+  /* We could use a more elaborate calculation here.  */
+  FRAME_TAB_BAR_HEIGHT (f) = FRAME_TAB_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
+
+  /* Compute the scroll bar width in character columns.  */
+  if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
+    {
+      int wid = FRAME_COLUMN_WIDTH (f);
+      FRAME_CONFIG_SCROLL_BAR_COLS (f)
+       = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid - 1) / wid;
+    }
+  else
+    {
+      int wid = FRAME_COLUMN_WIDTH (f);
+      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
+    }
+
+  /* Compute the scroll bar height in character lines.  */
+  if (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0)
+    {
+      int height = FRAME_LINE_HEIGHT (f);
+      FRAME_CONFIG_SCROLL_BAR_LINES (f)
+       = (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) + height - 1) / height;
+    }
+  else
+    {
+      int height = FRAME_LINE_HEIGHT (f);
+      FRAME_CONFIG_SCROLL_BAR_LINES (f) = (14 + height - 1) / height;
+    }
+
+  /* Now make the frame display the given font.  */
+  if (FRAME_GTK_WIDGET (f) != NULL)
+    adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+                      FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3,
+                      false, Qfont);
+
+  return font_object;
+}
+
+int
+x_display_pixel_height (struct pgtk_display_info *dpyinfo)
+{
+  GdkDisplay *gdpy = dpyinfo->gdpy;
+  GdkScreen *gscr = gdk_display_get_default_screen (gdpy);
+  return gdk_screen_get_height (gscr);
+}
+
+int
+x_display_pixel_width (struct pgtk_display_info *dpyinfo)
+{
+  GdkDisplay *gdpy = dpyinfo->gdpy;
+  GdkScreen *gscr = gdk_display_get_default_screen (gdpy);
+  return gdk_screen_get_width (gscr);
+}
+
+void
+x_set_parent_frame (struct frame *f, Lisp_Object new_value,
+                   Lisp_Object old_value)
+/* --------------------------------------------------------------------------
+     Set frame F's `parent-frame' parameter.  If non-nil, make F a child
+     frame of the frame specified by that parameter.  Technically, this
+     makes F's window-system window a child window of the parent frame's
+     window-system window.  If nil, make F's window-system window a
+     top-level window--a child of its display's root window.
+
+     A child frame's `left' and `top' parameters specify positions
+     relative to the top-left corner of its parent frame's native
+     rectangle.  On macOS moving a parent frame moves all its child
+     frames too, keeping their position relative to the parent
+     unaltered.  When a parent frame is iconified or made invisible, its
+     child frames are made invisible.  When a parent frame is deleted,
+     its child frames are deleted too.
+
+     Whether a child frame has a tool bar may be window-system or window
+     manager dependent.  It's advisable to disable it via the frame
+     parameter settings.
+
+     Some window managers may not honor this parameter.
+   -------------------------------------------------------------------------- 
*/
+{
+  struct frame *p = NULL;
+
+  if (!NILP (new_value)
+      && (!FRAMEP (new_value)
+         || !FRAME_LIVE_P (p = XFRAME (new_value))
+         || !FRAME_PGTK_P (p)))
+    {
+      store_frame_param (f, Qparent_frame, old_value);
+      error ("Invalid specification of `parent-frame'");
+    }
+
+  if (p != FRAME_PARENT_FRAME (f))
+    {
+      block_input ();
+
+      if (p != NULL)
+       {
+         if (FRAME_DISPLAY_INFO (f) != FRAME_DISPLAY_INFO (p))
+           error ("Cross display reparent.");
+       }
+
+      GtkWidget *fixed = FRAME_GTK_WIDGET (f);
+
+      GtkAllocation alloc;
+      gtk_widget_get_allocation (fixed, &alloc);
+      g_object_ref (fixed);
+
+      /* Remember the css provider, and restore it later. */
+      GtkCssProvider *provider = FRAME_X_OUTPUT (f)->border_color_css_provider;
+      FRAME_X_OUTPUT (f)->border_color_css_provider = NULL;
+      {
+       GtkStyleContext *ctxt = gtk_widget_get_style_context (FRAME_WIDGET (f));
+       if (provider != NULL)
+         gtk_style_context_remove_provider (ctxt, GTK_STYLE_PROVIDER 
(provider));
+      }
+
+      {
+       GtkWidget *whbox_of_f = gtk_widget_get_parent (fixed);
+       /* Here, unhighlight can be called and may change 
border_color_css_provider. */
+       gtk_container_remove (GTK_CONTAINER (whbox_of_f), fixed);
+
+       if (FRAME_GTK_OUTER_WIDGET (f))
+         {
+           gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
+           FRAME_GTK_OUTER_WIDGET (f) = NULL;
+           FRAME_OUTPUT_DATA (f)->vbox_widget = NULL;
+           FRAME_OUTPUT_DATA (f)->hbox_widget = NULL;
+           FRAME_OUTPUT_DATA (f)->menubar_widget = NULL;
+           FRAME_OUTPUT_DATA (f)->toolbar_widget = NULL;
+           FRAME_OUTPUT_DATA (f)->ttip_widget = NULL;
+           FRAME_OUTPUT_DATA (f)->ttip_lbl = NULL;
+           FRAME_OUTPUT_DATA (f)->ttip_window = NULL;
+         }
+      }
+
+      if (p == NULL)
+       {
+         xg_create_frame_outer_widgets (f);
+         pgtk_set_event_handler (f);
+         gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), 
fixed, TRUE, TRUE, 0);
+         f->output_data.pgtk->preferred_width = alloc.width;
+         f->output_data.pgtk->preferred_height = alloc.height;
+         x_wm_set_size_hint (f, 0, 0);
+         xg_frame_set_char_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, alloc.width),
+                                 FRAME_PIXEL_TO_TEXT_HEIGHT (f, alloc.height));
+         gtk_widget_queue_resize (FRAME_WIDGET (f));
+         gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
+       }
+      else
+       {
+         GtkWidget *fixed_of_p = FRAME_GTK_WIDGET (p);
+         gtk_fixed_put (GTK_FIXED (fixed_of_p), fixed, f->left_pos, 
f->top_pos);
+         gtk_widget_set_size_request (fixed, alloc.width, alloc.height);
+         gtk_widget_show_all (fixed);
+       }
+
+      /* Restore css provider. */
+      GtkStyleContext *ctxt = gtk_widget_get_style_context (FRAME_WIDGET (f));
+      GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider;
+      FRAME_X_OUTPUT (f)->border_color_css_provider = provider;
+      if (provider != NULL)
+       {
+         gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (provider),
+                                         GTK_STYLE_PROVIDER_PRIORITY_USER);
+       }
+      if (old != NULL)
+       {
+         gtk_style_context_remove_provider (ctxt, GTK_STYLE_PROVIDER (old));
+         g_object_unref(old);
+       }
+
+      g_object_unref (fixed);
+
+      if (FRAME_GTK_OUTER_WIDGET (f))
+       {
+         if (EQ (x_gtk_resize_child_frames, Qresize_mode))
+           gtk_container_set_resize_mode
+             (GTK_CONTAINER (FRAME_GTK_OUTER_WIDGET (f)),
+              p ? GTK_RESIZE_IMMEDIATE : GTK_RESIZE_QUEUE);
+       }
+
+      unblock_input ();
+
+      fset_parent_frame (f, new_value);
+    }
+}
+
+
+void
+x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value,
+                      Lisp_Object old_value)
+/* Set frame F's `no-focus-on-map' parameter which, if non-nil, means
+ * that F's window-system window does not want to receive input focus
+ * when it is mapped.  (A frame's window is mapped when the frame is
+ * displayed for the first time and when the frame changes its state
+ * from `iconified' or `invisible' to `visible'.)
+ *
+ * Some window managers may not honor this parameter. */
+{
+  /* doesn't work on wayland. */
+
+  if (!EQ (new_value, old_value))
+    {
+      xg_set_no_focus_on_map (f, new_value);
+      FRAME_NO_FOCUS_ON_MAP (f) = !NILP (new_value);
+    }
+}
+
+void
+x_set_no_accept_focus (struct frame *f, Lisp_Object new_value,
+                      Lisp_Object old_value)
+/*  Set frame F's `no-accept-focus' parameter which, if non-nil, hints
+ * that F's window-system window does not want to receive input focus
+ * via mouse clicks or by moving the mouse into it.
+ *
+ * If non-nil, this may have the unwanted side-effect that a user cannot
+ * scroll a non-selected frame with the mouse.
+ *
+ * Some window managers may not honor this parameter. */
+{
+  /* doesn't work on wayland. */
+
+  xg_set_no_accept_focus (f, new_value);
+  FRAME_NO_ACCEPT_FOCUS (f) = !NILP (new_value);
+}
+
+void
+x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
+/* Set frame F's `z-group' parameter.  If `above', F's window-system
+   window is displayed above all windows that do not have the `above'
+   property set.  If nil, F's window is shown below all windows that
+   have the `above' property set and above all windows that have the
+   `below' property set.  If `below', F's window is displayed below
+   all windows that do.
+
+   Some window managers may not honor this parameter. */
+{
+  /* doesn't work on wayland. */
+
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return;
+
+  if (NILP (new_value))
+    {
+      gtk_window_set_keep_above (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                FALSE);
+      gtk_window_set_keep_below (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                FALSE);
+      FRAME_Z_GROUP (f) = z_group_none;
+    }
+  else if (EQ (new_value, Qabove))
+    {
+      gtk_window_set_keep_above (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                TRUE);
+      gtk_window_set_keep_below (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                FALSE);
+      FRAME_Z_GROUP (f) = z_group_above;
+    }
+  else if (EQ (new_value, Qabove_suspended))
+    {
+      gtk_window_set_keep_above (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                FALSE);
+      FRAME_Z_GROUP (f) = z_group_above_suspended;
+    }
+  else if (EQ (new_value, Qbelow))
+    {
+      gtk_window_set_keep_above (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                FALSE);
+      gtk_window_set_keep_below (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                                TRUE);
+      FRAME_Z_GROUP (f) = z_group_below;
+    }
+  else
+    error ("Invalid z-group specification");
+}
+
+static void
+pgtk_initialize_display_info (struct pgtk_display_info *dpyinfo)
+/* --------------------------------------------------------------------------
+      Initialize global info and storage for display.
+   -------------------------------------------------------------------------- 
*/
+{
+  dpyinfo->resx = 96;
+  dpyinfo->resy = 96;
+  dpyinfo->color_p = 1;
+  dpyinfo->n_planes = 32;
+  dpyinfo->root_window = 42;   /* a placeholder.. */
+  dpyinfo->highlight_frame = dpyinfo->x_focus_frame = NULL;
+  dpyinfo->n_fonts = 0;
+  dpyinfo->smallest_font_height = 1;
+  dpyinfo->smallest_char_width = 1;
+
+  reset_mouse_highlight (&dpyinfo->mouse_highlight);
+}
+
+/* Set S->gc to a suitable GC for drawing glyph string S in cursor
+   face.  */
+
+static void
+x_set_cursor_gc (struct glyph_string *s)
+{
+  if (s->font == FRAME_FONT (s->f)
+      && s->face->background == FRAME_BACKGROUND_PIXEL (s->f)
+      && s->face->foreground == FRAME_FOREGROUND_PIXEL (s->f) && !s->cmp)
+      s->xgcv = FRAME_X_OUTPUT (s->f)->cursor_xgcv;
+  else
+    {
+      /* Cursor on non-default face: must merge.  */
+      Emacs_GC xgcv;
+
+      xgcv.background = FRAME_X_OUTPUT (s->f)->cursor_color;
+      xgcv.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 = FRAME_X_OUTPUT (s->f)->cursor_foreground_color;
+      if (xgcv.foreground == xgcv.background)
+       xgcv.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)
+       {
+         xgcv.background = s->face->foreground;
+         xgcv.foreground = s->face->background;
+       }
+
+      s->xgcv = xgcv;
+    }
+}
+
+
+/* Set up S->gc of glyph string S for drawing text in mouse face.  */
+
+static void
+x_set_mouse_face_gc (struct glyph_string *s)
+{
+  prepare_face_for_display (s->f, s->face);
+
+  if (s->font == s->face->font)
+    {
+      s->xgcv.foreground = s->face->foreground;
+      s->xgcv.background = s->face->background;
+    }
+  else
+    {
+      /* Otherwise construct scratch_cursor_gc with values from FACE
+         except for FONT.  */
+      Emacs_GC xgcv;
+
+      xgcv.background = s->face->background;
+      xgcv.foreground = s->face->foreground;
+
+      s->xgcv = xgcv;
+
+    }
+}
+
+
+/* Set S->gc of glyph string S to a GC suitable for drawing a mode line.
+   Faces to use in the mode line have already been computed when the
+   matrix was built, so there isn't much to do, here.  */
+
+static void
+x_set_mode_line_face_gc (struct glyph_string *s)
+{
+  s->xgcv.foreground = s->face->foreground;
+  s->xgcv.background = s->face->background;
+}
+
+
+/* Set S->gc of glyph string S for drawing that glyph string.  Set
+   S->stippled_p to a non-zero value if the face of S has a stipple
+   pattern.  */
+
+static void
+x_set_glyph_string_gc (struct glyph_string *s)
+{
+  prepare_face_for_display (s->f, s->face);
+
+  if (s->hl == DRAW_NORMAL_TEXT)
+    {
+      s->xgcv.foreground = s->face->foreground;
+      s->xgcv.background = s->face->background;
+      s->stippled_p = s->face->stipple != 0;
+    }
+  else if (s->hl == DRAW_INVERSE_VIDEO)
+    {
+      x_set_mode_line_face_gc (s);
+      s->stippled_p = s->face->stipple != 0;
+    }
+  else if (s->hl == DRAW_CURSOR)
+    {
+      x_set_cursor_gc (s);
+      s->stippled_p = false;
+    }
+  else if (s->hl == DRAW_MOUSE_FACE)
+    {
+      x_set_mouse_face_gc (s);
+      s->stippled_p = s->face->stipple != 0;
+    }
+  else if (s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN)
+    {
+      s->xgcv.foreground = s->face->foreground;
+      s->xgcv.background = s->face->background;
+      s->stippled_p = s->face->stipple != 0;
+    }
+  else
+    emacs_abort ();
+}
+
+
+/* Set clipping for output of glyph string S.  S may be part of a mode
+   line or menu if we don't have X toolkit support.  */
+
+static void
+x_set_glyph_string_clipping (struct glyph_string *s, cairo_t * cr)
+{
+  XRectangle r[2];
+  int n = get_glyph_string_clip_rects (s, r, 2);
+
+  if (n > 0)
+    {
+      for (int i = 0; i < n; i++)
+       {
+         cairo_rectangle (cr, r[i].x, r[i].y, r[i].width, r[i].height);
+       }
+      cairo_clip (cr);
+    }
+}
+
+
+/* Set SRC's clipping for output of glyph string DST.  This is called
+   when we are drawing DST's left_overhang or right_overhang only in
+   the area of SRC.  */
+
+static void
+x_set_glyph_string_clipping_exactly (struct glyph_string *src,
+                                    struct glyph_string *dst, cairo_t * cr)
+{
+  dst->clip[0].x = src->x;
+  dst->clip[0].y = src->y;
+  dst->clip[0].width = src->width;
+  dst->clip[0].height = src->height;
+  dst->num_clips = 1;
+
+  cairo_rectangle (cr, src->x, src->y, src->width, src->height);
+  cairo_clip (cr);
+}
+
+
+/* RIF:
+   Compute left and right overhang of glyph string S.  */
+
+static void
+pgtk_compute_glyph_string_overhangs (struct glyph_string *s)
+{
+  if (s->cmp == NULL
+      && (s->first_glyph->type == CHAR_GLYPH
+         || s->first_glyph->type == COMPOSITE_GLYPH))
+    {
+      struct font_metrics metrics;
+
+      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];
+         font->driver->text_extents (font, code, s->nchars, &metrics);
+       }
+      else
+       {
+         Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
+
+         composition_gstring_width (gstring, s->cmp_from, s->cmp_to,
+                                    &metrics);
+       }
+      s->right_overhang = (metrics.rbearing > metrics.width
+                          ? metrics.rbearing - metrics.width : 0);
+      s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
+    }
+  else if (s->cmp)
+    {
+      s->right_overhang = s->cmp->rbearing - s->cmp->pixel_width;
+      s->left_overhang = -s->cmp->lbearing;
+    }
+}
+
+
+/* Fill rectangle X, Y, W, H with background color of glyph string S.  */
+
+static void
+x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
+{
+  pgtk_fill_rectangle (s->f, s->xgcv.background, x, y, w, h);
+}
+
+
+static void
+fill_background_by_face (struct frame *f, struct face *face, int x, int y,
+                        int width, int height)
+{
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+
+  cairo_rectangle (cr, x, y, width, height);
+  cairo_clip (cr);
+
+  double r = ((face->background >> 16) & 0xff) / 255.0;
+  double g = ((face->background >> 8) & 0xff) / 255.0;
+  double b = ((face->background >> 0) & 0xff) / 255.0;
+  cairo_set_source_rgb (cr, r, g, b);
+  cairo_paint (cr);
+
+  if (face->stipple != 0)
+    {
+      cairo_pattern_t *mask =
+       FRAME_DISPLAY_INFO (f)->bitmaps[face->stipple - 1].pattern;
+
+      double r = ((face->foreground >> 16) & 0xff) / 255.0;
+      double g = ((face->foreground >> 8) & 0xff) / 255.0;
+      double b = ((face->foreground >> 0) & 0xff) / 255.0;
+      cairo_set_source_rgb (cr, r, g, b);
+      cairo_mask (cr, mask);
+    }
+
+  pgtk_end_cr_clip (f);
+}
+
+static void
+fill_background (struct glyph_string *s, int x, int y, int width, int height)
+{
+  fill_background_by_face (s->f, s->face, x, y, width, height);
+}
+
+/* Draw the background of glyph_string S.  If S->background_filled_p
+   is non-zero don't draw it.  FORCE_P non-zero means draw the
+   background even if it wouldn't be drawn normally.  This is used
+   when a string preceding S draws into the background of S, or S
+   contains the first component of a composition.  */
+
+static void
+x_draw_glyph_string_background (struct glyph_string *s, bool force_p)
+{
+  /* Nothing to do if background has already been drawn or if it
+     shouldn't be drawn in the first place.  */
+  if (!s->background_filled_p)
+    {
+      int box_line_width = max (s->face->box_horizontal_line_width, 0);
+
+      if (s->stippled_p)
+       {
+         /* Fill background with a stipple pattern.  */
+
+         fill_background (s,
+                          s->x, s->y + box_line_width,
+                          s->background_width,
+                          s->height - 2 * box_line_width);
+         s->background_filled_p = true;
+       }
+      else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
+              /* When xdisp.c ignores FONT_HEIGHT, we cannot trust
+                 font dimensions, since the actual glyphs might be
+                 much smaller.  So in that case we always clear the
+                 rectangle with background color.  */
+              || FONT_TOO_HIGH (s->font)
+              || s->font_not_found_p
+              || s->extends_to_end_of_line_p || force_p)
+       {
+         x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
+                                    s->background_width,
+                                    s->height - 2 * box_line_width);
+         s->background_filled_p = true;
+       }
+    }
+}
+
+
+static void
+pgtk_draw_rectangle (struct frame *f, unsigned long color, int x, int y,
+                    int width, int height)
+{
+  cairo_t *cr;
+
+  cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, color);
+  cairo_rectangle (cr, x + 0.5, y + 0.5, width, height);
+  cairo_set_line_width (cr, 1);
+  cairo_stroke (cr);
+  pgtk_end_cr_clip (f);
+}
+
+/* Draw the foreground of glyph string S.  */
+
+static void
+x_draw_glyph_string_foreground (struct glyph_string *s)
+{
+  int i, x;
+
+  /* If first glyph of S has a left box line, start drawing the text
+     of S to the right of that box line.  */
+  if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p)
+    x = s->x + max (s->face->box_vertical_line_width, 0);
+  else
+    x = s->x;
+
+  /* Draw characters of S as rectangles if S's font could not be
+     loaded.  */
+  if (s->font_not_found_p)
+    {
+      for (i = 0; i < s->nchars; ++i)
+       {
+         struct glyph *g = s->first_glyph + i;
+         pgtk_draw_rectangle (s->f,
+                              s->face->foreground, x, s->y,
+                              g->pixel_width - 1, s->height - 1);
+         x += g->pixel_width;
+       }
+    }
+  else
+    {
+      struct font *font = s->font;
+      int boff = font->baseline_offset;
+      int y;
+
+      if (font->vertical_centering)
+       boff = VCENTER_BASELINE_OFFSET (font, s->f) - boff;
+
+      y = s->ybase - boff;
+      if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
+       font->driver->draw (s, 0, s->nchars, x, y, false);
+      else
+       font->driver->draw (s, 0, s->nchars, x, y, true);
+      if (s->face->overstrike)
+       font->driver->draw (s, 0, s->nchars, x + 1, y, false);
+    }
+}
+
+/* Draw the foreground of composite glyph string S.  */
+
+static void
+x_draw_composite_glyph_string_foreground (struct glyph_string *s)
+{
+  int i, j, x;
+  struct font *font = s->font;
+
+  /* If first glyph of S has a left box line, start drawing the text
+     of S to the right of that box line.  */
+  if (s->face && s->face->box != FACE_NO_BOX
+      && s->first_glyph->left_box_line_p)
+    x = s->x + max (s->face->box_vertical_line_width, 0);
+  else
+    x = s->x;
+
+  /* S is a glyph string for a composition.  S->cmp_from is the index
+     of the first character drawn for glyphs of this composition.
+     S->cmp_from == 0 means we are drawing the very first character of
+     this composition.  */
+
+  /* Draw a rectangle for the composition if the font for the very
+     first character of the composition could not be loaded.  */
+  if (s->font_not_found_p)
+    {
+      if (s->cmp_from == 0)
+       pgtk_draw_rectangle (s->f, s->face->foreground, x, s->y,
+                            s->width - 1, s->height - 1);
+    }
+  else if (!s->first_glyph->u.cmp.automatic)
+    {
+      int y = s->ybase;
+
+      for (i = 0, j = s->cmp_from; i < s->nchars; i++, j++)
+       /* TAB in a composition means display glyphs with padding
+          space on the left or right.  */
+       if (COMPOSITION_GLYPH (s->cmp, j) != '\t')
+         {
+           int xx = x + s->cmp->offsets[j * 2];
+           int yy = y - s->cmp->offsets[j * 2 + 1];
+
+           font->driver->draw (s, j, j + 1, xx, yy, false);
+           if (s->face->overstrike)
+             font->driver->draw (s, j, j + 1, xx + 1, yy, false);
+         }
+    }
+  else
+    {
+      Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
+      Lisp_Object glyph;
+      int y = s->ybase;
+      int width = 0;
+
+      for (i = j = s->cmp_from; i < s->cmp_to; i++)
+       {
+         glyph = LGSTRING_GLYPH (gstring, i);
+         if (NILP (LGLYPH_ADJUSTMENT (glyph)))
+           width += LGLYPH_WIDTH (glyph);
+         else
+           {
+             int xoff, yoff, wadjust;
+
+             if (j < i)
+               {
+                 font->driver->draw (s, j, i, x, y, false);
+                 if (s->face->overstrike)
+                   font->driver->draw (s, j, i, x + 1, y, false);
+                 x += width;
+               }
+             xoff = LGLYPH_XOFF (glyph);
+             yoff = LGLYPH_YOFF (glyph);
+             wadjust = LGLYPH_WADJUST (glyph);
+             font->driver->draw (s, i, i + 1, x + xoff, y + yoff, false);
+             if (s->face->overstrike)
+               font->driver->draw (s, i, i + 1, x + xoff + 1, y + yoff,
+                                   false);
+             x += wadjust;
+             j = i + 1;
+             width = 0;
+           }
+       }
+      if (j < i)
+       {
+         font->driver->draw (s, j, i, x, y, false);
+         if (s->face->overstrike)
+           font->driver->draw (s, j, i, x + 1, y, false);
+       }
+    }
+}
+
+
+/* Draw the foreground of glyph string S for glyphless characters.  */
+
+static void
+x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
+{
+  struct glyph *glyph = s->first_glyph;
+  unsigned char2b[8];
+  int x, i, j;
+
+  /* If first glyph of S has a left box line, start drawing the text
+     of S to the right of that box line.  */
+  if (s->face && s->face->box != FACE_NO_BOX
+      && s->first_glyph->left_box_line_p)
+    x = s->x + max (s->face->box_vertical_line_width, 0);
+  else
+    x = s->x;
+
+  s->char2b = char2b;
+
+  for (i = 0; i < s->nchars; i++, glyph++)
+    {
+#ifdef GCC_LINT
+      enum
+      { PACIFY_GCC_BUG_81401 = 1 };
+#else
+      enum
+      { PACIFY_GCC_BUG_81401 = 0 };
+#endif
+      char buf[7 + PACIFY_GCC_BUG_81401];
+      char *str = NULL;
+      int len = glyph->u.glyphless.len;
+
+      if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)
+       {
+         if (len > 0
+             && CHAR_TABLE_P (Vglyphless_char_display)
+             &&
+             (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display))
+              >= 1))
+           {
+             Lisp_Object acronym
+               = (!glyph->u.glyphless.for_no_font
+                  ? CHAR_TABLE_REF (Vglyphless_char_display,
+                                    glyph->u.glyphless.ch)
+                  : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
+             if (STRINGP (acronym))
+               str = SSDATA (acronym);
+           }
+       }
+      else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
+       {
+         unsigned int ch = glyph->u.glyphless.ch;
+         eassume (ch <= MAX_CHAR);
+         sprintf (buf, "%0*X", ch < 0x10000 ? 4 : 6, ch);
+         str = buf;
+       }
+
+      if (str)
+       {
+         int upper_len = (len + 1) / 2;
+
+         /* It is assured that all LEN characters in STR is ASCII.  */
+         for (j = 0; j < len; j++)
+           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,
+                                false);
+         s->font->driver->draw (s, upper_len, len,
+                                x + glyph->slice.glyphless.lower_xoff,
+                                s->ybase + glyph->slice.glyphless.lower_yoff,
+                                false);
+       }
+      if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
+       pgtk_draw_rectangle (s->f, s->face->foreground,
+                            x, s->ybase - glyph->ascent,
+                            glyph->pixel_width - 1,
+                            glyph->ascent + glyph->descent - 1);
+      x += glyph->pixel_width;
+    }
+}
+
+/* Brightness beyond which a color won't have its highlight brightness
+   boosted.
+
+   Nominally, highlight colors for `3d' faces are calculated by
+   brightening an object's color by a constant scale factor, but this
+   doesn't yield good results for dark colors, so for colors who's
+   brightness is less than this value (on a scale of 0-65535) have an
+   use an additional additive factor.
+
+   The value here is set so that the default menu-bar/mode-line color
+   (grey75) will not have its highlights changed at all.  */
+#define HIGHLIGHT_COLOR_DARK_BOOST_LIMIT 48000
+
+
+/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
+   or DELTA.  Try a color with RGB values multiplied by FACTOR first.
+   If this produces the same color as PIXEL, try a color where all RGB
+   values have DELTA added.  Return the allocated color in *PIXEL.
+   DISPLAY is the X display, CMAP is the colormap to operate on.
+   Value is non-zero if successful.  */
+
+static bool
+x_alloc_lighter_color (struct frame *f, unsigned long *pixel, double factor,
+                      int delta)
+{
+  Emacs_Color color, new;
+  long bright;
+  bool success_p;
+
+  /* Get RGB color values.  */
+  color.pixel = *pixel;
+  pgtk_query_color (f, &color);
+
+  /* Change RGB values by specified FACTOR.  Avoid overflow!  */
+  eassert (factor >= 0);
+  new.red = min (0xffff, factor * color.red);
+  new.green = min (0xffff, factor * color.green);
+  new.blue = min (0xffff, factor * color.blue);
+
+  /* Calculate brightness of COLOR.  */
+  bright = (2 * color.red + 3 * color.green + color.blue) / 6;
+
+  /* We only boost colors that are darker than
+     HIGHLIGHT_COLOR_DARK_BOOST_LIMIT.  */
+  if (bright < HIGHLIGHT_COLOR_DARK_BOOST_LIMIT)
+    /* Make an additive adjustment to NEW, because it's dark enough so
+       that scaling by FACTOR alone isn't enough.  */
+    {
+      /* How far below the limit this color is (0 - 1, 1 being darker).  */
+      double dimness = 1 - (double) bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT;
+      /* The additive adjustment.  */
+      int min_delta = delta * dimness * factor / 2;
+
+      if (factor < 1)
+       {
+         new.red = max (0, new.red - min_delta);
+         new.green = max (0, new.green - min_delta);
+         new.blue = max (0, new.blue - min_delta);
+       }
+      else
+       {
+         new.red = min (0xffff, min_delta + new.red);
+         new.green = min (0xffff, min_delta + new.green);
+         new.blue = min (0xffff, min_delta + new.blue);
+       }
+    }
+
+  /* Try to allocate the color.  */
+  new.pixel = new.red >> 8 << 16 | new.green >> 8 << 8 | new.blue >> 8;
+  success_p = true;
+  if (success_p)
+    {
+      if (new.pixel == *pixel)
+       {
+         /* If we end up with the same color as before, try adding
+            delta to the RGB values.  */
+         new.red = min (0xffff, delta + color.red);
+         new.green = min (0xffff, delta + color.green);
+         new.blue = min (0xffff, delta + color.blue);
+         new.pixel =
+           new.red >> 8 << 16 | new.green >> 8 << 8 | new.blue >> 8;
+         success_p = true;
+       }
+      else
+       success_p = true;
+      *pixel = new.pixel;
+    }
+
+  return success_p;
+}
+
+static void
+x_fill_trapezoid_for_relief (struct frame *f, unsigned long color, int x,
+                            int y, int width, int height, int top_p)
+{
+  cairo_t *cr;
+
+  cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, color);
+  cairo_move_to (cr, top_p ? x : x + height, y);
+  cairo_line_to (cr, x, y + height);
+  cairo_line_to (cr, top_p ? x + width - height : x + width, y + height);
+  cairo_line_to (cr, x + width, y);
+  cairo_fill (cr);
+  pgtk_end_cr_clip (f);
+}
+
+enum corners
+{
+  CORNER_BOTTOM_RIGHT,         /* 0 -> pi/2 */
+  CORNER_BOTTOM_LEFT,          /* pi/2 -> pi */
+  CORNER_TOP_LEFT,             /* pi -> 3pi/2 */
+  CORNER_TOP_RIGHT,            /* 3pi/2 -> 2pi */
+  CORNER_LAST
+};
+
+static void
+x_erase_corners_for_relief (struct frame *f, unsigned long color, int x,
+                           int y, int width, int height, double radius,
+                           double margin, int corners)
+{
+  cairo_t *cr;
+  int i;
+
+  cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, color);
+  for (i = 0; i < CORNER_LAST; i++)
+    if (corners & (1 << i))
+      {
+       double xm, ym, xc, yc;
+
+       if (i == CORNER_TOP_LEFT || i == CORNER_BOTTOM_LEFT)
+         xm = x - margin, xc = xm + radius;
+       else
+         xm = x + width + margin, xc = xm - radius;
+       if (i == CORNER_TOP_LEFT || i == CORNER_TOP_RIGHT)
+         ym = y - margin, yc = ym + radius;
+       else
+         ym = y + height + margin, yc = ym - radius;
+
+       cairo_move_to (cr, xm, ym);
+       cairo_arc (cr, xc, yc, radius, i * M_PI_2, (i + 1) * M_PI_2);
+      }
+  cairo_clip (cr);
+  cairo_rectangle (cr, x, y, width, height);
+  cairo_fill (cr);
+  pgtk_end_cr_clip (f);
+}
+
+/* Set up the foreground color for drawing relief lines of glyph
+   string S.  RELIEF is a pointer to a struct relief containing the GC
+   with which lines will be drawn.  Use a color that is FACTOR or
+   DELTA lighter or darker than the relief's background which is found
+   in S->f->output_data.pgtk->relief_background.  If such a color cannot
+   be allocated, use DEFAULT_PIXEL, instead.  */
+
+static void
+x_setup_relief_color (struct frame *f, struct relief *relief, double factor,
+                     int delta, unsigned long default_pixel)
+{
+  Emacs_GC xgcv;
+  struct pgtk_output *di = FRAME_X_OUTPUT (f);
+  unsigned long pixel;
+  unsigned long background = di->relief_background;
+
+  /* Allocate new color.  */
+  xgcv.foreground = default_pixel;
+  pixel = background;
+  if (x_alloc_lighter_color (f, &pixel, factor, delta))
+    xgcv.foreground = relief->pixel = pixel;
+
+  relief->xgcv = xgcv;
+}
+
+/* Set up colors for the relief lines around glyph string S.  */
+
+static void
+x_setup_relief_colors (struct glyph_string *s)
+{
+  struct pgtk_output *di = FRAME_X_OUTPUT (s->f);
+  unsigned long color;
+
+  if (s->face->use_box_color_for_shadows_p)
+    color = s->face->box_color;
+  else if (s->first_glyph->type == IMAGE_GLYPH
+          && s->img->pixmap
+          && !IMAGE_BACKGROUND_TRANSPARENT (s->img, s->f, 0))
+    color = IMAGE_BACKGROUND (s->img, s->f, 0);
+  else
+    {
+      /* Get the background color of the face.  */
+      color = s->xgcv.background;
+    }
+
+  if (TRUE)
+    {
+      di->relief_background = color;
+      x_setup_relief_color (s->f, &di->white_relief, 1.2, 0x8000,
+                           WHITE_PIX_DEFAULT (s->f));
+      x_setup_relief_color (s->f, &di->black_relief, 0.6, 0x4000,
+                           BLACK_PIX_DEFAULT (s->f));
+    }
+}
+
+
+static void
+x_set_clip_rectangles (struct frame *f, cairo_t * cr, XRectangle * rectangles,
+                      int n)
+{
+  if (n > 0)
+    {
+      for (int i = 0; i < n; i++)
+       {
+         cairo_rectangle (cr,
+                          rectangles[i].x,
+                          rectangles[i].y,
+                          rectangles[i].width, rectangles[i].height);
+       }
+      cairo_clip (cr);
+    }
+}
+
+/* Draw a relief on frame F inside the rectangle given by LEFT_X,
+   TOP_Y, RIGHT_X, and BOTTOM_Y.  WIDTH is the thickness of the relief
+   to draw, it must be >= 0.  RAISED_P means draw a raised
+   relief.  LEFT_P means draw a relief on the left side of
+   the rectangle.  RIGHT_P means draw a relief on the right
+   side of the rectangle.  CLIP_RECT is the clipping rectangle to use
+   when drawing.  */
+
+static void
+x_draw_relief_rect (struct frame *f,
+                   int left_x, int top_y, int right_x, int bottom_y,
+                   int hwidth, int vwidth, bool raised_p, bool top_p,
+                   bool bot_p, bool left_p, bool right_p,
+                   XRectangle * clip_rect)
+{
+  unsigned long top_left_color, bottom_right_color;
+  int corners = 0;
+
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+
+  if (raised_p)
+    {
+      top_left_color = FRAME_X_OUTPUT (f)->white_relief.xgcv.foreground;
+      bottom_right_color = FRAME_X_OUTPUT (f)->black_relief.xgcv.foreground;
+    }
+  else
+    {
+      top_left_color = FRAME_X_OUTPUT (f)->black_relief.xgcv.foreground;
+      bottom_right_color = FRAME_X_OUTPUT (f)->white_relief.xgcv.foreground;
+    }
+
+  x_set_clip_rectangles (f, cr, clip_rect, 1);
+
+  if (left_p)
+    {
+      pgtk_fill_rectangle (f, top_left_color, left_x, top_y,
+                          vwidth, bottom_y + 1 - top_y);
+      if (top_p)
+       corners |= 1 << CORNER_TOP_LEFT;
+      if (bot_p)
+       corners |= 1 << CORNER_BOTTOM_LEFT;
+    }
+  if (right_p)
+    {
+      pgtk_fill_rectangle (f, bottom_right_color, right_x + 1 - vwidth, top_y,
+                          vwidth, bottom_y + 1 - top_y);
+      if (top_p)
+       corners |= 1 << CORNER_TOP_RIGHT;
+      if (bot_p)
+       corners |= 1 << CORNER_BOTTOM_RIGHT;
+    }
+  if (top_p)
+    {
+      if (!right_p)
+       pgtk_fill_rectangle (f, top_left_color, left_x, top_y,
+                            right_x + 1 - left_x, hwidth);
+      else
+       x_fill_trapezoid_for_relief (f, top_left_color, left_x, top_y,
+                                    right_x + 1 - left_x, hwidth, 1);
+    }
+  if (bot_p)
+    {
+      if (!left_p)
+       pgtk_fill_rectangle (f, bottom_right_color, left_x,
+                            bottom_y + 1 - hwidth, right_x + 1 - left_x,
+                            hwidth);
+      else
+       x_fill_trapezoid_for_relief (f, bottom_right_color,
+                                    left_x, bottom_y + 1 - hwidth,
+                                    right_x + 1 - left_x, hwidth, 0);
+    }
+  if (left_p && vwidth > 1)
+    pgtk_fill_rectangle (f, bottom_right_color, left_x, top_y,
+                        1, bottom_y + 1 - top_y);
+  if (top_p && hwidth > 1)
+    pgtk_fill_rectangle (f, bottom_right_color, left_x, top_y,
+                        right_x + 1 - left_x, 1);
+  if (corners)
+    {
+      x_erase_corners_for_relief (f, FRAME_BACKGROUND_PIXEL (f), left_x,
+                                 top_y, right_x - left_x + 1,
+                                 bottom_y - top_y + 1, 6, 1, corners);
+    }
+
+  pgtk_end_cr_clip (f);
+}
+
+/* Draw a box on frame F inside the rectangle given by LEFT_X, TOP_Y,
+   RIGHT_X, and BOTTOM_Y.  WIDTH is the thickness of the lines to
+   draw, it must be >= 0.  LEFT_P means draw a line on the
+   left side of the rectangle.  RIGHT_P means draw a line
+   on the right side of the rectangle.  CLIP_RECT is the clipping
+   rectangle to use when drawing.  */
+
+static void
+x_draw_box_rect (struct glyph_string *s,
+                int left_x, int top_y, int right_x, int bottom_y, int hwidth,
+                int vwidth, bool left_p, bool right_p,
+                XRectangle * clip_rect)
+{
+  unsigned long foreground_backup;
+
+  cairo_t *cr = pgtk_begin_cr_clip (s->f);
+
+  foreground_backup = s->xgcv.foreground;
+  s->xgcv.foreground = s->face->box_color;
+
+  x_set_clip_rectangles (s->f, cr, clip_rect, 1);
+
+  /* Top.  */
+  pgtk_fill_rectangle (s->f, s->xgcv.foreground,
+                      left_x, top_y, right_x - left_x + 1, hwidth);
+
+  /* Left.  */
+  if (left_p)
+    pgtk_fill_rectangle (s->f, s->xgcv.foreground,
+                        left_x, top_y, vwidth, bottom_y - top_y + 1);
+
+  /* Bottom.  */
+  pgtk_fill_rectangle (s->f, s->xgcv.foreground,
+                      left_x, bottom_y - hwidth + 1, right_x - left_x + 1,
+                      hwidth);
+
+  /* Right.  */
+  if (right_p)
+    pgtk_fill_rectangle (s->f, s->xgcv.foreground,
+                        right_x - vwidth + 1, top_y, vwidth,
+                        bottom_y - top_y + 1);
+
+  s->xgcv.foreground = foreground_backup;
+
+  pgtk_end_cr_clip (s->f);
+}
+
+
+/* Draw a box around glyph string S.  */
+
+static void
+x_draw_glyph_string_box (struct glyph_string *s)
+{
+  int hwidth, vwidth, left_x, right_x, top_y, bottom_y, last_x;
+  bool raised_p, left_p, right_p;
+  struct glyph *last_glyph;
+  XRectangle clip_rect;
+
+  last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
+           ? WINDOW_RIGHT_EDGE_X (s->w) : window_box_right (s->w, s->area));
+
+  /* The glyph that may have a right box line.  */
+  last_glyph = (s->cmp || s->img
+               ? s->first_glyph : s->first_glyph + s->nchars - 1);
+
+  vwidth = eabs (s->face->box_vertical_line_width);
+  hwidth = eabs (s->face->box_horizontal_line_width);
+  raised_p = s->face->box == FACE_RAISED_BOX;
+  left_x = s->x;
+  right_x = (s->row->full_width_p && s->extends_to_end_of_line_p
+            ? last_x - 1 : min (last_x, s->x + s->background_width) - 1);
+  top_y = s->y;
+  bottom_y = top_y + s->height - 1;
+
+  left_p = (s->first_glyph->left_box_line_p
+           || (s->hl == DRAW_MOUSE_FACE
+               && (s->prev == NULL || s->prev->hl != s->hl)));
+  right_p = (last_glyph->right_box_line_p
+            || (s->hl == DRAW_MOUSE_FACE
+                && (s->next == NULL || s->next->hl != s->hl)));
+
+  get_glyph_string_clip_rect (s, &clip_rect);
+
+  if (s->face->box == FACE_SIMPLE_BOX)
+    x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, hwidth,
+                    vwidth, left_p, right_p, &clip_rect);
+  else
+    {
+      x_setup_relief_colors (s);
+      x_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y, hwidth,
+                         vwidth, raised_p, true, true, left_p, right_p,
+                         &clip_rect);
+    }
+}
+
+static void
+x_get_scale_factor (int *scale_x, int *scale_y)
+{
+  *scale_x = *scale_y = 1;
+}
+
+static void
+x_draw_horizontal_wave (struct frame *f, unsigned long color, int x, int y,
+                       int width, int height, int wave_length)
+{
+  cairo_t *cr;
+  double dx = wave_length, dy = height - 1;
+  int xoffset, n;
+
+  cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, color);
+  cairo_rectangle (cr, x, y, width, height);
+  cairo_clip (cr);
+
+  if (x >= 0)
+    {
+      xoffset = x % (wave_length * 2);
+      if (xoffset == 0)
+       xoffset = wave_length * 2;
+    }
+  else
+    xoffset = x % (wave_length * 2) + wave_length * 2;
+  n = (width + xoffset) / wave_length + 1;
+  if (xoffset > wave_length)
+    {
+      xoffset -= wave_length;
+      --n;
+      y += height - 1;
+      dy = -dy;
+    }
+
+  cairo_move_to (cr, x - xoffset + 0.5, y + 0.5);
+  while (--n >= 0)
+    {
+      cairo_rel_line_to (cr, dx, dy);
+      dy = -dy;
+    }
+  cairo_set_line_width (cr, 1);
+  cairo_stroke (cr);
+  pgtk_end_cr_clip (f);
+}
+
+/*
+   Draw a wavy line under S. The wave fills wave_height pixels from y0.
+
+                    x0         wave_length = 2
+                                 --
+                y0   *   *   *   *   *
+                     |* * * * * * * * *
+    wave_height = 3  | *   *   *   *
+
+*/
+static void
+x_draw_underwave (struct glyph_string *s, unsigned long color)
+{
+  /* Adjust for scale/HiDPI.  */
+  int scale_x, scale_y;
+
+  x_get_scale_factor (&scale_x, &scale_y);
+
+  int wave_height = 3 * scale_y, wave_length = 2 * scale_x;
+
+  x_draw_horizontal_wave (s->f, color, s->x, s->ybase - wave_height + 3,
+                         s->width, wave_height, wave_length);
+}
+
+/* Draw a relief around the image glyph string S.  */
+
+static void
+x_draw_image_relief (struct glyph_string *s)
+{
+  int x1, y1, thick;
+  bool raised_p, top_p, bot_p, left_p, right_p;
+  int extra_x, extra_y;
+  XRectangle r;
+  int x = s->x;
+  int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
+
+  /* If first glyph of S has a left box line, start drawing it to the
+     right of that line.  */
+  if (s->face->box != FACE_NO_BOX
+      && s->first_glyph->left_box_line_p
+      && s->slice.x == 0)
+    x += max (s->face->box_vertical_line_width, 0);
+
+  /* If there is a margin around the image, adjust x- and y-position
+     by that margin.  */
+  if (s->slice.x == 0)
+    x += s->img->hmargin;
+  if (s->slice.y == 0)
+    y += s->img->vmargin;
+
+  if (s->hl == DRAW_IMAGE_SUNKEN
+      || s->hl == DRAW_IMAGE_RAISED)
+    {
+      if (s->face->id == TAB_BAR_FACE_ID)
+       thick = (tab_bar_button_relief < 0
+                ? DEFAULT_TAB_BAR_BUTTON_RELIEF
+                : min (tab_bar_button_relief, 1000000));
+      else
+       thick = (tool_bar_button_relief < 0
+                ? DEFAULT_TOOL_BAR_BUTTON_RELIEF
+                : min (tool_bar_button_relief, 1000000));
+      raised_p = s->hl == DRAW_IMAGE_RAISED;
+    }
+  else
+    {
+      thick = eabs (s->img->relief);
+      raised_p = s->img->relief > 0;
+    }
+
+  x1 = x + s->slice.width - 1;
+  y1 = y + s->slice.height - 1;
+
+  extra_x = extra_y = 0;
+  if (s->face->id == TAB_BAR_FACE_ID)
+    {
+      if (CONSP (Vtab_bar_button_margin)
+         && FIXNUMP (XCAR (Vtab_bar_button_margin))
+         && FIXNUMP (XCDR (Vtab_bar_button_margin)))
+       {
+         extra_x = XFIXNUM (XCAR (Vtab_bar_button_margin)) - thick;
+         extra_y = XFIXNUM (XCDR (Vtab_bar_button_margin)) - thick;
+       }
+      else if (FIXNUMP (Vtab_bar_button_margin))
+       extra_x = extra_y = XFIXNUM (Vtab_bar_button_margin) - thick;
+    }
+
+  if (s->face->id == TOOL_BAR_FACE_ID)
+    {
+      if (CONSP (Vtool_bar_button_margin)
+         && FIXNUMP (XCAR (Vtool_bar_button_margin))
+         && FIXNUMP (XCDR (Vtool_bar_button_margin)))
+       {
+         extra_x = XFIXNUM (XCAR (Vtool_bar_button_margin));
+         extra_y = XFIXNUM (XCDR (Vtool_bar_button_margin));
+       }
+      else if (FIXNUMP (Vtool_bar_button_margin))
+       extra_x = extra_y = XFIXNUM (Vtool_bar_button_margin);
+    }
+
+  top_p = bot_p = left_p = right_p = false;
+
+  if (s->slice.x == 0)
+    x -= thick + extra_x, left_p = true;
+  if (s->slice.y == 0)
+    y -= thick + extra_y, top_p = true;
+  if (s->slice.x + s->slice.width == s->img->width)
+    x1 += thick + extra_x, right_p = true;
+  if (s->slice.y + s->slice.height == s->img->height)
+    y1 += thick + extra_y, bot_p = true;
+
+  x_setup_relief_colors (s);
+  get_glyph_string_clip_rect (s, &r);
+  x_draw_relief_rect (s->f, x, y, x1, y1, thick, thick, raised_p,
+                     top_p, bot_p, left_p, right_p, &r);
+}
+
+/* Draw part of the background of glyph string S.  X, Y, W, and H
+   give the rectangle to draw.  */
+
+static void
+x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w,
+                            int h)
+{
+  if (s->stippled_p)
+    {
+      /* Fill background with a stipple pattern.  */
+
+      fill_background (s, x, y, w, h);
+    }
+  else
+    x_clear_glyph_string_rect (s, x, y, w, h);
+}
+
+static void
+x_cr_draw_image (struct frame *f, Emacs_GC *gc, cairo_pattern_t *image,
+                int src_x, int src_y, int width, int height,
+                int dest_x, int dest_y, bool overlay_p)
+{
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+
+  if (overlay_p)
+    cairo_rectangle (cr, dest_x, dest_y, width, height);
+  else
+    {
+      pgtk_set_cr_source_with_gc_background (f, gc);
+      cairo_rectangle (cr, dest_x, dest_y, width, height);
+      cairo_fill_preserve (cr);
+    }
+
+  cairo_translate (cr, dest_x - src_x, dest_y - src_y);
+
+  cairo_surface_t *surface;
+  cairo_pattern_get_surface (image, &surface);
+  cairo_format_t format = cairo_image_surface_get_format (surface);
+  if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1)
+    {
+      cairo_set_source (cr, image);
+      cairo_fill (cr);
+    }
+  else
+    {
+      pgtk_set_cr_source_with_gc_foreground (f, gc);
+      cairo_clip (cr);
+      cairo_mask (cr, image);
+    }
+
+  pgtk_end_cr_clip (f);
+}
+
+/* Draw foreground of image glyph string S.  */
+
+static void
+x_draw_image_foreground (struct glyph_string *s)
+{
+  int x = s->x;
+  int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
+
+  /* If first glyph of S has a left box line, start drawing it to the
+     right of that line.  */
+  if (s->face->box != FACE_NO_BOX
+      && s->first_glyph->left_box_line_p
+      && s->slice.x == 0)
+    x += max (s->face->box_vertical_line_width, 0);
+
+  /* If there is a margin around the image, adjust x- and y-position
+     by that margin.  */
+  if (s->slice.x == 0)
+    x += s->img->hmargin;
+  if (s->slice.y == 0)
+    y += s->img->vmargin;
+
+  if (s->img->cr_data)
+    {
+      cairo_t *cr = pgtk_begin_cr_clip (s->f);
+      x_set_glyph_string_clipping (s, cr);
+      x_cr_draw_image (s->f, &s->xgcv, s->img->cr_data,
+                      s->slice.x, s->slice.y, s->slice.width, s->slice.height,
+                      x, y, true);
+      if (!s->img->mask)
+       {
+         /* When the image has a mask, we can expect that at
+            least part of a mouse highlight or a block cursor will
+            be visible.  If the image doesn't have a mask, make
+            a block cursor visible by drawing a rectangle around
+            the image.  I believe it's looking better if we do
+            nothing here for mouse-face.  */
+         if (s->hl == DRAW_CURSOR)
+           {
+             int relief = eabs (s->img->relief);
+             pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief, y - 
relief,
+                                  s->slice.width + relief*2 - 1,
+                                  s->slice.height + relief*2 - 1);
+           }
+       }
+      pgtk_end_cr_clip (s->f);
+    }
+  else
+    /* Draw a rectangle if image could not be loaded.  */
+    pgtk_draw_rectangle (s->f, s->xgcv.foreground, x, y,
+                        s->slice.width - 1, s->slice.height - 1);
+}
+
+/* Draw image glyph string S.
+
+            s->y
+   s->x      +-------------------------
+            |   s->face->box
+            |
+            |     +-------------------------
+            |     |  s->img->margin
+            |     |
+            |     |       +-------------------
+            |     |       |  the image
+
+ */
+
+static void
+x_draw_image_glyph_string (struct glyph_string *s)
+{
+  int box_line_hwidth = max (s->face->box_vertical_line_width, 0);
+  int box_line_vwidth = max (s->face->box_horizontal_line_width, 0);
+  int height;
+
+  height = s->height;
+  if (s->slice.y == 0)
+    height -= box_line_vwidth;
+  if (s->slice.y + s->slice.height >= s->img->height)
+    height -= box_line_vwidth;
+
+  /* Fill background with face under the image.  Do it only if row is
+     taller than image or if image has a clip mask to reduce
+     flickering.  */
+  s->stippled_p = s->face->stipple != 0;
+  if (height > s->slice.height
+      || s->img->hmargin
+      || s->img->vmargin
+      || s->img->mask
+      || s->img->pixmap == 0
+      || s->width != s->background_width)
+    {
+       {
+         int x = s->x;
+         int y = s->y;
+         int width = s->background_width;
+
+         if (s->first_glyph->left_box_line_p
+             && s->slice.x == 0)
+           {
+             x += box_line_hwidth;
+             width -= box_line_hwidth;
+           }
+
+         if (s->slice.y == 0)
+           y += box_line_vwidth;
+
+         x_draw_glyph_string_bg_rect (s, x, y, width, height);
+       }
+
+      s->background_filled_p = true;
+    }
+
+  /* Draw the foreground.  */
+  x_draw_image_foreground (s);
+
+  /* If we must draw a relief around the image, do it.  */
+  if (s->img->relief
+      || s->hl == DRAW_IMAGE_RAISED
+      || s->hl == DRAW_IMAGE_SUNKEN)
+    x_draw_image_relief (s);
+}
+
+/* Draw stretch glyph string S.  */
+
+static void
+x_draw_stretch_glyph_string (struct glyph_string *s)
+{
+  eassert (s->first_glyph->type == STRETCH_GLYPH);
+
+  if (s->hl == DRAW_CURSOR && !x_stretch_cursor_p)
+    {
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+         wide as the stretch glyph.  */
+      int width, background_width = s->background_width;
+      int x = s->x;
+
+      if (!s->row->reversed_p)
+       {
+         int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+       }
+      else
+       {
+         /* In R2L rows, draw the cursor on the right edge of the
+            stretch glyph.  */
+         int right_x = window_box_right (s->w, TEXT_AREA);
+
+         if (x + background_width > right_x)
+           background_width -= x - right_x;
+         x += background_width;
+       }
+      width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+       x -= width;
+
+      /* Draw cursor.  */
+      x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
+
+      /* Clear rest using the GC of the original non-cursor face.  */
+      if (width < background_width)
+       {
+         int y = s->y;
+         int w = background_width - width, h = s->height;
+         XRectangle r;
+         unsigned long color;
+
+         if (!s->row->reversed_p)
+           x += width;
+         else
+           x = s->x;
+         if (s->row->mouse_face_p && cursor_in_mouse_face_p (s->w))
+           {
+             x_set_mouse_face_gc (s);
+             color = s->xgcv.foreground;
+           }
+         else
+           color = s->face->background;
+
+         cairo_t *cr = pgtk_begin_cr_clip (s->f);
+
+         get_glyph_string_clip_rect (s, &r);
+         x_set_clip_rectangles (s->f, cr, &r, 1);
+
+         if (s->face->stipple)
+           {
+             /* Fill background with a stipple pattern.  */
+             fill_background (s, x, y, w, h);
+           }
+         else
+           {
+             pgtk_fill_rectangle (s->f, color, x, y, w, h);
+           }
+
+         pgtk_end_cr_clip (s->f);
+       }
+    }
+  else if (!s->background_filled_p)
+    {
+      int background_width = s->background_width;
+      int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      /* Don't draw into left fringe or scrollbar area except for
+         header line and mode line.  */
+      if (x < text_left_x && !s->row->mode_line_p)
+       {
+         int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w);
+         int right_x = text_left_x;
+
+         if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
+           left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w);
+         else
+           right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w);
+
+         /* Adjust X and BACKGROUND_WIDTH to fit inside the space
+            between LEFT_X and RIGHT_X.  */
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+         if (x + background_width > right_x)
+           background_width = right_x - x;
+       }
+      if (background_width > 0)
+       x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
+    }
+
+  s->background_filled_p = true;
+}
+
+static void
+pgtk_draw_glyph_string (struct glyph_string *s)
+{
+  bool relief_drawn_p = false;
+
+  /* If S draws into the background of its successors, draw the
+     background of the successors first so that S can draw into it.
+     This makes S->next use XDrawString instead of XDrawImageString.  */
+  if (s->next && s->right_overhang && !s->for_overlaps)
+    {
+      int width;
+      struct glyph_string *next;
+
+      for (width = 0, next = s->next;
+          next && width < s->right_overhang;
+          width += next->width, next = next->next)
+       if (next->first_glyph->type != IMAGE_GLYPH)
+         {
+           cairo_t *cr = pgtk_begin_cr_clip (next->f);
+           x_set_glyph_string_gc (next);
+           x_set_glyph_string_clipping (next, cr);
+           if (next->first_glyph->type == STRETCH_GLYPH)
+             x_draw_stretch_glyph_string (next);
+           else
+             x_draw_glyph_string_background (next, true);
+           next->num_clips = 0;
+           pgtk_end_cr_clip (next->f);
+         }
+    }
+
+  /* Set up S->gc, set clipping and draw S.  */
+  x_set_glyph_string_gc (s);
+
+  cairo_t *cr = pgtk_begin_cr_clip (s->f);
+
+  /* Draw relief (if any) in advance for char/composition so that the
+     glyph string can be drawn over it.  */
+  if (!s->for_overlaps
+      && s->face->box != FACE_NO_BOX
+      && (s->first_glyph->type == CHAR_GLYPH
+         || s->first_glyph->type == COMPOSITE_GLYPH))
+
+    {
+      x_set_glyph_string_clipping (s, cr);
+      x_draw_glyph_string_background (s, true);
+      x_draw_glyph_string_box (s);
+      x_set_glyph_string_clipping (s, cr);
+      relief_drawn_p = true;
+    }
+  else if (!s->clip_head       /* draw_glyphs didn't specify a clip mask. */
+          && !s->clip_tail
+          && ((s->prev && s->prev->hl != s->hl && s->left_overhang)
+              || (s->next && s->next->hl != s->hl && s->right_overhang)))
+    /* We must clip just this glyph.  left_overhang part has already
+       drawn when s->prev was drawn, and right_overhang part will be
+       drawn later when s->next is drawn. */
+      x_set_glyph_string_clipping_exactly (s, s, cr);
+  else
+      x_set_glyph_string_clipping (s, cr);
+
+  switch (s->first_glyph->type)
+    {
+    case IMAGE_GLYPH:
+      x_draw_image_glyph_string (s);
+      break;
+
+    case XWIDGET_GLYPH:
+      x_draw_xwidget_glyph_string (s);
+      break;
+
+    case STRETCH_GLYPH:
+      x_draw_stretch_glyph_string (s);
+      break;
+
+    case CHAR_GLYPH:
+      if (s->for_overlaps)
+       s->background_filled_p = true;
+      else
+       x_draw_glyph_string_background (s, false);
+      x_draw_glyph_string_foreground (s);
+      break;
+
+    case COMPOSITE_GLYPH:
+      if (s->for_overlaps || (s->cmp_from > 0
+                             && !s->first_glyph->u.cmp.automatic))
+       s->background_filled_p = true;
+      else
+       x_draw_glyph_string_background (s, true);
+      x_draw_composite_glyph_string_foreground (s);
+      break;
+
+    case GLYPHLESS_GLYPH:
+      if (s->for_overlaps)
+       s->background_filled_p = true;
+      else
+       x_draw_glyph_string_background (s, true);
+      x_draw_glyphless_glyph_string_foreground (s);
+      break;
+
+    default:
+      emacs_abort ();
+    }
+
+  if (!s->for_overlaps)
+    {
+      /* Draw relief if not yet drawn.  */
+      if (!relief_drawn_p && s->face->box != FACE_NO_BOX)
+       x_draw_glyph_string_box (s);
+
+      /* Draw underline.  */
+      if (s->face->underline)
+       {
+         if (s->face->underline == FACE_UNDER_WAVE)
+           {
+             if (s->face->underline_defaulted_p)
+               x_draw_underwave (s, s->xgcv.foreground);
+             else
+               {
+                 x_draw_underwave (s, s->face->underline_color);
+               }
+           }
+         else if (s->face->underline == FACE_UNDER_LINE)
+           {
+             unsigned long thickness, position;
+             int y;
+
+             if (s->prev && s->prev->face->underline
+                 && s->prev->face->underline == FACE_UNDER_LINE)
+               {
+                 /* We use the same underline style as the previous one.  */
+                 thickness = s->prev->underline_thickness;
+                 position = s->prev->underline_position;
+               }
+             else
+               {
+                 struct font *font = font_for_underline_metrics (s);
+
+                 /* Get the underline thickness.  Default is 1 pixel.  */
+                 if (font && font->underline_thickness > 0)
+                   thickness = font->underline_thickness;
+                 else
+                   thickness = 1;
+                 if (x_underline_at_descent_line)
+                   position = (s->height - thickness) - (s->ybase - s->y);
+                 else
+                   {
+                     /* Get the underline position.  This is the recommended
+                        vertical offset in pixels from the baseline to the top 
of
+                        the underline.  This is a signed value according to the
+                        specs, and its default is
+
+                        ROUND ((maximum descent) / 2), with
+                        ROUND(x) = floor (x + 0.5)  */
+
+                     if (x_use_underline_position_properties
+                         && font && font->underline_position >= 0)
+                       position = font->underline_position;
+                     else if (font)
+                       position = (font->descent + 1) / 2;
+                     else
+                       position = underline_minimum_offset;
+                   }
+                 position = max (position, underline_minimum_offset);
+               }
+             /* Check the sanity of thickness and position.  We should
+                avoid drawing underline out of the current line area.  */
+             if (s->y + s->height <= s->ybase + position)
+               position = (s->height - 1) - (s->ybase - s->y);
+             if (s->y + s->height < s->ybase + position + thickness)
+               thickness = (s->y + s->height) - (s->ybase + position);
+             s->underline_thickness = thickness;
+             s->underline_position = position;
+             y = s->ybase + position;
+             if (s->face->underline_defaulted_p)
+               pgtk_fill_rectangle (s->f, s->xgcv.foreground,
+                                    s->x, y, s->width, thickness);
+             else
+               {
+                 pgtk_fill_rectangle (s->f, s->face->underline_color,
+                                      s->x, y, s->width, thickness);
+               }
+           }
+       }
+      /* Draw overline.  */
+      if (s->face->overline_p)
+       {
+         unsigned long dy = 0, h = 1;
+
+         if (s->face->overline_color_defaulted_p)
+           pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, s->y + dy,
+                                s->width, h);
+         else
+           {
+             pgtk_fill_rectangle (s->f, s->face->overline_color, s->x,
+                                  s->y + dy, s->width, h);
+           }
+       }
+
+      /* Draw strike-through.  */
+      if (s->face->strike_through_p)
+       {
+         /* Y-coordinate and height of the glyph string's first
+            glyph.  We cannot use s->y and s->height because those
+            could be larger if there are taller display elements
+            (e.g., characters displayed with a larger font) in the
+            same glyph row.  */
+         int glyph_y = s->ybase - s->first_glyph->ascent;
+         int glyph_height = s->first_glyph->ascent + s->first_glyph->descent;
+         /* Strike-through width and offset from the glyph string's
+            top edge.  */
+          unsigned long h = 1;
+          unsigned long dy = (glyph_height - h) / 2;
+
+         if (s->face->strike_through_color_defaulted_p)
+           pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, glyph_y + dy,
+                                s->width, h);
+         else
+           {
+             pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x,
+                                  glyph_y + dy, s->width, h);
+           }
+       }
+
+      if (s->prev)
+       {
+         struct glyph_string *prev;
+
+         for (prev = s->prev; prev; prev = prev->prev)
+           if (prev->hl != s->hl
+               && prev->x + prev->width + prev->right_overhang > s->x)
+             {
+               /* As prev was drawn while clipped to its own area, we
+                  must draw the right_overhang part using s->hl now.  */
+               enum draw_glyphs_face save = prev->hl;
+
+               prev->hl = s->hl;
+               x_set_glyph_string_gc (prev);
+               cairo_save (cr);
+               x_set_glyph_string_clipping_exactly (s, prev, cr);
+               if (prev->first_glyph->type == CHAR_GLYPH)
+                 x_draw_glyph_string_foreground (prev);
+               else
+                 x_draw_composite_glyph_string_foreground (prev);
+               prev->hl = save;
+               prev->num_clips = 0;
+               cairo_restore (cr);
+             }
+       }
+
+      if (s->next)
+       {
+         struct glyph_string *next;
+
+         for (next = s->next; next; next = next->next)
+           if (next->hl != s->hl
+               && next->x - next->left_overhang < s->x + s->width)
+             {
+               /* As next will be drawn while clipped to its own area,
+                  we must draw the left_overhang part using s->hl now.  */
+               enum draw_glyphs_face save = next->hl;
+
+               next->hl = s->hl;
+               x_set_glyph_string_gc (next);
+               cairo_save (cr);
+               x_set_glyph_string_clipping_exactly (s, next, cr);
+               if (next->first_glyph->type == CHAR_GLYPH)
+                 x_draw_glyph_string_foreground (next);
+               else
+                 x_draw_composite_glyph_string_foreground (next);
+               cairo_restore (cr);
+               next->hl = save;
+               next->num_clips = 0;
+               next->clip_head = s->next;
+             }
+       }
+    }
+
+  /* Reset clipping.  */
+  pgtk_end_cr_clip (s->f);
+  s->num_clips = 0;
+}
+
+/* RIF: Define cursor CURSOR on frame F.  */
+
+static void
+pgtk_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
+{
+  if (!f->pointer_invisible && FRAME_X_OUTPUT (f)->current_cursor != cursor)
+    gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
+                          cursor);
+  FRAME_X_OUTPUT (f)->current_cursor = cursor;
+}
+
+static void
+pgtk_after_update_window_line (struct window *w,
+                              struct glyph_row *desired_row)
+{
+  struct frame *f;
+  int width, height;
+
+  /* begin copy from other terms */
+  eassert (w);
+
+  if (!desired_row->mode_line_p && !w->pseudo_window_p)
+    desired_row->redraw_fringe_bitmaps_p = 1;
+
+  /* When a window has disappeared, make sure that no rest of
+     full-width rows stays visible in the internal border.  */
+  if (windows_or_buffers_changed
+      && desired_row->full_width_p
+      && (f = XFRAME (w->frame),
+         width = FRAME_INTERNAL_BORDER_WIDTH (f),
+         width != 0) && (height = desired_row->visible_height, height > 0))
+    {
+      int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
+
+      block_input ();
+      pgtk_clear_frame_area (f, 0, y, width, height);
+      pgtk_clear_frame_area (f,
+                            FRAME_PIXEL_WIDTH (f) - width, y, width, height);
+      unblock_input ();
+    }
+}
+
+static void
+pgtk_clear_frame_area (struct frame *f, int x, int y, int width, int height)
+{
+  pgtk_clear_area (f, x, y, width, height);
+}
+
+/* Draw a hollow box cursor on window W in glyph row ROW.  */
+
+static void
+x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  int x, y, wd, h;
+  struct glyph *cursor_glyph;
+
+  /* Get the glyph the cursor is on.  If we can't tell because
+     the current matrix is invalid or such, give up.  */
+  cursor_glyph = get_phys_cursor_glyph (w);
+  if (cursor_glyph == NULL)
+    return;
+
+  /* Compute frame-relative coordinates for phys cursor.  */
+  get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h);
+  wd = w->phys_cursor_width - 1;
+
+  /* The foreground of cursor_gc is typically the same as the normal
+     background color, which can cause the cursor box to be invisible.  */
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, FRAME_X_OUTPUT (f)->cursor_color);
+
+  /* When on R2L character, show cursor at the right edge of the
+     glyph, unless the cursor box is as wide as the glyph or wider
+     (the latter happens when x-stretch-cursor is non-nil).  */
+  if ((cursor_glyph->resolved_level & 1) != 0
+      && cursor_glyph->pixel_width > wd)
+    {
+      x += cursor_glyph->pixel_width - wd;
+      if (wd > 0)
+       wd -= 1;
+    }
+  /* Set clipping, draw the rectangle, and reset clipping again.  */
+  pgtk_clip_to_row (w, row, TEXT_AREA, cr);
+  pgtk_draw_rectangle (f, FRAME_X_OUTPUT (f)->cursor_color, x, y, wd, h - 1);
+  pgtk_end_cr_clip (f);
+}
+
+/* Draw a bar cursor on window W in glyph row ROW.
+
+   Implementation note: One would like to draw a bar cursor with an
+   angle equal to the one given by the font property XA_ITALIC_ANGLE.
+   Unfortunately, I didn't find a font yet that has this property set.
+   --gerd.  */
+
+static void
+x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width,
+                  enum text_cursor_kinds kind)
+{
+  struct frame *f = XFRAME (w->frame);
+  struct glyph *cursor_glyph;
+
+  /* If cursor is out of bounds, don't draw garbage.  This can happen
+     in mini-buffer windows when switching between echo area glyphs
+     and mini-buffer.  */
+  cursor_glyph = get_phys_cursor_glyph (w);
+  if (cursor_glyph == NULL)
+    return;
+
+  /* Experimental avoidance of cursor on xwidget.  */
+  if (cursor_glyph->type == XWIDGET_GLYPH)
+    return;
+
+  /* If on an image, draw like a normal cursor.  That's usually better
+     visible than drawing a bar, esp. if the image is large so that
+     the bar might not be in the window.  */
+  if (cursor_glyph->type == IMAGE_GLYPH)
+    {
+      struct glyph_row *r;
+      r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos);
+      draw_phys_cursor_glyph (w, r, DRAW_CURSOR);
+    }
+  else
+    {
+      struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id);
+      unsigned long color;
+
+      cairo_t *cr = pgtk_begin_cr_clip (f);
+
+      /* If the glyph's background equals the color we normally draw
+         the bars cursor in, the bar cursor in its normal color is
+         invisible.  Use the glyph's foreground color instead in this
+         case, on the assumption that the glyph's colors are chosen so
+         that the glyph is legible.  */
+      if (face->background == FRAME_X_OUTPUT (f)->cursor_color)
+       color = face->foreground;
+      else
+       color = FRAME_X_OUTPUT (f)->cursor_color;
+
+      pgtk_clip_to_row (w, row, TEXT_AREA, cr);
+
+      if (kind == BAR_CURSOR)
+       {
+         int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
+
+         if (width < 0)
+           width = FRAME_CURSOR_WIDTH (f);
+         width = min (cursor_glyph->pixel_width, width);
+
+         w->phys_cursor_width = width;
+
+         /* If the character under cursor is R2L, draw the bar cursor
+            on the right of its glyph, rather than on the left.  */
+         if ((cursor_glyph->resolved_level & 1) != 0)
+           x += cursor_glyph->pixel_width - width;
+
+         pgtk_fill_rectangle (f, color, x,
+                              WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
+                              width, row->height);
+       }
+      else                     /* HBAR_CURSOR */
+       {
+         int dummy_x, dummy_y, dummy_h;
+         int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
+
+         if (width < 0)
+           width = row->height;
+
+         width = min (row->height, width);
+
+         get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
+                                   &dummy_y, &dummy_h);
+
+         if ((cursor_glyph->resolved_level & 1) != 0
+             && cursor_glyph->pixel_width > w->phys_cursor_width - 1)
+           x += cursor_glyph->pixel_width - w->phys_cursor_width + 1;
+         pgtk_fill_rectangle (f, color, x,
+                              WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
+                                                       row->height - width),
+                              w->phys_cursor_width - 1, width);
+       }
+
+      pgtk_end_cr_clip (f);
+    }
+}
+
+/* RIF: Draw cursor on window W.  */
+
+static void
+pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
+                        int y, enum text_cursor_kinds cursor_type,
+                        int cursor_width, bool on_p, bool active_p)
+{
+  struct frame *f = XFRAME (w->frame);
+  if (on_p)
+    {
+      w->phys_cursor_type = cursor_type;
+      w->phys_cursor_on_p = true;
+
+      if (glyph_row->exact_window_width_line_p
+         && (glyph_row->reversed_p
+             ? (w->phys_cursor.hpos < 0)
+             : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
+       {
+         glyph_row->cursor_in_fringe_p = true;
+         draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
+       }
+      else
+       {
+         switch (cursor_type)
+           {
+           case HOLLOW_BOX_CURSOR:
+             x_draw_hollow_cursor (w, glyph_row);
+             break;
+
+           case FILLED_BOX_CURSOR:
+             draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
+             break;
+
+           case BAR_CURSOR:
+             x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR);
+             break;
+
+           case HBAR_CURSOR:
+             x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR);
+             break;
+
+           case NO_CURSOR:
+             w->phys_cursor_width = 0;
+             break;
+
+           default:
+             emacs_abort ();
+           }
+       }
+
+      if (w == XWINDOW (f->selected_window))
+       {
+         int frame_x =
+           WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w);
+         int frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, y);
+         pgtk_im_set_cursor_location (f, frame_x, frame_y,
+                                      w->phys_cursor_width,
+                                      w->phys_cursor_height);
+       }
+    }
+
+}
+
+static void
+pgtk_copy_bits (struct frame *f, cairo_rectangle_t * src_rect,
+               cairo_rectangle_t * dst_rect)
+{
+  cairo_t *cr;
+  cairo_surface_t *surface;    /* temporary surface */
+
+  surface =
+    cairo_surface_create_similar (FRAME_CR_SURFACE (f),
+                                 CAIRO_CONTENT_COLOR_ALPHA,
+                                 (int) src_rect->width,
+                                 (int) src_rect->height);
+
+  cr = cairo_create (surface);
+  cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), -src_rect->x,
+                           -src_rect->y);
+  cairo_rectangle (cr, 0, 0, src_rect->width, src_rect->height);
+  cairo_clip (cr);
+  cairo_paint (cr);
+  cairo_destroy (cr);
+
+  cr = pgtk_begin_cr_clip (f);
+  cairo_set_source_surface (cr, surface, dst_rect->x, dst_rect->y);
+  cairo_rectangle (cr, dst_rect->x, dst_rect->y, dst_rect->width,
+                  dst_rect->height);
+  cairo_clip (cr);
+  cairo_paint (cr);
+  pgtk_end_cr_clip (f);
+
+  cairo_surface_destroy (surface);
+}
+
+/* Scroll part of the display as described by RUN.  */
+
+static void
+pgtk_scroll_run (struct window *w, struct run *run)
+{
+  struct frame *f = XFRAME (w->frame);
+  int x, y, width, height, from_y, to_y, bottom_y;
+
+  /* Get frame-relative bounding box of the text display area of W,
+     without mode lines.  Include in this box the left and right
+     fringe of W.  */
+  window_box (w, ANY_AREA, &x, &y, &width, &height);
+
+  from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
+  to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
+  bottom_y = y + height;
+
+  if (to_y < from_y)
+    {
+      /* Scrolling up.  Make sure we don't copy part of the mode
+         line at the bottom.  */
+      if (from_y + run->height > bottom_y)
+       height = bottom_y - from_y;
+      else
+       height = run->height;
+    }
+  else
+    {
+      /* Scrolling down.  Make sure we don't copy over the mode line.
+         at the bottom.  */
+      if (to_y + run->height > bottom_y)
+       height = bottom_y - to_y;
+      else
+       height = run->height;
+    }
+
+  block_input ();
+
+#ifdef HAVE_XWIDGETS
+  /* "Copy" xwidget views in the area that will be scrolled.  */
+  GtkWidget *tem, *parent = FRAME_GTK_WIDGET (f);
+  GList *children = gtk_container_get_children (GTK_CONTAINER (parent));
+  GList *iter;
+  struct xwidget_view *view;
+
+  for (iter = children; iter; iter = iter->next)
+    {
+      tem = iter->data;
+      view = g_object_get_data (G_OBJECT (tem), XG_XWIDGET_VIEW);
+
+      if (view && !view->hidden)
+       {
+         int window_y = view->y + view->clip_top;
+         int window_height = view->clip_bottom - view->clip_top;
+
+         Emacs_Rectangle r1, r2, result;
+         r1.x = w->pixel_left;
+         r1.y = from_y;
+         r1.width = w->pixel_width;
+         r1.height = height;
+         r2 = r1;
+         r2.y = window_y;
+         r2.height = window_height;
+
+         /* The window is offscreen, just unmap it.  */
+         if (window_height == 0)
+           {
+             view->hidden = true;
+             gtk_widget_hide (tem);
+             continue;
+           }
+
+         bool intersects_p =
+           gui_intersect_rectangles (&r1, &r2, &result);
+
+         if (XWINDOW (view->w) == w && intersects_p)
+           {
+             int y = view->y + (to_y - from_y);
+             int text_area_x, text_area_y, text_area_width, text_area_height;
+             int clip_top, clip_bottom;
+
+             window_box (w, view->area, &text_area_x, &text_area_y,
+                         &text_area_width, &text_area_height);
+
+             view->y = y;
+
+             clip_top = 0;
+             clip_bottom = XXWIDGET (view->model)->height;
+
+             if (y < text_area_y)
+               clip_top = text_area_y - y;
+
+             if ((y + clip_bottom) > (text_area_y + text_area_height))
+               {
+                 clip_bottom -= (y + clip_bottom) - (text_area_y + 
text_area_height);
+               }
+
+             view->clip_top = clip_top;
+             view->clip_bottom = clip_bottom;
+
+             /* This means the view has moved offscreen.  Unmap
+                it and hide it here.  */
+             if ((view->clip_bottom - view->clip_top) <= 0)
+               {
+                 view->hidden = true;
+                 gtk_widget_hide (tem);
+               }
+             else
+               {
+                 gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (f)),
+                                 tem, view->x + view->clip_left,
+                                 view->y + view->clip_top);
+                 gtk_widget_set_size_request (tem, view->clip_right - 
view->clip_left,
+                                              view->clip_bottom - 
view->clip_top);
+                 gtk_widget_queue_allocate (tem);
+               }
+           }
+       }
+    }
+
+  g_list_free (children);
+#endif
+
+  /* Cursor off.  Will be switched on again in x_update_window_end.  */
+  gui_clear_cursor (w);
+
+  {
+    cairo_rectangle_t src_rect = { x, from_y, width, height };
+    cairo_rectangle_t dst_rect = { x, to_y, width, height };
+    pgtk_copy_bits (f, &src_rect, &dst_rect);
+  }
+
+  unblock_input ();
+}
+
+/* Icons.  */
+
+/* Make the x-window of frame F use the gnu icon bitmap.  */
+
+static bool
+pgtk_bitmap_icon (struct frame *f, Lisp_Object file)
+{
+  ptrdiff_t bitmap_id;
+
+  if (FRAME_GTK_WIDGET (f) == 0)
+    return true;
+
+  /* Free up our existing icon bitmap and mask if any.  */
+  if (f->output_data.pgtk->icon_bitmap > 0)
+    image_destroy_bitmap (f, f->output_data.pgtk->icon_bitmap);
+  f->output_data.pgtk->icon_bitmap = 0;
+
+  if (STRINGP (file))
+    {
+      /* Use gtk_window_set_icon_from_file () if available,
+        It's not restricted to bitmaps */
+      if (xg_set_icon (f, file))
+       return false;
+      bitmap_id = image_create_bitmap_from_file (f, file);
+    }
+  else
+    {
+      /* Create the GNU bitmap and mask if necessary.  */
+      if (FRAME_DISPLAY_INFO (f)->icon_bitmap_id < 0)
+       {
+         ptrdiff_t rc = -1;
+
+          if (xg_set_icon (f, xg_default_icon_file)
+              || xg_set_icon_from_xpm_data (f, gnu_xpm_bits))
+            {
+              FRAME_DISPLAY_INFO (f)->icon_bitmap_id = -2;
+              return false;
+            }
+
+         /* If all else fails, use the (black and white) xbm image. */
+         if (rc == -1)
+           {
+              rc = image_create_bitmap_from_data (f,
+                                                  (char *) gnu_xbm_bits,
+                                                  gnu_xbm_width,
+                                                  gnu_xbm_height);
+             if (rc == -1)
+               return true;
+
+             FRAME_DISPLAY_INFO (f)->icon_bitmap_id = rc;
+           }
+       }
+
+      /* The first time we create the GNU bitmap and mask,
+        this increments the ref-count one extra time.
+        As a result, the GNU bitmap and mask are never freed.
+        That way, we don't have to worry about allocating it again.  */
+      image_reference_bitmap (f, FRAME_DISPLAY_INFO (f)->icon_bitmap_id);
+
+      bitmap_id = FRAME_DISPLAY_INFO (f)->icon_bitmap_id;
+    }
+
+  if (FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img != NULL)
+    {
+      gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                          FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img);
+    }
+  f->output_data.pgtk->icon_bitmap = bitmap_id;
+
+  return false;
+}
+
+
+/* Make the x-window of frame F use a rectangle with text.
+   Use ICON_NAME as the text.  */
+
+bool
+pgtk_text_icon (struct frame *f, const char *icon_name)
+{
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), NULL);
+      gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 
icon_name);
+    }
+
+  return false;
+}
+
+/***********************************************************************
+                   Starting and ending an update
+ ***********************************************************************/
+
+/* 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
+   each window being updated.  Currently, there is nothing to do here
+   because all interesting stuff is done on a window basis.  */
+
+static void
+pgtk_update_begin (struct frame *f)
+{
+  pgtk_clear_under_internal_border (f);
+}
+
+/* Draw a vertical window border from (x,y0) to (x,y1)  */
+
+static void
+pgtk_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  struct face *face;
+  cairo_t *cr;
+
+  cr = pgtk_begin_cr_clip (f);
+
+  face = FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID);
+  if (face)
+    pgtk_set_cr_source_with_color (f, face->foreground);
+
+  cairo_rectangle (cr, x, y0, 1, y1 - y0);
+  cairo_fill (cr);
+
+  pgtk_end_cr_clip (f);
+}
+
+/* Draw a window divider from (x0,y0) to (x1,y1)  */
+
+static void
+pgtk_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
+  struct face *face_first
+    = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
+  struct face *face_last
+    = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
+  unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f);
+  unsigned long color_first = (face_first
+                              ? face_first->foreground
+                              : FRAME_FOREGROUND_PIXEL (f));
+  unsigned long color_last = (face_last
+                             ? face_last->foreground
+                             : FRAME_FOREGROUND_PIXEL (f));
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+
+  if (y1 - y0 > x1 - x0 && x1 - x0 > 2)
+    /* Vertical.  */
+    {
+      pgtk_set_cr_source_with_color (f, color_first);
+      cairo_rectangle (cr, x0, y0, 1, y1 - y0);
+      cairo_fill (cr);
+      pgtk_set_cr_source_with_color (f, color);
+      cairo_rectangle (cr, x0 + 1, y0, x1 - x0 - 2, y1 - y0);
+      cairo_fill (cr);
+      pgtk_set_cr_source_with_color (f, color_last);
+      cairo_rectangle (cr, x1 - 1, y0, 1, y1 - y0);
+      cairo_fill (cr);
+    }
+  else if (x1 - x0 > y1 - y0 && y1 - y0 > 3)
+    /* Horizontal.  */
+    {
+      pgtk_set_cr_source_with_color (f, color_first);
+      cairo_rectangle (cr, x0, y0, x1 - x0, 1);
+      cairo_fill (cr);
+      pgtk_set_cr_source_with_color (f, color);
+      cairo_rectangle (cr, x0, y0 + 1, x1 - x0, y1 - y0 - 2);
+      cairo_fill (cr);
+      pgtk_set_cr_source_with_color (f, color_last);
+      cairo_rectangle (cr, x0, y1 - 1, x1 - x0, 1);
+      cairo_fill (cr);
+    }
+  else
+    {
+      pgtk_set_cr_source_with_color (f, color);
+      cairo_rectangle (cr, x0, y0, x1 - x0, y1 - y0);
+      cairo_fill (cr);
+    }
+
+  pgtk_end_cr_clip (f);
+}
+
+/* End update of frame F.  This function is installed as a hook in
+   update_end.  */
+
+static void
+pgtk_update_end (struct frame *f)
+{
+  /* Mouse highlight may be displayed again.  */
+  MOUSE_HL_INFO (f)->mouse_face_defer = false;
+}
+
+static void
+pgtk_frame_up_to_date (struct frame *f)
+{
+  block_input ();
+  FRAME_MOUSE_UPDATE (f);
+  if (!buffer_flipping_blocked_p ())
+    {
+      flip_cr_context (f);
+      gtk_widget_queue_draw (FRAME_GTK_WIDGET (f));
+    }
+  unblock_input ();
+}
+
+/* Return the current position of the mouse.
+   *FP should be a frame which indicates which display to ask about.
+
+   If the mouse movement started in a scroll bar, set *FP, *BAR_WINDOW,
+   and *PART to the frame, window, and scroll bar part that the mouse
+   is over.  Set *X and *Y to the portion and whole of the mouse's
+   position on the scroll bar.
+
+   If the mouse movement started elsewhere, set *FP to the frame the
+   mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell
+   the mouse is over.
+
+   Set *TIMESTAMP to the server time-stamp for the time at which the mouse
+   was at this position.
+
+   Don't store anything if we don't have a valid set of values to report.
+
+   This clears the mouse_moved flag, so we can wait for the next mouse
+   movement.  */
+
+static void
+pgtk_mouse_position (struct frame **fp, int insist, Lisp_Object * bar_window,
+                    enum scroll_bar_part *part, Lisp_Object * x,
+                    Lisp_Object * y, Time * timestamp)
+{
+  struct frame *f1;
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp);
+  int win_x, win_y;
+  GdkSeat *seat;
+  GdkDevice *device;
+  GdkModifierType mask;
+  GdkWindow *win;
+
+  block_input ();
+
+  Lisp_Object frame, tail;
+
+  /* Clear the mouse-moved flag for every frame on this display.  */
+  FOR_EACH_FRAME (tail, frame)
+    if (FRAME_PGTK_P (XFRAME (frame))
+       && FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp))
+    XFRAME (frame)->mouse_moved = false;
+
+  dpyinfo->last_mouse_scroll_bar = NULL;
+
+  if (gui_mouse_grabbed (dpyinfo))
+    {
+      /* 1.1. use last_mouse_frame as frame where the pointer is on. */
+      f1 = dpyinfo->last_mouse_frame;
+    }
+  else
+    {
+      f1 = *fp;
+      /* 1.2. get frame where the pointer is on. */
+      win = gtk_widget_get_window (FRAME_GTK_WIDGET (*fp));
+      seat = gdk_display_get_default_seat (dpyinfo->gdpy);
+      device = gdk_seat_get_pointer (seat);
+      win =
+       gdk_window_get_device_position (win, device, &win_x, &win_y, &mask);
+      if (win != NULL)
+       f1 = pgtk_any_window_to_frame (win);
+      else
+       {
+         /* crossing display server? */
+         f1 = SELECTED_FRAME ();
+       }
+    }
+
+  /* f1 can be a terminal frame. Bug#50322 */
+  if (f1 == NULL || !FRAME_PGTK_P (f1))
+    {
+      unblock_input ();
+      return;
+    }
+
+  /* 2. get the display and the device. */
+  win = gtk_widget_get_window (FRAME_GTK_WIDGET (f1));
+  GdkDisplay *gdpy = gdk_window_get_display (win);
+  seat = gdk_display_get_default_seat (gdpy);
+  device = gdk_seat_get_pointer (seat);
+
+  /* 3. get x, y relative to edit window of the frame. */
+  win = gdk_window_get_device_position (win, device, &win_x, &win_y, &mask);
+
+  if (f1 != NULL)
+    {
+      dpyinfo = FRAME_DISPLAY_INFO (f1);
+      remember_mouse_glyph (f1, win_x, win_y, &dpyinfo->last_mouse_glyph);
+      dpyinfo->last_mouse_glyph_frame = f1;
+
+      *bar_window = Qnil;
+      *part = 0;
+      *fp = f1;
+      XSETINT (*x, win_x);
+      XSETINT (*y, win_y);
+      *timestamp = dpyinfo->last_mouse_movement_time;
+    }
+
+  unblock_input ();
+}
+
+/* Fringe bitmaps.  */
+
+static int max_fringe_bmp = 0;
+static cairo_pattern_t **fringe_bmp = 0;
+
+static void
+pgtk_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd)
+{
+  int i, stride;
+  cairo_surface_t *surface;
+  unsigned char *data;
+  cairo_pattern_t *pattern;
+
+  if (which >= max_fringe_bmp)
+    {
+      i = max_fringe_bmp;
+      max_fringe_bmp = which + 20;
+      fringe_bmp =
+       (cairo_pattern_t **) xrealloc (fringe_bmp,
+                                      max_fringe_bmp *
+                                      sizeof (cairo_pattern_t *));
+      while (i < max_fringe_bmp)
+       fringe_bmp[i++] = 0;
+    }
+
+  block_input ();
+
+  surface = cairo_image_surface_create (CAIRO_FORMAT_A1, wd, h);
+  stride = cairo_image_surface_get_stride (surface);
+  data = cairo_image_surface_get_data (surface);
+
+  for (i = 0; i < h; i++)
+    {
+      *((unsigned short *) data) = bits[i];
+      data += stride;
+    }
+
+  cairo_surface_mark_dirty (surface);
+  pattern = cairo_pattern_create_for_surface (surface);
+  cairo_surface_destroy (surface);
+
+  unblock_input ();
+
+  fringe_bmp[which] = pattern;
+}
+
+static void
+pgtk_destroy_fringe_bitmap (int which)
+{
+  if (which >= max_fringe_bmp)
+    return;
+
+  if (fringe_bmp[which])
+    {
+      block_input ();
+      cairo_pattern_destroy (fringe_bmp[which]);
+      unblock_input ();
+    }
+  fringe_bmp[which] = 0;
+}
+
+static void
+pgtk_clip_to_row (struct window *w, struct glyph_row *row,
+                 enum glyph_row_area area, cairo_t * cr)
+{
+  int window_x, window_y, window_width;
+  cairo_rectangle_int_t rect;
+
+  window_box (w, area, &window_x, &window_y, &window_width, 0);
+
+  rect.x = window_x;
+  rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y));
+  rect.y = max (rect.y, window_y);
+  rect.width = window_width;
+  rect.height = row->visible_height;
+
+  cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
+  cairo_clip (cr);
+}
+
+static void
+pgtk_cr_draw_image (struct frame *f, Emacs_GC * gc, cairo_pattern_t * image,
+                   int src_x, int src_y, int width, int height,
+                   int dest_x, int dest_y, bool overlay_p)
+{
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+
+  if (overlay_p)
+    cairo_rectangle (cr, dest_x, dest_y, width, height);
+  else
+    {
+      pgtk_set_cr_source_with_gc_background (f, gc);
+      cairo_rectangle (cr, dest_x, dest_y, width, height);
+      cairo_fill_preserve (cr);
+    }
+  cairo_translate (cr, dest_x - src_x, dest_y - src_y);
+
+  cairo_surface_t *surface;
+  cairo_pattern_get_surface (image, &surface);
+  cairo_format_t format = cairo_image_surface_get_format (surface);
+  if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1)
+    {
+      cairo_set_source (cr, image);
+      cairo_fill (cr);
+    }
+  else
+    {
+      pgtk_set_cr_source_with_gc_foreground (f, gc);
+      cairo_clip (cr);
+      cairo_mask (cr, image);
+    }
+
+  pgtk_end_cr_clip (f);
+}
+
+static void
+pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
+                        struct draw_fringe_bitmap_params *p)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  struct face *face = p->face;
+
+  cairo_t *cr = pgtk_begin_cr_clip (f);
+
+  /* Must clip because of partially visible lines.  */
+  pgtk_clip_to_row (w, row, ANY_AREA, cr);
+
+  if (p->bx >= 0 && !p->overlay_p)
+    {
+      /* In case the same realized face is used for fringes and
+         for something displayed in the text (e.g. face `region' on
+         mono-displays, the fill style may have been changed to
+         FillSolid in x_draw_glyph_string_background.  */
+      if (face->stipple)
+       {
+         fill_background_by_face (f, face, p->bx, p->by, p->nx, p->ny);
+       }
+      else
+       {
+         pgtk_set_cr_source_with_color (f, face->background);
+         cairo_rectangle (cr, p->bx, p->by, p->nx, p->ny);
+         cairo_fill (cr);
+       }
+    }
+
+  if (p->which && p->which < max_fringe_bmp)
+    {
+      Emacs_GC gcv;
+
+      gcv.foreground = (p->cursor_p
+                       ? (p->overlay_p ? face->background
+                          : FRAME_X_OUTPUT (f)->cursor_color)
+                       : face->foreground);
+      gcv.background = face->background;
+      pgtk_cr_draw_image (f, &gcv, fringe_bmp[p->which], 0, p->dh,
+                         p->wd, p->h, p->x, p->y, p->overlay_p);
+    }
+
+  pgtk_end_cr_clip (f);
+}
+
+static struct atimer *hourglass_atimer = NULL;
+static int hourglass_enter_count = 0;
+
+static void
+hourglass_cb (struct atimer *timer)
+{
+ /*NOP*/}
+
+static void
+pgtk_show_hourglass (struct frame *f)
+{
+  struct pgtk_output *x = FRAME_X_OUTPUT (f);
+  if (x->hourglass_widget != NULL)
+    gtk_widget_destroy (x->hourglass_widget);
+  x->hourglass_widget = gtk_event_box_new ();  /* gtk_event_box is 
GDK_INPUT_ONLY. */
+  gtk_widget_set_has_window (x->hourglass_widget, true);
+  gtk_fixed_put (GTK_FIXED (FRAME_GTK_WIDGET (f)), x->hourglass_widget, 0, 0);
+  gtk_widget_show (x->hourglass_widget);
+  gtk_widget_set_size_request (x->hourglass_widget, 30000, 30000);
+  gdk_window_raise (gtk_widget_get_window (x->hourglass_widget));
+  gdk_window_set_cursor (gtk_widget_get_window (x->hourglass_widget),
+                        x->hourglass_cursor);
+
+  /* For cursor animation, we receive signals, set pending_signals, and 
dispatch. */
+  if (hourglass_enter_count++ == 0)
+    {
+      struct timespec ts = make_timespec (0, 50 * 1000 * 1000);
+      if (hourglass_atimer != NULL)
+       cancel_atimer (hourglass_atimer);
+      hourglass_atimer =
+       start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
+    }
+
+  /* Cursor frequently stops animation. gtk's bug? */
+}
+
+static void
+pgtk_hide_hourglass (struct frame *f)
+{
+  struct pgtk_output *x = FRAME_X_OUTPUT (f);
+  if (--hourglass_enter_count == 0)
+    {
+      if (hourglass_atimer != NULL)
+       {
+         cancel_atimer (hourglass_atimer);
+         hourglass_atimer = NULL;
+       }
+    }
+  if (x->hourglass_widget != NULL)
+    {
+      gtk_widget_destroy (x->hourglass_widget);
+      x->hourglass_widget = NULL;
+    }
+}
+
+/* Flushes changes to display.  */
+static void
+pgtk_flush_display (struct frame *f)
+{
+}
+
+extern frame_parm_handler pgtk_frame_parm_handlers[];
+
+static struct redisplay_interface pgtk_redisplay_interface = {
+  pgtk_frame_parm_handlers,
+  gui_produce_glyphs,
+  gui_write_glyphs,
+  gui_insert_glyphs,
+  gui_clear_end_of_line,
+  pgtk_scroll_run,
+  pgtk_after_update_window_line,
+  NULL, /* gui_update_window_begin, */
+  NULL, /* gui_update_window_end, */
+  pgtk_flush_display,
+  gui_clear_window_mouse_face,
+  gui_get_glyph_overhangs,
+  gui_fix_overlapping_area,
+  pgtk_draw_fringe_bitmap,
+  pgtk_define_fringe_bitmap,
+  pgtk_destroy_fringe_bitmap,
+  pgtk_compute_glyph_string_overhangs,
+  pgtk_draw_glyph_string,
+  pgtk_define_frame_cursor,
+  pgtk_clear_frame_area,
+  pgtk_clear_under_internal_border,
+  pgtk_draw_window_cursor,
+  pgtk_draw_vertical_window_border,
+  pgtk_draw_window_divider,
+  NULL,                                /* pgtk_shift_glyphs_for_insert, */
+  pgtk_show_hourglass,
+  pgtk_hide_hourglass,
+  pgtk_default_font_parameter,
+};
+
+static void
+pgtk_redraw_scroll_bars (struct frame *f)
+{
+}
+
+void
+pgtk_clear_frame (struct frame *f)
+/* --------------------------------------------------------------------------
+      External (hook): Erase the entire frame
+   -------------------------------------------------------------------------- 
*/
+{
+  /* comes on initial frame because we have
+     after-make-frame-functions = select-frame */
+  if (!FRAME_DEFAULT_FACE (f))
+    return;
+
+  /* mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); */
+
+  block_input ();
+
+  pgtk_clear_area (f, 0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
+
+  /* as of 2006/11 or so this is now needed */
+  pgtk_redraw_scroll_bars (f);
+  unblock_input ();
+}
+
+/* Invert the middle quarter of the frame for .15 sec.  */
+
+static void
+recover_from_visible_bell (struct atimer *timer)
+{
+  struct frame *f = timer->client_data;
+
+  if (FRAME_X_OUTPUT (f)->cr_surface_visible_bell != NULL)
+    {
+      cairo_surface_destroy (FRAME_X_OUTPUT (f)->cr_surface_visible_bell);
+      FRAME_X_OUTPUT (f)->cr_surface_visible_bell = NULL;
+    }
+
+  if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
+    FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
+}
+
+static void
+pgtk_flash (struct frame *f)
+{
+  block_input ();
+
+  {
+    cairo_surface_t *surface_orig = FRAME_CR_SURFACE (f);
+
+    int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
+    int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
+    cairo_surface_t *surface =
+      cairo_surface_create_similar (surface_orig, CAIRO_CONTENT_COLOR_ALPHA,
+                                   width, height);
+
+    cairo_t *cr = cairo_create (surface);
+    cairo_set_source_surface (cr, surface_orig, 0, 0);
+    cairo_rectangle (cr, 0, 0, width, height);
+    cairo_clip (cr);
+    cairo_paint (cr);
+
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
+
+    {
+      /* Get the height not including a menu bar widget.  */
+      int height = FRAME_PIXEL_HEIGHT (f);
+      /* Height of each line to flash.  */
+      int flash_height = FRAME_LINE_HEIGHT (f);
+      /* These will be the left and right margins of the rectangles.  */
+      int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
+      int flash_right =
+       FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
+      int width = flash_right - flash_left;
+
+      /* If window is tall, flash top and bottom line.  */
+      if (height > 3 * FRAME_LINE_HEIGHT (f))
+       {
+         cairo_rectangle (cr,
+                          flash_left,
+                          (FRAME_INTERNAL_BORDER_WIDTH (f)
+                           + FRAME_TOP_MARGIN_HEIGHT (f)),
+                          width, flash_height);
+         cairo_fill (cr);
+
+         cairo_rectangle (cr,
+                          flash_left,
+                          (height - flash_height
+                           - FRAME_INTERNAL_BORDER_WIDTH (f)),
+                          width, flash_height);
+         cairo_fill (cr);
+       }
+      else
+       {
+         /* If it is short, flash it all.  */
+         cairo_rectangle (cr,
+                          flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
+                          width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
+         cairo_fill (cr);
+       }
+
+      FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface;
+      {
+       struct timespec delay = make_timespec (0, 50 * 1000 * 1000);
+       if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
+         {
+           cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
+           FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
+         }
+       FRAME_X_OUTPUT (f)->atimer_visible_bell =
+         start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
+      }
+
+    }
+
+    cairo_destroy (cr);
+  }
+
+  unblock_input ();
+}
+
+/* Make audible bell.  */
+
+static void
+pgtk_ring_bell (struct frame *f)
+{
+  if (visible_bell)
+    {
+      pgtk_flash (f);
+    }
+  else
+    {
+      block_input ();
+      gtk_widget_error_bell (FRAME_GTK_WIDGET (f));
+      unblock_input ();
+    }
+}
+
+/* Read events coming from the X server.
+   Return as soon as there are no more events to be read.
+
+   Return the number of characters stored into the buffer,
+   thus pretending to be `read' (except the characters we store
+   in the keyboard buffer can be multibyte, so are not necessarily
+   C chars).  */
+
+static int
+pgtk_read_socket (struct terminal *terminal, struct input_event *hold_quit)
+{
+  GMainContext *context;
+  bool context_acquired = false;
+  int count;
+
+  count = evq_flush (hold_quit);
+  if (count > 0)
+    {
+      return count;
+    }
+
+  context = g_main_context_default ();
+  context_acquired = g_main_context_acquire (context);
+
+  block_input ();
+
+  if (context_acquired)
+    {
+      while (g_main_context_pending (context))
+       {
+         g_main_context_dispatch (context);
+       }
+    }
+
+  unblock_input ();
+
+  if (context_acquired)
+    g_main_context_release (context);
+
+  count = evq_flush (hold_quit);
+  if (count > 0)
+    {
+      return count;
+    }
+
+  return 0;
+}
+
+/* Lisp window being scrolled.  Set when starting to interact with
+   a toolkit scroll bar, reset to nil when ending the interaction.  */
+
+static Lisp_Object window_being_scrolled;
+
+static void
+pgtk_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part,
+                           int portion, int whole, bool horizontal)
+{
+  union buffered_input_event inev;
+
+  EVENT_INIT (inev.ie);
+
+  inev.ie.kind =
+    horizontal ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT : SCROLL_BAR_CLICK_EVENT;
+  inev.ie.frame_or_window = window;
+  inev.ie.arg = Qnil;
+  inev.ie.timestamp = 0;
+  inev.ie.code = 0;
+  inev.ie.part = part;
+  inev.ie.x = make_fixnum (portion);
+  inev.ie.y = make_fixnum (whole);
+  inev.ie.modifiers = 0;
+
+  evq_enqueue (&inev);
+}
+
+
+/* Scroll bar callback for GTK scroll bars.  WIDGET is the scroll
+   bar widget.  DATA is a pointer to the scroll_bar structure. */
+
+static gboolean
+xg_scroll_callback (GtkRange * range,
+                   GtkScrollType scroll, gdouble value, gpointer user_data)
+{
+  int whole = 0, portion = 0;
+  struct scroll_bar *bar = user_data;
+  enum scroll_bar_part part = scroll_bar_nowhere;
+  GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range));
+
+  if (xg_ignore_gtk_scrollbar)
+    return false;
+
+  switch (scroll)
+    {
+    case GTK_SCROLL_JUMP:
+#if 0
+      /* Buttons 1 2 or 3 must be grabbed.  */
+      if (FRAME_DISPLAY_INFO (f)->grabbed != 0
+          && FRAME_DISPLAY_INFO (f)->grabbed < (1 << 4))
+#endif
+        {
+         if (bar->horizontal)
+           {
+             part = scroll_bar_horizontal_handle;
+             whole = (int) (gtk_adjustment_get_upper (adj) -
+                            gtk_adjustment_get_page_size (adj));
+             portion = min ((int) value, whole);
+             bar->dragging = portion;
+           }
+         else
+           {
+             part = scroll_bar_handle;
+             whole = gtk_adjustment_get_upper (adj) -
+               gtk_adjustment_get_page_size (adj);
+             portion = min ((int) value, whole);
+             bar->dragging = portion;
+           }
+       }
+      break;
+    case GTK_SCROLL_STEP_BACKWARD:
+      part = (bar->horizontal ? scroll_bar_left_arrow : scroll_bar_up_arrow);
+      bar->dragging = -1;
+      break;
+    case GTK_SCROLL_STEP_FORWARD:
+      part = (bar->horizontal
+             ? scroll_bar_right_arrow : scroll_bar_down_arrow);
+      bar->dragging = -1;
+      break;
+    case GTK_SCROLL_PAGE_BACKWARD:
+      part = (bar->horizontal
+             ? scroll_bar_before_handle : scroll_bar_above_handle);
+      bar->dragging = -1;
+      break;
+    case GTK_SCROLL_PAGE_FORWARD:
+      part = (bar->horizontal
+             ? scroll_bar_after_handle : scroll_bar_below_handle);
+      bar->dragging = -1;
+      break;
+    default:
+      break;
+    }
+
+  if (part != scroll_bar_nowhere)
+    {
+      window_being_scrolled = bar->window;
+      pgtk_send_scroll_bar_event (bar->window, part, portion, whole,
+                                 bar->horizontal);
+    }
+
+  return false;
+}
+
+/* Callback for button release. Sets dragging to -1 when dragging is done.  */
+
+static gboolean
+xg_end_scroll_callback (GtkWidget * widget,
+                       GdkEventButton * event, gpointer user_data)
+{
+  struct scroll_bar *bar = user_data;
+  bar->dragging = -1;
+  if (WINDOWP (window_being_scrolled))
+    {
+      pgtk_send_scroll_bar_event (window_being_scrolled,
+                                 scroll_bar_end_scroll, 0, 0,
+                                 bar->horizontal);
+      window_being_scrolled = Qnil;
+    }
+
+  return false;
+}
+
+#define SCROLL_BAR_NAME "verticalScrollBar"
+#define SCROLL_BAR_HORIZONTAL_NAME "horizontalScrollBar"
+
+/* Create the widget for scroll bar BAR on frame F.  Record the widget
+   and X window of the scroll bar in BAR.  */
+
+static void
+x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
+{
+  const char *scroll_bar_name = SCROLL_BAR_NAME;
+
+  block_input ();
+  xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback),
+                       G_CALLBACK (xg_end_scroll_callback), scroll_bar_name);
+  unblock_input ();
+}
+
+static void
+x_create_horizontal_toolkit_scroll_bar (struct frame *f,
+                                       struct scroll_bar *bar)
+{
+  const char *scroll_bar_name = SCROLL_BAR_HORIZONTAL_NAME;
+
+  block_input ();
+  xg_create_horizontal_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback),
+                                  G_CALLBACK (xg_end_scroll_callback),
+                                  scroll_bar_name);
+  unblock_input ();
+}
+
+/* Set the thumb size and position of scroll bar BAR.  We are currently
+   displaying PORTION out of a whole WHOLE, and our position POSITION.  */
+
+static void
+x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion,
+                               int position, int whole)
+{
+  xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
+}
+
+static void
+x_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
+                                          int portion, int position,
+                                          int whole)
+{
+  xg_set_toolkit_horizontal_scroll_bar_thumb (bar, portion, position, whole);
+}
+
+
+
+/* Create a scroll bar and return the scroll bar vector for it.  W is
+   the Emacs window on which to create the scroll bar. TOP, LEFT,
+   WIDTH and HEIGHT are the pixel coordinates and dimensions of the
+   scroll bar. */
+
+static struct scroll_bar *
+x_scroll_bar_create (struct window *w, int top, int left,
+                    int width, int height, bool horizontal)
+{
+  struct frame *f = XFRAME (w->frame);
+  struct scroll_bar *bar
+    = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, prev, PVEC_OTHER);
+  Lisp_Object barobj;
+
+  block_input ();
+
+  if (horizontal)
+    x_create_horizontal_toolkit_scroll_bar (f, bar);
+  else
+    x_create_toolkit_scroll_bar (f, bar);
+
+  XSETWINDOW (bar->window, w);
+  bar->top = top;
+  bar->left = left;
+  bar->width = width;
+  bar->height = height;
+  bar->start = 0;
+  bar->end = 0;
+  bar->dragging = -1;
+  bar->horizontal = horizontal;
+
+  /* Add bar to its frame's list of scroll bars.  */
+  bar->next = FRAME_SCROLL_BARS (f);
+  bar->prev = Qnil;
+  XSETVECTOR (barobj, bar);
+  fset_scroll_bars (f, barobj);
+  if (!NILP (bar->next))
+    XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
+
+  /* Map the window/widget.  */
+  {
+    if (horizontal)
+      xg_update_horizontal_scrollbar_pos (f, bar->x_window, top,
+                                         left, width, max (height, 1));
+    else
+      xg_update_scrollbar_pos (f, bar->x_window, top,
+                              left, width, max (height, 1));
+  }
+
+  unblock_input ();
+  return bar;
+}
+
+/* Destroy scroll bar BAR, and set its Emacs window's scroll bar to
+   nil.  */
+
+static void
+x_scroll_bar_remove (struct scroll_bar *bar)
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
+  block_input ();
+
+  xg_remove_scroll_bar (f, bar->x_window);
+
+  /* Dissociate this scroll bar from its window.  */
+  if (bar->horizontal)
+    wset_horizontal_scroll_bar (XWINDOW (bar->window), Qnil);
+  else
+    wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
+
+  unblock_input ();
+}
+
+/* Set the handle of the vertical scroll bar for WINDOW to indicate
+   that we are displaying PORTION characters out of a total of WHOLE
+   characters, starting at POSITION.  If WINDOW has no scroll bar,
+   create one.  */
+
+static void
+pgtk_set_vertical_scroll_bar (struct window *w, int portion, int whole,
+                             int position)
+{
+  struct frame *f = XFRAME (w->frame);
+  Lisp_Object barobj;
+  struct scroll_bar *bar;
+  int top, height, left, width;
+  int window_y, window_height;
+
+  /* Get window dimensions.  */
+  window_box (w, ANY_AREA, 0, &window_y, 0, &window_height);
+  top = window_y;
+  height = window_height;
+  left = WINDOW_SCROLL_BAR_AREA_X (w);
+  width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
+
+  /* Does the scroll bar exist yet?  */
+  if (NILP (w->vertical_scroll_bar))
+    {
+      if (width > 0 && height > 0)
+       {
+         block_input ();
+          pgtk_clear_area (f, left, top, width, height);
+         unblock_input ();
+       }
+
+      bar = x_scroll_bar_create (w, top, left, width, max (height, 1), false);
+    }
+  else
+    {
+      /* It may just need to be moved and resized.  */
+      unsigned int mask = 0;
+
+      bar = XSCROLL_BAR (w->vertical_scroll_bar);
+
+      block_input ();
+
+      if (left != bar->left)
+       mask |= 1;
+      if (top != bar->top)
+       mask |= 1;
+      if (width != bar->width)
+       mask |= 1;
+      if (height != bar->height)
+       mask |= 1;
+
+      /* Move/size the scroll bar widget.  */
+      if (mask)
+       {
+         /* Since toolkit scroll bars are smaller than the space reserved
+            for them on the frame, we have to clear "under" them.  */
+         if (width > 0 && height > 0)
+           pgtk_clear_area (f, left, top, width, height);
+          xg_update_scrollbar_pos (f, bar->x_window, top,
+                                  left, width, max (height, 1));
+       }
+
+      /* Remember new settings.  */
+      bar->left = left;
+      bar->top = top;
+      bar->width = width;
+      bar->height = height;
+
+      unblock_input ();
+    }
+
+  x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
+
+  XSETVECTOR (barobj, bar);
+  wset_vertical_scroll_bar (w, barobj);
+}
+
+
+static void
+pgtk_set_horizontal_scroll_bar (struct window *w, int portion, int whole,
+                               int position)
+{
+  struct frame *f = XFRAME (w->frame);
+  Lisp_Object barobj;
+  struct scroll_bar *bar;
+  int top, height, left, width;
+  int window_x, window_width;
+  int pixel_width = WINDOW_PIXEL_WIDTH (w);
+
+  /* Get window dimensions.  */
+  window_box (w, ANY_AREA, &window_x, 0, &window_width, 0);
+  left = window_x;
+  width = window_width;
+  top = WINDOW_SCROLL_BAR_AREA_Y (w);
+  height = WINDOW_SCROLL_BAR_AREA_HEIGHT (w);
+
+  /* Does the scroll bar exist yet?  */
+  if (NILP (w->horizontal_scroll_bar))
+    {
+      if (width > 0 && height > 0)
+       {
+         block_input ();
+
+         /* Clear also part between window_width and
+            WINDOW_PIXEL_WIDTH.  */
+         pgtk_clear_area (f, left, top, pixel_width, height);
+         unblock_input ();
+       }
+
+      bar = x_scroll_bar_create (w, top, left, width, height, true);
+    }
+  else
+    {
+      /* It may just need to be moved and resized.  */
+      unsigned int mask = 0;
+
+      bar = XSCROLL_BAR (w->horizontal_scroll_bar);
+
+      block_input ();
+
+      if (left != bar->left)
+       mask |= 1;
+      if (top != bar->top)
+       mask |= 1;
+      if (width != bar->width)
+       mask |= 1;
+      if (height != bar->height)
+       mask |= 1;
+
+      /* Move/size the scroll bar widget.  */
+      if (mask)
+       {
+         /* Since toolkit scroll bars are smaller than the space reserved
+            for them on the frame, we have to clear "under" them.  */
+         if (width > 0 && height > 0)
+           pgtk_clear_area (f,
+                            WINDOW_LEFT_EDGE_X (w), top,
+                            pixel_width - WINDOW_RIGHT_DIVIDER_WIDTH (w),
+                            height);
+         xg_update_horizontal_scrollbar_pos (f, bar->x_window, top, left,
+                                             width, height);
+       }
+
+      /* Remember new settings.  */
+      bar->left = left;
+      bar->top = top;
+      bar->width = width;
+      bar->height = height;
+
+      unblock_input ();
+    }
+
+  x_set_toolkit_horizontal_scroll_bar_thumb (bar, portion, position, whole);
+
+  XSETVECTOR (barobj, bar);
+  wset_horizontal_scroll_bar (w, barobj);
+}
+
+/* The following three hooks are used when we're doing a thorough
+   redisplay of the frame.  We don't explicitly know which scroll bars
+   are going to be deleted, because keeping track of when windows go
+   away is a real pain - "Can you say set-window-configuration, boys
+   and girls?"  Instead, we just assert at the beginning of redisplay
+   that *all* scroll bars are to be removed, and then save a scroll bar
+   from the fiery pit when we actually redisplay its window.  */
+
+/* Arrange for all scroll bars on FRAME to be removed at the next call
+   to `*judge_scroll_bars_hook'.  A scroll bar may be spared if
+   `*redeem_scroll_bar_hook' is applied to its window before the judgment.  */
+
+static void
+pgtk_condemn_scroll_bars (struct frame *frame)
+{
+  if (!NILP (FRAME_SCROLL_BARS (frame)))
+    {
+      if (!NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
+       {
+         /* Prepend scrollbars to already condemned ones.  */
+         Lisp_Object last = FRAME_SCROLL_BARS (frame);
+
+         while (!NILP (XSCROLL_BAR (last)->next))
+           last = XSCROLL_BAR (last)->next;
+
+         XSCROLL_BAR (last)->next = FRAME_CONDEMNED_SCROLL_BARS (frame);
+         XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = last;
+       }
+
+      fset_condemned_scroll_bars (frame, FRAME_SCROLL_BARS (frame));
+      fset_scroll_bars (frame, Qnil);
+    }
+}
+
+
+/* Un-mark WINDOW's scroll bar for deletion in this judgment cycle.
+   Note that WINDOW isn't necessarily condemned at all.  */
+
+static void
+pgtk_redeem_scroll_bar (struct window *w)
+{
+  struct scroll_bar *bar;
+  Lisp_Object barobj;
+  struct frame *f;
+
+  /* We can't redeem this window's scroll bar if it doesn't have one.  */
+  if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar))
+    emacs_abort ();
+
+  if (!NILP (w->vertical_scroll_bar) && WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
+    {
+      bar = XSCROLL_BAR (w->vertical_scroll_bar);
+      /* Unlink it from the condemned list.  */
+      f = XFRAME (WINDOW_FRAME (w));
+      if (NILP (bar->prev))
+       {
+         /* If the prev pointer is nil, it must be the first in one of
+            the lists.  */
+         if (EQ (FRAME_SCROLL_BARS (f), w->vertical_scroll_bar))
+           /* It's not condemned.  Everything's fine.  */
+           goto horizontal;
+         else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
+                      w->vertical_scroll_bar))
+           fset_condemned_scroll_bars (f, bar->next);
+         else
+           /* If its prev pointer is nil, it must be at the front of
+              one or the other!  */
+           emacs_abort ();
+       }
+      else
+       XSCROLL_BAR (bar->prev)->next = bar->next;
+
+      if (!NILP (bar->next))
+       XSCROLL_BAR (bar->next)->prev = bar->prev;
+
+      bar->next = FRAME_SCROLL_BARS (f);
+      bar->prev = Qnil;
+      XSETVECTOR (barobj, bar);
+      fset_scroll_bars (f, barobj);
+      if (!NILP (bar->next))
+       XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
+    }
+
+horizontal:
+  if (!NILP (w->horizontal_scroll_bar)
+      && WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w))
+    {
+      bar = XSCROLL_BAR (w->horizontal_scroll_bar);
+      /* Unlink it from the condemned list.  */
+      f = XFRAME (WINDOW_FRAME (w));
+      if (NILP (bar->prev))
+       {
+         /* If the prev pointer is nil, it must be the first in one of
+            the lists.  */
+         if (EQ (FRAME_SCROLL_BARS (f), w->horizontal_scroll_bar))
+           /* It's not condemned.  Everything's fine.  */
+           return;
+         else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
+                      w->horizontal_scroll_bar))
+           fset_condemned_scroll_bars (f, bar->next);
+         else
+           /* If its prev pointer is nil, it must be at the front of
+              one or the other!  */
+           emacs_abort ();
+       }
+      else
+       XSCROLL_BAR (bar->prev)->next = bar->next;
+
+      if (!NILP (bar->next))
+       XSCROLL_BAR (bar->next)->prev = bar->prev;
+
+      bar->next = FRAME_SCROLL_BARS (f);
+      bar->prev = Qnil;
+      XSETVECTOR (barobj, bar);
+      fset_scroll_bars (f, barobj);
+      if (!NILP (bar->next))
+       XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
+    }
+}
+
+/* Remove all scroll bars on FRAME that haven't been saved since the
+   last call to `*condemn_scroll_bars_hook'.  */
+
+static void
+pgtk_judge_scroll_bars (struct frame *f)
+{
+  Lisp_Object bar, next;
+
+  bar = FRAME_CONDEMNED_SCROLL_BARS (f);
+
+  /* Clear out the condemned list now so we won't try to process any
+     more events on the hapless scroll bars.  */
+  fset_condemned_scroll_bars (f, Qnil);
+
+  for (; !NILP (bar); bar = next)
+    {
+      struct scroll_bar *b = XSCROLL_BAR (bar);
+
+      x_scroll_bar_remove (b);
+
+      next = b->next;
+      b->next = b->prev = Qnil;
+    }
+
+  /* Now there should be no references to the condemned scroll bars,
+     and they should get garbage-collected.  */
+}
+
+static void
+set_fullscreen_state (struct frame *f)
+{
+  if (!FRAME_GTK_OUTER_WIDGET (f))
+    return;
+
+  GtkWindow *widget = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f));
+  switch (f->want_fullscreen)
+    {
+    case FULLSCREEN_NONE:
+      gtk_window_unfullscreen (widget);
+      gtk_window_unmaximize (widget);
+      store_frame_param (f, Qfullscreen, Qnil);
+      break;
+
+    case FULLSCREEN_BOTH:
+      gtk_window_unmaximize (widget);
+      gtk_window_fullscreen (widget);
+      store_frame_param (f, Qfullscreen, Qfullboth);
+      break;
+
+    case FULLSCREEN_MAXIMIZED:
+      gtk_window_unfullscreen (widget);
+      gtk_window_maximize (widget);
+      store_frame_param (f, Qfullscreen, Qmaximized);
+      break;
+
+    case FULLSCREEN_WIDTH:
+    case FULLSCREEN_HEIGHT:
+      /* Not supported by gtk. Ignore them. */
+      break;
+    }
+
+  f->want_fullscreen = FULLSCREEN_NONE;
+}
+
+static void
+pgtk_fullscreen_hook (struct frame *f)
+{
+  if (FRAME_VISIBLE_P (f))
+    {
+      block_input ();
+      set_fullscreen_state (f);
+      unblock_input ();
+    }
+}
+
+/* This function is called when the last frame on a display is deleted. */
+void
+pgtk_delete_terminal (struct terminal *terminal)
+{
+  struct pgtk_display_info *dpyinfo = terminal->display_info.pgtk;
+
+  /* Protect against recursive calls.  delete_frame in
+     delete_terminal calls us back when it deletes our last frame.  */
+  if (!terminal->name)
+    return;
+
+  block_input ();
+
+  pgtk_im_finish (dpyinfo);
+
+  /* Normally, the display is available...  */
+  if (dpyinfo->gdpy)
+    {
+      image_destroy_all_bitmaps (dpyinfo);
+
+      g_clear_object (&dpyinfo->xg_cursor);
+      g_clear_object (&dpyinfo->vertical_scroll_bar_cursor);
+      g_clear_object (&dpyinfo->horizontal_scroll_bar_cursor);
+      g_clear_object (&dpyinfo->invisible_cursor);
+      if (dpyinfo->last_click_event != NULL) {
+       gdk_event_free (dpyinfo->last_click_event);
+       dpyinfo->last_click_event = NULL;
+      }
+
+      xg_display_close (dpyinfo->gdpy);
+
+      /* Do not close the connection here because it's already closed
+         by X(t)CloseDisplay (Bug#18403).  */
+      dpyinfo->gdpy = NULL;
+    }
+
+  if (dpyinfo->connection >= 0)
+    emacs_close (dpyinfo->connection);
+
+  dpyinfo->connection = -1;
+
+  delete_keyboard_wait_descriptor (0);
+
+  pgtk_delete_display (dpyinfo);
+  unblock_input ();
+}
+
+/* Store F's background color into *BGCOLOR.  */
+static void
+pgtk_query_frame_background_color (struct frame *f, Emacs_Color * bgcolor)
+{
+  bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
+  pgtk_query_color (f, bgcolor);
+}
+
+static void
+pgtk_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap)
+{
+  if (pixmap)
+    {
+      xfree (pixmap->data);
+      xfree (pixmap);
+    }
+}
+
+void
+pgtk_focus_frame (struct frame *f, bool noactivate)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+
+  GtkWidget *wid = FRAME_WIDGET (f);
+
+  if (dpyinfo->x_focus_frame != f && wid != NULL)
+    {
+      block_input ();
+      gtk_widget_grab_focus (wid);
+      unblock_input ();
+    }
+}
+
+
+static void
+set_opacity_recursively (GtkWidget * w, gpointer data)
+{
+  gtk_widget_set_opacity (w, *(double *) data);
+  if (GTK_IS_CONTAINER (w))
+    gtk_container_foreach (GTK_CONTAINER (w), set_opacity_recursively, data);
+}
+
+static void
+x_set_frame_alpha (struct frame *f)
+{
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  double alpha = 1.0;
+  double alpha_min = 1.0;
+
+  if (dpyinfo->highlight_frame == f)
+    alpha = f->alpha[0];
+  else
+    alpha = f->alpha[1];
+
+  if (alpha < 0.0)
+    return;
+
+  if (FLOATP (Vframe_alpha_lower_limit))
+    alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit);
+  else if (FIXNUMP (Vframe_alpha_lower_limit))
+    alpha_min = (XFIXNUM (Vframe_alpha_lower_limit)) / 100.0;
+
+  if (alpha > 1.0)
+    alpha = 1.0;
+  else if (alpha < alpha_min && alpha_min <= 1.0)
+    alpha = alpha_min;
+
+#if 0
+  /* If there is a parent from the window manager, put the property there
+     also, to work around broken window managers that fail to do that.
+     Do this unconditionally as this function is called on reparent when
+     alpha has not changed on the frame.  */
+
+  if (!FRAME_PARENT_FRAME (f))
+    {
+      Window parent = x_find_topmost_parent (f);
+      if (parent != None)
+       XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
+                        XA_CARDINAL, 32, PropModeReplace,
+                        (unsigned char *) &opac, 1);
+    }
+#endif
+
+  set_opacity_recursively (FRAME_WIDGET (f), &alpha);
+  /* without this, blending mode is strange on wayland. */
+  gtk_widget_queue_resize_no_redraw (FRAME_WIDGET (f));
+}
+
+static void
+frame_highlight (struct frame *f)
+{
+  /* We used to only do this if Vx_no_window_manager was non-nil, but
+     the ICCCM (section 4.1.6) says that the window's border pixmap
+     and border pixel are window attributes which are "private to the
+     client", so we can always change it to whatever we want.  */
+  block_input ();
+  /* I recently started to get errors in this XSetWindowBorder, depending on
+     the window-manager in use, tho something more is at play since I've been
+     using that same window-manager binary for ever.  Let's not crash just
+     because of this (bug#9310).  */
+
+  GtkWidget *w = FRAME_WIDGET (f);
+
+  char *css =
+    g_strdup_printf ("decoration { border: solid %dpx #%06x; }",
+                    f->border_width,
+                    (unsigned int) FRAME_X_OUTPUT (f)->border_pixel & 
0x00ffffff);
+
+  GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
+  GtkCssProvider *css_provider = gtk_css_provider_new ();
+  gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
+  gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (css_provider),
+                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
+  g_free (css);
+
+  GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider;
+  FRAME_X_OUTPUT (f)->border_color_css_provider = css_provider;
+  if (old != NULL)
+    {
+      gtk_style_context_remove_provider (ctxt, GTK_STYLE_PROVIDER (old));
+      g_object_unref (old);
+    }
+
+  unblock_input ();
+  gui_update_cursor (f, true);
+  x_set_frame_alpha (f);
+}
+
+static void
+frame_unhighlight (struct frame *f)
+{
+  /* We used to only do this if Vx_no_window_manager was non-nil, but
+     the ICCCM (section 4.1.6) says that the window's border pixmap
+     and border pixel are window attributes which are "private to the
+     client", so we can always change it to whatever we want.  */
+  block_input ();
+  /* Same as above for XSetWindowBorder (bug#9310).  */
+
+  GtkWidget *w = FRAME_WIDGET (f);
+
+  char *css =
+    g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }",
+                    f->border_width);
+
+  GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
+  GtkCssProvider *css_provider = gtk_css_provider_new ();
+  gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
+  gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (css_provider),
+                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
+  g_free (css);
+
+  GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider;
+  FRAME_X_OUTPUT (f)->border_color_css_provider = css_provider;
+  if (old != NULL)
+    {
+      gtk_style_context_remove_provider (ctxt, GTK_STYLE_PROVIDER (old));
+      g_object_unref (old);
+    }
+
+  unblock_input ();
+  gui_update_cursor (f, true);
+  x_set_frame_alpha (f);
+}
+
+
+void
+pgtk_frame_rehighlight (struct pgtk_display_info *dpyinfo)
+{
+  struct frame *old_highlight = dpyinfo->highlight_frame;
+
+  if (dpyinfo->x_focus_frame)
+    {
+      dpyinfo->highlight_frame
+       = ((FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame)))
+          ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->x_focus_frame))
+          : dpyinfo->x_focus_frame);
+      if (!FRAME_LIVE_P (dpyinfo->highlight_frame))
+       {
+         fset_focus_frame (dpyinfo->x_focus_frame, Qnil);
+         dpyinfo->highlight_frame = dpyinfo->x_focus_frame;
+       }
+    }
+  else
+    dpyinfo->highlight_frame = 0;
+
+  if (old_highlight)
+    frame_unhighlight (old_highlight);
+  if (dpyinfo->highlight_frame)
+    frame_highlight (dpyinfo->highlight_frame);
+}
+
+/* The focus has changed, or we have redirected a frame's focus to
+   another frame (this happens when a frame uses a surrogate
+   mini-buffer frame).  Shift the highlight as appropriate.
+
+   The FRAME argument doesn't necessarily have anything to do with which
+   frame is being highlighted or un-highlighted; we only use it to find
+   the appropriate X display info.  */
+
+static void
+XTframe_rehighlight (struct frame *frame)
+{
+  pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (frame));
+}
+
+
+/* Toggle mouse pointer visibility on frame F by using invisible cursor.  */
+
+static void
+x_toggle_visible_pointer (struct frame *f, bool invisible)
+{
+  Emacs_Cursor cursor;
+  if (invisible)
+    cursor = FRAME_DISPLAY_INFO (f)->invisible_cursor;
+  else
+    cursor = f->output_data.pgtk->current_cursor;
+  gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
+                        cursor);
+  f->pointer_invisible = invisible;
+}
+
+static void
+x_setup_pointer_blanking (struct pgtk_display_info *dpyinfo)
+{
+  dpyinfo->toggle_visible_pointer = x_toggle_visible_pointer;
+  dpyinfo->invisible_cursor =
+    gdk_cursor_new_for_display (dpyinfo->gdpy, GDK_BLANK_CURSOR);
+}
+
+static void
+XTtoggle_invisible_pointer (struct frame *f, bool invisible)
+{
+  block_input ();
+  FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, invisible);
+  unblock_input ();
+}
+
+/* The focus has changed.  Update the frames as necessary to reflect
+   the new situation.  Note that we can't change the selected frame
+   here, because the Lisp code we are interrupting might become confused.
+   Each event gets marked with the frame in which it occurred, so the
+   Lisp code can tell when the switch took place by examining the events.  */
+
+static void
+x_new_focus_frame (struct pgtk_display_info *dpyinfo, struct frame *frame)
+{
+  struct frame *old_focus = dpyinfo->x_focus_frame;
+  /* doesn't work on wayland */
+
+  if (frame != dpyinfo->x_focus_frame)
+    {
+      /* Set this before calling other routines, so that they see
+         the correct value of x_focus_frame.  */
+      dpyinfo->x_focus_frame = frame;
+
+      if (old_focus && old_focus->auto_lower)
+       if (FRAME_GTK_OUTER_WIDGET (old_focus))
+         gdk_window_lower (gtk_widget_get_window
+                           (FRAME_GTK_OUTER_WIDGET (old_focus)));
+
+      if (dpyinfo->x_focus_frame && dpyinfo->x_focus_frame->auto_raise)
+       if (FRAME_GTK_OUTER_WIDGET (dpyinfo->x_focus_frame))
+         gdk_window_raise (gtk_widget_get_window
+                           (FRAME_GTK_OUTER_WIDGET (dpyinfo->x_focus_frame)));
+    }
+
+  pgtk_frame_rehighlight (dpyinfo);
+}
+
+static void
+pgtk_buffer_flipping_unblocked_hook (struct frame *f)
+{
+  block_input ();
+  flip_cr_context (f);
+  gtk_widget_queue_draw (FRAME_GTK_WIDGET (f));
+  unblock_input ();
+}
+
+static struct terminal *
+pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
+/* --------------------------------------------------------------------------
+      Set up use of Gtk before we make the first connection.
+   -------------------------------------------------------------------------- 
*/
+{
+  struct terminal *terminal;
+
+  terminal = create_terminal (output_pgtk, &pgtk_redisplay_interface);
+
+  terminal->display_info.pgtk = dpyinfo;
+  dpyinfo->terminal = terminal;
+
+  terminal->clear_frame_hook = pgtk_clear_frame;
+  terminal->ring_bell_hook = pgtk_ring_bell;
+  terminal->toggle_invisible_pointer_hook = XTtoggle_invisible_pointer;
+  terminal->update_begin_hook = pgtk_update_begin;
+  terminal->update_end_hook = pgtk_update_end;
+  terminal->read_socket_hook = pgtk_read_socket;
+  terminal->frame_up_to_date_hook = pgtk_frame_up_to_date;
+  terminal->mouse_position_hook = pgtk_mouse_position;
+  terminal->frame_rehighlight_hook = XTframe_rehighlight;
+  terminal->buffer_flipping_unblocked_hook = 
pgtk_buffer_flipping_unblocked_hook;
+  terminal->frame_raise_lower_hook = pgtk_frame_raise_lower;
+  terminal->frame_visible_invisible_hook = pgtk_make_frame_visible_invisible;
+  terminal->fullscreen_hook = pgtk_fullscreen_hook;
+  terminal->menu_show_hook = pgtk_menu_show;
+  terminal->activate_menubar_hook = pgtk_activate_menubar;
+  terminal->popup_dialog_hook = pgtk_popup_dialog;
+  terminal->change_tab_bar_height_hook = x_change_tab_bar_height;
+  terminal->set_vertical_scroll_bar_hook = pgtk_set_vertical_scroll_bar;
+  terminal->set_horizontal_scroll_bar_hook = pgtk_set_horizontal_scroll_bar;
+  terminal->condemn_scroll_bars_hook = pgtk_condemn_scroll_bars;
+  terminal->redeem_scroll_bar_hook = pgtk_redeem_scroll_bar;
+  terminal->judge_scroll_bars_hook = pgtk_judge_scroll_bars;
+  terminal->get_string_resource_hook = pgtk_get_string_resource;
+  terminal->delete_frame_hook = x_destroy_window;
+  terminal->delete_terminal_hook = pgtk_delete_terminal;
+  terminal->query_frame_background_color = pgtk_query_frame_background_color;
+  terminal->defined_color_hook = pgtk_defined_color;
+  terminal->set_new_font_hook = pgtk_new_font;
+  terminal->set_bitmap_icon_hook = pgtk_bitmap_icon;
+  terminal->implicit_set_name_hook = pgtk_implicitly_set_name;
+  terminal->iconify_frame_hook = pgtk_iconify_frame;
+  terminal->set_scroll_bar_default_width_hook =
+    pgtk_set_scroll_bar_default_width;
+  terminal->set_scroll_bar_default_height_hook =
+    pgtk_set_scroll_bar_default_height;
+  terminal->set_window_size_hook = pgtk_set_window_size;
+  terminal->query_colors = pgtk_query_colors;
+  terminal->get_focus_frame = x_get_focus_frame;
+  terminal->focus_frame_hook = pgtk_focus_frame;
+  terminal->set_frame_offset_hook = x_set_offset;
+  terminal->free_pixmap = pgtk_free_pixmap;
+
+  /* Other hooks are NULL by default.  */
+
+  return terminal;
+}
+
+struct pgtk_window_is_of_frame_recursive_t
+{
+  GdkWindow *window;
+  bool result;
+  GtkWidget *emacs_gtk_fixed;  /* stop on emacsgtkfixed other than this. */
+};
+
+static void
+pgtk_window_is_of_frame_recursive (GtkWidget * widget, gpointer data)
+{
+  struct pgtk_window_is_of_frame_recursive_t *datap = data;
+
+  if (datap->result)
+    return;
+
+  if (EMACS_IS_FIXED (widget) && widget != datap->emacs_gtk_fixed)
+    return;
+
+  if (gtk_widget_get_window (widget) == datap->window)
+    {
+      datap->result = true;
+      return;
+    }
+
+  if (GTK_IS_CONTAINER (widget)) {
+    gtk_container_foreach (GTK_CONTAINER (widget),
+                          pgtk_window_is_of_frame_recursive, datap);
+  }
+}
+
+static bool
+pgtk_window_is_of_frame (struct frame *f, GdkWindow * window)
+{
+  struct pgtk_window_is_of_frame_recursive_t data;
+  data.window = window;
+  data.result = false;
+  data.emacs_gtk_fixed = FRAME_GTK_WIDGET (f);
+  pgtk_window_is_of_frame_recursive (FRAME_WIDGET (f), &data);
+  return data.result;
+}
+
+/* Like x_window_to_frame but also compares the window with the widget's
+   windows.  */
+static struct frame *
+pgtk_any_window_to_frame (GdkWindow * window)
+{
+  Lisp_Object tail, frame;
+  struct frame *f, *found = NULL;
+
+  if (window == NULL)
+    return NULL;
+
+  FOR_EACH_FRAME (tail, frame)
+  {
+    if (found)
+      break;
+    f = XFRAME (frame);
+    if (FRAME_PGTK_P (f))
+      {
+       if (pgtk_window_is_of_frame (f, window))
+         found = f;
+      }
+  }
+
+  return found;
+}
+
+static gboolean
+pgtk_handle_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
+{
+#if GTK_CHECK_VERSION (3, 18, 0)
+  struct frame *f;
+  union buffered_input_event inev;
+  GtkWidget *frame_widget;
+  gint x, y;
+
+  if (event->type == GDK_TOUCHPAD_PINCH
+      && (event->touchpad_pinch.phase
+         != GDK_TOUCHPAD_GESTURE_PHASE_END))
+    {
+      f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+      frame_widget = FRAME_GTK_WIDGET (f);
+
+      gtk_widget_translate_coordinates (widget, frame_widget,
+                                       lrint (event->touchpad_pinch.x),
+                                       lrint (event->touchpad_pinch.y),
+                                       &x, &y);
+      if (f)
+       {
+
+         inev.ie.kind = PINCH_EVENT;
+         XSETFRAME (inev.ie.frame_or_window, f);
+         XSETINT (inev.ie.x, x);
+         XSETINT (inev.ie.y, y);
+         inev.ie.arg = list4 (make_float (event->touchpad_pinch.dx),
+                              make_float (event->touchpad_pinch.dy),
+                              make_float (event->touchpad_pinch.scale),
+                              make_float (event->touchpad_pinch.angle_delta));
+         inev.ie.modifiers = pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO 
(f),
+                                                          
event->touchpad_pinch.state);
+         evq_enqueue (&inev);
+       }
+
+      return TRUE;
+    }
+#endif
+  return FALSE;
+}
+
+static void
+pgtk_fill_rectangle (struct frame *f, unsigned long color, int x, int y,
+                    int width, int height)
+{
+  cairo_t *cr;
+  cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, color);
+  cairo_rectangle (cr, x, y, width, height);
+  cairo_fill (cr);
+  pgtk_end_cr_clip (f);
+}
+
+void
+pgtk_clear_under_internal_border (struct frame *f)
+{
+  if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0
+      && (!FRAME_GTK_OUTER_WIDGET (f)
+         || gtk_widget_get_realized (FRAME_GTK_OUTER_WIDGET (f))))
+    {
+      int border = FRAME_INTERNAL_BORDER_WIDTH (f);
+      int width = FRAME_PIXEL_WIDTH (f);
+      int height = FRAME_PIXEL_HEIGHT (f);
+      int margin = FRAME_TOP_MARGIN_HEIGHT (f);
+      int face_id =
+       (FRAME_PARENT_FRAME (f)
+        ? (!NILP (Vface_remapping_alist)
+           ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID)
+           : CHILD_FRAME_BORDER_FACE_ID)
+        : (!NILP (Vface_remapping_alist)
+           ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+           : INTERNAL_BORDER_FACE_ID));
+      struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
+
+      block_input ();
+
+      if (face)
+       {
+#define x_fill_rectangle(f, gc, x, y, w, h) \
+           fill_background_by_face (f, face, x, y, w, h)
+         x_fill_rectangle (f, gc, 0, margin, width, border);
+         x_fill_rectangle (f, gc, 0, 0, border, height);
+         x_fill_rectangle (f, gc, width - border, 0, border, height);
+         x_fill_rectangle (f, gc, 0, height - border, width, border);
+#undef x_fill_rectangle
+       }
+      else
+       {
+#define x_clear_area(f, x, y, w, h)  pgtk_clear_area (f, x, y, w, h)
+         x_clear_area (f, 0, 0, border, height);
+         x_clear_area (f, 0, margin, width, border);
+         x_clear_area (f, width - border, 0, border, height);
+         x_clear_area (f, 0, height - border, width, border);
+#undef x_clear_area
+       }
+
+      unblock_input ();
+    }
+}
+
+static gboolean
+pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, gpointer * data)
+{
+  struct frame *f;
+
+  GdkWindow *win = gtk_widget_get_window (widget);
+
+  if (win != NULL)
+    {
+      cairo_surface_t *src = NULL;
+      f = pgtk_any_window_to_frame (win);
+      if (f != NULL)
+       {
+         src = FRAME_X_OUTPUT (f)->cr_surface_visible_bell;
+         if (src == NULL && FRAME_CR_ACTIVE_CONTEXT (f) != NULL)
+           src = cairo_get_target (FRAME_CR_ACTIVE_CONTEXT (f));
+       }
+      if (src != NULL)
+       {
+         cairo_set_source_surface (cr, src, 0, 0);
+         cairo_paint (cr);
+       }
+    }
+  return FALSE;
+}
+
+static void
+size_allocate (GtkWidget * widget, GtkAllocation * alloc,
+              gpointer user_data)
+{
+  struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+
+  /* Between a frame is created and not shown, size is allocated and
+   * this handler is called.  When that, since the widget's window is
+   * NULL, we can't get f, pgtk_cr_update_surface_desired_size is not
+   * called, and its size is 0x0.  That causes empty frame.
+   *
+   * Fortunately since we know f in pgtk_set_event_handler, we can get
+   * it through user_data;
+   */
+  if (!f)
+    f = user_data;
+
+  if (f)
+    {
+      xg_frame_resized (f, alloc->width, alloc->height);
+      pgtk_cr_update_surface_desired_size (f, alloc->width, alloc->height, 
false);
+    }
+}
+
+static void
+x_find_modifier_meanings (struct pgtk_display_info *dpyinfo)
+{
+  GdkDisplay *gdpy = dpyinfo->gdpy;
+  GdkKeymap *keymap = gdk_keymap_get_for_display (gdpy);
+  GdkModifierType state = GDK_META_MASK;
+  gboolean r = gdk_keymap_map_virtual_modifiers (keymap, &state);
+  if (r)
+    {
+      /* Meta key exists. */
+      if (state == GDK_META_MASK)
+       {
+         dpyinfo->meta_mod_mask = GDK_MOD1_MASK;       /* maybe this is meta. 
*/
+         dpyinfo->alt_mod_mask = 0;
+       }
+      else
+       {
+         dpyinfo->meta_mod_mask = state & ~GDK_META_MASK;
+         if (dpyinfo->meta_mod_mask == GDK_MOD1_MASK)
+           dpyinfo->alt_mod_mask = 0;
+         else
+           dpyinfo->alt_mod_mask = GDK_MOD1_MASK;
+       }
+    }
+  else
+    {
+      dpyinfo->meta_mod_mask = GDK_MOD1_MASK;
+      dpyinfo->alt_mod_mask = 0;
+    }
+
+  state = GDK_SUPER_MASK;
+  r = gdk_keymap_map_virtual_modifiers (keymap, &state);
+  if (r)
+    {
+      /* Super key exists. */
+      if (state == GDK_SUPER_MASK)
+       {
+         dpyinfo->super_mod_mask = GDK_MOD4_MASK;      /* maybe this is super. 
*/
+       }
+      else
+       {
+         dpyinfo->super_mod_mask = state & ~GDK_SUPER_MASK;
+       }
+    }
+  else
+    {
+      dpyinfo->super_mod_mask = GDK_MOD4_MASK;
+    }
+
+  state = GDK_HYPER_MASK;
+  r = gdk_keymap_map_virtual_modifiers (keymap, &state);
+  if (r)
+    {
+      /* Hyper key exists. */
+      if (state == GDK_HYPER_MASK)
+       {
+         dpyinfo->hyper_mod_mask = GDK_MOD3_MASK;      /* maybe this is hyper. 
*/
+       }
+      else
+       {
+         dpyinfo->hyper_mod_mask = state & ~GDK_HYPER_MASK;
+       }
+    }
+  else
+    {
+      dpyinfo->hyper_mod_mask = GDK_MOD3_MASK;
+    }
+
+  /* If xmodmap says:
+   *   $ xmodmap | grep mod4
+   *   mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L 
(0xcf)
+   * then, when mod4 is pressed, both of super and hyper are recognized ON.
+   * Maybe many people have such configuration, and they don't like such 
behavior,
+   * so I disable hyper if such configuration is detected.
+   */
+  if (dpyinfo->hyper_mod_mask == dpyinfo->super_mod_mask)
+    dpyinfo->hyper_mod_mask = 0;
+}
+
+static void
+get_modifier_values (int *mod_ctrl,
+                    int *mod_meta,
+                    int *mod_alt, int *mod_hyper, int *mod_super)
+{
+  Lisp_Object tem;
+
+  *mod_ctrl = ctrl_modifier;
+  *mod_meta = meta_modifier;
+  *mod_alt = alt_modifier;
+  *mod_hyper = hyper_modifier;
+  *mod_super = super_modifier;
+
+  tem = Fget (Vx_ctrl_keysym, Qmodifier_value);
+  if (INTEGERP (tem))
+    *mod_ctrl = XFIXNUM (tem) & INT_MAX;
+  tem = Fget (Vx_alt_keysym, Qmodifier_value);
+  if (INTEGERP (tem))
+    *mod_alt = XFIXNUM (tem) & INT_MAX;
+  tem = Fget (Vx_meta_keysym, Qmodifier_value);
+  if (INTEGERP (tem))
+    *mod_meta = XFIXNUM (tem) & INT_MAX;
+  tem = Fget (Vx_hyper_keysym, Qmodifier_value);
+  if (INTEGERP (tem))
+    *mod_hyper = XFIXNUM (tem) & INT_MAX;
+  tem = Fget (Vx_super_keysym, Qmodifier_value);
+  if (INTEGERP (tem))
+    *mod_super = XFIXNUM (tem) & INT_MAX;
+}
+
+int
+pgtk_gtk_to_emacs_modifiers (struct pgtk_display_info *dpyinfo, int state)
+{
+  int mod_ctrl;
+  int mod_meta;
+  int mod_alt;
+  int mod_hyper;
+  int mod_super;
+  int mod;
+
+  get_modifier_values (&mod_ctrl, &mod_meta, &mod_alt, &mod_hyper,
+                      &mod_super);
+
+  mod = 0;
+  if (state & GDK_SHIFT_MASK)
+    mod |= shift_modifier;
+  if (state & GDK_CONTROL_MASK)
+    mod |= mod_ctrl;
+  if (state & dpyinfo->meta_mod_mask)
+    mod |= mod_meta;
+  if (state & dpyinfo->alt_mod_mask)
+    mod |= mod_alt;
+  if (state & dpyinfo->super_mod_mask)
+    mod |= mod_super;
+  if (state & dpyinfo->hyper_mod_mask)
+    mod |= mod_hyper;
+  return mod;
+}
+
+int
+pgtk_emacs_to_gtk_modifiers (struct pgtk_display_info *dpyinfo, int state)
+{
+  int mod_ctrl;
+  int mod_meta;
+  int mod_alt;
+  int mod_hyper;
+  int mod_super;
+  int mask;
+
+  get_modifier_values (&mod_ctrl, &mod_meta, &mod_alt, &mod_hyper,
+                      &mod_super);
+
+  mask = 0;
+  if (state & mod_alt)
+    mask |= dpyinfo->alt_mod_mask;
+  if (state & mod_super)
+    mask |= dpyinfo->super_mod_mask;
+  if (state & mod_hyper)
+    mask |= dpyinfo->hyper_mod_mask;
+  if (state & shift_modifier)
+    mask |= GDK_SHIFT_MASK;
+  if (state & mod_ctrl)
+    mask |= GDK_CONTROL_MASK;
+  if (state & mod_meta)
+    mask |= dpyinfo->meta_mod_mask;
+  return mask;
+}
+
+#define IsCursorKey(keysym)       (0xff50 <= (keysym) && (keysym) < 0xff60)
+#define IsMiscFunctionKey(keysym) (0xff60 <= (keysym) && (keysym) < 0xff6c)
+#define IsKeypadKey(keysym)       (0xff80 <= (keysym) && (keysym) < 0xffbe)
+#define IsFunctionKey(keysym)     (0xffbe <= (keysym) && (keysym) < 0xffe1)
+#define IsModifierKey(keysym)                                                  
\
+  ((((keysym) >= GDK_KEY_Shift_L) && ((keysym) <= GDK_KEY_Hyper_R))            
\
+   || (((keysym) >= GDK_KEY_ISO_Lock) && ((keysym) <= 
GDK_KEY_ISO_Level5_Lock))        \
+   || ((keysym) == GDK_KEY_Mode_switch)                                        
        \
+   || ((keysym) == GDK_KEY_Num_Lock))
+
+
+void
+pgtk_enqueue_string (struct frame *f, gchar * str)
+{
+  gunichar *ustr;
+
+  ustr = g_utf8_to_ucs4 (str, -1, NULL, NULL, NULL);
+  if (ustr == NULL)
+    return;
+  for (; *ustr != 0; ustr++)
+    {
+      union buffered_input_event inev;
+      Lisp_Object c = make_fixnum (*ustr);
+      EVENT_INIT (inev.ie);
+      inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
+                     ? ASCII_KEYSTROKE_EVENT
+                     : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+      inev.ie.arg = Qnil;
+      inev.ie.code = XFIXNAT (c);
+      XSETFRAME (inev.ie.frame_or_window, f);
+      inev.ie.modifiers = 0;
+      inev.ie.timestamp = 0;
+      evq_enqueue (&inev);
+    }
+
+}
+
+void
+pgtk_enqueue_preedit (struct frame *f, Lisp_Object preedit)
+{
+  union buffered_input_event inev;
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = PGTK_PREEDIT_TEXT_EVENT;
+  inev.ie.arg = preedit;
+  inev.ie.code = 0;
+  XSETFRAME (inev.ie.frame_or_window, f);
+  inev.ie.modifiers = 0;
+  inev.ie.timestamp = 0;
+  evq_enqueue (&inev);
+}
+
+static gboolean
+key_press_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
+{
+  struct coding_system coding;
+  union buffered_input_event inev;
+  ptrdiff_t nbytes = 0;
+  Mouse_HLInfo *hlinfo;
+
+  USE_SAFE_ALLOCA;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  hlinfo = MOUSE_HL_INFO (f);
+
+  /* If mouse-highlight is an integer, input clears out
+     mouse highlighting.  */
+  if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+    {
+      clear_mouse_face (hlinfo);
+      hlinfo->mouse_face_hidden = true;
+    }
+
+  if (f != 0)
+    {
+      /* While super is pressed, gtk_im_context_filter_keypress() always 
process the
+       * key events ignoring super.
+       * As a work around, don't call it while super or hyper are pressed...
+       */
+      struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+      if (!(event->key.state & (dpyinfo->super_mod_mask | 
dpyinfo->hyper_mod_mask)))
+       {
+         if (pgtk_im_filter_keypress (f, &event->key))
+           return TRUE;
+       }
+    }
+
+  if (f != 0)
+    {
+      guint keysym, orig_keysym;
+      /* al%imercury@uunet.uu.net says that making this 81
+         instead of 80 fixed a bug whereby meta chars made
+         his Emacs hang.
+
+         It seems that some version of XmbLookupString has
+         a bug of not returning XBufferOverflow in
+         status_return even if the input is too long to
+         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 handa@etl.go.jp  */
+      unsigned char copy_buffer[513];
+      unsigned char *copy_bufptr = copy_buffer;
+      int copy_bufsiz = sizeof (copy_buffer);
+      int modifiers;
+      Lisp_Object coding_system = Qlatin_1;
+      Lisp_Object c;
+      guint state = event->key.state;
+
+      state |=
+       pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
+                                    extra_keyboard_modifiers);
+      modifiers = state;
+
+      /* This will have to go some day...  */
+
+      /* make_lispy_event turns chars into control chars.
+         Don't do it here because XLookupString is too eager.  */
+      state &= ~GDK_CONTROL_MASK;
+      state &= ~(GDK_META_MASK
+                | GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_MOD1_MASK);
+
+      nbytes = event->key.length;
+      if (nbytes > copy_bufsiz)
+       nbytes = copy_bufsiz;
+      memcpy (copy_bufptr, event->key.string, nbytes);
+
+      keysym = event->key.keyval;
+      orig_keysym = keysym;
+
+      /* Common for all keysym input events.  */
+      XSETFRAME (inev.ie.frame_or_window, f);
+      inev.ie.modifiers =
+       pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers);
+      inev.ie.timestamp = event->key.time;
+
+      /* First deal with keysyms which have defined
+         translations to characters.  */
+      if (keysym >= 32 && keysym < 128)
+       /* Avoid explicitly decoding each ASCII character.  */
+       {
+         inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+         inev.ie.code = keysym;
+         goto done;
+       }
+
+      /* Keysyms directly mapped to Unicode characters.  */
+      if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
+       {
+         if (keysym < 0x01000080)
+           inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+         else
+           inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+         inev.ie.code = keysym & 0xFFFFFF;
+         goto done;
+       }
+
+      /* Now non-ASCII.  */
+      if (HASH_TABLE_P (Vpgtk_keysym_table)
+         && (c = Fgethash (make_fixnum (keysym),
+                           Vpgtk_keysym_table, Qnil), FIXNATP (c)))
+       {
+         inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
+                         ? ASCII_KEYSTROKE_EVENT
+                         : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+         inev.ie.code = XFIXNAT (c);
+         goto done;
+       }
+
+      /* Random non-modifier sorts of keysyms.  */
+      if (((keysym >= GDK_KEY_BackSpace && keysym <= GDK_KEY_Escape)
+          || keysym == GDK_KEY_Delete
+#ifdef GDK_KEY_ISO_Left_Tab
+          || (keysym >= GDK_KEY_ISO_Left_Tab && keysym <= GDK_KEY_ISO_Enter)
+#endif
+          || IsCursorKey (keysym)      /* 0xff50 <= x < 0xff60 */
+          || IsMiscFunctionKey (keysym)        /* 0xff60 <= x < VARIES */
+#ifdef HPUX
+          /* This recognizes the "extended function
+             keys".  It seems there's no cleaner way.
+             Test IsModifierKey to avoid handling
+             mode_switch incorrectly.  */
+          || (GDK_KEY_Select <= keysym && keysym < GDK_KEY_KP_Space)
+#endif
+#ifdef GDK_KEY_dead_circumflex
+          || orig_keysym == GDK_KEY_dead_circumflex
+#endif
+#ifdef GDK_KEY_dead_grave
+          || orig_keysym == GDK_KEY_dead_grave
+#endif
+#ifdef GDK_KEY_dead_tilde
+          || orig_keysym == GDK_KEY_dead_tilde
+#endif
+#ifdef GDK_KEY_dead_diaeresis
+          || orig_keysym == GDK_KEY_dead_diaeresis
+#endif
+#ifdef GDK_KEY_dead_macron
+          || orig_keysym == GDK_KEY_dead_macron
+#endif
+#ifdef GDK_KEY_dead_degree
+          || orig_keysym == GDK_KEY_dead_degree
+#endif
+#ifdef GDK_KEY_dead_acute
+          || orig_keysym == GDK_KEY_dead_acute
+#endif
+#ifdef GDK_KEY_dead_cedilla
+          || orig_keysym == GDK_KEY_dead_cedilla
+#endif
+#ifdef GDK_KEY_dead_breve
+          || orig_keysym == GDK_KEY_dead_breve
+#endif
+#ifdef GDK_KEY_dead_ogonek
+          || orig_keysym == GDK_KEY_dead_ogonek
+#endif
+#ifdef GDK_KEY_dead_caron
+          || orig_keysym == GDK_KEY_dead_caron
+#endif
+#ifdef GDK_KEY_dead_doubleacute
+          || orig_keysym == GDK_KEY_dead_doubleacute
+#endif
+#ifdef GDK_KEY_dead_abovedot
+          || orig_keysym == GDK_KEY_dead_abovedot
+#endif
+          || IsKeypadKey (keysym)      /* 0xff80 <= x < 0xffbe */
+          || IsFunctionKey (keysym)    /* 0xffbe <= x < 0xffe1 */
+          /* Any "vendor-specific" key is ok.  */
+          || (orig_keysym & (1 << 28))
+          || (keysym != GDK_KEY_VoidSymbol && nbytes == 0))
+         && !(event->key.is_modifier
+              /* Gtk's modifier keys are different from Xlib's ones.
+               * I need to exclude them.
+               */
+              || IsModifierKey (orig_keysym)
+              /* The symbols from GDK_KEY_ISO_Lock
+                 to GDK_KEY_ISO_Last_Group_Lock
+                 don't have real modifiers but
+                 should be treated similarly to
+                 Mode_switch by Emacs. */
+#if defined GDK_KEY_ISO_Lock && defined GDK_KEY_ISO_Last_Group_Lock
+              || (GDK_KEY_ISO_Lock <= orig_keysym
+                  && orig_keysym <= GDK_KEY_ISO_Last_Group_Lock)
+#endif
+         ))
+       {
+         STORE_KEYSYM_FOR_DEBUG (keysym);
+         /* make_lispy_event will convert this to a symbolic
+            key.  */
+         inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
+         inev.ie.code = keysym;
+         goto done;
+       }
+
+      {                                /* Raw bytes, not keysym.  */
+       ptrdiff_t i;
+       int nchars, len;
+
+       for (i = 0, nchars = 0; i < nbytes; i++)
+         {
+           if (ASCII_CHAR_P (copy_bufptr[i]))
+             nchars++;
+           STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]);
+         }
+
+       if (nchars < nbytes)
+         {
+           /* Decode the input data.  */
+
+           /* The input should be decoded with locale `coding_system'. */
+           if (!NILP (Vlocale_coding_system))
+             coding_system = Vlocale_coding_system;
+           setup_coding_system (coding_system, &coding);
+           coding.src_multibyte = false;
+           coding.dst_multibyte = true;
+           /* The input is converted to events, thus we can't
+              handle composition.  Anyway, there's no XIM that
+              gives us composition information.  */
+           coding.common_flags &= ~CODING_ANNOTATION_MASK;
+
+           SAFE_NALLOCA (coding.destination, MAX_MULTIBYTE_LENGTH, nbytes);
+           coding.dst_bytes = MAX_MULTIBYTE_LENGTH * nbytes;
+           coding.mode |= CODING_MODE_LAST_BLOCK;
+           decode_coding_c_string (&coding, copy_bufptr, nbytes, Qnil);
+           nbytes = coding.produced;
+           nchars = coding.produced_char;
+           copy_bufptr = coding.destination;
+         }
+
+       /* Convert the input data to a sequence of
+          character events.  */
+       for (i = 0; i < nbytes; i += len)
+         {
+           int ch;
+           if (nchars == nbytes)
+             ch = copy_bufptr[i], len = 1;
+           else
+             ch = string_char_and_length (copy_bufptr + i, &len);
+           inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch)
+                           ? ASCII_KEYSTROKE_EVENT
+                           : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+           inev.ie.code = ch;
+           evq_enqueue (&inev);
+         }
+
+       /* count += nchars; */
+
+       inev.ie.kind = NO_EVENT;        /* Already stored above.  */
+
+       if (keysym == GDK_KEY_VoidSymbol)
+         goto done;
+      }
+    }
+
+done:
+  if (inev.ie.kind != NO_EVENT)
+    {
+      XSETFRAME (inev.ie.frame_or_window, f);
+      evq_enqueue (&inev);
+      /* count++; */
+    }
+
+  SAFE_FREE ();
+
+  return TRUE;
+}
+
+static gboolean
+key_release_event (GtkWidget *widget,
+                  GdkEvent *event,
+                  gpointer *user_data)
+{
+  return TRUE;
+}
+
+static gboolean
+configure_event (GtkWidget *widget,
+                GdkEvent *event,
+                gpointer *user_data)
+{
+  struct frame *f = pgtk_any_window_to_frame (event->configure.window);
+  if (f && widget == FRAME_GTK_OUTER_WIDGET (f))
+    {
+      if (any_help_event_p)
+       {
+         Lisp_Object frame;
+         if (f)
+           XSETFRAME (frame, f);
+         else
+           frame = Qnil;
+         help_echo_string = Qnil;
+         gen_help_event (Qnil, frame, Qnil, Qnil, 0);
+       }
+    }
+  return FALSE;
+}
+
+static gboolean
+map_event (GtkWidget *widget,
+          GdkEvent *event,
+          gpointer *user_data)
+{
+  struct frame *f = pgtk_any_window_to_frame (event->any.window);
+  union buffered_input_event inev;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  if (f)
+    {
+      bool iconified = FRAME_ICONIFIED_P (f);
+
+      /* Check if fullscreen was specified before we where mapped the
+         first time, i.e. from the command line.  */
+      if (!FRAME_X_OUTPUT (f)->has_been_visible)
+       {
+         set_fullscreen_state (f);
+       }
+
+      if (!iconified)
+       {
+         /* The `z-group' is reset every time a frame becomes
+            invisible.  Handle this here.  */
+         if (FRAME_Z_GROUP (f) == z_group_above)
+           x_set_z_group (f, Qabove, Qnil);
+         else if (FRAME_Z_GROUP (f) == z_group_below)
+           x_set_z_group (f, Qbelow, Qnil);
+       }
+
+      SET_FRAME_VISIBLE (f, 1);
+      SET_FRAME_ICONIFIED (f, false);
+      FRAME_X_OUTPUT (f)->has_been_visible = true;
+
+      if (iconified)
+       {
+         inev.ie.kind = DEICONIFY_EVENT;
+         XSETFRAME (inev.ie.frame_or_window, f);
+       }
+    }
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return FALSE;
+}
+
+static gboolean
+window_state_event (GtkWidget *widget,
+                   GdkEvent *event,
+                   gpointer *user_data)
+{
+  struct frame *f = pgtk_any_window_to_frame (event->window_state.window);
+  union buffered_input_event inev;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  if (f)
+    {
+      if (event->window_state.new_window_state & GDK_WINDOW_STATE_FOCUSED)
+       {
+         if (FRAME_ICONIFIED_P (f))
+           {
+             /* Gnome shell does not iconify us when C-z is pressed.
+                It hides the frame.  So if our state says we aren't
+                hidden anymore, treat it as deiconified.  */
+             SET_FRAME_VISIBLE (f, 1);
+             SET_FRAME_ICONIFIED (f, false);
+             FRAME_X_OUTPUT (f)->has_been_visible = true;
+             inev.ie.kind = DEICONIFY_EVENT;
+             XSETFRAME (inev.ie.frame_or_window, f);
+           }
+       }
+    }
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return FALSE;
+}
+
+static gboolean
+delete_event (GtkWidget *widget,
+             GdkEvent *event, gpointer *user_data)
+{
+  struct frame *f = pgtk_any_window_to_frame (event->any.window);
+  union buffered_input_event inev;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  if (f)
+    {
+      inev.ie.kind = DELETE_WINDOW_EVENT;
+      XSETFRAME (inev.ie.frame_or_window, f);
+    }
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return TRUE;
+}
+
+/* The focus may have changed.  Figure out if it is a real focus change,
+   by checking both FocusIn/Out and Enter/LeaveNotify events.
+
+   Returns FOCUS_IN_EVENT event in *BUFP. */
+
+/* Handle FocusIn and FocusOut state changes for FRAME.
+   If FRAME has focus and there exists more than one frame, puts
+   a FOCUS_IN_EVENT into *BUFP.  */
+
+static void
+x_focus_changed (gboolean is_enter, int state,
+                struct pgtk_display_info *dpyinfo, struct frame *frame,
+                union buffered_input_event *bufp)
+{
+  if (is_enter)
+    {
+      if (dpyinfo->x_focus_event_frame != frame)
+       {
+         x_new_focus_frame (dpyinfo, frame);
+         dpyinfo->x_focus_event_frame = frame;
+
+         /* Don't stop displaying the initial startup message
+            for a switch-frame event we don't need.  */
+         /* When run as a daemon, Vterminal_frame is always NIL.  */
+         bufp->ie.arg = (((NILP (Vterminal_frame)
+                           || !FRAME_PGTK_P (XFRAME (Vterminal_frame))
+                           || EQ (Fdaemonp (), Qt))
+                          && CONSP (Vframe_list)
+                          && !NILP (XCDR (Vframe_list))) ? Qt : Qnil);
+         bufp->ie.kind = FOCUS_IN_EVENT;
+         XSETFRAME (bufp->ie.frame_or_window, frame);
+       }
+
+      frame->output_data.pgtk->focus_state |= state;
+
+    }
+  else
+    {
+      frame->output_data.pgtk->focus_state &= ~state;
+
+      if (dpyinfo->x_focus_event_frame == frame)
+        {
+          dpyinfo->x_focus_event_frame = 0;
+          x_new_focus_frame (dpyinfo, 0);
+
+          bufp->ie.kind = FOCUS_OUT_EVENT;
+          XSETFRAME (bufp->ie.frame_or_window, frame);
+        }
+
+      if (frame->pointer_invisible)
+       XTtoggle_invisible_pointer (frame, false);
+    }
+}
+
+static gboolean
+enter_notify_event (GtkWidget *widget, GdkEvent *event,
+                   gpointer *user_data)
+{
+  union buffered_input_event inev;
+  struct frame *frame =
+    pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  if (frame == NULL)
+    return FALSE;
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
+  struct frame *focus_frame = dpyinfo->x_focus_frame;
+  int focus_state
+    = focus_frame ? focus_frame->output_data.pgtk->focus_state : 0;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  if (event->crossing.detail != GDK_NOTIFY_INFERIOR
+      && event->crossing.focus && !(focus_state & FOCUS_EXPLICIT))
+    x_focus_changed (TRUE, FOCUS_IMPLICIT, dpyinfo, frame, &inev);
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return TRUE;
+}
+
+static gboolean
+leave_notify_event (GtkWidget *widget, GdkEvent *event,
+                   gpointer *user_data)
+{
+  union buffered_input_event inev;
+  struct frame *frame =
+    pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  if (frame == NULL)
+    return FALSE;
+  struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
+  struct frame *focus_frame = dpyinfo->x_focus_frame;
+  int focus_state
+    = focus_frame ? focus_frame->output_data.pgtk->focus_state : 0;
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame);
+
+  if (frame == hlinfo->mouse_face_mouse_frame)
+    {
+      /* If we move outside the frame, then we're
+        certainly no longer on any text in the frame.  */
+      clear_mouse_face (hlinfo);
+      hlinfo->mouse_face_mouse_frame = 0;
+    }
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  if (event->crossing.detail != GDK_NOTIFY_INFERIOR
+      && event->crossing.focus && !(focus_state & FOCUS_EXPLICIT))
+    x_focus_changed (FALSE, FOCUS_IMPLICIT, dpyinfo, frame, &inev);
+
+  if (frame)
+    {
+      if (any_help_event_p)
+       {
+         Lisp_Object frame_obj;
+         XSETFRAME (frame_obj, frame);
+         help_echo_string = Qnil;
+         gen_help_event (Qnil, frame_obj, Qnil, Qnil, 0);
+       }
+    }
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return TRUE;
+}
+
+static gboolean
+focus_in_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
+{
+  union buffered_input_event inev;
+  struct frame *frame =
+    pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+
+  if (frame == NULL)
+    return TRUE;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  x_focus_changed (TRUE, FOCUS_EXPLICIT,
+                  FRAME_DISPLAY_INFO (frame), frame, &inev);
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+
+  pgtk_im_focus_in (frame);
+
+  return TRUE;
+}
+
+static gboolean
+focus_out_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
+{
+  union buffered_input_event inev;
+  struct frame *frame =
+    pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+
+  if (frame == NULL)
+    return TRUE;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  x_focus_changed (FALSE, FOCUS_EXPLICIT,
+                  FRAME_DISPLAY_INFO (frame), frame, &inev);
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+
+  pgtk_im_focus_out (frame);
+
+  return TRUE;
+}
+
+/* Function to report a mouse movement to the mainstream Emacs code.
+   The input handler calls this.
+
+   We have received a mouse movement event, which is given in *event.
+   If the mouse is over a different glyph than it was last time, tell
+   the mainstream emacs code by setting mouse_moved.  If not, ask for
+   another motion event, so we can check again the next time it moves.  */
+
+static bool
+note_mouse_movement (struct frame *frame, const GdkEventMotion * event)
+{
+  XRectangle *r;
+  struct pgtk_display_info *dpyinfo;
+
+  if (!FRAME_X_OUTPUT (frame))
+    return false;
+
+  dpyinfo = FRAME_DISPLAY_INFO (frame);
+  dpyinfo->last_mouse_movement_time = event->time;
+  dpyinfo->last_mouse_motion_frame = frame;
+  dpyinfo->last_mouse_motion_x = event->x;
+  dpyinfo->last_mouse_motion_y = event->y;
+
+  if (event->window != gtk_widget_get_window (FRAME_GTK_WIDGET (frame)))
+    {
+      frame->mouse_moved = true;
+      dpyinfo->last_mouse_scroll_bar = NULL;
+      note_mouse_highlight (frame, -1, -1);
+      dpyinfo->last_mouse_glyph_frame = NULL;
+      return true;
+    }
+
+
+  /* Has the mouse moved off the glyph it was on at the last sighting?  */
+  r = &dpyinfo->last_mouse_glyph;
+  if (frame != dpyinfo->last_mouse_glyph_frame
+      || event->x < r->x || event->x >= r->x + r->width
+      || event->y < r->y || event->y >= r->y + r->height)
+    {
+      frame->mouse_moved = true;
+      dpyinfo->last_mouse_scroll_bar = NULL;
+      note_mouse_highlight (frame, event->x, event->y);
+      /* Remember which glyph we're now on.  */
+      remember_mouse_glyph (frame, event->x, event->y, r);
+      dpyinfo->last_mouse_glyph_frame = frame;
+      return true;
+    }
+
+  return false;
+}
+
+static gboolean
+motion_notify_event (GtkWidget * widget, GdkEvent * event,
+                    gpointer * user_data)
+{
+  union buffered_input_event inev;
+  struct frame *f, *frame;
+  struct pgtk_display_info *dpyinfo;
+  Mouse_HLInfo *hlinfo;
+
+  /* This is needed to make pointer visible when motion_notify event */
+  pending_signals = true;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  previous_help_echo_string = help_echo_string;
+  help_echo_string = Qnil;
+
+  frame = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  dpyinfo = FRAME_DISPLAY_INFO (frame);
+  f = (gui_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame
+       : pgtk_any_window_to_frame (gtk_widget_get_window (widget)));
+  hlinfo = MOUSE_HL_INFO (f);
+
+  if (hlinfo->mouse_face_hidden)
+    {
+      hlinfo->mouse_face_hidden = false;
+      clear_mouse_face (hlinfo);
+    }
+
+  if (f && xg_event_is_for_scrollbar (f, event))
+    f = 0;
+  if (f)
+    {
+      /* Maybe generate a SELECT_WINDOW_EVENT for
+         `mouse-autoselect-window' but don't let popup menus
+         interfere with this (Bug#1261).  */
+      if (!NILP (Vmouse_autoselect_window)
+         /* Don't switch if we're currently in the minibuffer.
+            This tries to work around problems where the
+            minibuffer gets unselected unexpectedly, and where
+            you then have to move your mouse all the way down to
+            the minibuffer to select it.  */
+         && !MINI_WINDOW_P (XWINDOW (selected_window))
+         /* With `focus-follows-mouse' non-nil create an event
+            also when the target window is on another frame.  */
+         && (f == XFRAME (selected_frame) || !NILP (focus_follows_mouse)))
+       {
+         static Lisp_Object last_mouse_window;
+         Lisp_Object window = window_from_coordinates
+           (f, event->motion.x, event->motion.y, 0, false, false);
+
+         /* A window will be autoselected only when it is not
+            selected now and the last mouse movement event was
+            not in it.  The remainder of the code is a bit vague
+            wrt what a "window" is.  For immediate autoselection,
+            the window is usually the entire window but for GTK
+            where the scroll bars don't count.  For delayed
+            autoselection the window is usually the window's text
+            area including the margins.  */
+         if (WINDOWP (window)
+             && !EQ (window, last_mouse_window)
+             && !EQ (window, selected_window))
+           {
+             inev.ie.kind = SELECT_WINDOW_EVENT;
+             inev.ie.frame_or_window = window;
+           }
+
+         /* Remember the last window where we saw the mouse.  */
+         last_mouse_window = window;
+       }
+
+      if (!note_mouse_movement (f, &event->motion))
+       help_echo_string = previous_help_echo_string;
+    }
+  else
+    {
+      /* If we move outside the frame, then we're
+         certainly no longer on any text in the frame.  */
+      clear_mouse_face (hlinfo);
+    }
+
+  /* If the contents of the global variable help_echo_string
+     has changed, generate a HELP_EVENT.  */
+  int do_help = 0;
+  if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
+    do_help = 1;
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+
+  if (do_help > 0)
+    {
+      Lisp_Object frame;
+
+      if (f)
+       XSETFRAME (frame, f);
+      else
+       frame = Qnil;
+
+      any_help_event_p = true;
+      gen_help_event (help_echo_string, frame, help_echo_window,
+                     help_echo_object, help_echo_pos);
+    }
+
+  return TRUE;
+}
+
+/* Mouse clicks and mouse movement.  Rah.
+
+   Formerly, we used PointerMotionHintMask (in standard_event_mask)
+   so that we would have to call XQueryPointer after each MotionNotify
+   event to ask for another such event.  However, this made mouse tracking
+   slow, and there was a bug that made it eventually stop.
+
+   Simply asking for MotionNotify all the time seems to work better.
+
+   In order to avoid asking for motion events and then throwing most
+   of them away or busy-polling the server for mouse positions, we ask
+   the server for pointer motion hints.  This means that we get only
+   one event per group of mouse movements.  "Groups" are delimited by
+   other kinds of events (focus changes and button clicks, for
+   example), or by XQueryPointer calls; when one of these happens, we
+   get another MotionNotify event the next time the mouse moves.  This
+   is at least as efficient as getting motion events when mouse
+   tracking is on, and I suspect only negligibly worse when tracking
+   is off.  */
+
+/* Prepare a mouse-event in *RESULT for placement in the input queue.
+
+   If the event is a button press, then note that we have grabbed
+   the mouse.  */
+
+static Lisp_Object
+construct_mouse_click (struct input_event *result,
+                      const GdkEventButton * event, struct frame *f)
+{
+  /* Make the event type NO_EVENT; we'll change that when we decide
+     otherwise.  */
+  result->kind = MOUSE_CLICK_EVENT;
+  result->code = event->button - 1;
+  result->timestamp = event->time;
+  result->modifiers =
+    (pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), event->state) |
+     (event->type == GDK_BUTTON_RELEASE ? up_modifier : down_modifier));
+
+  XSETINT (result->x, event->x);
+  XSETINT (result->y, event->y);
+  XSETFRAME (result->frame_or_window, f);
+  result->arg = Qnil;
+  return Qnil;
+}
+
+static gboolean
+button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
+{
+  union buffered_input_event inev;
+  struct frame *f, *frame;
+  struct pgtk_display_info *dpyinfo;
+
+  /* If we decide we want to generate an event to be seen
+     by the rest of Emacs, we put it here.  */
+  bool tab_bar_p = false;
+  bool tool_bar_p = false;
+  Lisp_Object tab_bar_arg = Qnil;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  /* ignore double click and triple click. */
+  if (event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE)
+    return TRUE;
+
+  frame = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  dpyinfo = FRAME_DISPLAY_INFO (frame);
+
+  dpyinfo->last_mouse_glyph_frame = NULL;
+#if 0
+  x_display_set_last_user_time (dpyinfo, event->button.time);
+#endif
+
+  if (gui_mouse_grabbed (dpyinfo))
+    f = dpyinfo->last_mouse_frame;
+  else
+    {
+      f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+
+      if (f && event->button.type == GDK_BUTTON_PRESS
+         && !FRAME_NO_ACCEPT_FOCUS (f))
+       {
+         /* When clicking into a child frame or when clicking
+            into a parent frame with the child frame selected and
+            `no-accept-focus' is not set, select the clicked
+            frame.  */
+         struct frame *hf = dpyinfo->highlight_frame;
+
+         if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf)))
+           {
+             block_input ();
+             gtk_widget_grab_focus (FRAME_GTK_WIDGET (f));
+
+             if (FRAME_GTK_OUTER_WIDGET (f))
+               gtk_window_present (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+             unblock_input ();
+           }
+       }
+    }
+
+  /* xg_event_is_for_scrollbar() doesn't work correctly on sway, and
+   * we shouldn't need it.
+   */
+#if 0
+  if (f && xg_event_is_for_scrollbar (f, event))
+    f = 0;
+#endif
+
+  if (f)
+    {
+      /* Is this in the tab-bar?  */
+      if (WINDOWP (f->tab_bar_window)
+         && WINDOW_TOTAL_LINES (XWINDOW (f->tab_bar_window)))
+       {
+         Lisp_Object window;
+         int x = event->button.x;
+         int y = event->button.y;
+
+         window = window_from_coordinates (f, x, y, 0, true, true);
+         tab_bar_p = EQ (window, f->tab_bar_window);
+
+         if (tab_bar_p)
+           tab_bar_arg = handle_tab_bar_click
+             (f, x, y, event->type == GDK_BUTTON_PRESS,
+              pgtk_gtk_to_emacs_modifiers (dpyinfo, event->button.state));
+       }
+    }
+
+  if (f)
+    {
+      if (!(tab_bar_p && NILP (tab_bar_arg)) && !tool_bar_p)
+       {
+         if (ignore_next_mouse_click_timeout)
+           {
+             if (event->type == GDK_BUTTON_PRESS
+                 && event->button.time > ignore_next_mouse_click_timeout)
+               {
+                 ignore_next_mouse_click_timeout = 0;
+                 construct_mouse_click (&inev.ie, &event->button, f);
+               }
+             if (event->type == GDK_BUTTON_RELEASE)
+               ignore_next_mouse_click_timeout = 0;
+           }
+         else
+           construct_mouse_click (&inev.ie, &event->button, f);
+
+         if (!NILP (tab_bar_arg))
+           inev.ie.arg = tab_bar_arg;
+       }
+#if 0
+      if (FRAME_X_EMBEDDED_P (f))
+       xembed_send_message (f, event->button.time,
+                            XEMBED_REQUEST_FOCUS, 0, 0, 0);
+#endif
+    }
+
+  if (event->type == GDK_BUTTON_PRESS)
+    {
+      dpyinfo->grabbed |= (1 << event->button.button);
+      dpyinfo->last_mouse_frame = f;
+
+      if (dpyinfo->last_click_event != NULL)
+       gdk_event_free (dpyinfo->last_click_event);
+      dpyinfo->last_click_event = gdk_event_copy (event);
+    }
+  else
+    dpyinfo->grabbed &= ~(1 << event->button.button);
+
+  /* Ignore any mouse motion that happened before this event;
+     any subsequent mouse-movement Emacs events should reflect
+     only motion after the ButtonPress/Release.  */
+  if (f != 0)
+    f->mouse_moved = false;
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return TRUE;
+}
+
+static gboolean
+scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
+{
+  union buffered_input_event inev;
+  struct frame *f, *frame;
+  struct pgtk_display_info *dpyinfo;
+  GdkScrollDirection dir;
+  double delta_x, delta_y;
+
+  EVENT_INIT (inev.ie);
+  inev.ie.kind = NO_EVENT;
+  inev.ie.arg = Qnil;
+
+  frame = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  dpyinfo = FRAME_DISPLAY_INFO (frame);
+
+  if (gui_mouse_grabbed (dpyinfo))
+    f = dpyinfo->last_mouse_frame;
+  else
+    f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+
+  inev.ie.kind = NO_EVENT;
+  inev.ie.timestamp = event->scroll.time;
+  inev.ie.modifiers =
+    pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), event->scroll.state);
+  XSETINT (inev.ie.x, event->scroll.x);
+  XSETINT (inev.ie.y, event->scroll.y);
+  XSETFRAME (inev.ie.frame_or_window, f);
+  inev.ie.arg = Qnil;
+
+  if (gdk_event_is_scroll_stop_event (event))
+    {
+      inev.ie.kind = TOUCH_END_EVENT;
+      evq_enqueue (&inev);
+      return TRUE;
+    }
+
+  if (gdk_event_get_scroll_direction (event, &dir))
+    {
+      switch (dir)
+       {
+       case GDK_SCROLL_UP:
+         inev.ie.kind = WHEEL_EVENT;
+         inev.ie.modifiers |= up_modifier;
+         break;
+       case GDK_SCROLL_DOWN:
+         inev.ie.kind = WHEEL_EVENT;
+         inev.ie.modifiers |= down_modifier;
+         break;
+       case GDK_SCROLL_LEFT:
+         inev.ie.kind = HORIZ_WHEEL_EVENT;
+         inev.ie.modifiers |= up_modifier;
+         break;
+       case GDK_SCROLL_RIGHT:
+         inev.ie.kind = HORIZ_WHEEL_EVENT;
+         inev.ie.modifiers |= down_modifier;
+         break;
+       case GDK_SCROLL_SMOOTH:         /* shut up warning */
+         break;
+       }
+    }
+  else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
+    {
+      if (!mwheel_coalesce_scroll_events)
+       {
+         inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
+                         ? HORIZ_WHEEL_EVENT
+                         : WHEEL_EVENT);
+         inev.ie.modifiers |= (inev.ie.kind == HORIZ_WHEEL_EVENT
+                               ? (delta_x >= 0 ? up_modifier : down_modifier)
+                               : (delta_y >= 0 ? down_modifier : up_modifier));
+         inev.ie.arg = list3 (Qnil, make_float (-delta_x * 100),
+                              make_float (-delta_y * 100));
+       }
+      else
+       {
+         dpyinfo->scroll.acc_x += delta_x;
+         dpyinfo->scroll.acc_y += delta_y;
+         if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
+           {
+             int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
+             inev.ie.kind = WHEEL_EVENT;
+             inev.ie.modifiers |= down_modifier;
+             inev.ie.arg = list3 (make_fixnum (nlines),
+                                  make_float (-dpyinfo->scroll.acc_x * 100),
+                                  make_float (-dpyinfo->scroll.acc_y * 100));
+             dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
+           }
+         else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
+           {
+             int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
+             inev.ie.kind = WHEEL_EVENT;
+             inev.ie.modifiers |= up_modifier;
+             inev.ie.arg = list3 (make_fixnum (nlines),
+                                  make_float (-dpyinfo->scroll.acc_x * 100),
+                                  make_float (-dpyinfo->scroll.acc_y * 100));
+
+             dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
+           }
+         else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
+                  || !mwheel_coalesce_scroll_events)
+           {
+             int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
+             inev.ie.kind = HORIZ_WHEEL_EVENT;
+             inev.ie.modifiers |= up_modifier;
+             inev.ie.arg = list3 (make_fixnum (nchars),
+                                  make_float (-dpyinfo->scroll.acc_x * 100),
+                                  make_float (-dpyinfo->scroll.acc_y * 100));
+
+             dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
+           }
+         else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
+           {
+             int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
+             inev.ie.kind = HORIZ_WHEEL_EVENT;
+             inev.ie.modifiers |= down_modifier;
+             inev.ie.arg = list3 (make_fixnum (nchars),
+                                  make_float (-dpyinfo->scroll.acc_x * 100),
+                                  make_float (-dpyinfo->scroll.acc_y * 100));
+
+             dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
+           }
+       }
+    }
+
+  if (inev.ie.kind != NO_EVENT)
+    evq_enqueue (&inev);
+  return TRUE;
+}
+
+static void
+drag_data_received (GtkWidget * widget, GdkDragContext * context,
+                   gint x, gint y,
+                   GtkSelectionData * data,
+                   guint info, guint time, gpointer user_data)
+{
+  struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+  gchar **uris = gtk_selection_data_get_uris (data);
+
+  if (uris != NULL)
+    {
+      for (int i = 0; uris[i] != NULL; i++)
+       {
+         union buffered_input_event inev;
+         Lisp_Object arg = Qnil;
+
+         EVENT_INIT (inev.ie);
+         inev.ie.kind = NO_EVENT;
+         inev.ie.arg = Qnil;
+
+         arg = list2 (Qurl, build_string (uris[i]));
+
+         inev.ie.kind = DRAG_N_DROP_EVENT;
+         inev.ie.modifiers = 0;
+         XSETINT (inev.ie.x, x);
+         XSETINT (inev.ie.y, y);
+         XSETFRAME (inev.ie.frame_or_window, f);
+         inev.ie.arg = arg;
+         inev.ie.timestamp = 0;
+
+         evq_enqueue (&inev);
+       }
+    }
+
+  gtk_drag_finish (context, TRUE, FALSE, time);
+}
+
+void
+pgtk_set_event_handler (struct frame *f)
+{
+  if (f->tooltip)
+    {
+      g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "draw",
+                       G_CALLBACK (pgtk_handle_draw), NULL);
+      return;
+    }
+
+  gtk_drag_dest_set (FRAME_GTK_WIDGET (f), GTK_DEST_DEFAULT_ALL, NULL, 0,
+                    GDK_ACTION_COPY);
+  gtk_drag_dest_add_uri_targets (FRAME_GTK_WIDGET (f));
+
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      g_signal_connect (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
+                       "window-state-event", G_CALLBACK (window_state_event),
+                       NULL);
+      g_signal_connect (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), "delete-event",
+                       G_CALLBACK (delete_event), NULL);
+      g_signal_connect (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), "event",
+                       G_CALLBACK (pgtk_handle_event), NULL);
+      g_signal_connect (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), 
"configure-event",
+                       G_CALLBACK (configure_event), NULL);
+    }
+
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "map-event",
+                   G_CALLBACK (map_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "size-allocate",
+                   G_CALLBACK (size_allocate), f);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-press-event",
+                   G_CALLBACK (key_press_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-release-event",
+                   G_CALLBACK (key_release_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "focus-in-event",
+                   G_CALLBACK (focus_in_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "focus-out-event",
+                   G_CALLBACK (focus_out_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "enter-notify-event",
+                   G_CALLBACK (enter_notify_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "leave-notify-event",
+                   G_CALLBACK (leave_notify_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "motion-notify-event",
+                   G_CALLBACK (motion_notify_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "button-press-event",
+                   G_CALLBACK (button_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "button-release-event",
+                   G_CALLBACK (button_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "scroll-event",
+                   G_CALLBACK (scroll_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "selection-clear-event",
+                   G_CALLBACK (pgtk_selection_lost), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "configure-event",
+                   G_CALLBACK (configure_event), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "drag-data-received",
+                   G_CALLBACK (drag_data_received), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "draw",
+                   G_CALLBACK (pgtk_handle_draw), NULL);
+  g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "event",
+                   G_CALLBACK (pgtk_handle_event), NULL);
+}
+
+static void
+my_log_handler (const gchar * log_domain, GLogLevelFlags log_level,
+               const gchar * msg, gpointer user_data)
+{
+  if (!strstr (msg, "g_set_prgname"))
+    fprintf (stderr, "%s-WARNING **: %s", log_domain, msg);
+}
+
+/* Test whether two display-name strings agree up to the dot that separates
+   the screen number from the server number.  */
+static bool
+same_x_server (const char *name1, const char *name2)
+{
+  bool seen_colon = false;
+  Lisp_Object sysname = Fsystem_name ();
+  const char *system_name = SSDATA (sysname);
+  ptrdiff_t system_name_length = SBYTES (sysname);
+  ptrdiff_t length_until_period = 0;
+
+  while (system_name[length_until_period] != 0
+        && system_name[length_until_period] != '.')
+    length_until_period++;
+
+  /* Treat `unix' like an empty host name.  */
+  if (!strncmp (name1, "unix:", 5))
+    name1 += 4;
+  if (!strncmp (name2, "unix:", 5))
+    name2 += 4;
+  /* Treat this host's name like an empty host name.  */
+  if (!strncmp (name1, system_name, system_name_length)
+      && name1[system_name_length] == ':')
+    name1 += system_name_length;
+  if (!strncmp (name2, system_name, system_name_length)
+      && name2[system_name_length] == ':')
+    name2 += system_name_length;
+  /* Treat this host's domainless name like an empty host name.  */
+  if (!strncmp (name1, system_name, length_until_period)
+      && name1[length_until_period] == ':')
+    name1 += length_until_period;
+  if (!strncmp (name2, system_name, length_until_period)
+      && name2[length_until_period] == ':')
+    name2 += length_until_period;
+
+  for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
+    {
+      if (*name1 == ':')
+       seen_colon = true;
+      if (seen_colon && *name1 == '.')
+       return true;
+    }
+  return (seen_colon
+         && (*name1 == '.' || *name1 == '\0')
+         && (*name2 == '.' || *name2 == '\0'));
+}
+
+#define GNOME_INTERFACE_SCHEMA "org.gnome.desktop.interface"
+
+static gdouble pgtk_text_scaling_factor (void)
+{
+  GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default 
();
+  if (schema_source != NULL)
+    {
+      GSettingsSchema *schema = g_settings_schema_source_lookup (schema_source,
+         GNOME_INTERFACE_SCHEMA, true);
+      if (schema != NULL)
+        {
+         g_settings_schema_unref (schema);
+         GSettings *set = g_settings_new (GNOME_INTERFACE_SCHEMA);
+         return g_settings_get_double (set, "text-scaling-factor");
+       }
+    }
+  return 1;
+}
+
+
+/* Open a connection to X display DISPLAY_NAME, and return
+   the structure that describes the open display.
+   If we cannot contact the display, return null.  */
+
+struct pgtk_display_info *
+pgtk_term_init (Lisp_Object display_name, char *resource_name)
+{
+  GdkDisplay *dpy;
+  struct terminal *terminal;
+  struct pgtk_display_info *dpyinfo;
+  static int x_initialized = 0;
+  static unsigned x_display_id = 0;
+  static char *initial_display = NULL;
+  static dynlib_handle_ptr *handle = NULL;
+  char *dpy_name;
+  Lisp_Object lisp_dpy_name = Qnil;
+
+  block_input ();
+
+  if (!x_initialized)
+    {
+      any_help_event_p = false;
+
+      Fset_input_interrupt_mode (Qt);
+      baud_rate = 19200;
+
+#ifdef USE_CAIRO
+      gui_init_fringe (&pgtk_redisplay_interface);
+#endif
+
+      ++x_initialized;
+    }
+
+  dpy_name = SSDATA (display_name);
+  if (strlen (dpy_name) == 0 && initial_display != NULL)
+    dpy_name = initial_display;
+  lisp_dpy_name = build_string (dpy_name);
+
+  {
+#define NUM_ARGV 10
+    int argc;
+    char *argv[NUM_ARGV];
+    char **argv2 = argv;
+    guint id;
+
+    if (x_initialized++ > 1)
+      {
+       xg_display_open (dpy_name, &dpy);
+      }
+    else
+      {
+        static char display_opt[] = "--display";
+        static char name_opt[] = "--name";
+
+        for (argc = 0; argc < NUM_ARGV; ++argc)
+          argv[argc] = 0;
+
+        argc = 0;
+        argv[argc++] = initial_argv[0];
+
+       if (strlen (dpy_name) != 0)
+         {
+           argv[argc++] = display_opt;
+           argv[argc++] = dpy_name;
+         }
+
+        argv[argc++] = name_opt;
+        argv[argc++] = resource_name;
+
+       /* Work around GLib bug that outputs a faulty warning. See
+          https://bugzilla.gnome.org/show_bug.cgi?id=563627.  */
+       id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
+                               | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
+
+       /* gtk_init does set_locale.  Fix locale before and after.  */
+       fixup_locale ();
+       unrequest_sigio ();     /* See comment in x_display_ok.  */
+       gtk_init (&argc, &argv2);
+       request_sigio ();
+       fixup_locale ();
+
+
+        g_log_remove_handler ("GLib", id);
+
+        xg_initialize ();
+
+        dpy = DEFAULT_GDK_DISPLAY ();
+
+       initial_display = g_strdup (gdk_display_get_name (dpy));
+       dpy_name = initial_display;
+       lisp_dpy_name = build_string (dpy_name);
+      }
+  }
+
+  /* Detect failure.  */
+  if (dpy == 0)
+    {
+      unblock_input ();
+      return 0;
+    }
+
+
+  dpyinfo = xzalloc (sizeof *dpyinfo);
+  pgtk_initialize_display_info (dpyinfo);
+  terminal = pgtk_create_terminal (dpyinfo);
+
+  {
+    struct pgtk_display_info *share;
+
+    for (share = x_display_list; share; share = share->next)
+      if (same_x_server (SSDATA (XCAR (share->name_list_element)), dpy_name))
+       break;
+    if (share)
+      terminal->kboard = share->terminal->kboard;
+    else
+      {
+       terminal->kboard = allocate_kboard (Qpgtk);
+
+       /* Don't let the initial kboard remain current longer than necessary.
+          That would cause problems if a file loaded on startup tries to
+          prompt in the mini-buffer.  */
+       if (current_kboard == initial_kboard)
+         current_kboard = terminal->kboard;
+      }
+    terminal->kboard->reference_count++;
+  }
+
+  /* Put this display on the chain.  */
+  dpyinfo->next = x_display_list;
+  x_display_list = dpyinfo;
+
+  dpyinfo->name_list_element = Fcons (lisp_dpy_name, Qnil);
+  dpyinfo->gdpy = dpy;
+
+  /* https://lists.gnu.org/r/emacs-devel/2015-11/msg00194.html  */
+  dpyinfo->smallest_font_height = 1;
+  dpyinfo->smallest_char_width = 1;
+
+  /* Set the name of the terminal. */
+  terminal->name = xlispstrdup (lisp_dpy_name);
+
+  Lisp_Object system_name = Fsystem_name ();
+  ptrdiff_t nbytes;
+  if (INT_ADD_WRAPV (SBYTES (Vinvocation_name), SBYTES (system_name) + 2,
+                    &nbytes))
+    memory_full (SIZE_MAX);
+  dpyinfo->x_id = ++x_display_id;
+  dpyinfo->x_id_name = xmalloc (nbytes);
+  char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
+  *nametail++ = '@';
+  lispstpcpy (nametail, system_name);
+
+  /* Figure out which modifier bits mean what.  */
+  x_find_modifier_meanings (dpyinfo);
+
+  /* Get the scroll bar cursor.  */
+  /* We must create a GTK cursor, it is required for GTK widgets.  */
+  dpyinfo->xg_cursor = xg_create_default_cursor (dpyinfo->gdpy);
+
+  dpyinfo->vertical_scroll_bar_cursor
+    = gdk_cursor_new_for_display (dpyinfo->gdpy, GDK_SB_V_DOUBLE_ARROW);
+
+  dpyinfo->horizontal_scroll_bar_cursor
+    = gdk_cursor_new_for_display (dpyinfo->gdpy, GDK_SB_H_DOUBLE_ARROW);
+
+  dpyinfo->icon_bitmap_id = -1;
+
+  reset_mouse_highlight (&dpyinfo->mouse_highlight);
+
+  {
+    GdkScreen *gscr = gdk_display_get_default_screen (dpyinfo->gdpy);
+
+    gdouble dpi = gdk_screen_get_resolution (gscr);
+    if (dpi < 0)
+       dpi = 96.0;
+
+    dpi *= pgtk_text_scaling_factor ();
+    dpyinfo->resx = dpi;
+    dpyinfo->resy = dpi;
+  }
+
+  /* smooth scroll setting */
+  dpyinfo->scroll.x_per_char = 2;
+  dpyinfo->scroll.y_per_line = 2;
+
+  dpyinfo->connection = -1;
+
+  if (!handle)
+    handle = dynlib_open (NULL);
+
+#ifdef GDK_WINDOWING_X11
+  if (!strcmp (G_OBJECT_TYPE_NAME (dpy), "GdkX11Display") && handle)
+    {
+      void *(*gdk_x11_display_get_xdisplay) (GdkDisplay *)
+       = dynlib_sym (handle, "gdk_x11_display_get_xdisplay");
+      int (*x_connection_number) (void *)
+       = dynlib_sym (handle, "XConnectionNumber");
+
+      if (x_connection_number
+         && gdk_x11_display_get_xdisplay)
+       dpyinfo->connection
+         = x_connection_number (gdk_x11_display_get_xdisplay (dpy));
+    }
+#endif
+
+#ifdef GDK_WINDOWING_WAYLAND
+  if (GDK_IS_WAYLAND_DISPLAY (dpy) && handle)
+    {
+      struct wl_display *wl_dpy = gdk_wayland_display_get_wl_display (dpy);
+      int (*display_get_fd) (struct wl_display *)
+       = dynlib_sym (handle, "wl_display_get_fd");
+
+      if (display_get_fd)
+       dpyinfo->connection = display_get_fd (wl_dpy);
+    }
+#endif
+
+  if (dpyinfo->connection >= 0)
+    {
+      add_keyboard_wait_descriptor (dpyinfo->connection);
+#ifdef F_SETOWN
+      fcntl (dpyinfo->connection, F_SETOWN, getpid ());
+#endif /* ! defined (F_SETOWN) */
+
+      if (interrupt_input)
+       init_sigio (dpyinfo->connection);
+    }
+
+  x_setup_pointer_blanking (dpyinfo);
+
+  xsettings_initialize (dpyinfo);
+
+  pgtk_selection_init ();
+
+  pgtk_im_init (dpyinfo);
+
+  unblock_input ();
+
+  return dpyinfo;
+}
+
+/* Get rid of display DPYINFO, deleting all frames on it,
+   and without sending any more commands to the X server.  */
+
+static void
+pgtk_delete_display (struct pgtk_display_info *dpyinfo)
+{
+  struct terminal *t;
+
+  /* Close all frames and delete the generic struct terminal for this
+     X display.  */
+  for (t = terminal_list; t; t = t->next_terminal)
+    if (t->type == output_pgtk && t->display_info.pgtk == dpyinfo)
+      {
+        delete_terminal (t);
+        break;
+      }
+
+  if (x_display_list == dpyinfo)
+    x_display_list = dpyinfo->next;
+  else
+    {
+      struct pgtk_display_info *tail;
+
+      for (tail = x_display_list; tail; tail = tail->next)
+       if (tail->next == dpyinfo)
+         tail->next = tail->next->next;
+    }
+
+  xfree (dpyinfo);
+}
+
+char *
+pgtk_xlfd_to_fontname (const char *xlfd)
+/* --------------------------------------------------------------------------
+    Convert an X font name (XLFD) to an Gtk font name.
+    Only family is used.
+    The string returned is temporarily allocated.
+   -------------------------------------------------------------------------- 
*/
+{
+  char *name = xmalloc (180);
+
+  if (!strncmp (xlfd, "--", 2))
+    {
+      if (sscanf (xlfd, "--%179[^-]-", name) != 1)
+       name[0] = '\0';
+    }
+  else
+    {
+      if (sscanf (xlfd, "-%*[^-]-%179[^-]-", name) != 1)
+       name[0] = '\0';
+    }
+
+  /* stopgap for malformed XLFD input */
+  if (strlen (name) == 0)
+    strcpy (name, "Monospace");
+
+  return name;
+}
+
+bool
+pgtk_defined_color (struct frame *f,
+                   const char *name,
+                   Emacs_Color * color_def, bool alloc, bool makeIndex)
+/* --------------------------------------------------------------------------
+         Return true if named color found, and set color_def rgb accordingly.
+         If makeIndex and alloc are nonzero put the color in the color_table,
+         and set color_def pixel to the resulting index.
+         If makeIndex is zero, set color_def pixel to ARGB.
+         Return false if not found
+   -------------------------------------------------------------------------- 
*/
+{
+  int r;
+
+  block_input ();
+  r = xg_check_special_colors (f, name, color_def);
+  if (!r)
+    r = pgtk_parse_color (f, name, color_def);
+  unblock_input ();
+  return r;
+}
+
+/* On frame F, translate the color name to RGB values.  Use cached
+   information, if possible.
+
+   Note that there is currently no way to clean old entries out of the
+   cache.  However, it is limited to names in the server's database,
+   and names we've actually looked up; list-colors-display is probably
+   the most color-intensive case we're likely to hit.  */
+
+int
+pgtk_parse_color (struct frame *f, const char *color_name,
+                 Emacs_Color * color)
+{
+  GdkRGBA rgba;
+  if (gdk_rgba_parse (&rgba, color_name))
+    {
+      color->red = rgba.red * 65535;
+      color->green = rgba.green * 65535;
+      color->blue = rgba.blue * 65535;
+      color->pixel =
+       (color->red >> 8) << 16 |
+       (color->green >> 8) << 8 |
+       (color->blue >> 8) << 0;
+      return 1;
+    }
+  return 0;
+}
+
+/* On frame F, translate pixel colors to RGB values for the NCOLORS
+   colors in COLORS.  On W32, we no longer try to map colors to
+   a palette.  */
+void
+pgtk_query_colors (struct frame *f, Emacs_Color * colors, int ncolors)
+{
+  int i;
+
+  for (i = 0; i < ncolors; i++)
+    {
+      unsigned long pixel = colors[i].pixel;
+      /* Convert to a 16 bit value in range 0 - 0xffff. */
+#define GetRValue(p) (((p) >> 16) & 0xff)
+#define GetGValue(p) (((p) >> 8) & 0xff)
+#define GetBValue(p) (((p) >> 0) & 0xff)
+      colors[i].red = GetRValue (pixel) * 257;
+      colors[i].green = GetGValue (pixel) * 257;
+      colors[i].blue = GetBValue (pixel) * 257;
+    }
+}
+
+void
+pgtk_query_color (struct frame *f, Emacs_Color * color)
+{
+  pgtk_query_colors (f, color, 1);
+}
+
+void
+pgtk_clear_area (struct frame *f, int x, int y, int width, int height)
+{
+  cairo_t *cr;
+
+  eassert (width > 0 && height > 0);
+
+  cr = pgtk_begin_cr_clip (f);
+  pgtk_set_cr_source_with_color (f, FRAME_X_OUTPUT (f)->background_color);
+  cairo_rectangle (cr, x, y, width, height);
+  cairo_fill (cr);
+  pgtk_end_cr_clip (f);
+}
+
+
+void
+syms_of_pgtkterm (void)
+{
+  /* from 23+ we need to tell emacs what modifiers there are.. */
+  DEFSYM (Qmodifier_value, "modifier-value");
+  DEFSYM (Qalt, "alt");
+  DEFSYM (Qhyper, "hyper");
+  DEFSYM (Qmeta, "meta");
+  DEFSYM (Qsuper, "super");
+  DEFSYM (Qcontrol, "control");
+  DEFSYM (QUTF8_STRING, "UTF8_STRING");
+
+  DEFSYM (Qfile, "file");
+  DEFSYM (Qurl, "url");
+
+  DEFSYM (Qlatin_1, "latin-1");
+
+  xg_default_icon_file =
+    build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
+  staticpro (&xg_default_icon_file);
+
+  DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock");
+
+
+  Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
+  Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
+  Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
+  Fput (Qsuper, Qmodifier_value, make_fixnum (super_modifier));
+  Fput (Qcontrol, Qmodifier_value, make_fixnum (ctrl_modifier));
+
+  DEFVAR_LISP ("x-ctrl-keysym", Vx_ctrl_keysym,
+              doc: /* Which keys Emacs uses for the ctrl modifier.
+This should be one of the symbols `ctrl', `alt', `hyper', `meta',
+`super'.  For example, `ctrl' means use the Ctrl_L and Ctrl_R keysyms.
+The default is nil, which is the same as `ctrl'.  */ );
+  Vx_ctrl_keysym = Qnil;
+
+  DEFVAR_LISP ("x-alt-keysym", Vx_alt_keysym,
+              doc: /* Which keys Emacs uses for the alt modifier.
+This should be one of the symbols `ctrl', `alt', `hyper', `meta',
+`super'.  For example, `alt' means use the Alt_L and Alt_R keysyms.
+The default is nil, which is the same as `alt'.  */ );
+  Vx_alt_keysym = Qnil;
+
+  DEFVAR_LISP ("x-hyper-keysym", Vx_hyper_keysym,
+              doc: /* Which keys Emacs uses for the hyper modifier.
+This should be one of the symbols `ctrl', `alt', `hyper', `meta',
+`super'.  For example, `hyper' means use the Hyper_L and Hyper_R
+keysyms.  The default is nil, which is the same as `hyper'.  */ );
+  Vx_hyper_keysym = Qnil;
+
+  DEFVAR_LISP ("x-meta-keysym", Vx_meta_keysym,
+              doc: /* Which keys Emacs uses for the meta modifier.
+This should be one of the symbols `ctrl', `alt', `hyper', `meta',
+`super'.  For example, `meta' means use the Meta_L and Meta_R keysyms.
+The default is nil, which is the same as `meta'.  */ );
+  Vx_meta_keysym = Qnil;
+
+  DEFVAR_LISP ("x-super-keysym", Vx_super_keysym,
+              doc: /* Which keys Emacs uses for the super modifier.
+This should be one of the symbols `ctrl', `alt', `hyper', `meta',
+`super'.  For example, `super' means use the Super_L and Super_R
+keysyms.  The default is nil, which is the same as `super'.  */ );
+  Vx_super_keysym = Qnil;
+
+  /* TODO: move to common code */
+  DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
+              doc: /* Which toolkit scroll bars Emacs uses, if any.
+A value of nil means Emacs doesn't use toolkit scroll bars.
+With the X Window system, the value is a symbol describing the
+X toolkit.  Possible values are: gtk, motif, xaw, or xaw3d.
+With MS Windows or Nextstep, the value is t.  */ );
+  /* Vx_toolkit_scroll_bars = Qt; */
+  Vx_toolkit_scroll_bars = intern_c_string ("gtk");
+
+  DEFVAR_BOOL ("x-use-underline-position-properties", 
x_use_underline_position_properties,
+              doc: /*Non-nil means make use of UNDERLINE_POSITION font 
properties.
+A value of nil means ignore them.  If you encounter fonts with bogus
+UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
+to 4.1, set this to nil. */);
+  x_use_underline_position_properties = 0;
+
+  DEFVAR_BOOL ("x-underline-at-descent-line", x_underline_at_descent_line,
+              doc: /* Non-nil means to draw the underline at the same place as 
the descent line.
+A value of nil means to draw the underline according to the value of the
+variable `x-use-underline-position-properties', which is usually at the
+baseline level.  The default value is nil.  */);
+  x_underline_at_descent_line = 0;
+
+  DEFVAR_BOOL ("x-gtk-use-window-move", x_gtk_use_window_move,
+              doc: /* Non-nil means rely on gtk_window_move to set frame 
positions.
+If this variable is t (the default), the GTK build uses the function
+gtk_window_move to set or store frame positions and disables some time
+consuming frame position adjustments.  In newer versions of GTK, Emacs
+always uses gtk_window_move and ignores the value of this variable.  */);
+  x_gtk_use_window_move = true;
+
+
+  DEFVAR_LISP ("pgtk-wait-for-event-timeout", Vpgtk_wait_for_event_timeout,
+              doc: /* How long to wait for X events.
+
+Emacs will wait up to this many seconds to receive X events after
+making changes which affect the state of the graphical interface.
+Under some window managers this can take an indefinite amount of time,
+so it is important to limit the wait.
+
+If set to a non-float value, there will be no wait at all.  */);
+  Vpgtk_wait_for_event_timeout = make_float (0.1);
+
+  DEFVAR_LISP ("pgtk-keysym-table", Vpgtk_keysym_table,
+              doc: /* Hash table of character codes indexed by X keysym codes. 
 */);
+  Vpgtk_keysym_table =
+    make_hash_table (hashtest_eql, 900, DEFAULT_REHASH_SIZE,
+                    DEFAULT_REHASH_THRESHOLD, Qnil, false);
+
+  window_being_scrolled = Qnil;
+  staticpro (&window_being_scrolled);
+
+  /* Tell Emacs about this window system.  */
+  Fprovide (Qpgtk, Qnil);
+}
+
+/* Cairo does not allow resizing a surface/context after it is
+ * created, so we need to trash the old context, create a new context
+ * on the next cr_clip_begin with the new dimensions and request a
+ * re-draw.
+ *
+ * This Will leave the active context available to present on screen
+ * until a redrawn frame is completed.
+ */
+void
+pgtk_cr_update_surface_desired_size (struct frame *f, int width, int height, 
bool force)
+{
+  if (FRAME_CR_SURFACE_DESIRED_WIDTH (f) != width
+      || FRAME_CR_SURFACE_DESIRED_HEIGHT (f) != height
+      || force)
+    {
+      pgtk_cr_destroy_frame_context (f);
+      FRAME_CR_SURFACE_DESIRED_WIDTH (f) = width;
+      FRAME_CR_SURFACE_DESIRED_HEIGHT (f) = height;
+      SET_FRAME_GARBAGED (f);
+    }
+}
+
+
+cairo_t *
+pgtk_begin_cr_clip (struct frame *f)
+{
+  cairo_t *cr = FRAME_CR_CONTEXT (f);
+
+  if (!cr)
+    {
+      cairo_surface_t *surface =
+       gdk_window_create_similar_surface (gtk_widget_get_window
+                                          (FRAME_GTK_WIDGET (f)),
+                                          CAIRO_CONTENT_COLOR_ALPHA,
+                                          FRAME_CR_SURFACE_DESIRED_WIDTH (f),
+                                          FRAME_CR_SURFACE_DESIRED_HEIGHT
+                                          (f));
+
+      cr = FRAME_CR_CONTEXT (f) = cairo_create (surface);
+      cairo_surface_destroy (surface);
+    }
+
+  cairo_save (cr);
+
+  return cr;
+}
+
+void
+pgtk_end_cr_clip (struct frame *f)
+{
+  cairo_restore (FRAME_CR_CONTEXT (f));
+}
+
+void
+pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC * gc)
+{
+  pgtk_set_cr_source_with_color (f, gc->foreground);
+}
+
+void
+pgtk_set_cr_source_with_gc_background (struct frame *f, Emacs_GC * gc)
+{
+  pgtk_set_cr_source_with_color (f, gc->background);
+}
+
+void
+pgtk_set_cr_source_with_color (struct frame *f, unsigned long color)
+{
+  Emacs_Color col;
+  col.pixel = color;
+  pgtk_query_color (f, &col);
+  cairo_set_source_rgb (FRAME_CR_CONTEXT (f), col.red / 65535.0,
+                       col.green / 65535.0, col.blue / 65535.0);
+}
+
+void
+pgtk_cr_draw_frame (cairo_t * cr, struct frame *f)
+{
+  cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), 0, 0);
+  cairo_paint (cr);
+}
+
+static cairo_status_t
+pgtk_cr_accumulate_data (void *closure, const unsigned char *data,
+                     unsigned int length)
+{
+  Lisp_Object *acc = (Lisp_Object *) closure;
+
+  *acc = Fcons (make_unibyte_string ((char const *) data, length), *acc);
+
+  return CAIRO_STATUS_SUCCESS;
+}
+
+void
+pgtk_cr_destroy_frame_context (struct frame *f)
+{
+  if (FRAME_CR_CONTEXT (f) != NULL)
+    {
+      cairo_destroy (FRAME_CR_CONTEXT (f));
+      FRAME_CR_CONTEXT (f) = NULL;
+    }
+}
+
+static void
+pgtk_cr_destroy (void *cr)
+{
+  block_input ();
+  cairo_destroy (cr);
+  unblock_input ();
+}
+
+
+
+Lisp_Object
+pgtk_cr_export_frames (Lisp_Object frames, cairo_surface_type_t surface_type)
+{
+  struct frame *f;
+  cairo_surface_t *surface;
+  cairo_t *cr;
+  int width, height;
+  void (*surface_set_size_func) (cairo_surface_t *, double, double) = NULL;
+  Lisp_Object acc = Qnil;
+  ptrdiff_t count = SPECPDL_INDEX ();
+
+  specbind (Qredisplay_dont_pause, Qt);
+  redisplay_preserve_echo_area (31);
+
+  f = XFRAME (XCAR (frames));
+  frames = XCDR (frames);
+  width = FRAME_PIXEL_WIDTH (f);
+  height = FRAME_PIXEL_HEIGHT (f);
+
+  block_input ();
+#ifdef CAIRO_HAS_PDF_SURFACE
+  if (surface_type == CAIRO_SURFACE_TYPE_PDF)
+    {
+      surface = cairo_pdf_surface_create_for_stream (pgtk_cr_accumulate_data, 
&acc,
+                                                    width, height);
+      surface_set_size_func = cairo_pdf_surface_set_size;
+    }
+  else
+#endif
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
+  if (surface_type == CAIRO_SURFACE_TYPE_IMAGE)
+    surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
+  else
+#endif
+#ifdef CAIRO_HAS_PS_SURFACE
+  if (surface_type == CAIRO_SURFACE_TYPE_PS)
+    {
+      surface = cairo_ps_surface_create_for_stream (pgtk_cr_accumulate_data, 
&acc,
+                                                   width, height);
+      surface_set_size_func = cairo_ps_surface_set_size;
+    }
+  else
+#endif
+#ifdef CAIRO_HAS_SVG_SURFACE
+  if (surface_type == CAIRO_SURFACE_TYPE_SVG)
+    surface = cairo_svg_surface_create_for_stream (pgtk_cr_accumulate_data, 
&acc,
+                                                  width, height);
+  else
+#endif
+    abort ();
+
+  cr = cairo_create (surface);
+  cairo_surface_destroy (surface);
+  record_unwind_protect_ptr (pgtk_cr_destroy, cr);
+
+  while (1)
+    {
+      cairo_t *saved_cr = FRAME_CR_CONTEXT (f);
+      FRAME_CR_CONTEXT (f) = cr;
+      pgtk_clear_area (f, 0, 0, width, height);
+      expose_frame (f, 0, 0, width, height);
+      FRAME_CR_CONTEXT (f) = saved_cr;
+
+      if (NILP (frames))
+       break;
+
+      cairo_surface_show_page (surface);
+      f = XFRAME (XCAR (frames));
+      frames = XCDR (frames);
+      width = FRAME_PIXEL_WIDTH (f);
+      height = FRAME_PIXEL_HEIGHT (f);
+      if (surface_set_size_func)
+       (*surface_set_size_func) (surface, width, height);
+
+      unblock_input ();
+      maybe_quit ();
+      block_input ();
+    }
+
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
+  if (surface_type == CAIRO_SURFACE_TYPE_IMAGE)
+    {
+      cairo_surface_flush (surface);
+      cairo_surface_write_to_png_stream (surface, pgtk_cr_accumulate_data, 
&acc);
+    }
+#endif
+  unblock_input ();
+
+  unbind_to (count, Qnil);
+
+  return CALLN (Fapply, intern ("concat"), Fnreverse (acc));
+}
+
+
+void
+init_pgtkterm (void)
+{
+}
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
new file mode 100644
index 0000000000..42b03e315e
--- /dev/null
+++ b/src/pgtkterm.h
@@ -0,0 +1,668 @@
+/* Definitions and headers for communication with pure Gtk+3.
+   Copyright (C) 1989, 1993, 2005, 2008-2022 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/>.  */
+
+#ifndef _PGTKTERM_H_
+#define _PGTKTERM_H_
+
+#include "dispextern.h"
+#include "frame.h"
+#include "character.h"
+#include "font.h"
+#include "sysselect.h"
+
+#ifdef HAVE_PGTK
+
+#include <gtk/gtk.h>
+
+#ifdef CAIRO_HAS_PDF_SURFACE
+#include <cairo-pdf.h>
+#endif
+#ifdef CAIRO_HAS_PS_SURFACE
+#include <cairo-ps.h>
+#endif
+#ifdef CAIRO_HAS_SVG_SURFACE
+#include <cairo-svg.h>
+#endif
+
+/* could use list to store these, but rest of emacs has a big infrastructure
+   for managing a table of bitmap "records" */
+struct pgtk_bitmap_record
+{
+  void *img;
+  char *file;
+  int refcount;
+  int height, width, depth;
+  cairo_pattern_t *pattern;
+};
+
+#define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
+#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | 
(b))
+
+#define ALPHA_FROM_ULONG(color) ((color) >> 24)
+#define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
+#define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
+#define BLUE_FROM_ULONG(color) ((color) & 0xff)
+
+struct scroll_bar
+{
+  /* These fields are shared by all vectors.  */
+  union vectorlike_header header;
+
+  /* The window we're a scroll bar for.  */
+  Lisp_Object window;
+
+  /* The next and previous in the chain of scroll bars in this frame.  */
+  Lisp_Object next, prev;
+
+  /* Fields from `x_window' down will not be traced by the GC.  */
+
+  /* The X window representing this scroll bar.  */
+  Window x_window;
+
+  /* The position and size of the scroll bar in pixels, relative to the
+     frame.  */
+  int top, left, width, height;
+
+  /* The starting and ending positions of the handle, relative to the
+     handle area (i.e. zero is the top position, not
+     SCROLL_BAR_TOP_BORDER).  If they're equal, that means the handle
+     hasn't been drawn yet.
+
+     These are not actually the locations where the beginning and end
+     are drawn; in order to keep handles from becoming invisible when
+     editing large files, we establish a minimum height by always
+     drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
+     where they would be normally; the bottom and top are in a
+     different co-ordinate system.  */
+  int start, end;
+
+  /* If the scroll bar handle is currently being dragged by the user,
+     this is the number of pixels from the top of the handle to the
+     place where the user grabbed it.  If the handle isn't currently
+     being dragged, this is -1.  */
+  int dragging;
+
+#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
+  /* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback.  
*/
+  enum scroll_bar_part last_seen_part;
+#endif
+
+#if defined (USE_TOOLKIT_SCROLL_BARS) && !defined (USE_GTK)
+  /* Last value of whole for horizontal scrollbars.  */
+  int whole;
+#endif
+
+  /* True if the scroll bar is horizontal.  */
+  bool horizontal;
+};
+
+
+/* init'd in pgtk_initialize_display_info () */
+struct pgtk_display_info
+{
+  /* Chain of all pgtk_display_info structures.  */
+  struct pgtk_display_info *next;
+
+  /* The generic display parameters corresponding to this PGTK display. */
+  struct terminal *terminal;
+
+  /* This says how to access this display in Gdk.  */
+  GdkDisplay *gdpy;
+
+  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).  */
+  Lisp_Object name_list_element;
+
+  /* Number of frames that are on this display.  */
+  int reference_count;
+
+  /* Logical identifier of this display.  */
+  unsigned x_id;
+
+  /* Default name for all frames on this display.  */
+  char *x_id_name;
+
+  /* The number of fonts loaded. */
+  int n_fonts;
+
+  /* Minimum width over all characters in all fonts in font_table.  */
+  int smallest_char_width;
+
+  /* Minimum font height over all fonts in font_table.  */
+  int smallest_font_height;
+
+  struct pgtk_bitmap_record *bitmaps;
+  ptrdiff_t bitmaps_size;
+  ptrdiff_t bitmaps_last;
+
+  /* DPI resolution of this screen */
+  double resx, resy;
+
+  /* Mask of things that cause the mouse to be grabbed */
+  int grabbed;
+
+  int n_planes;
+
+  int color_p;
+
+  /* Emacs bitmap-id of the default icon bitmap for this frame.
+     Or -1 if none has been allocated yet.  */
+  ptrdiff_t icon_bitmap_id;
+
+  Window root_window;
+
+  /* Xism */
+  XrmDatabase rdb;
+
+  /* The cursor to use for vertical scroll bars. */
+  Emacs_Cursor vertical_scroll_bar_cursor;
+
+  /* The cursor to use for horizontal scroll bars. */
+  Emacs_Cursor horizontal_scroll_bar_cursor;
+
+  /* Information about the range of text currently shown in
+     mouse-face.  */
+  Mouse_HLInfo mouse_highlight;
+
+  struct frame *highlight_frame;
+  struct frame *x_focus_frame;
+
+  /* The last frame mentioned in a FocusIn or FocusOut event.  This is
+     separate from x_focus_frame, because whether or not LeaveNotify
+     events cause us to lose focus depends on whether or not we have
+     received a FocusIn event for it.  */
+  struct frame *x_focus_event_frame;
+
+  /* The frame where the mouse was last time we reported a mouse event.  */
+  struct frame *last_mouse_frame;
+
+  /* The frame where the mouse was last time we reported a mouse motion.  */
+  struct frame *last_mouse_motion_frame;
+
+  /* Position where the mouse was last time we reported a motion.
+     This is a position on last_mouse_motion_frame.  */
+  int last_mouse_motion_x;
+  int last_mouse_motion_y;
+
+  /* Where the mouse was last time we reported a mouse position.  */
+  XRectangle last_mouse_glyph;
+
+  /* Time of last mouse movement.  */
+  Time last_mouse_movement_time;
+
+  /* The scroll bar in which the last motion event occurred.  */
+  void *last_mouse_scroll_bar;
+
+  /* The invisible cursor used for pointer blanking.
+     Unused if this display supports Xfixes extension.  */
+  Emacs_Cursor invisible_cursor;
+
+  /* Function used to toggle pointer visibility on this display.  */
+  void (*toggle_visible_pointer) (struct frame *, bool);
+
+  /* The GDK cursor for scroll bars and popup menus.  */
+  GdkCursor *xg_cursor;
+
+
+  /* The frame where the mouse was last time we reported a mouse position.  */
+  struct frame *last_mouse_glyph_frame;
+
+  /* Modifier masks in gdk */
+  int meta_mod_mask, alt_mod_mask, super_mod_mask, hyper_mod_mask;
+
+  /* The last click event. */
+  GdkEvent *last_click_event;
+
+  /* input method */
+  struct
+  {
+    GtkIMContext *context;
+    struct frame *focused_frame;
+  } im;
+
+  struct
+  {
+    double acc_x, acc_y;
+    double x_per_char, y_per_line;
+  } scroll;
+
+  int connection;
+};
+
+/* This is a chain of structures for all the PGTK displays currently in use.  
*/
+extern struct pgtk_display_info *x_display_list;
+
+struct pgtk_output
+{
+#if 0
+  void *view;
+  void *miniimage;
+#endif
+  unsigned long foreground_color;
+  unsigned long background_color;
+  void *toolbar;
+
+  /* Cursors */
+  Emacs_Cursor current_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;
+
+  /* PGTK-specific */
+  Emacs_Cursor current_pointer;
+
+  /* border color */
+  unsigned long border_pixel;
+  GtkCssProvider *border_color_css_provider;
+
+  /* scrollbar color */
+  GtkCssProvider *scrollbar_foreground_css_provider;
+  GtkCssProvider *scrollbar_background_css_provider;
+
+  /* Widget whose cursor is hourglass_cursor.  This widget is temporarily
+     mapped to display an hourglass cursor.  */
+  GtkWidget *hourglass_widget;
+
+  Emacs_GC cursor_xgcv;
+
+  /* lord knows why Emacs needs to know about our Window ids.. */
+  Window window_desc, parent_desc;
+  char explicit_parent;
+
+  /* If >=0, a bitmap index.  The indicated bitmap is used for the
+     icon. */
+  ptrdiff_t icon_bitmap;
+
+  struct font *font;
+  int baseline_offset;
+
+  /* If a fontset is specified for this frame instead of font, this
+     value contains an ID of the fontset, else -1.  */
+  int fontset;                 /* only used with font_backend */
+
+  unsigned long mouse_color;
+  unsigned long cursor_color;
+  unsigned long cursor_foreground_color;
+
+  int icon_top;
+  int icon_left;
+
+  /* The size of the extra width currently allotted for vertical
+     scroll bars, in pixels.  */
+  int vertical_scroll_bar_extra;
+
+  /* The height of the titlebar decoration (included in PGTKWindow's frame). */
+  int titlebar_height;
+
+  /* The height of the toolbar if displayed, else 0. */
+  int toolbar_height;
+
+  /* This is the Emacs structure for the PGTK display this frame is on.  */
+  struct pgtk_display_info *display_info;
+
+  /* Non-zero if we are zooming (maximizing) the frame.  */
+  int zooming;
+
+  /* Non-zero if we are doing an animation, e.g. toggling the tool bar. */
+  int in_animation;
+
+  /* The last size hints set.  */
+  GdkGeometry size_hints;
+  long hint_flags;
+  int preferred_width, preferred_height;
+
+  /* The widget of this screen.  This is the window of a top widget.  */
+  GtkWidget *widget;
+  /* The widget of the edit portion of this screen; the window in
+     "window_desc" is inside of this.  */
+  GtkWidget *edit_widget;
+  /* The widget used for laying out widgets vertically.  */
+  GtkWidget *vbox_widget;
+  /* The widget used for laying out widgets horizontally.  */
+  GtkWidget *hbox_widget;
+  /* The menubar in this frame.  */
+  GtkWidget *menubar_widget;
+  /* The tool bar in this frame  */
+  GtkWidget *toolbar_widget;
+  /* True if tool bar is packed into the hbox widget (i.e. vertical).  */
+  bool_bf toolbar_in_hbox:1;
+  bool_bf toolbar_is_packed:1;
+
+  GtkTooltip *ttip_widget;
+  GtkWidget *ttip_lbl;
+  GtkWindow *ttip_window;
+
+  /* Height of menu bar widget, in pixels.  This value
+     is not meaningful if the menubar is turned off.  */
+  int menubar_height;
+
+  /* Height of tool bar widget, in pixels.  top_height is used if tool bar
+     at top, bottom_height if tool bar is at the bottom.
+     Zero if not using an external tool bar or if tool bar is vertical.  */
+  int toolbar_top_height, toolbar_bottom_height;
+
+  /* Width of tool bar widget, in pixels.  left_width is used if tool bar
+     at left, right_width if tool bar is at the right.
+     Zero if not using an external tool bar or if tool bar is horizontal.  */
+  int toolbar_left_width, toolbar_right_width;
+
+#ifdef USE_CAIRO
+  /* Cairo drawing contexts.  */
+  cairo_t *cr_context, *cr_active;
+  int cr_surface_desired_width, cr_surface_desired_height;
+  /* Cairo surface for double buffering */
+  cairo_surface_t *cr_surface_visible_bell;
+#endif
+  struct atimer *atimer_visible_bell;
+
+  int has_been_visible;
+
+  /* Relief GCs, colors etc.  */
+  struct relief
+  {
+    Emacs_GC xgcv;
+    unsigned long pixel;
+  }
+  black_relief, white_relief;
+
+  /* The background for which the above relief GCs were set up.
+     They are changed only when a different background is involved.  */
+  unsigned long relief_background;
+
+  /* Keep track of focus.  May be EXPLICIT if we received a FocusIn for this
+     frame, or IMPLICIT if we received an EnterNotify.
+     FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
+  int focus_state;
+
+  /* Keep track of scale factor.  If monitor's scale factor is changed, or
+     monitor is switched and scale factor is changed, then recreate cairo_t
+     and cairo_surface_t.  I need GTK's such signal, but there isn't, so
+     I watch it periodically with atimer. */
+  double watched_scale_factor;
+  struct atimer *scale_factor_atimer;
+};
+
+/* this dummy decl needed to support TTYs */
+struct x_output
+{
+  int unused;
+};
+
+enum
+{
+  /* Values for focus_state, used as bit mask.
+     EXPLICIT means we received a FocusIn for the frame and know it has
+     the focus.  IMPLICIT means we received an EnterNotify and the frame
+     may have the focus if no window manager is running.
+     FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
+  FOCUS_NONE = 0,
+  FOCUS_IMPLICIT = 1,
+  FOCUS_EXPLICIT = 2
+};
+
+/* This gives the pgtk_display_info structure for the display F is on.  */
+#define FRAME_X_OUTPUT(f)         ((f)->output_data.pgtk)
+#define FRAME_OUTPUT_DATA(f)      FRAME_X_OUTPUT (f)
+
+#define FRAME_DISPLAY_INFO(f)     (FRAME_X_OUTPUT (f)->display_info)
+#define FRAME_FOREGROUND_COLOR(f) (FRAME_X_OUTPUT (f)->foreground_color)
+#define FRAME_BACKGROUND_COLOR(f) (FRAME_X_OUTPUT (f)->background_color)
+#define FRAME_CURSOR_COLOR(f)     (FRAME_X_OUTPUT (f)->cursor_color)
+#define FRAME_POINTER_TYPE(f)     (FRAME_X_OUTPUT (f)->current_pointer)
+#define FRAME_FONT(f)             (FRAME_X_OUTPUT (f)->font)
+#define FRAME_GTK_OUTER_WIDGET(f) (FRAME_X_OUTPUT (f)->widget)
+#define FRAME_GTK_WIDGET(f)       (FRAME_X_OUTPUT (f)->edit_widget)
+#define FRAME_WIDGET(f)           (FRAME_GTK_OUTER_WIDGET (f) ?                
\
+                                   FRAME_GTK_OUTER_WIDGET (f) :                
\
+                                   FRAME_GTK_WIDGET (f))
+
+/* aliases */
+#define FRAME_PGTK_VIEW(f)         FRAME_GTK_WIDGET (f)
+#define FRAME_X_WINDOW(f)          FRAME_GTK_OUTER_WIDGET (f)
+#define FRAME_NATIVE_WINDOW(f)     GTK_WINDOW (FRAME_X_WINDOW (f))
+
+#define FRAME_X_DISPLAY(f)        (FRAME_DISPLAY_INFO (f)->gdpy)
+
+#define DEFAULT_GDK_DISPLAY() gdk_display_get_default ()
+
+/* Turning a lisp vector value into a pointer to a struct scroll_bar.  */
+#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
+
+#define PGTK_FACE_FOREGROUND(f) ((f)->foreground)
+#define PGTK_FACE_BACKGROUND(f) ((f)->background)
+#define FRAME_DEFAULT_FACE(f) FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID)
+
+/* Compute pixel height of the frame's titlebar. */
+#define FRAME_PGTK_TITLEBAR_HEIGHT(f)                                     0
+
+/* Compute pixel size for vertical scroll bars */
+#define PGTK_SCROLL_BAR_WIDTH(f)                                       \
+  (FRAME_HAS_VERTICAL_SCROLL_BARS (f)                                  \
+   ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0                       \
+          ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f)                          \
+          : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)))      \
+   : 0)
+
+/* Compute pixel size for horizontal scroll bars */
+#define PGTK_SCROLL_BAR_HEIGHT(f)                                      \
+  (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)                                        
\
+   ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0                      \
+          ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f)                         \
+          : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)))      \
+   : 0)
+
+/* Difference btwn char-column-calculated and actual SB widths.
+   This is only a concern for rendering when SB on left. */
+#define PGTK_SCROLL_BAR_ADJUST(w, f)                           \
+  (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ?                        \
+   (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)         \
+    - PGTK_SCROLL_BAR_WIDTH (f)) : 0)
+
+/* Difference btwn char-line-calculated and actual SB heights.
+   This is only a concern for rendering when SB on top. */
+#define PGTK_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f)              \
+  (WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ?             \
+   (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \
+    - PGTK_SCROLL_BAR_HEIGHT (f)) : 0)
+
+#define FRAME_MENUBAR_HEIGHT(f) (FRAME_X_OUTPUT (f)->menubar_height)
+
+/* Calculate system coordinates of the left and top of the parent
+   window or, if there is no parent window, the screen. */
+#define PGTK_PARENT_WINDOW_LEFT_POS(f)                                    \
+  (FRAME_PARENT_FRAME (f) != NULL                                       \
+   ? [[FRAME_PGTK_VIEW (f) window] parentWindow].frame.origin.x : 0)
+#define PGTK_PARENT_WINDOW_TOP_POS(f)                                     \
+  (FRAME_PARENT_FRAME (f) != NULL                                       \
+   ? ([[FRAME_PGTK_VIEW (f) window] parentWindow].frame.origin.y          \
+      + [[FRAME_PGTK_VIEW (f) window] parentWindow].frame.size.height     \
+      - FRAME_PGTK_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f)))              \
+   : [[[PGTKScreen screepgtk] objectAtIndex: 0] frame].size.height)
+
+#define FRAME_PGTK_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table)
+
+#define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.pgtk->toolbar_top_height)
+#define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
+  ((f)->output_data.pgtk->toolbar_bottom_height)
+#define FRAME_TOOLBAR_HEIGHT(f) \
+  (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
+#define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.pgtk->toolbar_left_width)
+#define FRAME_TOOLBAR_RIGHT_WIDTH(f) 
((f)->output_data.pgtk->toolbar_right_width)
+#define FRAME_TOOLBAR_WIDTH(f) \
+  (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f))
+
+#define FRAME_FONTSET(f) (FRAME_X_OUTPUT (f)->fontset)
+
+#define FRAME_BASELINE_OFFSET(f) (FRAME_X_OUTPUT (f)->baseline_offset)
+#define BLACK_PIX_DEFAULT(f) 0x000000
+#define WHITE_PIX_DEFAULT(f) 0xFFFFFF
+
+/* First position where characters can be shown (instead of scrollbar, if
+   it is on left. */
+#define FIRST_CHAR_POSITION(f)                         \
+  (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0  \
+   : FRAME_SCROLL_BAR_COLS (f))
+
+#define FRAME_CR_SURFACE_DESIRED_WIDTH(f)              \
+  ((f)->output_data.pgtk->cr_surface_desired_width)
+#define FRAME_CR_SURFACE_DESIRED_HEIGHT(f) \
+  ((f)->output_data.pgtk->cr_surface_desired_height)
+
+/* Display init/shutdown functions implemented in pgtkterm.c */
+extern struct pgtk_display_info *pgtk_term_init (Lisp_Object display_name,
+                                                char *resource_name);
+extern void pgtk_term_shutdown (int sig);
+
+/* Implemented in pgtkterm, published in or needed from pgtkfns. */
+extern void pgtk_clear_frame (struct frame *f);
+extern char *pgtk_xlfd_to_fontname (const char *xlfd);
+
+/* Implemented in pgtkfns. */
+extern void pgtk_set_doc_edited (void);
+extern const char *pgtk_get_defaults_value (const char *key);
+extern const char *pgtk_get_string_resource (XrmDatabase rdb,
+                                            const char *name,
+                                            const char *class);
+extern void pgtk_implicitly_set_name (struct frame *f, Lisp_Object arg,
+                                     Lisp_Object oldval);
+
+/* Color management implemented in pgtkterm. */
+extern bool pgtk_defined_color (struct frame *f,
+                               const char *name,
+                               Emacs_Color * color_def, bool alloc,
+                               bool makeIndex);
+extern void pgtk_query_color (struct frame *f, Emacs_Color * color);
+extern void pgtk_query_colors (struct frame *f, Emacs_Color * colors,
+                              int ncolors);
+extern int pgtk_parse_color (struct frame *f, const char *color_name,
+                            Emacs_Color * color);
+
+/* Implemented in pgtkterm.c */
+extern void pgtk_clear_area (struct frame *f, int x, int y, int width,
+                            int height);
+extern int pgtk_gtk_to_emacs_modifiers (struct pgtk_display_info *dpyinfo,
+                                       int state);
+extern void pgtk_clear_under_internal_border (struct frame *f);
+extern void pgtk_set_event_handler (struct frame *f);
+
+/* Implemented in pgtkterm.c */
+extern int x_display_pixel_height (struct pgtk_display_info *);
+extern int x_display_pixel_width (struct pgtk_display_info *);
+
+/* Implemented in pgtkterm.c */
+extern void x_destroy_window (struct frame *f);
+extern void x_set_parent_frame (struct frame *f, Lisp_Object new_value,
+                               Lisp_Object old_value);
+extern void x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value,
+                                  Lisp_Object old_value);
+extern void x_set_no_accept_focus (struct frame *f, Lisp_Object new_value,
+                                  Lisp_Object old_value);
+extern void x_set_z_group (struct frame *f, Lisp_Object new_value,
+                          Lisp_Object old_value);
+
+/* Cairo related functions implemented in pgtkterm.c */
+extern void pgtk_cr_update_surface_desired_size (struct frame *, int, int, 
bool);
+extern cairo_t *pgtk_begin_cr_clip (struct frame *f);
+extern void pgtk_end_cr_clip (struct frame *f);
+extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f,
+                                                  Emacs_GC * gc);
+extern void pgtk_set_cr_source_with_gc_background (struct frame *f,
+                                                  Emacs_GC * gc);
+extern void pgtk_set_cr_source_with_color (struct frame *f,
+                                          unsigned long color);
+extern void pgtk_cr_draw_frame (cairo_t * cr, struct frame *f);
+extern void pgtk_cr_destroy_frame_context (struct frame *f);
+extern Lisp_Object pgtk_cr_export_frames (Lisp_Object frames, 
cairo_surface_type_t surface_type);
+
+/* Defined in pgtkmenu.c */
+extern Lisp_Object pgtk_popup_dialog (struct frame *f, Lisp_Object header,
+                                     Lisp_Object contents);
+extern Lisp_Object pgtk_dialog_show (struct frame *f, Lisp_Object title,
+                                    Lisp_Object header,
+                                    const char **error_name);
+extern void initialize_frame_menubar (struct frame *);
+
+
+/* Symbol initializations implemented in each pgtk sources. */
+extern void syms_of_pgtkterm (void);
+extern void syms_of_pgtkfns (void);
+extern void syms_of_pgtkmenu (void);
+extern void syms_of_pgtkselect (void);
+extern void syms_of_pgtkim (void);
+
+/* Implemented in pgtkselect. */
+extern void nxatoms_of_pgtkselect (void);
+
+/* Initialization and marking implemented in pgtkterm.c */
+extern void init_pgtkterm (void);
+extern void mark_pgtkterm (void);
+extern void pgtk_delete_terminal (struct terminal *terminal);
+
+extern void pgtk_make_frame_visible (struct frame *f);
+extern void pgtk_make_frame_invisible (struct frame *f);
+extern void x_wm_set_size_hint (struct frame *, long, bool);
+extern void x_free_frame_resources (struct frame *);
+extern void pgtk_iconify_frame (struct frame *f);
+extern void pgtk_focus_frame (struct frame *f, bool noactivate);
+extern void pgtk_set_scroll_bar_default_width (struct frame *f);
+extern void pgtk_set_scroll_bar_default_height (struct frame *f);
+extern Lisp_Object x_get_focus_frame (struct frame *frame);
+
+extern void pgtk_frame_rehighlight (struct pgtk_display_info *dpyinfo);
+
+extern void x_change_tab_bar_height (struct frame *, int);
+
+extern struct pgtk_display_info *check_pgtk_display_info (Lisp_Object object);
+
+extern void pgtk_default_font_parameter (struct frame *f, Lisp_Object parms);
+
+extern void pgtk_menu_set_in_use (bool in_use);
+
+
+extern void pgtk_enqueue_string (struct frame *f, gchar * str);
+extern void pgtk_enqueue_preedit (struct frame *f, Lisp_Object image_data);
+extern void pgtk_im_focus_in (struct frame *f);
+extern void pgtk_im_focus_out (struct frame *f);
+extern bool pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev);
+extern void pgtk_im_set_cursor_location (struct frame *f, int x, int y,
+                                        int width, int height);
+extern void pgtk_im_init (struct pgtk_display_info *dpyinfo);
+extern void pgtk_im_finish (struct pgtk_display_info *dpyinfo);
+
+extern bool xg_set_icon (struct frame *, Lisp_Object);
+extern bool xg_set_icon_from_xpm_data (struct frame *f, const char **data);
+
+extern bool pgtk_text_icon (struct frame *f, const char *icon_name);
+
+extern double pgtk_frame_scale_factor (struct frame *);
+extern int pgtk_emacs_to_gtk_modifiers (struct pgtk_display_info *, int);
+
+#endif /* HAVE_PGTK */
+#endif /* _PGTKTERM_H_ */
diff --git a/src/print.c b/src/print.c
index 214f1d12c1..a3c9011215 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,6 +1,6 @@
 /* Lisp object printing and output streams.
 
-Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
+Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -1524,16 +1524,21 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
     case PVEC_XWIDGET:
 #ifdef HAVE_XWIDGETS
       {
+       if (NILP (XXWIDGET (obj)->buffer))
+         print_c_string ("#<killed xwidget>", printcharfun);
+       else
+         {
 #ifdef USE_GTK
-       int len = sprintf (buf, "#<xwidget %u %p>",
-                          XXWIDGET (obj)->xwidget_id,
-                          XXWIDGET (obj)->widget_osr);
+           int len = sprintf (buf, "#<xwidget %u %p>",
+                              XXWIDGET (obj)->xwidget_id,
+                              XXWIDGET (obj)->widget_osr);
 #else
-       int len = sprintf (buf, "#<xwidget %u %p>",
-                          XXWIDGET (obj)->xwidget_id,
-                          XXWIDGET (obj)->xwWidget);
+           int len = sprintf (buf, "#<xwidget %u %p>",
+                              XXWIDGET (obj)->xwidget_id,
+                              XXWIDGET (obj)->xwWidget);
 #endif
-       strout (buf, len, len, printcharfun);
+           strout (buf, len, len, printcharfun);
+         }
        break;
       }
 #else
diff --git a/src/process.c b/src/process.c
index 76094988f2..9664180cfd 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1,6 +1,6 @@
 /* Asynchronous subprocess control for GNU Emacs.
 
-Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2021 Free Software
+Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/process.h b/src/process.h
index 4a25d13d26..392b661ce6 100644
--- a/src/process.h
+++ b/src/process.h
@@ -1,5 +1,5 @@
 /* Definitions for asynchronous process control in GNU Emacs.
-   Copyright (C) 1985, 1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/profiler.c b/src/profiler.c
index 21ae2447aa..31a46d1b5e 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -1,6 +1,6 @@
 /* Profiler implementation.
 
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/puresize.h b/src/puresize.h
index 811d0b4d36..5516747ac2 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -1,5 +1,5 @@
 /* How much read-only Lisp storage a dumped Emacs needs.
-   Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/ralloc.c b/src/ralloc.c
index 02689265f2..22a5f5bc5a 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1,5 +1,5 @@
 /* Block-relocating memory allocator.
-   Copyright (C) 1993, 1995, 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 3224f65fa4..7c172fe63a 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -1,6 +1,6 @@
 /* Emacs regular expression matching and search
 
-   Copyright (C) 1993-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/src/regex-emacs.h b/src/regex-emacs.h
index 027ab65558..59579a1a8b 100644
--- a/src/regex-emacs.h
+++ b/src/regex-emacs.h
@@ -1,6 +1,6 @@
 /* Emacs regular expression API
 
-   Copyright (C) 1985, 1989-1993, 1995, 2000-2021 Free Software
+   Copyright (C) 1985, 1989-1993, 1995, 2000-2022 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/src/region-cache.c b/src/region-cache.c
index b75a9691b5..20fb14b671 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -1,6 +1,6 @@
 /* Caching facts about regions of the buffer, for optimization.
 
-Copyright (C) 1985-1989, 1993, 1995, 2001-2021 Free Software Foundation,
+Copyright (C) 1985-1989, 1993, 1995, 2001-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/region-cache.h b/src/region-cache.h
index 128215718d..dc732328c8 100644
--- a/src/region-cache.h
+++ b/src/region-cache.h
@@ -1,6 +1,6 @@
 /* Header file: Caching facts about regions of the buffer, for optimization.
 
-Copyright (C) 1985-1986, 1993, 1995, 2001-2021 Free Software Foundation,
+Copyright (C) 1985-1986, 1993, 1995, 2001-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/scroll.c b/src/scroll.c
index 9042888d1f..c643730965 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -1,6 +1,6 @@
 /* Calculate what line insertion or deletion to do, and do it
 
-Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2021 Free Software
+Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/search.c b/src/search.c
index 66e77d42b4..a1adfa2d8c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1,6 +1,6 @@
 /* String search routines for GNU Emacs.
 
-Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2021 Free Software
+Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/sheap.c b/src/sheap.c
index 5401e791b0..1ec1f699ce 100644
--- a/src/sheap.c
+++ b/src/sheap.c
@@ -1,7 +1,7 @@
 /* simulate `sbrk' with an array in .bss, for `unexec' support for Cygwin;
    complete rewrite of xemacs Cygwin `unexec' code
 
-   Copyright (C) 2004-2021 Free Software Foundation, Inc.
+   Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/sheap.h b/src/sheap.h
index f1004d6c2e..297b7cf317 100644
--- a/src/sheap.h
+++ b/src/sheap.h
@@ -1,6 +1,6 @@
 /* Static heap allocation for GNU Emacs.
 
-Copyright 2016-2021 Free Software Foundation, Inc.
+Copyright 2016-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/sound.c b/src/sound.c
index d42bc8550d..9681a136e4 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1,6 +1,6 @@
 /* sound.c -- sound support.
 
-Copyright (C) 1998-1999, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1998-1999, 2001-2022 Free Software Foundation, Inc.
 
 Author: Gerd Moellmann <gerd@gnu.org>
 
diff --git a/src/sqlite.c b/src/sqlite.c
index d92dcf723c..649cb38294 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2021 Free Software Foundation, Inc.
+Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -247,7 +247,7 @@ If FILE is nil, an in-memory database will be opened 
instead.  */)
   if (!NILP (file))
     {
       CHECK_STRING (file);
-      file = encode_string (Fexpand_file_name (file, Qnil));
+      file = ENCODE_FILE (Fexpand_file_name (file, Qnil));
       name = xstrdup (SSDATA (file));
     }
   else
@@ -400,7 +400,9 @@ Value is the number of affected rows.  */)
 
  exit:
   if (errmsg != NULL)
-    xsignal1 (Qerror, build_string (errmsg));
+    xsignal1 (ret == SQLITE_LOCKED || ret == SQLITE_BUSY?
+             Qsqlite_locked_error: Qerror,
+             build_string (errmsg));
 
   return retval;
 }
@@ -572,22 +574,59 @@ DEFUN ("sqlite-rollback", Fsqlite_rollback, 
Ssqlite_rollback, 1, 1, 0,
   return sqlite_exec (XSQLITE (db)->db, "rollback");
 }
 
+DEFUN ("sqlite-pragma", Fsqlite_pragma, Ssqlite_pragma, 2, 2, 0,
+       doc: /* Execute PRAGMA in DB.  */)
+  (Lisp_Object db, Lisp_Object pragma)
+{
+  check_sqlite (db, false);
+  CHECK_STRING (pragma);
+
+  return sqlite_exec (XSQLITE (db)->db,
+                     SSDATA (concat2 (build_string ("PRAGMA "), pragma)));
+}
+
 #ifdef HAVE_SQLITE3_LOAD_EXTENSION
 DEFUN ("sqlite-load-extension", Fsqlite_load_extension,
        Ssqlite_load_extension, 2, 2, 0,
        doc: /* Load an SQlite MODULE into DB.
 MODULE should be the name of an SQlite module's file, a
 shared library in the system-dependent format and having a
-system-dependent file-name extension.  */)
+system-dependent file-name extension.
+
+Only modules on Emacs' list of allowed modules can be loaded.  */)
   (Lisp_Object db, Lisp_Object module)
 {
   check_sqlite (db, false);
   CHECK_STRING (module);
-  Lisp_Object module_encoded = encode_string (Fexpand_file_name (module, 
Qnil));
 
-  sqlite3 *sdb = XSQLITE (db)->db;
-  int result = sqlite3_load_extension (sdb, SSDATA (module_encoded),
-                                      NULL, NULL);
+  /* Add names of useful and free modules here.  */
+  const char *allowlist[3] = { "pcre", "csvtable", NULL };
+  char *name = SSDATA (Ffile_name_nondirectory (module));
+  /* Possibly skip past a common prefix.  */
+  const char *prefix = "libsqlite3_mod_";
+  if (!strncmp (name, prefix, strlen (prefix)))
+    name += strlen (prefix);
+
+  bool do_allow = false;
+  for (const char **allow = allowlist; *allow; allow++)
+    {
+      if (strlen (*allow) < strlen (name)
+         && !strncmp (*allow, name, strlen (*allow))
+         && (!strcmp (name + strlen (*allow), ".so")
+             || !strcmp (name + strlen (*allow), ".DLL")))
+       {
+         do_allow = true;
+         break;
+       }
+    }
+
+  if (!do_allow)
+    xsignal (Qerror, build_string ("Module name not on allowlist"));
+
+  int result = sqlite3_load_extension
+                      (XSQLITE (db)->db,
+                       SSDATA (ENCODE_FILE (Fexpand_file_name (module, Qnil))),
+                       NULL, NULL);
   if (result ==  SQLITE_OK)
     return Qt;
   return Qnil;
@@ -687,6 +726,7 @@ syms_of_sqlite (void)
   defsubr (&Ssqlite_transaction);
   defsubr (&Ssqlite_commit);
   defsubr (&Ssqlite_rollback);
+  defsubr (&Ssqlite_pragma);
 #ifdef HAVE_SQLITE3_LOAD_EXTENSION
   defsubr (&Ssqlite_load_extension);
 #endif
@@ -698,8 +738,15 @@ syms_of_sqlite (void)
   DEFSYM (Qfull, "full");
 #endif
   defsubr (&Ssqlitep);
-  DEFSYM (Qsqlitep, "sqlitep");
   defsubr (&Ssqlite_available_p);
+
+  DEFSYM (Qsqlite_locked_error, "sqlite-locked-error");
+  Fput (Qsqlite_locked_error, Qerror_conditions,
+       Fpurecopy (list2 (Qsqlite_locked_error, Qerror)));
+  Fput (Qsqlite_locked_error, Qerror_message,
+       build_pure_c_string ("Database locked"));
+
+  DEFSYM (Qsqlitep, "sqlitep");
   DEFSYM (Qfalse, "false");
   DEFSYM (Qsqlite, "sqlite");
   DEFSYM (Qsqlite3, "sqlite3");
diff --git a/src/syntax.c b/src/syntax.c
index 057a4c3b1f..9df878b8ed 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1,5 +1,5 @@
 /* GNU Emacs routines to deal with syntax tables; also word and list parsing.
-   Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2021 Free
+   Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2022 Free
    Software Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/syntax.h b/src/syntax.h
index 66ee139a96..c1bb9274d0 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -1,6 +1,6 @@
 /* Declarations having to do with GNU Emacs syntax tables.
 
-Copyright (C) 1985, 1993-1994, 1997-1998, 2001-2021 Free Software
+Copyright (C) 1985, 1993-1994, 1997-1998, 2001-2022 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/sysdep.c b/src/sysdep.c
index 5e13dd097e..d682e87cc7 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1,5 +1,5 @@
 /* Interfaces to system-dependent kernel and library entries.
-   Copyright (C) 1985-1988, 1993-1995, 1999-2021 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1999-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/sysselect.h b/src/sysselect.h
index 017c02b77f..45cc22bc4c 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -1,5 +1,5 @@
 /* sysselect.h - System-dependent definitions for the select function.
-   Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/syssignal.h b/src/syssignal.h
index 285a3c548b..07055c04be 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -1,6 +1,6 @@
 /* syssignal.h - System-dependent definitions for signals.
 
-Copyright (C) 1993, 1999, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993, 1999, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/sysstdio.h b/src/sysstdio.h
index d6ebfb455f..5bcfe7d8a5 100644
--- a/src/sysstdio.h
+++ b/src/sysstdio.h
@@ -1,6 +1,6 @@
 /* Standard I/O for Emacs.
 
-Copyright 2013-2021 Free Software Foundation, Inc.
+Copyright 2013-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/systhread.c b/src/systhread.c
index c68853caca..08afa7e583 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -1,5 +1,5 @@
 /* System thread definitions
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/systhread.h b/src/systhread.h
index 601505f4f8..fb1a0a72d6 100644
--- a/src/systhread.h
+++ b/src/systhread.h
@@ -1,5 +1,5 @@
 /* System thread definitions
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/systime.h b/src/systime.h
index 08ab5bdde3..f3b1b2394d 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -1,5 +1,5 @@
 /* systime.h - System-dependent definitions for time manipulations.
-   Copyright (C) 1993-1994, 2002-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2002-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -80,8 +80,7 @@ struct lisp_time
   /* Clock count as a Lisp integer.  */
   Lisp_Object ticks;
 
-  /* Clock frequency (ticks per second) as a positive Lisp integer.
-     (TICKS . HZ) is a valid Lisp timestamp unless HZ < 65536.  */
+  /* Clock frequency (ticks per second) as a positive Lisp integer.  */
   Lisp_Object hz;
 };
 
diff --git a/src/systty.h b/src/systty.h
index c19b4b35f1..3a8fffe25f 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -1,5 +1,5 @@
 /* systty.h - System-dependent definitions for terminals.
-   Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/syswait.h b/src/syswait.h
index 42e8c40854..61c4364fe3 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -1,5 +1,5 @@
 /* Define wait system call interface for Emacs.
-   Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1995, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/term.c b/src/term.c
index 8e106e7c63..4c7a90a577 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1,5 +1,5 @@
 /* Terminal control module for terminals described by TERMCAP
-   Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2021 Free Software
+   Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/termcap.c b/src/termcap.c
index 227dbeb7d9..5afa8ae9de 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -1,5 +1,5 @@
 /* Work-alike for termcap, plus extra features.
-   Copyright (C) 1985-1986, 1993-1995, 2000-2008, 2011, 2013-2021 Free
+   Copyright (C) 1985-1986, 1993-1995, 2000-2008, 2011, 2013-2022 Free
    Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
diff --git a/src/termchar.h b/src/termchar.h
index 7ab9337fbe..49560dbc2a 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -1,5 +1,5 @@
 /* Flags and parameters describing terminal's characteristics.
-   Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/termhooks.h b/src/termhooks.h
index f64c19e039..55f7aa5d1a 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -1,6 +1,6 @@
 /* Parameters and display hooks for terminal devices.
 
-Copyright (C) 1985-1986, 1993-1994, 2001-2021 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1994, 2001-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -61,6 +61,7 @@ enum output_method
   output_msdos_raw,
   output_w32,
   output_ns,
+  output_pgtk,
   output_haiku
 };
 
@@ -268,12 +269,45 @@ enum event_kind
   , FILE_NOTIFY_EVENT
 #endif
 
+#ifdef HAVE_PGTK
+  /* Pre-edit text was changed. */
+  , PGTK_PREEDIT_TEXT_EVENT
+#endif
+
   /* Either the mouse wheel has been released without it being
      clicked, or the user has lifted his finger from a touchpad.
 
      In the future, this may take into account other multi-touch
      events generated from touchscreens and such.  */
   , TOUCH_END_EVENT
+
+  /* In a TOUCHSCREEN_UPDATE_EVENT, ARG is a list of elements of the
+     form (X Y ID), where X and Y are the coordinates of the
+     touchpoint relative to the top-left corner of the frame, and ID
+     is a unique number identifying the touchpoint.
+
+     In TOUCHSCREEN_BEGIN_EVENT and TOUCHSCREEN_END_EVENT, ARG is the
+     unique ID of the touchpoint, and X and Y are the frame-relative
+     positions of the touchpoint.  */
+
+  , TOUCHSCREEN_UPDATE_EVENT
+  , TOUCHSCREEN_BEGIN_EVENT
+  , TOUCHSCREEN_END_EVENT
+
+  /* In a PINCH_EVENT, X and Y are the position of the pointer
+     relative to the top-left corner of the frame, and arg is a list
+     of (DX DY SCALE ANGLE), in which:
+
+       - DX and DY are the difference between the positions of the
+         fingers comprising the current gesture and the last such
+         gesture in the same sequence.
+       - SCALE is the division of the current distance between the
+         fingers and the distance at the start of the gesture.
+       - DELTA-ANGLE is the delta between the angle of the current
+         event and the last event in the same sequence, in degrees.  A
+         positive delta represents a change clockwise, and a negative
+         delta represents a change counter-clockwise.  */
+  , PINCH_EVENT
 };
 
 /* Bit width of an enum event_kind tag at the start of structs and unions.  */
@@ -454,6 +488,7 @@ struct terminal
     struct x_display_info *x;         /* xterm.h */
     struct w32_display_info *w32;     /* w32term.h */
     struct ns_display_info *ns;       /* nsterm.h */
+    struct pgtk_display_info *pgtk; /* pgtkterm.h */
     struct haiku_display_info *haiku; /* haikuterm.h */
   } display_info;
 
@@ -528,7 +563,7 @@ struct terminal
      BGCOLOR.  */
   void (*query_frame_background_color) (struct frame *f, Emacs_Color *bgcolor);
 
-#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (HAVE_PGTK)
   /* On frame F, translate pixel colors to RGB values for the NCOLORS
      colors in COLORS.  Use cached information, if available.  */
 
@@ -843,6 +878,9 @@ extern struct terminal *terminal_list;
 #elif defined (HAVE_NS)
 #define TERMINAL_FONT_CACHE(t)                                         \
   (t->type == output_ns ? t->display_info.ns->name_list_element : Qnil)
+#elif defined (HAVE_PGTK)
+#define TERMINAL_FONT_CACHE(t)                                         \
+  (t->type == output_pgtk ? t->display_info.pgtk->name_list_element : Qnil)
 #elif defined (HAVE_HAIKU)
 #define TERMINAL_FONT_CACHE(t)                                         \
   (t->type == output_haiku ? t->display_info.haiku->name_list_element : Qnil)
diff --git a/src/terminal.c b/src/terminal.c
index b5f244ee31..3db80f4b1f 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1,5 +1,5 @@
 /* Functions related to terminal devices.
-   Copyright (C) 2005-2021 Free Software Foundation, Inc.
+   Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -445,6 +445,8 @@ possible return values.  */)
       return Qpc;
     case output_ns:
       return Qns;
+    case output_pgtk:
+      return Qpgtk;
     case output_haiku:
       return Qhaiku;
     default:
diff --git a/src/terminfo.c b/src/terminfo.c
index a9c9572bbb..1a7b38d7d9 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -1,5 +1,5 @@
 /* Interface from Emacs to terminfo.
-   Copyright (C) 1985-1986, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/termopts.h b/src/termopts.h
index 0a3dfa092f..ff1be13245 100644
--- a/src/termopts.h
+++ b/src/termopts.h
@@ -1,5 +1,5 @@
 /* Flags and parameters describing user options for handling the terminal.
-   Copyright (C) 1985-1986, 1990, 2001-2021 Free Software Foundation,
+   Copyright (C) 1985-1986, 1990, 2001-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/textprop.c b/src/textprop.c
index d7d6a66923..2d1e34d586 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1,5 +1,5 @@
 /* Interface code for dealing with text properties.
-   Copyright (C) 1993-1995, 1997, 1999-2021 Free Software Foundation,
+   Copyright (C) 1993-1995, 1997, 1999-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/thread.c b/src/thread.c
index 714b1cd903..bfcac91982 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -1,5 +1,5 @@
 /* Threading code.
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/thread.h b/src/thread.h
index b316e916d1..1e7eb86f6e 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -1,5 +1,5 @@
 /* Thread definitions
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/timefns.c b/src/timefns.c
index a9921cdc10..f73c69149f 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1,6 +1,6 @@
 /* Timestamp functions for Emacs
 
-Copyright (C) 1985-1987, 1989, 1993-2021 Free Software Foundation, Inc.
+Copyright (C) 1985-1987, 1989, 1993-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -69,16 +69,6 @@ enum { TM_YEAR_BASE = 1900 };
 # define FASTER_TIMEFNS 1
 #endif
 
-/* Whether to warn about Lisp timestamps (TICKS . HZ) that may be
-   instances of obsolete-format timestamps (HI . LO) where HI is
-   the high-order bits and LO the low-order 16 bits.  Currently this
-   is true, but it should change to false in a future version of
-   Emacs.  Compile with -DWARN_OBSOLETE_TIMESTAMPS=0 to see what the
-   future will be like.  */
-#ifndef WARN_OBSOLETE_TIMESTAMPS
-enum { WARN_OBSOLETE_TIMESTAMPS = true };
-#endif
-
 /* Although current-time etc. generate list-format timestamps
    (HI LO US PS), the plan is to change these functions to generate
    frequency-based timestamps (TICKS . HZ) in a future release.
@@ -817,14 +807,10 @@ decode_time_components (enum timeform form,
   return decode_ticks_hz (make_integer_mpz (), hz, result, dresult);
 }
 
-enum { DECODE_SECS_ONLY = WARN_OBSOLETE_TIMESTAMPS + 1 };
-
 /* Decode a Lisp timestamp SPECIFIED_TIME that represents a time.
 
-   FLAGS specifies conversion flags.  If FLAGS & DECODE_SECS_ONLY,
-   ignore and do not validate any sub-second components of an
-   old-format SPECIFIED_TIME.  If FLAGS & WARN_OBSOLETE_TIMESTAMPS,
-   diagnose what could be obsolete (HIGH . LOW) timestamps.
+   If DECODE_SECS_ONLY, ignore and do not validate any sub-second
+   components of an old-format SPECIFIED_TIME.
 
    If RESULT is not null, store into *RESULT the converted time;
    otherwise, store into *DRESULT the number of seconds since the
@@ -833,7 +819,7 @@ enum { DECODE_SECS_ONLY = WARN_OBSOLETE_TIMESTAMPS + 1 };
 
    Return the form of SPECIFIED-TIME.  Signal an error if unsuccessful.  */
 static enum timeform
-decode_lisp_time (Lisp_Object specified_time, int flags,
+decode_lisp_time (Lisp_Object specified_time, bool decode_secs_only,
                  struct lisp_time *result, double *dresult)
 {
   Lisp_Object high = make_fixnum (0);
@@ -854,7 +840,7 @@ decode_lisp_time (Lisp_Object specified_time, int flags,
        {
          Lisp_Object low_tail = XCDR (low);
          low = XCAR (low);
-         if (! (flags & DECODE_SECS_ONLY))
+         if (! decode_secs_only)
            {
              if (CONSP (low_tail))
                {
@@ -877,9 +863,6 @@ decode_lisp_time (Lisp_Object specified_time, int flags,
        }
       else
        {
-         if (flags & WARN_OBSOLETE_TIMESTAMPS
-             && RANGED_FIXNUMP (0, low, (1 << LO_TIME_BITS) - 1))
-           message ("obsolete timestamp with cdr %"pI"d", XFIXNUM (low));
          form = TIMEFORM_TICKS_HZ;
        }
 
@@ -1008,8 +991,7 @@ static struct lisp_time
 lisp_time_struct (Lisp_Object specified_time, enum timeform *pform)
 {
   struct lisp_time t;
-  enum timeform form
-    = decode_lisp_time (specified_time, WARN_OBSOLETE_TIMESTAMPS, &t, 0);
+  enum timeform form = decode_lisp_time (specified_time, false, &t, 0);
   if (pform)
     *pform = form;
   return t;
@@ -1034,9 +1016,8 @@ lisp_time_argument (Lisp_Object specified_time)
 static time_t
 lisp_seconds_argument (Lisp_Object specified_time)
 {
-  int flags = WARN_OBSOLETE_TIMESTAMPS | DECODE_SECS_ONLY;
   struct lisp_time lt;
-  decode_lisp_time (specified_time, flags, &lt, 0);
+  decode_lisp_time (specified_time, true, &lt, 0);
   struct timespec t = lisp_to_timespec (lt);
   if (! timespec_valid_p (t))
     time_overflow ();
@@ -1138,24 +1119,6 @@ time_arith (Lisp_Object a, Lisp_Object b, bool subtract)
       mpz_t *ihz = &mpz[0];
       mpz_mul (*ihz, *fa, *db);
 
-      /* When warning about obsolete timestamps, if the smaller
-        denominator comes from a non-(TICKS . HZ) timestamp and could
-        generate a (TICKS . HZ) timestamp that would look obsolete,
-        arrange for the result to have a higher HZ to avoid a
-        spurious warning by a later consumer of this function's
-        returned value.  */
-      verify (1 << LO_TIME_BITS <= ULONG_MAX);
-      if (WARN_OBSOLETE_TIMESTAMPS
-         && (da_lt_db ? aform : bform) == TIMEFORM_FLOAT
-         && (da_lt_db ? bform : aform) != TIMEFORM_TICKS_HZ
-         && mpz_cmp_ui (*hzmin, 1) > 0
-         && mpz_cmp_ui (*hzmin, 1 << LO_TIME_BITS) < 0)
-       {
-         mpz_t *hzmin1 = &mpz[2 - da_lt_db];
-         mpz_set_ui (*hzmin1, 1 << LO_TIME_BITS);
-         hzmin = hzmin1;
-       }
-
       /* iticks = (fb * na) OP (fa * nb), where OP is + or -.  */
       mpz_t const *na = bignum_integer (iticks, ta.ticks);
       mpz_mul (*iticks, *fb, *na);
@@ -1177,8 +1140,7 @@ time_arith (Lisp_Object a, Lisp_Object b, bool subtract)
             upwards by multiplying the normalized numerator and denominator
             so that the resulting denominator becomes at least hzmin.
             This rescaling avoids returning a timestamp that is less precise
-            than both a and b, or a timestamp that looks obsolete when that
-            might be a problem.  */
+            than both a and b.  */
          if (!FASTER_TIMEFNS || mpz_cmp (*ihz, *hzmin) < 0)
            {
              /* Rescale straightforwardly.  Although this might not
@@ -1303,7 +1265,7 @@ or (if you need time as a string) `format-time-string'.  
*/)
   (Lisp_Object specified_time)
 {
   double t;
-  decode_lisp_time (specified_time, 0, 0, &t);
+  decode_lisp_time (specified_time, false, 0, &t);
   return make_float (t);
 }
 
@@ -1422,8 +1384,9 @@ without consideration for daylight saving time.
 The value is a copy of FORMAT-STRING, but with certain constructs replaced
 by text that describes the specified date and time in TIME:
 
-%Y is the year, %y within the century, %C the century.
-%G is the year corresponding to the ISO week, %g within the century.
+%Y is the year, %y year without century, %C the century.
+%G is the year corresponding to the ISO week, %g year corresponding
+ to the ISO week, without century.
 %m is the numeric month.
 %b and %h are the locale's abbreviated month name, %B the full name.
  (%h is not supported on MS-Windows.)
@@ -1431,7 +1394,7 @@ by text that describes the specified date and time in 
TIME:
 %u is the numeric day of week from 1 (Monday) to 7, %w from 0 (Sunday) to 6.
 %a is the locale's abbreviated name of the day of week, %A the full name.
 %U is the week number starting on Sunday, %W starting on Monday,
- %V according to ISO 8601.
+ %V the week number according to ISO 8601.
 %j is the day of the year.
 
 %H is the hour on a 24-hour clock, %I is on a 12-hour clock, %k is like %H
@@ -1651,12 +1614,11 @@ saving flag to be guessed.
 
 As an obsolescent calling convention, if this function is called with
 6 or more arguments, the first 6 arguments are SECOND, MINUTE, HOUR,
-DAY, MONTH, and YEAR, and specify the components of a decoded time,
-where DST assumed to be -1 and FORM is omitted.  If there are more
-than 6 arguments the *last* argument is used as ZONE and any other
-extra arguments are ignored, so that (apply #\\='encode-time
-(decode-time ...)) works.  In this obsolescent convention, DST and
-ZONE default to -1 and nil respectively.
+DAY, MONTH, and YEAR, and specify the components of a decoded time.
+If there are more than 6 arguments the *last* argument is used as ZONE
+and any other extra arguments are ignored, so that (apply
+#\\='encode-time (decode-time ...)) works.  In this obsolescent
+convention, DST and ZONE default to -1 and nil respectively.
 
 Years before 1970 are not guaranteed to work.  On some systems,
 year values as low as 1901 do work.
@@ -1703,7 +1665,7 @@ usage: (encode-time TIME &rest OBSOLESCENT-ARGUMENTS)  */)
 
   /* Let SEC = floor (LT.ticks / HZ), with SUBSECTICKS the remainder.  */
   struct lisp_time lt;
-  decode_lisp_time (secarg, 0, &lt, 0);
+  decode_lisp_time (secarg, false, &lt, 0);
   Lisp_Object hz = lt.hz, sec, subsecticks;
   if (FASTER_TIMEFNS && EQ (hz, make_fixnum (1)))
     {
@@ -1756,9 +1718,7 @@ Truncate the returned value toward minus infinity.
 If FORM is nil (the default), return the same form as `current-time'.
 If FORM is a positive integer, return a pair of integers (TICKS . FORM),
 where TICKS is the number of clock ticks and FORM is the clock frequency
-in ticks per second.  (Currently the positive integer should be at least
-65536 if the returned value is expected to be given to standard functions
-expecting Lisp timestamps.)  If FORM is t, return (TICKS . PHZ), where
+in ticks per second.  If FORM is t, return (TICKS . PHZ), where
 PHZ is a suitable clock frequency in ticks per second.  If FORM is
 `integer', return an integer count of seconds.  If FORM is `list',
 return an integer list (HIGH LOW USEC PSEC), where HIGH has the most
@@ -1767,7 +1727,7 @@ bits, and USEC and PSEC are the microsecond and 
picosecond counts.  */)
      (Lisp_Object time, Lisp_Object form)
 {
   struct lisp_time t;
-  enum timeform input_form = decode_lisp_time (time, 0, &t, 0);
+  enum timeform input_form = decode_lisp_time (time, false, &t, 0);
   if (NILP (form))
     form = CURRENT_TIME_LIST ? Qlist : Qt;
   if (EQ (form, Qlist))
diff --git a/src/tparam.c b/src/tparam.c
index c89a9bde9a..89483ed52a 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -1,5 +1,5 @@
 /* Merge parameters into a termcap entry string.
-   Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2021 Free
+   Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2022 Free
    Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
diff --git a/src/tparam.h b/src/tparam.h
index 893c3cac12..6361f138ea 100644
--- a/src/tparam.h
+++ b/src/tparam.h
@@ -1,6 +1,6 @@
 /* Interface definitions for termcap entries.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/undo.c b/src/undo.c
index 2db401ebc7..5d705945c4 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1,5 +1,5 @@
 /* undo handling for GNU Emacs.
-   Copyright (C) 1990, 1993-1994, 2000-2021 Free Software Foundation,
+   Copyright (C) 1990, 1993-1994, 2000-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/unexaix.c b/src/unexaix.c
index 949750f493..457c754304 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -1,5 +1,5 @@
 /* Dump an executable file.
-   Copyright (C) 1985-1988, 1999, 2001-2021 Free Software Foundation,
+   Copyright (C) 1985-1988, 1999, 2001-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/unexcoff.c b/src/unexcoff.c
index c4b2f6ebea..337754f6d4 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1985-1988, 1992-1994, 2001-2021 Free Software
+/* Copyright (C) 1985-1988, 1992-1994, 2001-2022 Free Software
  * Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/unexcw.c b/src/unexcw.c
index 157e9f4560..d1099bb205 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -1,7 +1,7 @@
 /* unexec() support for Cygwin;
    complete rewrite of xemacs Cygwin unexec() code
 
-   Copyright (C) 2004-2021 Free Software Foundation, Inc.
+   Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/unexelf.c b/src/unexelf.c
index b5cded5cfd..e61bdd4e88 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1985-1988, 1990, 1992, 1999-2021 Free Software
+/* Copyright (C) 1985-1988, 1990, 1992, 1999-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index f226f1b6c1..be1ef43e62 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -1,5 +1,5 @@
 /* Dump Emacs in Mach-O format for use on macOS.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/unexw32.c b/src/unexw32.c
index 1c60e3da0e..fe76b37a05 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -1,5 +1,5 @@
 /* unexec for GNU Emacs on Windows NT.
-   Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/verbose.mk.in b/src/verbose.mk.in
index 9252971acc..e3f5678303 100644
--- a/src/verbose.mk.in
+++ b/src/verbose.mk.in
@@ -1,6 +1,6 @@
 ### verbose.mk --- Makefile fragment for GNU Emacs
 
-## Copyright (C) 2021 Free Software Foundation, Inc.
+## Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
@@ -33,26 +33,26 @@ AM_V_GLOBALS =
 AM_V_NO_PD =
 AM_V_RC =
 else
-AM_V_AR = @echo "  AR      " $@;
+AM_V_AR      = @$(info $   AR       $@)
 AM_V_at = @
-AM_V_CC = @echo "  CC      " $@;
-AM_V_CXX = @echo "  CXX     " $@;
-AM_V_CCLD = @echo "  CCLD    " $@;
-AM_V_CXXLD = @echo "  CXXLD   " $@;
+AM_V_CC      = @$(info $   CC       $@)
+AM_V_CXX     = @$(info $   CXX      $@)
+AM_V_CCLD    = @$(info $   CCLD     $@)
+AM_V_CXXLD   = @$(info $   CXXLD    $@)
 ifeq ($(HAVE_NATIVE_COMP),yes)
 ifeq ($(NATIVE_DISABLED),1)
-AM_V_ELC = @echo "  ELC     " $@;
+AM_V_ELC     = @$(info $   ELC      $@)
 AM_V_ELN =
 else
-AM_V_ELC = @echo "  ELC+ELN " $@;
-AM_V_ELN = @echo "  ELN " $@;
+AM_V_ELC     = @$(info $   ELC+ELN  $@)
+AM_V_ELN     = @$(info $   ELN      $@)
 endif
 else
-AM_V_ELC = @echo "  ELC     " $@;
+AM_V_ELC     = @$(info $   ELC      $@)
 AM_V_ELN =
 endif
-AM_V_GEN = @echo "  GEN     " $@;
-AM_V_GLOBALS = @echo "  GEN     " globals.h;
+AM_V_GEN     = @$(info $   GEN      $@)
+AM_V_GLOBALS = @$(info $   GEN      globals.h)
 AM_V_NO_PD = --no-print-directory
-AM_V_RC = @echo "  RC      " $@;
+AM_V_RC      = @$(info $   RC       $@)
 endif
diff --git a/src/vm-limit.c b/src/vm-limit.c
index e0547651bb..043ea96d15 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -1,5 +1,5 @@
 /* Functions for memory limit warnings.
-   Copyright (C) 1990, 1992, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1992, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w16select.c b/src/w16select.c
index bbd2ed4bb9..f6bc3dd8d4 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -1,6 +1,6 @@
 /* 16-bit Windows Selection processing for emacs on MS-Windows
 
-Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1996-1997, 2001-2022 Free Software Foundation, Inc.
 
 Author: Dale P. Smith <dpsm@en.com>
 
diff --git a/src/w32.c b/src/w32.c
index 1de148f034..0dc874eac4 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1,6 +1,6 @@
 /* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 1994-1995, 2000-2021 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32.h b/src/w32.h
index bb3ec40324..4941170bdc 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -2,7 +2,7 @@
 #define EMACS_W32_H
 
 /* Support routines for the NT version of Emacs.
-   Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32common.h b/src/w32common.h
index 6493b9c88d..6b9c2c08dd 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -1,5 +1,5 @@
 /* Common functions for Microsoft Windows builds of Emacs
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32console.c b/src/w32console.c
index 99546c2d75..12e1f39789 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -1,5 +1,5 @@
 /* Terminal hooks for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1992, 1999, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1999, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32cygwinx.c b/src/w32cygwinx.c
index b58febc4e0..bb2539be94 100644
--- a/src/w32cygwinx.c
+++ b/src/w32cygwinx.c
@@ -1,6 +1,6 @@
 /* Common functions for the Microsoft Windows and Cygwin builds.
 
-Copyright (C) 2018-2021 Free Software Foundation, Inc.
+Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32fns.c b/src/w32fns.c
index 65463b5261..37f9b813c6 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,6 +1,6 @@
 /* Graphical user interface functions for the Microsoft Windows API.
 
-Copyright (C) 1989, 1992-2021 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -7525,7 +7525,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
   /* Calculate size of tooltip window.  */
   size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
-                                 make_fixnum (w->pixel_height), Qnil);
+                                 make_fixnum (w->pixel_height), Qnil,
+                                 Qnil);
   /* Add the frame's internal border to calculated size.  */
   width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
   height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
diff --git a/src/w32font.c b/src/w32font.c
index 2d09f459f8..0495099db5 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1,5 +1,5 @@
 /* Font backend for the Microsoft Windows API.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32font.h b/src/w32font.h
index cf2bf3c242..9fd4a6c187 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -1,5 +1,5 @@
 /* Shared GDI and Uniscribe Font backend declarations for the Windows API.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32gui.h b/src/w32gui.h
index d2c34bd00a..4e8de84854 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication on the Microsoft Windows API.
-   Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32heap.c b/src/w32heap.c
index a0d4c070be..675162447d 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -1,5 +1,5 @@
 /* Heap management routines for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
diff --git a/src/w32heap.h b/src/w32heap.h
index 0b34f8a356..764fc48a4e 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -1,5 +1,5 @@
 /* Heap management routines (including unexec) for GNU Emacs on Windows NT.
-   Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32image.c b/src/w32image.c
index cc1a6eba22..f3374dcfd3 100644
--- a/src/w32image.c
+++ b/src/w32image.c
@@ -1,6 +1,6 @@
 /* Implementation of MS-Windows native image API via the GDI+ library.
 
-Copyright (C) 2020-2021 Free Software Foundation, Inc.
+Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 4cc01d31c9..6a1d9afacf 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -1,5 +1,5 @@
 /* Input event support for Emacs on the Microsoft Windows API.
-   Copyright (C) 1992-1993, 1995, 2001-2021 Free Software Foundation,
+   Copyright (C) 1992-1993, 1995, 2001-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/w32inevt.h b/src/w32inevt.h
index f0097716f3..e5b2581430 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -1,5 +1,5 @@
 /* Input routines for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32menu.c b/src/w32menu.c
index 3bf7666394..42e27babbc 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1,5 +1,5 @@
 /* Menu support for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2021 Free
+   Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2022 Free
    Software Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/w32notify.c b/src/w32notify.c
index 889fd9f3c9..e7d2f0f076 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -1,6 +1,6 @@
 /* Filesystem notifications support for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 2012-2021 Free Software Foundation, Inc.
+Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 Author: Eli Zaretskii <eliz@gnu.org>
 
diff --git a/src/w32proc.c b/src/w32proc.c
index bfe720eb62..781a19f480 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,6 +1,6 @@
 /* Process support for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 1992, 1995, 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1992, 1995, 1999-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32reg.c b/src/w32reg.c
index 9794162bd0..30cf4ab5ec 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -1,6 +1,6 @@
 /* Emulate the X Resource Manager through the registry.
 
-Copyright (C) 1990, 1993-1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1990, 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 Author: Kevin Gallo
 
diff --git a/src/w32select.c b/src/w32select.c
index f19b85a2ae..eae1a0bac0 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1,6 +1,6 @@
 /* Selection processing for Emacs on the Microsoft Windows API.
 
-Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 Author: Kevin Gallo
        Benjamin Riefenstahl
diff --git a/src/w32select.h b/src/w32select.h
index 7ed8696ea9..db707036d0 100644
--- a/src/w32select.h
+++ b/src/w32select.h
@@ -1,6 +1,6 @@
 /* Selection processing for Emacs on the Microsoft W32 API.
 
-Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32term.c b/src/w32term.c
index fdb088deda..700c492cc3 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1,6 +1,6 @@
 /* Implementation of GUI terminal on the Microsoft Windows API.
 
-Copyright (C) 1989, 1993-2021 Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32term.h b/src/w32term.h
index 160be35782..6c48323651 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication on the Microsoft Windows API.
-   Copyright (C) 1995, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 0df1ff298f..7c772b68f6 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -1,6 +1,6 @@
 /* Font backend for the Microsoft W32 Uniscribe API.
    Windows-specific parts of the HarfBuzz font backend.
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 712214b591..d5974b906e 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -1,5 +1,5 @@
 /* Functions taken directly from X sources for use with the Microsoft Windows 
API.
-   Copyright (C) 1989, 1992-1995, 1999, 2001-2021 Free Software
+   Copyright (C) 1989, 1992-1995, 1999, 2001-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/widget.c b/src/widget.c
index dd43fd1c46..c13ec50498 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -1,5 +1,5 @@
 /* The emacs frame widget.
-   Copyright (C) 1992-1993, 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 1992-1993, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/widget.h b/src/widget.h
index 105bc6646d..dbf21a64cb 100644
--- a/src/widget.h
+++ b/src/widget.h
@@ -1,5 +1,5 @@
 /* The emacs frame widget public header file.
-   Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/widgetprv.h b/src/widgetprv.h
index 58620a05b2..960f814e16 100644
--- a/src/widgetprv.h
+++ b/src/widgetprv.h
@@ -1,5 +1,5 @@
 /* The emacs frame widget private header file.
-   Copyright (C) 1993, 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/window.c b/src/window.c
index e801ff821f..1e7c26b82e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,6 @@
 /* Window creation, deletion and examination for GNU Emacs.
    Does not include redisplay.
-   Copyright (C) 1985-1987, 1993-1998, 2000-2021 Free Software
+   Copyright (C) 1985-1987, 1993-1998, 2000-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/window.h b/src/window.h
index 2400c422c1..141c29e810 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,5 +1,5 @@
 /* Window definitions for GNU Emacs.
-   Copyright (C) 1985-1986, 1993, 1995, 1997-2021 Free Software
+   Copyright (C) 1985-1986, 1993, 1995, 1997-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -756,7 +756,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
 #endif
 
 /* True if W is a tab bar window.  */
-#if defined (HAVE_WINDOW_SYSTEM)
+#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_PGTK)
 # define WINDOW_TAB_BAR_P(W) \
    (WINDOWP (WINDOW_XFRAME (W)->tab_bar_window) \
     && (W) == XWINDOW (WINDOW_XFRAME (W)->tab_bar_window))
diff --git a/src/xdisp.c b/src/xdisp.c
index 89b295932e..2326df4300 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,6 +1,6 @@
 /* Display generation from window structure and buffer text.
 
-Copyright (C) 1985-1988, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -5209,9 +5209,8 @@ find_display_property (Lisp_Object disp, Lisp_Object prop)
     return Qnil;
 }
 
-static
-Lisp_Object get_display_property (ptrdiff_t bufpos, Lisp_Object prop,
-                                 Lisp_Object object)
+static Lisp_Object
+get_display_property (ptrdiff_t bufpos, Lisp_Object prop, Lisp_Object object)
 {
   return find_display_property (Fget_text_property (make_fixnum (bufpos),
                                                    Qdisplay, object),
@@ -5361,12 +5360,13 @@ handle_display_prop (struct it *it)
   if (!it->string_from_display_prop_p)
     it->area = TEXT_AREA;
 
-  if (!STRINGP (it->string))
-    object = it->w->contents;
-
   propval = get_char_property_and_overlay (make_fixnum (position->charpos),
                                           Qdisplay, object, &overlay);
 
+  /* Rest of the code must have OBJECT be either a string or a buffer.  */
+  if (!STRINGP (it->string))
+    object = it->w->contents;
+
   /* Handle min-width ends. */
   if (!NILP (it->min_width_property)
       && NILP (find_display_property (propval, Qmin_width)))
@@ -6829,6 +6829,27 @@ iterate_out_of_display_property (struct it *it)
     it->current.string_pos = it->position;
 }
 
+/* Restore the IT->face_box_p flag, since it could have been
+   overwritten by the face of the object that we just finished
+   displaying.  Also, set the IT->start_of_box_run_p flag if the
+   change in faces requires that.  */
+static void
+restore_face_box_flags (struct it *it, int prev_face_id)
+{
+  struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
+
+  if (face)
+    {
+      struct face *prev_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
+
+      if (!(it->start_of_box_run_p && prev_face && prev_face->box))
+       it->start_of_box_run_p = (face->box != FACE_NO_BOX
+                                 && (prev_face == NULL
+                                     || prev_face->box == FACE_NO_BOX));
+      it->face_box_p = face->box != FACE_NO_BOX;
+    }
+}
+
 /* Restore IT's settings from IT->stack.  Called, for example, when no
    more overlay strings must be processed, and we return to delivering
    display elements from a buffer, or when the end of a string from a
@@ -6841,6 +6862,7 @@ pop_it (struct it *it)
   struct iterator_stack_entry *p;
   bool from_display_prop = it->from_disp_prop_p;
   ptrdiff_t prev_pos = IT_CHARPOS (*it);
+  int prev_face_id = it->face_id;
 
   eassert (it->sp > 0);
   --it->sp;
@@ -6872,25 +6894,13 @@ pop_it (struct it *it)
       break;
     case GET_FROM_BUFFER:
       {
-       struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
-
-       /* Restore the face_box_p flag, since it could have been
-          overwritten by the face of the object that we just finished
-          displaying.  */
-       if (face)
-         it->face_box_p = face->box != FACE_NO_BOX;
+       restore_face_box_flags (it, prev_face_id);
        it->object = it->w->contents;
       }
       break;
     case GET_FROM_STRING:
       {
-       struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
-
-       /* Restore the face_box_p flag, since it could have been
-          overwritten by the face of the object that we just finished
-          displaying.  */
-       if (face)
-         it->face_box_p = face->box != FACE_NO_BOX;
+       restore_face_box_flags (it, prev_face_id);
        it->object = it->string;
       }
       break;
@@ -10423,11 +10433,12 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int 
to_x, int to_y, int to_vpos
 
 /* Move iterator IT backward by a specified y-distance DY, DY >= 0.
 
-   If DY > 0, move IT backward at least that many pixels.  DY = 0
-   means move IT backward to the preceding line start or BEGV.  This
-   function may move over more than DY pixels if IT->current_y - DY
-   ends up in the middle of a line; in this case IT->current_y will be
-   set to the top of the line moved to.  */
+   If DY > 0, move IT backward that many pixels.
+   DY = 0 means move IT backward to the preceding line start or to BEGV.
+   This function may move over less or more than DY pixels if
+   IT->current_y - DY ends up in the middle of a line; in this case
+   IT->current_y will be set to the top of the line either before or
+   after the exact pixel coordinate.  */
 
 void
 move_it_vertically_backward (struct it *it, int dy)
@@ -10831,15 +10842,16 @@ in_display_vector_p (struct it *it)
    set WINDOW's buffer to the buffer specified by its BUFFER_OR_NAME
    argument.  */
 static Lisp_Object
-window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, 
Lisp_Object x_limit,
-                       Lisp_Object y_limit, Lisp_Object mode_lines)
+window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to,
+                       Lisp_Object x_limit, Lisp_Object y_limit,
+                       Lisp_Object mode_lines, Lisp_Object ignore_line_at_end)
 {
   struct window *w = decode_live_window (window);
   struct it it;
   ptrdiff_t start, end, bpos;
   struct text_pos startp;
   void *itdata = NULL;
-  int c, max_x = 0, max_y = 0, x = 0, y = 0;
+  int c, max_x = 0, max_y = 0, x = 0, y = 0, vertical_offset = 0, doff = 0;
 
   if (NILP (from))
     {
@@ -10865,6 +10877,13 @@ window_text_pixel_size (Lisp_Object window, 
Lisp_Object from, Lisp_Object to, Li
            break;
        }
     }
+  else if (CONSP (from))
+    {
+      start = clip_to_bounds (BEGV, fix_position (XCAR (from)), ZV);
+      bpos = CHAR_TO_BYTE (start);
+      CHECK_FIXNUM (XCDR (from));
+      vertical_offset = XFIXNUM (XCDR (from));
+    }
   else
     {
       start = clip_to_bounds (BEGV, fix_position (from), ZV);
@@ -10911,7 +10930,9 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object 
from, Lisp_Object to, Li
 
   itdata = bidi_shelve_cache ();
   start_display (&it, w, startp);
+
   int start_y = it.current_y;
+
   /* It makes no sense to measure dimensions of region of text that
      crosses the point where bidi reordering changes scan direction.
      By using unidirectional movement here we at least support the use
@@ -10920,13 +10941,50 @@ window_text_pixel_size (Lisp_Object window, 
Lisp_Object from, Lisp_Object to, Li
      same directionality.  */
   it.bidi_p = false;
 
-  /* Start at the beginning of the line containing FROM.  Otherwise
-     IT.current_x will be incorrectly set to zero at some arbitrary
-     non-zero X coordinate.  */
-  reseat_at_previous_visible_line_start (&it);
-  it.current_x = it.hpos = 0;
-  if (IT_CHARPOS (it) != start)
-    move_it_to (&it, start, -1, -1, -1, MOVE_TO_POS);
+  if (vertical_offset != 0)
+    {
+      int last_y;
+      it.current_y = 0;
+
+      move_it_by_lines (&it, 0);
+
+      /* `move_it_vertically_backward' is called by move_it_vertically
+         to move by a negative value (upwards), but it is not always
+         guaranteed to leave the iterator at or above the position
+         given by the offset, which this loop ensures.  */
+      if (vertical_offset < 0)
+       {
+         while (it.current_y > vertical_offset)
+           {
+             last_y = it.current_y;
+             move_it_vertically_backward (&it,
+                                          (abs (vertical_offset)
+                                           + it.current_y));
+
+             if (it.current_y == last_y)
+               break;
+           }
+       }
+      else
+       {
+         move_it_vertically (&it, vertical_offset);
+       }
+
+      it.current_y = (WINDOW_TAB_LINE_HEIGHT (w)
+                     + WINDOW_HEADER_LINE_HEIGHT (w));
+      start = clip_to_bounds (BEGV, IT_CHARPOS (it), ZV);
+      start_y = it.current_y;
+    }
+  else
+    {
+      /* Start at the beginning of the line containing FROM.  Otherwise
+        IT.current_x will be incorrectly set to zero at some arbitrary
+        non-zero X coordinate.  */
+      reseat_at_previous_visible_line_start (&it);
+      it.current_x = it.hpos = 0;
+      if (IT_CHARPOS (it) != start)
+       move_it_to (&it, start, -1, -1, -1, MOVE_TO_POS);
+    }
 
   /* Now move to TO.  */
   int start_x = it.current_x;
@@ -10968,8 +11026,16 @@ window_text_pixel_size (Lisp_Object window, 
Lisp_Object from, Lisp_Object to, Li
       if (IT_CHARPOS (it) == end)
        {
          x += it.pixel_width;
-         it.max_ascent = max (it.max_ascent, it.ascent);
-         it.max_descent = max (it.max_descent, it.descent);
+
+         /* DTRT if ignore_line_at_end is t.  */
+         if (!NILP (ignore_line_at_end))
+           doff = (max (it.max_ascent, it.ascent)
+                   + max (it.max_descent, it.descent));
+         else
+           {
+             it.max_ascent = max (it.max_ascent, it.ascent);
+             it.max_descent = max (it.max_descent, it.descent);
+           }
        }
     }
   else
@@ -10990,8 +11056,14 @@ window_text_pixel_size (Lisp_Object window, 
Lisp_Object from, Lisp_Object to, Li
 
   /* Subtract height of header-line and tab-line which was counted
      automatically by start_display.  */
-  y = it.current_y + it.max_ascent + it.max_descent
-    - WINDOW_TAB_LINE_HEIGHT (w) - WINDOW_HEADER_LINE_HEIGHT (w);
+  if (!NILP (ignore_line_at_end))
+    y = (it.current_y + doff
+        - WINDOW_TAB_LINE_HEIGHT (w)
+        - WINDOW_HEADER_LINE_HEIGHT (w));
+  else
+    y = (it.current_y + it.max_ascent + it.max_descent + doff
+        - WINDOW_TAB_LINE_HEIGHT (w) - WINDOW_HEADER_LINE_HEIGHT (w));
+
   /* Don't return more than Y-LIMIT.  */
   if (y > max_y)
     y = max_y;
@@ -11035,26 +11107,34 @@ window_text_pixel_size (Lisp_Object window, 
Lisp_Object from, Lisp_Object to, Li
 
   bidi_unshelve_cache (itdata, false);
 
-  return Fcons (make_fixnum (x - start_x), make_fixnum (y));
+  return (!vertical_offset
+         ? Fcons (make_fixnum (x - start_x), make_fixnum (y))
+         : list3i (x - start_x, y, start));
 }
 
-DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, 
Swindow_text_pixel_size, 0, 6, 0,
+DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, 
Swindow_text_pixel_size, 0, 7, 0,
        doc: /* Return the size of the text of WINDOW's buffer in pixels.
 WINDOW must be a live window and defaults to the selected one.  The
-return value is a cons of the maximum pixel-width of any text line
-and the pixel-height of all the text lines in the accessible portion
-of buffer text.
+return value is a cons of the maximum pixel-width of any text line and
+the pixel-height of all the text lines in the accessible portion of
+buffer text.
+
+If FROM is a cons cell, the return value includes, in addition to the
+dimensions, also a third element that provides the buffer position
+from which measuring of the text dimensions was actually started.
 
 This function exists to allow Lisp programs to adjust the dimensions
 of WINDOW to the buffer text it needs to display.
 
 The optional argument FROM, if non-nil, specifies the first text
 position to consider, and defaults to the minimum accessible position
-of the buffer.  If FROM is t, it stands for the minimum accessible
-position that starts a non-empty line.  TO, if non-nil, specifies the
-last text position and defaults to the maximum accessible position of
-the buffer.  If TO is t, it stands for the maximum accessible position
-that ends a non-empty line.
+of the buffer.  If FROM is a cons, its car specifies a buffer
+position, and its cdr specifies the vertical offset in pixels from
+that position to the first screen line to be measured.  If FROM is t,
+it stands for the minimum accessible position that starts a non-empty
+line.  TO, if non-nil, specifies the last text position and defaults
+to the maximum accessible position of the buffer.  If TO is t, it
+stands for the maximum accessible position that ends a non-empty line.
 
 The optional argument X-LIMIT, if non-nil, specifies the maximum X
 coordinate beyond which the text should be ignored.  It is therefore
@@ -11085,9 +11165,12 @@ Optional argument MODE-LINES nil or omitted means do 
not include the
 height of the mode-, tab- or header-line of WINDOW in the return value.
 If it is the symbol `mode-line', 'tab-line' or `header-line', include
 only the height of that line, if present, in the return value.  If t,
-include the height of any of these, if present, in the return value.  */)
+include the height of any of these, if present, in the return value.
+
+IGNORE-LINE-AT-END, if non-nil, means to not add the height of the
+screen line that includes TO to the returned height of the text.  */)
   (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit,
-   Lisp_Object y_limit, Lisp_Object mode_lines)
+   Lisp_Object y_limit, Lisp_Object mode_lines, Lisp_Object ignore_line_at_end)
 {
   struct window *w = decode_live_window (window);
   struct buffer *b = XBUFFER (w->contents);
@@ -11100,7 +11183,8 @@ include the height of any of these, if present, in the 
return value.  */)
       set_buffer_internal_1 (b);
     }
 
-  value = window_text_pixel_size (window, from, to, x_limit, y_limit, 
mode_lines);
+  value = window_text_pixel_size (window, from, to, x_limit, y_limit, 
mode_lines,
+                                 ignore_line_at_end);
 
   if (old_b)
     set_buffer_internal_1 (old_b);
@@ -11150,7 +11234,8 @@ WINDOW.  */)
       set_marker_both (w->old_pointm, buffer, BEG, BEG_BYTE);
     }
 
-  value = window_text_pixel_size (window, Qnil, Qnil, x_limit, y_limit, Qnil);
+  value = window_text_pixel_size (window, Qnil, Qnil, x_limit, y_limit, Qnil,
+                                 Qnil);
 
   unbind_to (count, Qnil);
 
@@ -13660,6 +13745,7 @@ display_tab_bar_line (struct it *it, int height)
      so there's no need to check the face here.  */
   it->start_of_box_run_p = true;
 
+  bool enough = false;
   while (it->current_x < max_x)
     {
       int x, n_glyphs_before, i, nglyphs;
@@ -13706,11 +13792,12 @@ display_tab_bar_line (struct it *it, int height)
          ++i;
        }
 
+      enough = ITERATOR_AT_END_OF_LINE_P (it);
+      set_iterator_to_next (it, true);
+
       /* Stop at line end.  */
-      if (ITERATOR_AT_END_OF_LINE_P (it))
+      if (enough)
        break;
-
-      set_iterator_to_next (it, true);
     }
 
  out:;
@@ -13788,9 +13875,9 @@ tab_bar_height (struct frame *f, int *n_rows, bool 
pixelwise)
                     0, 0, 0, STRING_MULTIBYTE (f->desired_tab_bar_string));
   it.paragraph_embedding = L2R;
 
+  clear_glyph_row (temp_row);
   while (!ITERATOR_AT_END_P (&it))
     {
-      clear_glyph_row (temp_row);
       it.glyph_row = temp_row;
       display_tab_bar_line (&it, -1);
     }
@@ -15913,7 +16000,7 @@ redisplay_internal (void)
   if (!fr->glyphs_initialized_p)
     return;
 
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS)
+#if defined (USE_X_TOOLKIT) || (defined (USE_GTK) && !defined (HAVE_PGTK)) || 
defined (HAVE_NS)
   if (popup_activated ())
     {
       return;
@@ -22456,7 +22543,7 @@ extend_face_to_end_of_line (struct it *it)
       && face->underline == FACE_NO_UNDERLINE
       && !face->overline_p
       && !face->strike_through_p
-      && FACE_COLOR_TO_PIXEL (face->background, f) == FRAME_BACKGROUND_PIXEL 
(f)
+      && face->background == FRAME_BACKGROUND_PIXEL (f)
 #ifdef HAVE_WINDOW_SYSTEM
       && !face->stipple
 #endif
@@ -22690,7 +22777,7 @@ extend_face_to_end_of_line (struct it *it)
          && (it->glyph_row->used[LEFT_MARGIN_AREA]
              < WINDOW_LEFT_MARGIN_WIDTH (it->w))
          && !it->glyph_row->mode_line_p
-         && FACE_COLOR_TO_PIXEL (face->background, f) != 
FRAME_BACKGROUND_PIXEL (f))
+         && face->background != FRAME_BACKGROUND_PIXEL (f))
        {
          struct glyph *g = it->glyph_row->glyphs[LEFT_MARGIN_AREA];
          struct glyph *e = g + it->glyph_row->used[LEFT_MARGIN_AREA];
@@ -22761,7 +22848,7 @@ extend_face_to_end_of_line (struct it *it)
          && (it->glyph_row->used[RIGHT_MARGIN_AREA]
              < WINDOW_RIGHT_MARGIN_WIDTH (it->w))
          && !it->glyph_row->mode_line_p
-         && FACE_COLOR_TO_PIXEL (face->background, f) != 
FRAME_BACKGROUND_PIXEL (f))
+         && face->background != FRAME_BACKGROUND_PIXEL (f))
        {
          struct glyph *g = it->glyph_row->glyphs[RIGHT_MARGIN_AREA];
          struct glyph *e = g + it->glyph_row->used[RIGHT_MARGIN_AREA];
@@ -25506,6 +25593,11 @@ display_menu_bar (struct window *w)
   if (FRAME_W32_P (f))
     return;
 #endif
+#if defined (HAVE_PGTK)
+  if (FRAME_PGTK_P (f))
+    return;
+#endif
+
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
   if (FRAME_X_P (f))
     return;
@@ -27613,6 +27705,21 @@ display_string (const char *string, Lisp_Object 
lisp_string, Lisp_Object face_st
                                   0, &endptr, it->base_face_id, false, 0);
       face = FACE_FROM_ID (it->f, it->face_id);
       it->face_box_p = face->box != FACE_NO_BOX;
+
+      /* If we have a display spec, but there's no Lisp string being
+        displayed, then check whether we've got one from the
+        :propertize being passed in and use that.  */
+      if (NILP (lisp_string))
+       {
+         Lisp_Object display = Fget_text_property (make_fixnum (0), Qdisplay,
+                                                   face_string);
+         if (!NILP (display))
+           {
+             Lisp_Object min_width = Fplist_get (display, Qmin_width);
+             if (!NILP (min_width))
+               display_min_width (it, 0, face_string, min_width);
+           }
+       }
     }
 
   /* Set max_x to the maximum allowed X position.  Don't let it go
@@ -28442,7 +28549,10 @@ fill_composite_glyph_string (struct glyph_string *s, 
struct face *base_face,
     }
 
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       int c = COMPOSITION_GLYPH (s->cmp, 0);
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
@@ -28491,7 +28601,10 @@ fill_gstring_glyph_string (struct glyph_string *s, int 
face_id,
   s->cmp_from = glyph->slice.cmp.from;
   s->cmp_to = glyph->slice.cmp.to + 1;
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
       s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
@@ -28557,7 +28670,10 @@ fill_glyphless_glyph_string (struct glyph_string *s, 
int face_id,
   s->face = FACE_FROM_ID (s->f, face_id);
   s->font = s->face->font ? s->face->font : FRAME_FONT (s->f);
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
       s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
@@ -28629,7 +28745,10 @@ fill_glyph_string (struct glyph_string *s, int face_id,
   s->font = s->face->font;
 
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
       s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
@@ -28671,7 +28790,10 @@ fill_image_glyph_string (struct glyph_string *s)
   s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
   s->font = s->face->font;
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
       s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
@@ -28694,7 +28816,10 @@ fill_xwidget_glyph_string (struct glyph_string *s)
   s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
   s->font = s->face->font;
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
       s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
@@ -28728,7 +28853,10 @@ fill_stretch_glyph_string (struct glyph_string *s, int 
start, int end)
   s->face = FACE_FROM_ID (s->f, face_id);
   s->font = s->face->font;
   if (s->hl == DRAW_MOUSE_FACE
-      || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
+      || (s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
+         && cursor_in_mouse_face_p (s->w)))
     {
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
       s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
@@ -29015,6 +29143,8 @@ set_glyph_string_background_width (struct glyph_string 
*s, int start, int last_x
 #ifdef HAVE_WINDOW_SYSTEM
       if (FRAME_WINDOW_P (s->f)
          && s->hl == DRAW_CURSOR
+         && MATRIX_ROW (s->w->current_matrix,
+                        s->w->phys_cursor.vpos)->mouse_face_p
          && cursor_in_mouse_face_p (s->w))
        {
          /* Adjust the background width of the glyph string, because
@@ -33989,7 +34119,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
   struct buffer *b;
 
   /* When a menu is active, don't highlight because this looks odd.  */
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || 
defined (MSDOS)
+#if defined (USE_X_TOOLKIT) || (defined (USE_GTK) && !defined (HAVE_PGTK)) || 
defined (HAVE_NS) || defined (MSDOS)
   if (popup_activated ())
     return;
 #endif
diff --git a/src/xfaces.c b/src/xfaces.c
index 813d89e5a3..3fd31b7f22 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1,6 +1,6 @@
 /* xfaces.c -- "Face" primitives.
 
-Copyright (C) 1993-1994, 1998-2021 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 1998-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -247,6 +247,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #define GCGraphicsExposures 0
 #endif /* HAVE_NS */
 
+#ifdef HAVE_PGTK
+#define GCGraphicsExposures 0
+#endif /* HAVE_PGTK */
+
 #ifdef HAVE_HAIKU
 #define GCGraphicsExposures 0
 #endif /* HAVE_HAIKU */
@@ -579,6 +583,26 @@ x_free_gc (struct frame *f, Emacs_GC *gc)
 }
 #endif  /* HAVE_NS */
 
+#ifdef HAVE_PGTK
+/* PGTK emulation of GCs */
+
+static Emacs_GC *
+x_create_gc (struct frame *f,
+            unsigned long mask,
+            Emacs_GC *xgcv)
+{
+  Emacs_GC *gc = xmalloc (sizeof *gc);
+  *gc = *xgcv;
+  return gc;
+}
+
+static void
+x_free_gc (struct frame *f, Emacs_GC *gc)
+{
+  xfree (gc);
+}
+#endif  /* HAVE_NS */
+
 /***********************************************************************
                           Frames and faces
  ***********************************************************************/
@@ -4782,7 +4806,7 @@ face_for_font (struct frame *f, Lisp_Object font_object,
                struct face *base_face)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
-  unsigned hash;
+  uintptr_t hash;
   int i;
   struct face *face;
 
diff --git a/src/xfns.c b/src/xfns.c
index 5eff9f5b0f..b94fe17922 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1,6 +1,6 @@
 /* Functions for the X Window System.
 
-Copyright (C) 1989, 1992-2021 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -2916,7 +2916,7 @@ initial_set_up_x_back_buffer (struct frame *f)
   unblock_input ();
 }
 
-#if defined HAVE_XINPUT2 && !defined USE_GTK
+#if defined HAVE_XINPUT2
 static void
 setup_xi_event_mask (struct frame *f)
 {
@@ -2927,30 +2927,60 @@ setup_xi_event_mask (struct frame *f)
   mask.mask = m = alloca (l);
   memset (m, 0, l);
   mask.mask_len = l;
+
+  block_input ();
+#ifndef USE_GTK
   mask.deviceid = XIAllMasterDevices;
 
   XISetMask (m, XI_ButtonPress);
   XISetMask (m, XI_ButtonRelease);
-  XISetMask (m, XI_KeyPress);
-  XISetMask (m, XI_KeyRelease);
   XISetMask (m, XI_Motion);
   XISetMask (m, XI_Enter);
   XISetMask (m, XI_Leave);
-  XISetMask (m, XI_FocusIn);
-  XISetMask (m, XI_FocusOut);
+  XISetMask (m, XI_KeyPress);
+  XISetMask (m, XI_KeyRelease);
   XISelectEvents (FRAME_X_DISPLAY (f),
                  FRAME_X_WINDOW (f),
                  &mask, 1);
 
   memset (m, 0, l);
+#endif /* !USE_GTK */
+
+#ifdef USE_X_TOOLKIT
+  XISetMask (m, XI_KeyPress);
+  XISetMask (m, XI_KeyRelease);
+
+  XISelectEvents (FRAME_X_DISPLAY (f),
+                 FRAME_OUTER_WINDOW (f),
+                 &mask, 1);
+  memset (m, 0, l);
+#endif
+
   mask.deviceid = XIAllDevices;
 
   XISetMask (m, XI_PropertyEvent);
   XISetMask (m, XI_HierarchyChanged);
   XISetMask (m, XI_DeviceChanged);
+#ifdef XI_TouchBegin
+  if (FRAME_DISPLAY_INFO (f)->xi2_version >= 2)
+    {
+      XISetMask (m, XI_TouchBegin);
+      XISetMask (m, XI_TouchUpdate);
+      XISetMask (m, XI_TouchEnd);
+#ifdef XI_GesturePinchBegin
+      if (FRAME_DISPLAY_INFO (f)->xi2_version >= 4)
+       {
+         XISetMask (m, XI_GesturePinchBegin);
+         XISetMask (m, XI_GesturePinchUpdate);
+         XISetMask (m, XI_GesturePinchEnd);
+       }
+#endif
+    }
+#endif
   XISelectEvents (FRAME_X_DISPLAY (f),
                  FRAME_X_WINDOW (f),
                  &mask, 1);
+  unblock_input ();
 }
 #endif
 
@@ -3116,11 +3146,6 @@ x_window (struct frame *f, long window_prompting)
   class_hints.res_class = SSDATA (Vx_resource_class);
   XSetClassHint (FRAME_X_DISPLAY (f), XtWindow (shell_widget), &class_hints);
 
-#ifdef HAVE_XINPUT2
-  if (FRAME_DISPLAY_INFO (f)->supports_xi2)
-    setup_xi_event_mask (f);
-#endif
-
 #ifdef HAVE_X_I18N
   FRAME_XIC (f) = NULL;
   if (use_xim)
@@ -3208,6 +3233,11 @@ x_window (struct frame *f, long window_prompting)
   /* This is a no-op, except under Motif.  Make sure main areas are
      set to something reasonable, in case we get an error later.  */
   lw_set_main_areas (pane_widget, 0, frame_widget);
+
+#ifdef HAVE_XINPUT2
+  if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+    setup_xi_event_mask (f);
+#endif
 }
 
 #else /* not USE_X_TOOLKIT */
@@ -3247,6 +3277,11 @@ x_window (struct frame *f)
     unblock_input ();
   }
 #endif
+
+#ifdef HAVE_XINPUT2
+  if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+    setup_xi_event_mask (f);
+#endif
 }
 
 #else /*! USE_GTK */
@@ -4485,6 +4520,27 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
                 VendorRelease (dpy));
 }
 
+DEFUN ("x-server-input-extension-version", Fx_server_input_extension_version,
+       Sx_server_input_extension_version, 0, 1, 0,
+       doc: /* Return the version of the X Input Extension supported by 
TERMINAL.
+The value is nil if TERMINAL's X server doesn't support the X Input
+Extension extension, or if Emacs doesn't support the version present
+on that server.  Otherwise, the return value is a list of the the
+major and minor versions of the X Input Extension extension running on
+that server.  */)
+  (Lisp_Object terminal)
+{
+#ifdef HAVE_XINPUT2
+  struct x_display_info *dpyinfo = check_x_display_info (terminal);
+
+  return (dpyinfo->supports_xi2
+         ? list2i (2, dpyinfo->xi2_version)
+         : Qnil);
+#else
+  return Qnil;
+#endif
+}
+
 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
        doc: /* Return the number of screens on the X server of display 
TERMINAL.
 The optional argument TERMINAL specifies which display to ask about.
@@ -4883,6 +4939,70 @@ x_get_monitor_attributes_xrandr (struct x_display_info 
*dpyinfo)
   int i, n_monitors, primary = -1;
   RROutput pxid = None;
   struct MonitorInfo *monitors;
+  bool randr15_p = false;
+
+#if RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 5)
+  XRRMonitorInfo *rr_monitors;
+
+  /* If RandR 1.5 or later is available, use that instead, as some
+     video drivers don't report correct dimensions via other versions
+     of RandR.  */
+  if (dpyinfo->xrandr_major_version > 1
+      || (dpyinfo->xrandr_major_version == 1
+         && dpyinfo->xrandr_minor_version >= 5))
+    {
+      XRectangle workarea;
+      char *name;
+
+      rr_monitors = XRRGetMonitors (dpyinfo->display,
+                                   dpyinfo->root_window,
+                                   True, &n_monitors);
+      if (!rr_monitors)
+       goto fallback;
+
+      monitors = xzalloc (n_monitors * sizeof *monitors);
+
+      for (int i = 0; i < n_monitors; ++i)
+       {
+         monitors[i].geom.x = rr_monitors[i].x;
+         monitors[i].geom.y = rr_monitors[i].y;
+         monitors[i].geom.width = rr_monitors[i].width;
+         monitors[i].geom.height = rr_monitors[i].height;
+         monitors[i].mm_width = rr_monitors[i].mwidth;
+         monitors[i].mm_height = rr_monitors[i].mheight;
+
+         name = XGetAtomName (dpyinfo->display, rr_monitors[i].name);
+         if (name)
+           {
+             monitors[i].name = xstrdup (name);
+             XFree (name);
+           }
+         else
+           monitors[i].name = xstrdup ("Unknown Monitor");
+
+         if (rr_monitors[i].primary)
+           primary = i;
+
+         if (rr_monitors[i].primary
+             && x_get_net_workarea (dpyinfo, &workarea))
+           {
+              monitors[i].work = workarea;
+              if (!gui_intersect_rectangles (&monitors[i].geom,
+                                            &monitors[i].work,
+                                            &monitors[i].work))
+               monitors[i].work = monitors[i].geom;
+           }
+         else
+           monitors[i].work = monitors[i].geom;
+       }
+
+      XRRFreeMonitors (rr_monitors);
+      randr15_p = true;
+      goto out;
+    }
+
+ fallback:;
+#endif
 
 #define RANDR13_LIBRARY \
   (RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3))
@@ -4971,12 +5091,16 @@ x_get_monitor_attributes_xrandr (struct x_display_info 
*dpyinfo)
       XRRFreeOutputInfo (info);
     }
   XRRFreeScreenResources (resources);
-
+#if RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 5)
+ out:
+#endif
   attributes_list = x_make_monitor_attribute_list (monitors,
                                                    n_monitors,
                                                    primary,
                                                    dpyinfo,
-                                                   "XRandr");
+                                                   (randr15_p
+                                                   ? "XRandR 1.5"
+                                                   : "XRandr"));
   free_monitors (monitors, n_monitors);
   return attributes_list;
 }
@@ -4991,17 +5115,9 @@ x_get_monitor_attributes (struct x_display_info *dpyinfo)
   (void) dpy; /* Suppress unused variable warning.  */
 
 #ifdef HAVE_XRANDR
-  int xrr_event_base, xrr_error_base;
-  bool xrr_ok = false;
-  xrr_ok = XRRQueryExtension (dpy, &xrr_event_base, &xrr_error_base);
-  if (xrr_ok)
-    {
-      XRRQueryVersion (dpy, &dpyinfo->xrandr_major_version,
-                      &dpyinfo->xrandr_minor_version);
-      xrr_ok = ((dpyinfo->xrandr_major_version == 1
-                && dpyinfo->xrandr_minor_version >= 2)
-               || dpyinfo->xrandr_major_version > 1);
-    }
+  bool xrr_ok = ((dpyinfo->xrandr_major_version == 1
+                 && dpyinfo->xrandr_minor_version >= 2)
+                || dpyinfo->xrandr_major_version > 1);
 
   if (xrr_ok)
     attributes_list = x_get_monitor_attributes_xrandr (dpyinfo);
@@ -5026,6 +5142,65 @@ x_get_monitor_attributes (struct x_display_info *dpyinfo)
 
 #endif /* !USE_GTK */
 
+#ifdef USE_LUCID
+/* This is used by the Lucid menu widget, but it's defined here so we
+   can make use of a great deal of existing code.  */
+static void
+xlw_monitor_dimensions_at_pos_1 (struct x_display_info *dpyinfo,
+                                Screen *screen, int src_x, int src_y,
+                                int *x, int *y, int *width, int *height)
+{
+  Lisp_Object attrs, tem, val;
+
+  attrs = x_get_monitor_attributes (dpyinfo);
+
+  for (tem = attrs; CONSP (tem); tem = XCDR (tem))
+    {
+      int sx, sy, swidth, sheight;
+      val = assq_no_quit (Qworkarea, XCAR (tem));
+      if (!NILP (val))
+       {
+         sx = XFIXNUM (XCAR (XCDR (val)));
+         sy = XFIXNUM (XCAR (XCDR (XCDR (val))));
+         swidth = XFIXNUM (XCAR (XCDR (XCDR (XCDR (val)))));
+         sheight = XFIXNUM (XCAR (XCDR (XCDR (XCDR (XCDR (val))))));
+
+         if (sx <= src_x && src_x < (sx + swidth)
+             && sy <= src_y && src_y < (sy + swidth))
+           {
+             *x = sx;
+             *y = sy;
+             *width = swidth;
+             *height = sheight;
+             return;
+           }
+       }
+    }
+
+  *x = 0;
+  *y = 0;
+  *width = WidthOfScreen (screen);
+  *height = HeightOfScreen (screen);
+}
+
+void
+xlw_monitor_dimensions_at_pos (Display *dpy, Screen *screen, int src_x,
+                              int src_y, int *x, int *y, int *width, int 
*height)
+{
+  struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
+
+  if (!dpyinfo)
+    emacs_abort ();
+
+  block_input ();
+  xlw_monitor_dimensions_at_pos_1 (dpyinfo, screen, src_x, src_y,
+                                  x, y, width, height);
+
+  unblock_input ();
+}
+#endif
+
+
 DEFUN ("x-display-monitor-attributes-list", Fx_display_monitor_attributes_list,
        Sx_display_monitor_attributes_list,
        0, 1, 0,
@@ -5622,8 +5797,25 @@ The coordinates X and Y are interpreted in pixels 
relative to a position
   int yval = check_integer_range (y, INT_MIN, INT_MAX);
 
   block_input ();
-  XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow (FRAME_X_DISPLAY 
(f)),
-               0, 0, 0, 0, xval, yval);
+#ifdef HAVE_XINPUT2
+  int deviceid;
+
+  if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+    {
+      XGrabServer (FRAME_X_DISPLAY (f));
+      if (XIGetClientPointer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+                             &deviceid))
+       {
+         XIWarpPointer (FRAME_X_DISPLAY (f), deviceid, None,
+                        DefaultRootWindow (FRAME_X_DISPLAY (f)),
+                        0, 0, 0, 0, xval, yval);
+       }
+      XUngrabServer (FRAME_X_DISPLAY (f));
+    }
+  else
+#endif
+    XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow 
(FRAME_X_DISPLAY (f)),
+                 0, 0, 0, 0, xval, yval);
   unblock_input ();
 
   return Qnil;
@@ -7148,7 +7340,8 @@ Text larger than the specified size is clipped.  */)
   try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
   /* Calculate size of tooltip window.  */
   size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
-                                 make_fixnum (w->pixel_height), Qnil);
+                                 make_fixnum (w->pixel_height), Qnil,
+                                 Qnil);
   /* Add the frame's internal border to calculated size.  */
   width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
   height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
@@ -7565,27 +7758,11 @@ present and mapped to the usual X keysyms.  */)
   struct frame *f = decode_window_system_frame (frame);
   Display *dpy = FRAME_X_DISPLAY (f);
   Lisp_Object have_keys;
-  int major, minor, op, event, error_code;
-
-  block_input ();
 
-  /* Check library version in case we're dynamically linked.  */
-  major = XkbMajorVersion;
-  minor = XkbMinorVersion;
-  if (!XkbLibraryVersion (&major, &minor))
-    {
-      unblock_input ();
-      return Qlambda;
-    }
+  if (!FRAME_DISPLAY_INFO (f)->supports_xkb)
+    return Qlambda;
 
-  /* Check that the server supports XKB.  */
-  major = XkbMajorVersion;
-  minor = XkbMinorVersion;
-  if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor))
-    {
-      unblock_input ();
-      return Qlambda;
-    }
+  block_input ();
 
   /* In this code we check that the keyboard has physical keys with names
      that start with BKSP (Backspace) and DELE (Delete), and that they
@@ -8154,6 +8331,7 @@ eliminated in future versions of Emacs.  */);
   defsubr (&Sx_server_max_request_size);
   defsubr (&Sx_server_vendor);
   defsubr (&Sx_server_version);
+  defsubr (&Sx_server_input_extension_version);
   defsubr (&Sx_display_pixel_width);
   defsubr (&Sx_display_pixel_height);
   defsubr (&Sx_display_mm_width);
diff --git a/src/xfont.c b/src/xfont.c
index 81d356175a..b5765cfa7b 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -1,5 +1,5 @@
 /* xfont.c -- X core font driver.
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
diff --git a/src/xftfont.c b/src/xftfont.c
index d8ad403548..f305738410 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -1,5 +1,5 @@
 /* xftfont.c -- XFT font driver.
-   Copyright (C) 2006-2021 Free Software Foundation, Inc.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
diff --git a/src/xgselect.c b/src/xgselect.c
index 92b118b955..674c259db7 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -1,6 +1,6 @@
 /* Function for handling the GLib event loop.
 
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,11 +28,13 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "blockinput.h"
 #include "systime.h"
+#include "process.h"
 
 static ptrdiff_t threads_holding_glib_lock;
 static GMainContext *glib_main_context;
 
-void release_select_lock (void)
+void
+release_select_lock (void)
 {
 #if GNUC_PREREQ (4, 7, 0)
   if (__atomic_sub_fetch (&threads_holding_glib_lock, 1, __ATOMIC_ACQ_REL) == 
0)
@@ -43,7 +45,8 @@ void release_select_lock (void)
 #endif
 }
 
-static void acquire_select_lock (GMainContext *context)
+static void
+acquire_select_lock (GMainContext *context)
 {
 #if GNUC_PREREQ (4, 7, 0)
   if (__atomic_fetch_add (&threads_holding_glib_lock, 1, __ATOMIC_ACQ_REL) == 
0)
@@ -181,6 +184,21 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set 
*efds,
 #else
   need_to_dispatch = true;
 #endif
+
+  /* xwidgets make heavy use of GLib subprocesses, which add their own
+     SIGCHLD handler at arbitrary locations.  That doesn't play well
+     with Emacs's own handler, so once GLib does its thing with its
+     subprocesses we restore our own SIGCHLD handler (which chains the
+     GLib handler) here.
+
+     There is an obvious race condition, but we can't really do
+     anything about that, except hope a SIGCHLD arrives soon to clear
+     up the situation.  */
+
+#ifdef HAVE_XWIDGETS
+  catch_child_signal ();
+#endif
+
   if (need_to_dispatch)
     {
       acquire_select_lock (context);
diff --git a/src/xgselect.h b/src/xgselect.h
index 2142a236b2..15482cbf92 100644
--- a/src/xgselect.h
+++ b/src/xgselect.h
@@ -1,6 +1,6 @@
 /* Header for xg_select.
 
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xmenu.c b/src/xmenu.c
index 07255911f9..b755f75da0 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1,6 +1,6 @@
 /* X Communication module for terminals which understand the X protocol.
 
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2021 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2022 Free Software
 Foundation, Inc.
 
 Author: Jon Arnold
@@ -51,6 +51,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "msdos.h"
 #endif
 
+#ifdef HAVE_XINPUT2
+#include <X11/extensions/XInput2.h>
+#endif
+
 #ifdef HAVE_X_WINDOWS
 /* This may include sys/types.h, and that somehow loses
    if this is not done before the other system files.  */
@@ -444,6 +448,19 @@ x_activate_menubar (struct frame *f)
   XPutBackEvent (f->output_data.x->display_info->display,
                  f->output_data.x->saved_menu_event);
 #else
+#if defined USE_X_TOOLKIT && defined HAVE_XINPUT2
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  /* Clear the XI2 grab so Motif or lwlib can set a core grab.
+     Otherwise some versions of Motif will emit a warning and hang,
+     and lwlib will fail to destroy the menu window.  */
+
+  if (dpyinfo->num_devices)
+    {
+      for (int i = 0; i < dpyinfo->num_devices; ++i)
+       XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
+                       CurrentTime);
+    }
+#endif
   XtDispatchEvent (f->output_data.x->saved_menu_event);
 #endif
   unblock_input ();
@@ -1445,7 +1462,17 @@ create_and_show_popup_menu (struct frame *f, 
widget_value *first_wv,
   /* Don't allow any geometry request from the user.  */
   XtSetArg (av[ac], (char *) XtNgeometry, 0); ac++;
   XtSetValues (menu, av, ac);
+#if defined HAVE_XINPUT2 && defined USE_LUCID
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+  /* Clear the XI2 grab so lwlib can set a core grab.  */
 
+  if (dpyinfo->num_devices)
+    {
+      for (int i = 0; i < dpyinfo->num_devices; ++i)
+       XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
+                       CurrentTime);
+    }
+#endif
   /* Display the menu.  */
   lw_popup_menu (menu, &dummy);
   popup_activated_flag = 1;
diff --git a/src/xml.c b/src/xml.c
index 495988ab23..522efd224c 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1,5 +1,5 @@
 /* Interface to libxml2.
-   Copyright (C) 2010-2021 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xrdb.c b/src/xrdb.c
index 7d84762978..56e07f74a2 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -1,5 +1,5 @@
 /* Deal with the X Resource Manager.
-   Copyright (C) 1990, 1993-1994, 2000-2021 Free Software Foundation,
+   Copyright (C) 1990, 1993-1994, 2000-2022 Free Software Foundation,
    Inc.
 
 Author: Joseph Arceneaux
diff --git a/src/xselect.c b/src/xselect.c
index cd6d86bdf4..cfe028a169 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1,5 +1,5 @@
 /* X Selection processing for Emacs.
-   Copyright (C) 1993-1997, 2000-2021 Free Software Foundation, Inc.
+   Copyright (C) 1993-1997, 2000-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xsettings.c b/src/xsettings.c
index 58dfd43ad1..71d02e6152 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -1,6 +1,6 @@
 /* Functions for handling font and other changes dynamically.
 
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,7 +26,11 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <byteswap.h>
 
 #include "lisp.h"
+#ifndef HAVE_PGTK
 #include "xterm.h"
+#else
+#include "gtkutil.h"
+#endif
 #include "xsettings.h"
 #include "frame.h"
 #include "keyboard.h"
@@ -34,7 +38,12 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "termhooks.h"
 #include "pdumper.h"
 
+#ifndef HAVE_PGTK
 #include <X11/Xproto.h>
+#else
+typedef unsigned short CARD16;
+typedef unsigned int CARD32;
+#endif
 
 #ifdef HAVE_GSETTINGS
 #include <glib-object.h>
@@ -55,7 +64,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 static char *current_mono_font;
 static char *current_font;
-static struct x_display_info *first_dpyinfo;
+static Display_Info *first_dpyinfo;
 static Lisp_Object current_tool_bar_style;
 
 /* Store a config changed event in to the event queue.  */
@@ -73,14 +82,18 @@ store_config_changed_event (Lisp_Object arg, Lisp_Object 
display_name)
 
 /* Return true if DPYINFO is still valid.  */
 static bool
-dpyinfo_valid (struct x_display_info *dpyinfo)
+dpyinfo_valid (Display_Info *dpyinfo)
 {
   bool found = false;
   if (dpyinfo != NULL)
     {
-      struct x_display_info *d;
+      Display_Info *d;
       for (d = x_display_list; !found && d; d = d->next)
+#ifndef HAVE_PGTK
         found = d == dpyinfo && d->display == dpyinfo->display;
+#else
+        found = d == dpyinfo && d->gdpy == dpyinfo->gdpy;
+#endif
     }
   return found;
 }
@@ -149,7 +162,7 @@ map_tool_bar_style (const char *tool_bar_style)
 
 static void
 store_tool_bar_style_changed (const char *newstyle,
-                              struct x_display_info *dpyinfo)
+                              Display_Info *dpyinfo)
 {
   Lisp_Object style = map_tool_bar_style (newstyle);
   if (EQ (current_tool_bar_style, style))
@@ -161,10 +174,12 @@ store_tool_bar_style_changed (const char *newstyle,
                                 XCAR (dpyinfo->name_list_element));
 }
 
+#ifndef HAVE_PGTK
 #if defined USE_CAIRO || defined HAVE_XFT
 #define XSETTINGS_FONT_NAME       "Gtk/FontName"
 #endif
 #define XSETTINGS_TOOL_BAR_STYLE  "Gtk/ToolbarStyle"
+#endif
 
 enum {
   SEEN_AA         = 0x01,
@@ -321,10 +336,11 @@ something_changed_gconfCB (GConfClient *client,
 
 #endif /* USE_CAIRO || HAVE_XFT */
 
+#ifndef HAVE_PGTK
 /* Find the window that contains the XSETTINGS property values.  */
 
 static void
-get_prop_window (struct x_display_info *dpyinfo)
+get_prop_window (Display_Info *dpyinfo)
 {
   Display *dpy = dpyinfo->display;
 
@@ -339,6 +355,9 @@ get_prop_window (struct x_display_info *dpyinfo)
 
   XUngrabServer (dpy);
 }
+#endif
+
+#ifndef HAVE_PGTK
 
 #define PAD(nr)    (((nr) + 3) & ~3)
 
@@ -566,13 +585,15 @@ parse_settings (unsigned char *prop,
 
   return settings_seen;
 }
+#endif
 
+#ifndef HAVE_PGTK
 /* Read settings from the XSettings property window on display for DPYINFO.
    Store settings read in SETTINGS.
    Return true iff successful.  */
 
 static bool
-read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
+read_settings (Display_Info *dpyinfo, struct xsettings *settings)
 {
   Atom act_type;
   int act_form;
@@ -600,12 +621,14 @@ read_settings (struct x_display_info *dpyinfo, struct 
xsettings *settings)
 
   return got_settings;
 }
+#endif
 
+#ifndef HAVE_PGTK
 /* Apply Xft settings in SETTINGS to the Xft library.
    Store a Lisp event that Xft settings changed.  */
 
 static void
-apply_xft_settings (struct x_display_info *dpyinfo,
+apply_xft_settings (Display_Info *dpyinfo,
                     struct xsettings *settings)
 {
 #ifdef HAVE_XFT
@@ -731,12 +754,14 @@ apply_xft_settings (struct x_display_info *dpyinfo,
     FcPatternDestroy (pat);
 #endif /* HAVE_XFT */
 }
+#endif
 
+#ifndef HAVE_PGTK
 /* Read XSettings from the display for DPYINFO.
    If SEND_EVENT_P store a Lisp event settings that changed.  */
 
 static void
-read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p)
+read_and_apply_settings (Display_Info *dpyinfo, bool send_event_p)
 {
   struct xsettings settings;
 
@@ -763,11 +788,13 @@ read_and_apply_settings (struct x_display_info *dpyinfo, 
bool send_event_p)
     }
 #endif
 }
+#endif
 
+#ifndef HAVE_PGTK
 /* Check if EVENT for the display in DPYINFO is XSettings related.  */
 
 void
-xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
+xft_settings_event (Display_Info *dpyinfo, const XEvent *event)
 {
   bool check_window_p = false, apply_settings_p = false;
 
@@ -805,6 +832,7 @@ xft_settings_event (struct x_display_info *dpyinfo, const 
XEvent *event)
   if (apply_settings_p)
     read_and_apply_settings (dpyinfo, true);
 }
+#endif
 
 /* Initialize GSettings and read startup values.  */
 
@@ -940,10 +968,11 @@ init_gconf (void)
 #endif /* HAVE_GCONF */
 }
 
+#ifndef HAVE_PGTK
 /* Init Xsettings and read startup values.  */
 
 static void
-init_xsettings (struct x_display_info *dpyinfo)
+init_xsettings (Display_Info *dpyinfo)
 {
   Display *dpy = dpyinfo->display;
 
@@ -959,13 +988,16 @@ init_xsettings (struct x_display_info *dpyinfo)
 
   unblock_input ();
 }
+#endif
 
 void
-xsettings_initialize (struct x_display_info *dpyinfo)
+xsettings_initialize (Display_Info *dpyinfo)
 {
   if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo;
   init_gconf ();
+#ifndef HAVE_PGTK
   init_xsettings (dpyinfo);
+#endif
   init_gsettings ();
 }
 
diff --git a/src/xsettings.h b/src/xsettings.h
index 26717fc08c..266526df10 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -1,6 +1,6 @@
 /* Functions for handle font changes dynamically.
 
-Copyright (C) 2009-2021 Free Software Foundation, Inc.
+Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -20,12 +20,23 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #ifndef XSETTINGS_H
 #define XSETTINGS_H
 
+#ifndef HAVE_PGTK
 #include <X11/Xlib.h>
+#endif
 
 struct x_display_info;
+struct pgtk_display_info;
+
+#ifndef HAVE_PGTK
+typedef struct x_display_info Display_Info;
+#else
+typedef struct pgtk_display_info Display_Info;
+#endif
 
-extern void xsettings_initialize (struct x_display_info *);
-extern void xft_settings_event (struct x_display_info *, const XEvent *);
+extern void xsettings_initialize (Display_Info *);
+#ifndef HAVE_PGTK
+extern void xft_settings_event (Display_Info *, const XEvent *);
+#endif
 extern const char *xsettings_get_system_font (void);
 #ifdef USE_LUCID
 extern const char *xsettings_get_system_normal_font (void);
diff --git a/src/xsmfns.c b/src/xsmfns.c
index ddb86d82fe..199e3ded3d 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -1,7 +1,7 @@
 /* Session management module for systems which understand the X Session
    management protocol.
 
-Copyright (C) 2002-2021 Free Software Foundation, Inc.
+Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xterm.c b/src/xterm.c
index 9d60292756..8202e8fb00 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,6 +1,6 @@
 /* X Communication module for terminals which understand the X protocol.
 
-Copyright (C) 1989, 1993-2021 Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -46,6 +46,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <X11/extensions/XInput2.h>
 #endif
 
+#ifdef HAVE_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+
 /* Load sys/types.h if not already loaded.
    In some systems loading it twice is suicidal.  */
 #ifndef makedev
@@ -353,6 +357,8 @@ x_extension_initialize (struct x_display_info *dpyinfo)
 static void
 x_free_xi_devices (struct x_display_info *dpyinfo)
 {
+  struct xi_touch_point_t *tem, *last;
+
   block_input ();
 
   if (dpyinfo->num_devices)
@@ -362,6 +368,14 @@ x_free_xi_devices (struct x_display_info *dpyinfo)
          XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
                          CurrentTime);
          xfree (dpyinfo->devices[i].valuators);
+
+         tem = dpyinfo->devices[i].touchpoints;
+         while (tem)
+           {
+             last = tem;
+             tem = tem->next;
+             xfree (last);
+           }
        }
 
       xfree (dpyinfo->devices);
@@ -407,7 +421,7 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
   block_input ();
   x_free_xi_devices (dpyinfo);
   infos = XIQueryDevice (dpyinfo->display,
-                        XIAllMasterDevices,
+                        XIAllDevices,
                         &ndevices);
 
   if (!ndevices)
@@ -432,6 +446,10 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
          xi_device->grab = 0;
          xi_device->valuators =
            xmalloc (sizeof *xi_device->valuators * device->num_classes);
+         xi_device->touchpoints = NULL;
+         xi_device->master_p = (device->use == XIMasterKeyboard
+                                || device->use == XIMasterPointer);
+         xi_device->direct_p = false;
 
          for (int c = 0; c < device->num_classes; ++c)
            {
@@ -442,22 +460,36 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
                  {
                    XIScrollClassInfo *info =
                      (XIScrollClassInfo *) device->classes[c];
-                   struct xi_scroll_valuator_t *valuator =
-                     &xi_device->valuators[actual_valuator_count++];
-
-                   valuator->horizontal
-                     = (info->scroll_type == XIScrollTypeHorizontal);
-                   valuator->invalid_p = true;
-                   valuator->emacs_value = DBL_MIN;
-                   valuator->increment = info->increment;
-                   valuator->number = info->number;
+                   struct xi_scroll_valuator_t *valuator;
+
+                   if (xi_device->master_p)
+                     {
+                       valuator = 
&xi_device->valuators[actual_valuator_count++];
+                       valuator->horizontal
+                         = (info->scroll_type == XIScrollTypeHorizontal);
+                       valuator->invalid_p = true;
+                       valuator->emacs_value = DBL_MIN;
+                       valuator->increment = info->increment;
+                       valuator->number = info->number;
+                     }
+
                    break;
                  }
+#endif
+#ifdef XITouchClass /* XInput 2.2 */
+               case XITouchClass:
+                 {
+                   XITouchClassInfo *info;
+
+                   info = (XITouchClassInfo *) device->classes[c];
+                   xi_device->direct_p = info->mode == XIDirectTouch;
+                 }
 #endif
                default:
                  break;
                }
            }
+
          xi_device->scroll_valuator_count = actual_valuator_count;
        }
     }
@@ -470,9 +502,10 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
 /* Return the delta of the scroll valuator VALUATOR_NUMBER under
    DEVICE_ID in the display DPYINFO with VALUE.  The valuator's
    valuator will be set to VALUE afterwards.  In case no scroll
-   valuator is found, or if device_id is not known to Emacs, DBL_MAX
-   is returned.  Otherwise, the valuator is returned in
-   VALUATOR_RETURN.  */
+   valuator is found, or if the valuator state is invalid (see the
+   comment under XI_Enter in handle_one_xevent), or if device_id is
+   not known to Emacs, DBL_MAX is returned.  Otherwise, the valuator
+   is returned in VALUATOR_RETURN.  */
 static double
 x_get_scroll_valuator_delta (struct x_display_info *dpyinfo, int device_id,
                             int valuator_number, double value,
@@ -484,7 +517,7 @@ x_get_scroll_valuator_delta (struct x_display_info 
*dpyinfo, int device_id,
     {
       struct xi_device_t *device = &dpyinfo->devices[i];
 
-      if (device->device_id == device_id)
+      if (device->device_id == device_id && device->master_p)
        {
          for (int j = 0; j < device->scroll_valuator_count; ++j)
            {
@@ -499,7 +532,7 @@ x_get_scroll_valuator_delta (struct x_display_info 
*dpyinfo, int device_id,
                      *valuator_return = sv;
 
                      unblock_input ();
-                     return 0.0;
+                     return DBL_MAX;
                    }
                  else
                    {
@@ -534,43 +567,70 @@ xi_device_from_id (struct x_display_info *dpyinfo, int 
deviceid)
   return NULL;
 }
 
+#ifdef XI_TouchBegin
+
 static void
-xi_grab_or_ungrab_device (struct xi_device_t *device,
-                         struct x_display_info *dpyinfo,
-                         Window window)
+xi_link_touch_point (struct xi_device_t *device,
+                    int detail, double x, double y)
 {
-  XIEventMask mask;
-  ptrdiff_t l = XIMaskLen (XI_LASTEVENT);
-  unsigned char *m;
-  mask.mask = m = alloca (l);
-  memset (m, 0, l);
-  mask.mask_len = l;
+  struct xi_touch_point_t *touchpoint;
 
-  XISetMask (m, XI_ButtonPress);
-  XISetMask (m, XI_ButtonRelease);
-  XISetMask (m, XI_Motion);
-  XISetMask (m, XI_Enter);
-  XISetMask (m, XI_Leave);
+  touchpoint = xmalloc (sizeof *touchpoint);
+  touchpoint->next = device->touchpoints;
+  touchpoint->x = x;
+  touchpoint->y = y;
+  touchpoint->number = detail;
 
-  if (device->grab)
+  device->touchpoints = touchpoint;
+}
+
+static bool
+xi_unlink_touch_point (int detail,
+                      struct xi_device_t *device)
+{
+  struct xi_touch_point_t *last, *tem;
+
+  for (last = NULL, tem = device->touchpoints; tem;
+       last = tem, tem = tem->next)
     {
-      XIGrabDevice (dpyinfo->display, device->device_id, window,
-                   CurrentTime, None, GrabModeAsync,
-                   GrabModeAsync, True, &mask);
+      if (tem->number == detail)
+       {
+         if (!last)
+           device->touchpoints = tem->next;
+         else
+           last->next = tem->next;
+
+         xfree (tem);
+         return true;
+       }
     }
-  else
+
+  return false;
+}
+
+static struct xi_touch_point_t *
+xi_find_touch_point (struct xi_device_t *device, int detail)
+{
+  struct xi_touch_point_t *point;
+
+  for (point = device->touchpoints; point; point = point->next)
     {
-      XIUngrabDevice (dpyinfo->display, device->device_id, CurrentTime);
+      if (point->number == detail)
+       return point;
     }
+
+  return NULL;
 }
 
+#endif /* XI_TouchBegin */
+
 static void
 xi_reset_scroll_valuators_for_device_id (struct x_display_info *dpyinfo, int 
id)
 {
   struct xi_device_t *device = xi_device_from_id (dpyinfo, id);
   struct xi_scroll_valuator_t *valuator;
 
-  if (!device)
+  if (!device || !device->master_p)
     return;
 
   if (!device->scroll_valuator_count)
@@ -5144,19 +5204,24 @@ x_detect_focus_change (struct x_display_info *dpyinfo, 
struct frame *frame,
         int focus_state
           = focus_frame ? focus_frame->output_data.x->focus_state : 0;
 
-       if (((((xi_event->evtype == XI_Enter
-               || xi_event->evtype == XI_Leave)
-              && (((XIEnterEvent *) xi_event)->detail
-                  != XINotifyInferior)
-              && !(focus_state & FOCUS_EXPLICIT))
-             || xi_event->evtype == XI_FocusIn
-             || xi_event->evtype == XI_FocusOut)))
+#ifdef USE_GTK
+       if (xi_event->evtype == XI_FocusIn
+           || xi_event->evtype == XI_FocusOut)
+         x_focus_changed ((xi_event->evtype == XI_FocusIn
+                           ? FocusIn : FocusOut),
+                          FOCUS_EXPLICIT,
+                          dpyinfo, frame, bufp);
+       else
+#endif
+         if ((xi_event->evtype == XI_Enter
+              || xi_event->evtype == XI_Leave)
+             && (((XIEnterEvent *) xi_event)->detail
+                 != XINotifyInferior)
+             && ((XIEnterEvent *) xi_event)->focus
+             && !(focus_state & FOCUS_EXPLICIT))
          x_focus_changed ((xi_event->evtype == XI_Enter
-                           || xi_event->evtype == XI_FocusIn
                            ? FocusIn : FocusOut),
-                          (xi_event->evtype == XI_Enter
-                           || xi_event->evtype == XI_Leave
-                           ? FOCUS_IMPLICIT : FOCUS_EXPLICIT),
+                          FOCUS_IMPLICIT,
                           dpyinfo, frame, bufp);
        break;
       }
@@ -5257,6 +5322,15 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
   KeySym *syms;
   int syms_per_code;
   XModifierKeymap *mods;
+#ifdef HAVE_XKB
+  Atom meta;
+  Atom super;
+  Atom hyper;
+  Atom shiftlock;
+  Atom alt;
+  int i;
+  int found_meta_p = false;
+#endif
 
   dpyinfo->meta_mod_mask = 0;
   dpyinfo->shift_lock_mask = 0;
@@ -5266,6 +5340,50 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
 
   XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
 
+#ifdef HAVE_XKB
+  if (dpyinfo->xkb_desc)
+    {
+      meta = XInternAtom (dpyinfo->display, "Meta", False);
+      super = XInternAtom (dpyinfo->display, "Super", False);
+      hyper = XInternAtom (dpyinfo->display, "Hyper", False);
+      shiftlock = XInternAtom (dpyinfo->display, "ShiftLock", False);
+      alt = XInternAtom (dpyinfo->display, "Alt", False);
+
+      for (i = 0; i < XkbNumVirtualMods; i++)
+       {
+         uint vmodmask = dpyinfo->xkb_desc->server->vmods[i];
+
+         if (dpyinfo->xkb_desc->names->vmods[i] == meta)
+           {
+             dpyinfo->meta_mod_mask |= vmodmask;
+             found_meta_p = vmodmask;
+           }
+         else if (dpyinfo->xkb_desc->names->vmods[i] == alt)
+           dpyinfo->alt_mod_mask |= vmodmask;
+         else if (dpyinfo->xkb_desc->names->vmods[i] == super)
+           dpyinfo->super_mod_mask |= vmodmask;
+         else if (dpyinfo->xkb_desc->names->vmods[i] == hyper)
+           dpyinfo->hyper_mod_mask |= vmodmask;
+         else if (dpyinfo->xkb_desc->names->vmods[i] == shiftlock)
+           dpyinfo->shift_lock_mask |= vmodmask;
+       }
+
+      if (!found_meta_p)
+       {
+         dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask;
+         dpyinfo->alt_mod_mask = 0;
+       }
+
+      if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask)
+       dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask;
+
+      if (dpyinfo->hyper_mod_mask & dpyinfo->super_mod_mask)
+       dpyinfo->hyper_mod_mask &= ~dpyinfo->super_mod_mask;
+
+      return;
+    }
+#endif
+
   syms = XGetKeyboardMapping (dpyinfo->display,
                              min_code, max_code - min_code + 1,
                              &syms_per_code);
@@ -5278,66 +5396,66 @@ x_find_modifier_meanings (struct x_display_info 
*dpyinfo)
     bool found_alt_or_meta;
 
     for (row = 3; row < 8; row++)
-    {
-      found_alt_or_meta = false;
-      for (col = 0; col < mods->max_keypermod; col++)
-       {
-         KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
-
-         /* Zeroes are used for filler.  Skip them.  */
-         if (code == 0)
-           continue;
-
-         /* Are any of this keycode's keysyms a meta key?  */
+      {
+       found_alt_or_meta = false;
+       for (col = 0; col < mods->max_keypermod; col++)
          {
-           int code_col;
-
-           for (code_col = 0; code_col < syms_per_code; code_col++)
-             {
-               int sym = syms[((code - min_code) * syms_per_code) + code_col];
-
-               switch (sym)
-                 {
-                 case XK_Meta_L:
-                 case XK_Meta_R:
-                   found_alt_or_meta = true;
-                   dpyinfo->meta_mod_mask |= (1 << row);
-                   break;
+           KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
 
-                 case XK_Alt_L:
-                 case XK_Alt_R:
-                   found_alt_or_meta = true;
-                   dpyinfo->alt_mod_mask |= (1 << row);
-                   break;
+           /* Zeroes are used for filler.  Skip them.  */
+           if (code == 0)
+             continue;
 
-                 case XK_Hyper_L:
-                 case XK_Hyper_R:
-                   if (!found_alt_or_meta)
-                     dpyinfo->hyper_mod_mask |= (1 << row);
-                   code_col = syms_per_code;
-                   col = mods->max_keypermod;
-                   break;
+           /* Are any of this keycode's keysyms a meta key?  */
+           {
+             int code_col;
 
-                 case XK_Super_L:
-                 case XK_Super_R:
-                   if (!found_alt_or_meta)
-                     dpyinfo->super_mod_mask |= (1 << row);
-                   code_col = syms_per_code;
-                   col = mods->max_keypermod;
-                   break;
+             for (code_col = 0; code_col < syms_per_code; code_col++)
+               {
+                 int sym = syms[((code - min_code) * syms_per_code) + 
code_col];
 
-                 case XK_Shift_Lock:
-                   /* Ignore this if it's not on the lock modifier.  */
-                   if (!found_alt_or_meta && ((1 << row) == LockMask))
-                     dpyinfo->shift_lock_mask = LockMask;
-                   code_col = syms_per_code;
-                   col = mods->max_keypermod;
-                   break;
-                 }
-             }
+                 switch (sym)
+                   {
+                   case XK_Meta_L:
+                   case XK_Meta_R:
+                     found_alt_or_meta = true;
+                     dpyinfo->meta_mod_mask |= (1 << row);
+                     break;
+
+                   case XK_Alt_L:
+                   case XK_Alt_R:
+                     found_alt_or_meta = true;
+                     dpyinfo->alt_mod_mask |= (1 << row);
+                     break;
+
+                   case XK_Hyper_L:
+                   case XK_Hyper_R:
+                     if (!found_alt_or_meta)
+                       dpyinfo->hyper_mod_mask |= (1 << row);
+                     code_col = syms_per_code;
+                     col = mods->max_keypermod;
+                     break;
+
+                   case XK_Super_L:
+                   case XK_Super_R:
+                     if (!found_alt_or_meta)
+                       dpyinfo->super_mod_mask |= (1 << row);
+                     code_col = syms_per_code;
+                     col = mods->max_keypermod;
+                     break;
+
+                   case XK_Shift_Lock:
+                     /* Ignore this if it's not on the lock modifier.  */
+                     if (!found_alt_or_meta && ((1 << row) == LockMask))
+                       dpyinfo->shift_lock_mask = LockMask;
+                     code_col = syms_per_code;
+                     col = mods->max_keypermod;
+                     break;
+                   }
+               }
+           }
          }
-       }
-    }
+      }
   }
 
   /* If we couldn't find any meta keys, accept any alt keys as meta keys.  */
@@ -8296,11 +8414,20 @@ handle_one_xevent (struct x_display_info *dpyinfo,
   inev.ie.kind = NO_EVENT;
   inev.ie.arg = Qnil;
 
+#ifdef HAVE_XKB
+  if (event->type != dpyinfo->xkb_event_type)
+    {
+#endif
 #ifdef HAVE_XINPUT2
-  if (event->type != GenericEvent)
+      if (event->type != GenericEvent)
 #endif
-    any = x_any_window_to_frame (dpyinfo, event->xany.window);
+       any = x_any_window_to_frame (dpyinfo, event->xany.window);
 #ifdef HAVE_XINPUT2
+      else
+       any = NULL;
+#endif
+#ifdef HAVE_XKB
+    }
   else
     any = NULL;
 #endif
@@ -9294,6 +9421,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       x_detect_focus_change (dpyinfo, any, event, &inev.ie);
 
       f = x_top_window_to_frame (dpyinfo, event->xcrossing.window);
+#if defined HAVE_X_TOOLKIT && defined HAVE_XINPUT2
+      /* The XI2 event mask is set on the frame widget, so this event
+        likely originates from the shell widget, which we aren't
+        interested in.  */
+      if (dpyinfo->supports_xi2)
+       f = NULL;
+#endif
       if (f)
         {
           if (f == hlinfo->mouse_face_mouse_frame)
@@ -9615,6 +9749,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                inev.ie.kind = SELECT_WINDOW_EVENT;
                inev.ie.frame_or_window = xvw->w;
              }
+
+           *finish = X_EVENT_DROP;
            goto OTHER;
          }
 #endif
@@ -9817,11 +9953,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
           x_find_modifier_meanings (dpyinfo);
          FALLTHROUGH;
         case MappingKeyboard:
-#ifdef HAVE_XKB
-         if (dpyinfo->xkb_desc)
-           XkbGetUpdatedMap (dpyinfo->display, XkbAllComponentsMask,
-                             dpyinfo->xkb_desc);
-#endif
           XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping);
         }
       goto OTHER;
@@ -9855,9 +9986,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
        XIValuatorState *states;
        double *values;
        bool found_valuator = false;
-#ifdef HAVE_XWIDGETS
-       bool any_stop_p = false;
-#endif /* HAVE_XWIDGETS */
 
        /* A fake XMotionEvent for x_note_mouse_movement. */
        XMotionEvent ev;
@@ -9908,24 +10036,52 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
            x_display_set_last_user_time (dpyinfo, xi_event->time);
            x_detect_focus_change (dpyinfo, any, event, &inev.ie);
+           {
+#ifdef HAVE_XWIDGETS
+             struct xwidget_view *xwidget_view = xwidget_view_from_window 
(enter->event);
+#else
+             bool xwidget_view = false;
+#endif
+
+             /* One problem behind the design of XInput 2 scrolling is
+                that valuators are not unique to each window, but only
+                the window that has grabbed the valuator's device or
+                the window that the device's pointer is on top of can
+                receive motion events.  There is also no way to
+                retrieve the value of a valuator outside of each motion
+                event.
+
+                As such, to prevent wildly inaccurate results when the
+                valuators have changed outside Emacs, we reset our
+                records of each valuator's value whenever the pointer
+                re-enters a frame after its valuators have potentially
+                been changed elsewhere.  */
+             if (enter->detail != XINotifyInferior
+                 && enter->mode != XINotifyPassiveUngrab
+                 /* See the comment under FocusIn in
+                    `x_detect_focus_change'.  The main relevant culprit
+                    these days seems to be XFCE.  */
+                 && enter->mode != XINotifyUngrab
+                 && (xwidget_view
+                     || (any && enter->event == FRAME_X_WINDOW (any))))
+               xi_reset_scroll_valuators_for_device_id (dpyinfo, 
enter->deviceid);
 
-           /* One problem behind the design of XInput 2 scrolling is
-              that valuators are not unique to each window, but only
-              the window that has grabbed the valuator's device or
-              the window that the device's pointer is on top of can
-              receive motion events.  There is also no way to
-              retrieve the value of a valuator outside of each motion
-              event.
-
-              As such, to prevent wildly inaccurate results when the
-              valuators have changed outside Emacs, we reset our
-              records of each valuator's value whenever the pointer
-              re-enters a frame after its valuators have potentially
-              been changed elsewhere.  */
-           if (enter->detail != XINotifyInferior
-               && enter->mode != XINotifyPassiveUngrab
-               && enter->mode != XINotifyUngrab && any)
-             xi_reset_scroll_valuators_for_device_id (dpyinfo, 
enter->deviceid);
+#ifdef HAVE_XWIDGETS
+             if (xwidget_view)
+               {
+                 /* Don't send an enter event to the xwidget if the
+                    first button is pressed, to avoid it releasing
+                    the passive grab.  I don't know why that happens,
+                    but this workaround makes dragging to select text
+                    work again.  */
+                 if (!(enter->buttons.mask_len
+                       && XIMaskIsSet (enter->buttons.mask, 1)))
+                   xwidget_motion_or_crossing (xwidget_view, event);
+
+                 goto XI_OTHER;
+               }
+#endif
+           }
 
            f = any;
 
@@ -9949,10 +10105,31 @@ handle_one_xevent (struct x_display_info *dpyinfo,
            ev.window = leave->event;
            any = x_any_window_to_frame (dpyinfo, leave->event);
 
+#ifdef HAVE_XWIDGETS
+           {
+             struct xwidget_view *xvw
+               = xwidget_view_from_window (leave->event);
+
+             if (xvw)
+               {
+                 *finish = X_EVENT_DROP;
+                 xwidget_motion_or_crossing (xvw, event);
+
+                 goto XI_OTHER;
+               }
+           }
+#endif
+
            x_display_set_last_user_time (dpyinfo, xi_event->time);
            x_detect_focus_change (dpyinfo, any, event, &inev.ie);
 
+#ifndef USE_X_TOOLKIT
            f = x_top_window_to_frame (dpyinfo, leave->event);
+#else
+           /* On Xt builds that have XI2, the enter and leave event
+              masks are set on the frame widget's window.  */
+           f = x_window_to_frame (dpyinfo, leave->event);
+#endif
            if (f)
              {
                if (f == hlinfo->mouse_face_mouse_frame)
@@ -9977,242 +10154,279 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif
            goto XI_OTHER;
          case XI_Motion:
-           states = &xev->valuators;
-           values = states->values;
-
-           x_display_set_last_user_time (dpyinfo, xi_event->time);
+           {
+             struct xi_device_t *device;
 
-#ifdef HAVE_XWIDGETS
-           struct xwidget_view *xv = xwidget_view_from_window (xev->event);
-           double xv_total_x = 0.0;
-           double xv_total_y = 0.0;
-#endif
+             states = &xev->valuators;
+             values = states->values;
+             device = xi_device_from_id (dpyinfo, xev->deviceid);
 
-           for (int i = 0; i < states->mask_len * 8; i++)
-             {
-               if (XIMaskIsSet (states->mask, i))
-                 {
-                   struct xi_scroll_valuator_t *val;
-                   double delta, scroll_unit;
-                   int scroll_height;
-                   Lisp_Object window;
+             if (!device || !device->master_p)
+               goto XI_OTHER;
 
+#ifdef XI_TouchBegin
+             if (xev->flags & XIPointerEmulated
+                 && dpyinfo->xi2_version >= 2)
+               goto XI_OTHER;
+#endif
 
-                   /* See the comment on top of
-                      x_init_master_valuators for more details on how
-                      scroll wheel movement is reported on XInput 2.  */
-                   delta = x_get_scroll_valuator_delta (dpyinfo, xev->deviceid,
-                                                        i, *values, &val);
+             x_display_set_last_user_time (dpyinfo, xi_event->time);
 
-                   if (delta != DBL_MAX)
-                     {
 #ifdef HAVE_XWIDGETS
-                       if (xv)
-                         {
-                           if (val->horizontal)
-                             xv_total_x += delta;
-                           else
-                             xv_total_y += delta;
+             struct xwidget_view *xv = xwidget_view_from_window (xev->event);
+             double xv_total_x = 0.0;
+             double xv_total_y = 0.0;
+#endif
 
-                           found_valuator = true;
+             for (int i = 0; i < states->mask_len * 8; i++)
+               {
+                 if (XIMaskIsSet (states->mask, i))
+                   {
+                     struct xi_scroll_valuator_t *val;
+                     double delta, scroll_unit;
+                     int scroll_height;
+                     Lisp_Object window;
 
-                           if (delta == 0.0)
-                             any_stop_p = true;
 
-                           continue;
-                         }
+                     /* See the comment on top of
+                        x_init_master_valuators for more details on how
+                        scroll wheel movement is reported on XInput 2.  */
+                     delta = x_get_scroll_valuator_delta (dpyinfo, 
xev->deviceid,
+                                                          i, *values, &val);
+
+                     if (delta != DBL_MAX)
+                       {
+#ifdef HAVE_XWIDGETS
+                         if (xv)
+                           {
+                             /* FIXME: figure out what in GTK is
+                                causing interval values to jump by
+                                >100 at the end of a touch sequence
+                                when an xwidget gets a scroll event
+                                where is_stop is TRUE.  */
+                             if (fabs (delta) > 100)
+                               continue;
+                             if (val->horizontal)
+                               xv_total_x += delta;
+                             else
+                               xv_total_y += delta;
+
+                             found_valuator = true;
+                             continue;
+                           }
 #endif
-                       if (!f)
-                         {
-                           f = x_any_window_to_frame (dpyinfo, xev->event);
+                         if (!f)
+                           {
+                             f = x_any_window_to_frame (dpyinfo, xev->event);
 
-                           if (!f)
-                             goto XI_OTHER;
-                         }
+                             if (!f)
+                               goto XI_OTHER;
+                           }
 
-                       found_valuator = true;
+                         found_valuator = true;
 
-                       if (signbit (delta) != signbit (val->emacs_value))
-                         val->emacs_value = 0;
+                         if (signbit (delta) != signbit (val->emacs_value))
+                           val->emacs_value = 0;
 
-                       val->emacs_value += delta;
+                         val->emacs_value += delta;
 
-                       if (mwheel_coalesce_scroll_events
-                           && (fabs (val->emacs_value) < 1)
-                           && (fabs (delta) > 0))
-                         continue;
+                         if (mwheel_coalesce_scroll_events
+                             && (fabs (val->emacs_value) < 1)
+                             && (fabs (delta) > 0))
+                           continue;
 
-                       bool s = signbit (val->emacs_value);
-                       inev.ie.kind = (fabs (delta) > 0
-                                       ? (val->horizontal
-                                          ? HORIZ_WHEEL_EVENT
-                                          : WHEEL_EVENT)
-                                       : TOUCH_END_EVENT);
-                       inev.ie.timestamp = xev->time;
+                         bool s = signbit (val->emacs_value);
+                         inev.ie.kind = (fabs (delta) > 0
+                                         ? (val->horizontal
+                                            ? HORIZ_WHEEL_EVENT
+                                            : WHEEL_EVENT)
+                                         : TOUCH_END_EVENT);
+                         inev.ie.timestamp = xev->time;
 
-                       XSETINT (inev.ie.x, lrint (xev->event_x));
-                       XSETINT (inev.ie.y, lrint (xev->event_y));
-                       XSETFRAME (inev.ie.frame_or_window, f);
+                         XSETINT (inev.ie.x, lrint (xev->event_x));
+                         XSETINT (inev.ie.y, lrint (xev->event_y));
+                         XSETFRAME (inev.ie.frame_or_window, f);
 
-                       if (fabs (delta) > 0)
-                         {
-                           inev.ie.modifiers = !s ? up_modifier : 
down_modifier;
-                           inev.ie.modifiers
-                             |= x_x_to_emacs_modifiers (dpyinfo,
-                                                        xev->mods.effective);
-                         }
+                         if (fabs (delta) > 0)
+                           {
+                             inev.ie.modifiers = !s ? up_modifier : 
down_modifier;
+                             inev.ie.modifiers
+                               |= x_x_to_emacs_modifiers (dpyinfo,
+                                                          xev->mods.effective);
+                           }
 
-                       window = window_from_coordinates (f, xev->event_x,
-                                                         xev->event_y, NULL,
-                                                         false, false);
+                         window = window_from_coordinates (f, xev->event_x,
+                                                           xev->event_y, NULL,
+                                                           false, false);
 
-                       if (WINDOWP (window))
-                         scroll_height = XWINDOW (window)->pixel_height;
-                       else
-                         /* EVENT_X and EVENT_Y can be outside the
-                            frame if F holds the input grab, so fall
-                            back to the height of the frame instead.  */
-                         scroll_height = FRAME_PIXEL_HEIGHT (f);
+                         if (WINDOWP (window))
+                           scroll_height = XWINDOW (window)->pixel_height;
+                         else
+                           /* EVENT_X and EVENT_Y can be outside the
+                              frame if F holds the input grab, so fall
+                              back to the height of the frame instead.  */
+                           scroll_height = FRAME_PIXEL_HEIGHT (f);
 
-                       scroll_unit = pow (scroll_height, 2.0 / 3.0);
+                         scroll_unit = pow (scroll_height, 2.0 / 3.0);
 
-                       if (NUMBERP (Vx_scroll_event_delta_factor))
-                         scroll_unit *= XFLOATINT 
(Vx_scroll_event_delta_factor);
+                         if (NUMBERP (Vx_scroll_event_delta_factor))
+                           scroll_unit *= XFLOATINT 
(Vx_scroll_event_delta_factor);
 
-                       if (fabs (delta) > 0)
-                         {
-                           if (val->horizontal)
-                             {
-                               inev.ie.arg
-                                 = list3 (Qnil,
-                                          make_float (val->emacs_value
-                                                      * scroll_unit),
-                                          make_float (0));
-                             }
-                           else
-                             {
-                               inev.ie.arg = list3 (Qnil, make_float (0),
-                                                    make_float 
(val->emacs_value
-                                                                * 
scroll_unit));
-                             }
-                         }
-                       else
-                         {
-                           inev.ie.arg = Qnil;
-                         }
+                         if (fabs (delta) > 0)
+                           {
+                             if (val->horizontal)
+                               {
+                                 inev.ie.arg
+                                   = list3 (Qnil,
+                                            make_float (val->emacs_value
+                                                        * scroll_unit),
+                                            make_float (0));
+                               }
+                             else
+                               {
+                                 inev.ie.arg = list3 (Qnil, make_float (0),
+                                                      make_float 
(val->emacs_value
+                                                                  * 
scroll_unit));
+                               }
+                           }
+                         else
+                           {
+                             inev.ie.arg = Qnil;
+                           }
 
-                       kbd_buffer_store_event_hold (&inev.ie, hold_quit);
+                         kbd_buffer_store_event_hold (&inev.ie, hold_quit);
 
-                       val->emacs_value = 0;
-                     }
-                   values++;
-                 }
+                         val->emacs_value = 0;
+                       }
+                     values++;
+                   }
 
-               inev.ie.kind = NO_EVENT;
-             }
+                 inev.ie.kind = NO_EVENT;
+               }
 
 #ifdef HAVE_XWIDGETS
-           if (xv)
-             {
-               if (found_valuator)
-                 xwidget_scroll (xv, xev->event_x, xev->event_y,
-                                 xv_total_x, xv_total_y, xev->mods.effective,
-                                 xev->time, any_stop_p);
-               else
-                 xwidget_motion_notify (xv, xev->event_x, xev->event_y,
-                                        xev->mods.effective, xev->time);
+             if (xv)
+               {
+                 uint state = xev->mods.effective;
 
-               goto XI_OTHER;
-             }
+                 if (xev->buttons.mask_len)
+                   {
+                     if (XIMaskIsSet (xev->buttons.mask, 1))
+                       state |= Button1Mask;
+                     if (XIMaskIsSet (xev->buttons.mask, 2))
+                       state |= Button2Mask;
+                     if (XIMaskIsSet (xev->buttons.mask, 3))
+                       state |= Button3Mask;
+                   }
+
+                 if (found_valuator)
+                   xwidget_scroll (xv, xev->event_x, xev->event_y,
+                                   -xv_total_x, -xv_total_y, state,
+                                   xev->time, (xv_total_x == 0.0
+                                               && xv_total_y == 0.0));
+                 else
+                   xwidget_motion_notify (xv, xev->event_x, xev->event_y,
+                                          xev->root_x, xev->root_y, state,
+                                          xev->time);
+
+                 goto XI_OTHER;
+               }
 #endif
-           if (found_valuator)
-             goto XI_OTHER;
+             if (found_valuator)
+               {
+#ifdef USE_GTK
+                 if (f && xg_event_is_for_scrollbar (f, event))
+                   *finish = X_EVENT_DROP;
+#endif
+                 goto XI_OTHER;
+               }
 
-           ev.x = lrint (xev->event_x);
-           ev.y = lrint (xev->event_y);
-           ev.window = xev->event;
-           ev.time = xev->time;
+             ev.x = lrint (xev->event_x);
+             ev.y = lrint (xev->event_y);
+             ev.window = xev->event;
+             ev.time = xev->time;
 
-           previous_help_echo_string = help_echo_string;
-           help_echo_string = Qnil;
+             previous_help_echo_string = help_echo_string;
+             help_echo_string = Qnil;
 
-           if (hlinfo->mouse_face_hidden)
-             {
-               hlinfo->mouse_face_hidden = false;
-               clear_mouse_face (hlinfo);
-             }
+             if (hlinfo->mouse_face_hidden)
+               {
+                 hlinfo->mouse_face_hidden = false;
+                 clear_mouse_face (hlinfo);
+               }
 
-           f = mouse_or_wdesc_frame (dpyinfo, xev->event);
+             f = mouse_or_wdesc_frame (dpyinfo, xev->event);
 
 #ifdef USE_GTK
-           if (f && xg_event_is_for_scrollbar (f, event))
-             f = 0;
+             if (f && xg_event_is_for_scrollbar (f, event))
+               f = 0;
 #endif
-           if (f)
-             {
-               /* Maybe generate a SELECT_WINDOW_EVENT for
-                  `mouse-autoselect-window' but don't let popup menus
-                  interfere with this (Bug#1261).  */
-               if (!NILP (Vmouse_autoselect_window)
-                   && !popup_activated ()
-                   /* Don't switch if we're currently in the minibuffer.
-                      This tries to work around problems where the
-                      minibuffer gets unselected unexpectedly, and where
-                      you then have to move your mouse all the way down to
-                      the minibuffer to select it.  */
-                   && !MINI_WINDOW_P (XWINDOW (selected_window))
-                   /* With `focus-follows-mouse' non-nil create an event
-                      also when the target window is on another frame.  */
-                   && (f == XFRAME (selected_frame)
-                       || !NILP (focus_follows_mouse)))
-                 {
-                   static Lisp_Object last_mouse_window;
-                   Lisp_Object window = window_from_coordinates (f, ev.x, 
ev.y, 0, false, false);
-
-                   /* A window will be autoselected only when it is not
-                      selected now and the last mouse movement event was
-                      not in it.  The remainder of the code is a bit vague
-                      wrt what a "window" is.  For immediate autoselection,
-                      the window is usually the entire window but for GTK
-                      where the scroll bars don't count.  For delayed
-                      autoselection the window is usually the window's text
-                      area including the margins.  */
-                   if (WINDOWP (window)
-                       && !EQ (window, last_mouse_window)
-                       && !EQ (window, selected_window))
-                     {
-                       inev.ie.kind = SELECT_WINDOW_EVENT;
-                       inev.ie.frame_or_window = window;
-                     }
+             if (f)
+               {
+                 /* Maybe generate a SELECT_WINDOW_EVENT for
+                    `mouse-autoselect-window' but don't let popup menus
+                    interfere with this (Bug#1261).  */
+                 if (!NILP (Vmouse_autoselect_window)
+                     && !popup_activated ()
+                     /* Don't switch if we're currently in the minibuffer.
+                        This tries to work around problems where the
+                        minibuffer gets unselected unexpectedly, and where
+                        you then have to move your mouse all the way down to
+                        the minibuffer to select it.  */
+                     && !MINI_WINDOW_P (XWINDOW (selected_window))
+                     /* With `focus-follows-mouse' non-nil create an event
+                        also when the target window is on another frame.  */
+                     && (f == XFRAME (selected_frame)
+                         || !NILP (focus_follows_mouse)))
+                   {
+                     static Lisp_Object last_mouse_window;
+                     Lisp_Object window = window_from_coordinates (f, ev.x, 
ev.y, 0, false, false);
+
+                     /* A window will be autoselected only when it is not
+                        selected now and the last mouse movement event was
+                        not in it.  The remainder of the code is a bit vague
+                        wrt what a "window" is.  For immediate autoselection,
+                        the window is usually the entire window but for GTK
+                        where the scroll bars don't count.  For delayed
+                        autoselection the window is usually the window's text
+                        area including the margins.  */
+                     if (WINDOWP (window)
+                         && !EQ (window, last_mouse_window)
+                         && !EQ (window, selected_window))
+                       {
+                         inev.ie.kind = SELECT_WINDOW_EVENT;
+                         inev.ie.frame_or_window = window;
+                       }
 
-                   /* Remember the last window where we saw the mouse.  */
-                   last_mouse_window = window;
-                 }
+                     /* Remember the last window where we saw the mouse.  */
+                     last_mouse_window = window;
+                   }
 
-               if (!x_note_mouse_movement (f, &ev))
-                 help_echo_string = previous_help_echo_string;
-             }
-           else
-             {
+                 if (!x_note_mouse_movement (f, &ev))
+                   help_echo_string = previous_help_echo_string;
+               }
+             else
+               {
 #ifndef USE_TOOLKIT_SCROLL_BARS
-               struct scroll_bar *bar
-                 = x_window_to_scroll_bar (xi_event->display, xev->event, 2);
+                 struct scroll_bar *bar
+                   = x_window_to_scroll_bar (xi_event->display, xev->event, 2);
 
-               if (bar)
-                 x_scroll_bar_note_movement (bar, &ev);
+                 if (bar)
+                   x_scroll_bar_note_movement (bar, &ev);
 #endif /* USE_TOOLKIT_SCROLL_BARS */
 
-               /* If we move outside the frame, then we're
-                  certainly no longer on any text in the frame.  */
-               clear_mouse_face (hlinfo);
-             }
+                 /* If we move outside the frame, then we're
+                    certainly no longer on any text in the frame.  */
+                 clear_mouse_face (hlinfo);
+               }
 
-           /* If the contents of the global variable help_echo_string
-              has changed, generate a HELP_EVENT.  */
-           if (!NILP (help_echo_string)
-               || !NILP (previous_help_echo_string))
-             do_help = 1;
-           goto XI_OTHER;
+             /* If the contents of the global variable help_echo_string
+                has changed, generate a HELP_EVENT.  */
+             if (!NILP (help_echo_string)
+                 || !NILP (previous_help_echo_string))
+               do_help = 1;
+             goto XI_OTHER;
+           }
          case XI_ButtonRelease:
          case XI_ButtonPress:
            {
@@ -10222,19 +10436,48 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              bool tab_bar_p = false;
              bool tool_bar_p = false;
              struct xi_device_t *device;
+#ifdef HAVE_XWIDGETS
+             struct xwidget_view *xvw;
+#endif
 
 #ifdef XIPointerEmulated
              /* Ignore emulated scroll events when XI2 native
                 scroll events are present.  */
-             if (dpyinfo->xi2_version >= 1
-                 && xev->detail >= 4
-                 && xev->detail <= 8
+             if (((dpyinfo->xi2_version == 1
+                  && xev->detail >= 4
+                  && xev->detail <= 8)
+                  || (dpyinfo->xi2_version >= 2))
                  && xev->flags & XIPointerEmulated)
-               goto XI_OTHER;
+               {
+                 *finish = X_EVENT_DROP;
+                 goto XI_OTHER;
+               }
+#endif
+
+#ifdef HAVE_XWIDGETS
+             xvw = xwidget_view_from_window (xev->event);
+             if (xvw)
+               {
+                 xwidget_button (xvw, xev->evtype == XI_ButtonPress,
+                                 lrint (xev->event_x), lrint (xev->event_y),
+                                 xev->detail, xev->mods.effective, xev->time);
+
+                 if (!EQ (selected_window, xvw->w) && (xev->detail < 4))
+                   {
+                     inev.ie.kind = SELECT_WINDOW_EVENT;
+                     inev.ie.frame_or_window = xvw->w;
+                   }
+
+                 *finish = X_EVENT_DROP;
+                 goto XI_OTHER;
+               }
 #endif
 
              device = xi_device_from_id (dpyinfo, xev->deviceid);
 
+             if (!device || !device->master_p)
+               goto XI_OTHER;
+
              bv.button = xev->detail;
              bv.type = xev->evtype == XI_ButtonPress ? ButtonPress : 
ButtonRelease;
              bv.x = lrint (xev->event_x);
@@ -10360,8 +10603,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  device->grab &= ~(1 << xev->detail);
                }
 
-             xi_grab_or_ungrab_device (device, dpyinfo, xev->event);
-
              if (f)
                f->mouse_moved = false;
 
@@ -10401,6 +10642,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              int copy_bufsiz = sizeof (copy_buffer);
              ptrdiff_t i;
              int nchars, len;
+             struct xi_device_t *device;
+
+             device = xi_device_from_id (dpyinfo, xev->deviceid);
+
+             if (!device || !device->master_p)
+               goto XI_OTHER;
 
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
              /* Dispatch XI_KeyPress events when in menu.  */
@@ -10421,7 +10668,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              xkey.root = xev->root;
              xkey.subwindow = xev->child;
              xkey.time = xev->time;
-             xkey.state = xev->mods.effective;
+             xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
+                           | (xev->group.effective << 13));
              xkey.keycode = xev->detail;
              xkey.same_screen = True;
 
@@ -10435,8 +10683,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #ifdef HAVE_XKB
              if (dpyinfo->xkb_desc)
                {
+                 uint xkb_state = state;
+                 xkb_state &= ~(1 << 13 | 1 << 14);
+                 xkb_state |= xev->group.effective << 13;
+
                  if (!XkbTranslateKeyCode (dpyinfo->xkb_desc, keycode,
-                                           state, &mods_rtrn, &keysym))
+                                           xkb_state, &mods_rtrn, &keysym))
                    goto XI_OTHER;
                }
              else
@@ -10758,6 +11010,220 @@ handle_one_xevent (struct x_display_info *dpyinfo,
          case XI_DeviceChanged:
            x_init_master_valuators (dpyinfo);
            goto XI_OTHER;
+#ifdef XI_TouchBegin
+         case XI_TouchBegin:
+           {
+             struct xi_device_t *device;
+             bool menu_bar_p = false, tool_bar_p = false;
+#ifdef HAVE_GTK3
+             GdkRectangle test_rect;
+#endif
+             device = xi_device_from_id (dpyinfo, xev->deviceid);
+             x_display_set_last_user_time (dpyinfo, xev->time);
+
+             if (!device)
+               goto XI_OTHER;
+
+             if (xi_find_touch_point (device, xev->detail))
+               emacs_abort ();
+
+             f = x_any_window_to_frame (dpyinfo, xev->event);
+
+#ifdef HAVE_GTK3
+             menu_bar_p = (f && FRAME_X_OUTPUT (f)->menubar_widget
+                           && xg_event_is_for_menubar (f, event));
+             if (f && FRAME_X_OUTPUT (f)->toolbar_widget)
+               {
+                 test_rect.x = xev->event_x;
+                 test_rect.y = xev->event_y;
+                 test_rect.width = 1;
+                 test_rect.height = 1;
+
+                 tool_bar_p = gtk_widget_intersect (FRAME_X_OUTPUT 
(f)->toolbar_widget,
+                                                    &test_rect, NULL);
+               }
+#endif
+
+             if (!menu_bar_p && !tool_bar_p)
+               {
+                 if (f && device->direct_p)
+                   {
+                     *finish = X_EVENT_DROP;
+                     x_catch_errors (dpyinfo->display);
+                     XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
+                                         xev->detail, xev->event, 
XIAcceptTouch);
+                     if (!x_had_errors_p (dpyinfo->display))
+                       {
+                         xi_link_touch_point (device, xev->detail, 
xev->event_x,
+                                              xev->event_y);
+
+                         inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT;
+                         inev.ie.timestamp = xev->time;
+                         XSETFRAME (inev.ie.frame_or_window, f);
+                         XSETINT (inev.ie.x, lrint (xev->event_x));
+                         XSETINT (inev.ie.y, lrint (xev->event_y));
+                         XSETINT (inev.ie.arg, xev->detail);
+                       }
+                     x_uncatch_errors_after_check ();
+                   }
+#ifndef HAVE_GTK3
+                 else
+                   {
+                     x_catch_errors (dpyinfo->display);
+                     XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
+                                         xev->detail, xev->event, 
XIRejectTouch);
+                     x_uncatch_errors ();
+                   }
+#endif
+               }
+             else
+               {
+#ifdef HAVE_GTK3
+                 bool was_waiting_for_input = waiting_for_input;
+                 /* This hack was adopted from the NS port.  Whether
+                    or not it is actually safe is a different story
+                    altogether.  */
+                 if (waiting_for_input)
+                   waiting_for_input = 0;
+                 set_frame_menubar (f, true);
+                 waiting_for_input = was_waiting_for_input;
+#endif
+               }
+
+             goto XI_OTHER;
+           }
+         case XI_TouchUpdate:
+           {
+             struct xi_device_t *device;
+             struct xi_touch_point_t *touchpoint;
+             Lisp_Object arg = Qnil;
+
+             device = xi_device_from_id (dpyinfo, xev->deviceid);
+             x_display_set_last_user_time (dpyinfo, xev->time);
+
+             if (!device)
+               goto XI_OTHER;
+
+             touchpoint = xi_find_touch_point (device, xev->detail);
+
+             if (!touchpoint)
+               goto XI_OTHER;
+
+             touchpoint->x = xev->event_x;
+             touchpoint->y = xev->event_y;
+
+             f = x_any_window_to_frame (dpyinfo, xev->event);
+
+             if (f && device->direct_p)
+               {
+                 inev.ie.kind = TOUCHSCREEN_UPDATE_EVENT;
+                 inev.ie.timestamp = xev->time;
+                 XSETFRAME (inev.ie.frame_or_window, f);
+
+                 for (touchpoint = device->touchpoints;
+                      touchpoint; touchpoint = touchpoint->next)
+                   {
+                     arg = Fcons (list3i (lrint (touchpoint->x),
+                                          lrint (touchpoint->y),
+                                          lrint (touchpoint->number)),
+                                  arg);
+                   }
+
+                 inev.ie.arg = arg;
+               }
+
+             goto XI_OTHER;
+           }
+         case XI_TouchEnd:
+           {
+             struct xi_device_t *device;
+             bool unlinked_p;
+
+             device = xi_device_from_id (dpyinfo, xev->deviceid);
+             x_display_set_last_user_time (dpyinfo, xev->time);
+
+             if (!device)
+               goto XI_OTHER;
+
+             unlinked_p = xi_unlink_touch_point (xev->detail, device);
+
+             if (unlinked_p)
+               {
+                 f = x_any_window_to_frame (dpyinfo, xev->event);
+
+                 if (f && device->direct_p)
+                   {
+                     inev.ie.kind = TOUCHSCREEN_END_EVENT;
+                     inev.ie.timestamp = xev->time;
+                     XSETFRAME (inev.ie.frame_or_window, f);
+                     XSETINT (inev.ie.x, lrint (xev->event_x));
+                     XSETINT (inev.ie.y, lrint (xev->event_y));
+                     XSETINT (inev.ie.arg, xev->detail);
+                   }
+               }
+
+             goto XI_OTHER;
+           }
+#endif
+#ifdef XI_GesturePinchBegin
+         case XI_GesturePinchBegin:
+         case XI_GesturePinchUpdate:
+           {
+             x_display_set_last_user_time (dpyinfo, xi_event->time);
+
+#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+             XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event;
+             struct xi_device_t *device = xi_device_from_id (dpyinfo, 
pev->deviceid);
+
+             if (!device || !device->master_p)
+               goto XI_OTHER;
+
+#ifdef HAVE_XWIDGETS
+             struct xwidget_view *xvw = xwidget_view_from_window (pev->event);
+
+             if (xvw)
+               {
+                 *finish = X_EVENT_DROP;
+                 xwidget_pinch (xvw, pev);
+                 goto XI_OTHER;
+               }
+#endif
+
+             any = x_any_window_to_frame (dpyinfo, pev->event);
+             if (any)
+               {
+                 inev.ie.kind = PINCH_EVENT;
+                 inev.ie.modifiers = x_x_to_emacs_modifiers 
(FRAME_DISPLAY_INFO (any),
+                                                             
pev->mods.effective);
+                 XSETINT (inev.ie.x, lrint (pev->event_x));
+                 XSETINT (inev.ie.y, lrint (pev->event_y));
+                 XSETFRAME (inev.ie.frame_or_window, any);
+                 inev.ie.arg = list4 (make_float (pev->delta_x),
+                                      make_float (pev->delta_y),
+                                      make_float (pev->scale),
+                                      make_float (pev->delta_angle));
+               }
+#endif
+             /* Once again GTK seems to crash when confronted by
+                events it doesn't understand.  */
+             *finish = X_EVENT_DROP;
+             goto XI_OTHER;
+           }
+         case XI_GesturePinchEnd:
+           {
+             x_display_set_last_user_time (dpyinfo, xi_event->time);
+
+#if defined HAVE_XWIDGETS && HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+             XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event;
+             struct xwidget_view *xvw = xwidget_view_from_window (pev->event);
+
+             if (xvw)
+               xwidget_pinch (xvw, pev);
+#endif
+             *finish = X_EVENT_DROP;
+             goto XI_OTHER;
+           }
+#endif
          default:
            goto XI_OTHER;
          }
@@ -10777,6 +11243,31 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif
 
     default:
+#ifdef HAVE_XKB
+      if (event->type == dpyinfo->xkb_event_type)
+       {
+         XkbEvent *xkbevent = (XkbEvent *) event;
+
+         if (xkbevent->any.xkb_type == XkbNewKeyboardNotify
+             || xkbevent->any.xkb_type == XkbMapNotify)
+           {
+             if (dpyinfo->xkb_desc)
+               {
+                 XkbGetUpdatedMap (dpyinfo->display,
+                                   (XkbKeySymsMask
+                                    | XkbKeyTypesMask
+                                    | XkbModifierMapMask
+                                    | XkbVirtualModsMask),
+                                   dpyinfo->xkb_desc);
+                 XkbGetNames (dpyinfo->display,
+                              XkbGroupNamesMask | XkbVirtualModNamesMask,
+                              dpyinfo->xkb_desc);
+
+                 x_find_modifier_meanings (dpyinfo);
+               }
+           }
+       }
+#endif
     OTHER:
 #ifdef USE_X_TOOLKIT
       block_input ();
@@ -12950,9 +13441,26 @@ void
 frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
 {
   block_input ();
+#ifdef HAVE_XINPUT2
+  int deviceid;
 
-  XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
-               0, 0, 0, 0, pix_x, pix_y);
+  if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+    {
+      XGrabServer (FRAME_X_DISPLAY (f));
+      if (XIGetClientPointer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+                             &deviceid))
+       {
+         XIWarpPointer (FRAME_X_DISPLAY (f),
+                        deviceid, None,
+                        FRAME_X_WINDOW (f),
+                        0, 0, 0, 0, pix_x, pix_y);
+       }
+      XUngrabServer (FRAME_X_DISPLAY (f));
+    }
+  else
+#endif
+    XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
+                 0, 0, 0, 0, pix_x, pix_y);
   unblock_input ();
 }
 
@@ -14381,8 +14889,10 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
 
   dpyinfo->x_id = ++x_display_id;
 
+#ifndef HAVE_XKB
   /* Figure out which modifier bits mean what.  */
   x_find_modifier_meanings (dpyinfo);
+#endif
 
   /* Get the scroll bar cursor.  */
 #ifdef USE_GTK
@@ -14460,7 +14970,9 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
   dpyinfo->supports_xi2 = false;
   int rc;
   int major = 2;
-#ifdef XI_BarrierHit /* XInput 2.3 */
+#ifdef XI_GesturePinchBegin /* XInput 2.4 */
+  int minor = 4;
+#elif XI_BarrierHit /* XInput 2.3 */
   int minor = 3;
 #elif defined XI_TouchBegin /* XInput 2.2 */
   int minor = 2;
@@ -14484,10 +14996,47 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
   dpyinfo->xi2_version = minor;
 #endif
 
+#ifdef HAVE_XRANDR
+  int xrr_event_base, xrr_error_base;
+  bool xrr_ok = false;
+  xrr_ok = XRRQueryExtension (dpy, &xrr_event_base, &xrr_error_base);
+  if (xrr_ok)
+    {
+      XRRQueryVersion (dpy, &dpyinfo->xrandr_major_version,
+                      &dpyinfo->xrandr_minor_version);
+    }
+#endif
+
 #ifdef HAVE_XKB
-  dpyinfo->xkb_desc = XkbGetMap (dpyinfo->display,
-                                XkbAllComponentsMask,
-                                XkbUseCoreKbd);
+  int xkb_major, xkb_minor, xkb_op, xkb_error_code;
+  xkb_major = XkbMajorVersion;
+  xkb_minor = XkbMinorVersion;
+
+  if (XkbLibraryVersion (&xkb_major, &xkb_minor)
+      && XkbQueryExtension (dpyinfo->display, &xkb_op, 
&dpyinfo->xkb_event_type,
+                           &xkb_error_code, &xkb_major, &xkb_minor))
+    {
+      dpyinfo->supports_xkb = true;
+      dpyinfo->xkb_desc = XkbGetMap (dpyinfo->display,
+                                    (XkbKeySymsMask
+                                     | XkbKeyTypesMask
+                                     | XkbModifierMapMask
+                                     | XkbVirtualModsMask),
+                                    XkbUseCoreKbd);
+
+      if (dpyinfo->xkb_desc)
+       XkbGetNames (dpyinfo->display,
+                    XkbGroupNamesMask | XkbVirtualModNamesMask,
+                    dpyinfo->xkb_desc);
+
+      XkbSelectEvents (dpyinfo->display,
+                      XkbUseCoreKbd,
+                      XkbNewKeyboardNotifyMask | XkbMapNotifyMask,
+                      XkbNewKeyboardNotifyMask | XkbMapNotifyMask);
+    }
+
+  /* Figure out which modifier bits mean what.  */
+  x_find_modifier_meanings (dpyinfo);
 #endif
 
 #if defined USE_CAIRO || defined HAVE_XFT
diff --git a/src/xterm.h b/src/xterm.h
index 7abe168bc6..d4600bdf80 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication with X protocol.
-   Copyright (C) 1989, 1993-1994, 1998-2021 Free Software Foundation,
+   Copyright (C) 1989, 1993-1994, 1998-2022 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -179,13 +179,24 @@ struct xi_scroll_valuator_t
   int horizontal;
 };
 
+struct xi_touch_point_t
+{
+  struct xi_touch_point_t *next;
+
+  int number;
+  double x, y;
+};
+
 struct xi_device_t
 {
   int device_id;
   int scroll_valuator_count;
   int grab;
+  bool master_p;
+  bool direct_p;
 
   struct xi_scroll_valuator_t *valuators;
+  struct xi_touch_point_t *touchpoints;
 };
 #endif
 
@@ -315,10 +326,10 @@ struct x_display_info
      use; XK_Caps_Lock should only affect alphabetic keys.  With this
      arrangement, the lock modifier should shift the character if
      (EVENT.state & shift_lock_mask) != 0.  */
-  int meta_mod_mask, shift_lock_mask;
+  unsigned int meta_mod_mask, shift_lock_mask;
 
   /* These are like meta_mod_mask, but for different modifiers.  */
-  int alt_mod_mask, super_mod_mask, hyper_mod_mask;
+  unsigned alt_mod_mask, super_mod_mask, hyper_mod_mask;
 
   /* Communication with window managers.  */
   Atom Xatom_wm_protocols;
@@ -511,6 +522,8 @@ struct x_display_info
 #endif
 
 #ifdef HAVE_XKB
+  bool supports_xkb;
+  int xkb_event_type;
   XkbDescPtr xkb_desc;
 #endif
 };
@@ -1229,6 +1242,10 @@ extern void x_change_tool_bar_height (struct frame *, 
int);
 extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
 extern void x_set_scroll_bar_default_width (struct frame *);
 extern void x_set_scroll_bar_default_height (struct frame *);
+#ifdef USE_LUCID
+extern void xlw_monitor_dimensions_at_pos (Display *, Screen *, int, int,
+                                          int *, int *, int *, int *);
+#endif
 
 /* Defined in xselect.c.  */
 
diff --git a/src/xwidget.c b/src/xwidget.c
index d8510ef928..7d6d256a19 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1,6 +1,6 @@
 /* Support for embedding graphical components in a buffer.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -39,7 +39,11 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <webkit2/webkit2.h>
 #include <JavaScriptCore/JavaScript.h>
 #include <cairo.h>
+#ifndef HAVE_PGTK
 #include <X11/Xlib.h>
+#else
+#include <gtk/gtk.h>
+#endif
 #ifdef HAVE_XINPUT2
 #include <X11/extensions/XInput2.h>
 #endif
@@ -55,7 +59,9 @@ static Lisp_Object internal_xwidget_list;
 static uint32_t xwidget_counter = 0;
 
 #ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
 static Lisp_Object x_window_to_xwv_map;
+#endif
 static gboolean offscreen_damage_event (GtkWidget *, GdkEvent *, gpointer);
 static void synthesize_focus_in_event (GtkWidget *);
 static GdkDevice *find_suitable_keyboard (struct frame *);
@@ -119,6 +125,134 @@ static void mouse_target_changed (WebKitWebView *, 
WebKitHitTestResult *, guint,
                                  gpointer);
 #endif
 
+#ifdef HAVE_PGTK
+static int
+xw_forward_event_translate (GdkEvent *event, struct xwidget_view *xv,
+                           struct xwidget *xw)
+{
+  GtkWidget *widget;
+  int new_x, new_y;
+
+  switch (event->type)
+    {
+    case GDK_BUTTON_PRESS:
+    case GDK_BUTTON_RELEASE:
+    case GDK_2BUTTON_PRESS:
+    case GDK_3BUTTON_PRESS:
+      widget = find_widget_at_pos (xw->widgetwindow_osr,
+                                  lrint (event->button.x - xv->clip_left),
+                                  lrint (event->button.y - xv->clip_top),
+                                  &new_x, &new_y);
+      if (widget)
+       {
+         event->any.window = gtk_widget_get_window (widget);
+         event->button.x = new_x;
+         event->button.y = new_y;
+         return 1;
+       }
+      return 0;
+    case GDK_SCROLL:
+      widget = find_widget_at_pos (xw->widgetwindow_osr,
+                                  lrint (event->scroll.x - xv->clip_left),
+                                  lrint (event->scroll.y - xv->clip_top),
+                                  &new_x, &new_y);
+      if (widget)
+       {
+         event->any.window = gtk_widget_get_window (widget);
+         event->scroll.x = new_x;
+         event->scroll.y = new_y;
+         return 1;
+       }
+      return 0;
+    case GDK_MOTION_NOTIFY:
+      widget = find_widget_at_pos (xw->widgetwindow_osr,
+                                  lrint (event->motion.x - xv->clip_left),
+                                  lrint (event->motion.y - xv->clip_top),
+                                  &new_x, &new_y);
+      if (widget)
+       {
+         event->any.window = gtk_widget_get_window (widget);
+         event->motion.x = new_x;
+         event->motion.y = new_y;
+         return 1;
+       }
+      return 0;
+    case GDK_ENTER_NOTIFY:
+    case GDK_LEAVE_NOTIFY:
+      widget = find_widget_at_pos (xw->widgetwindow_osr,
+                                  lrint (event->crossing.x - xv->clip_left),
+                                  lrint (event->crossing.y - xv->clip_top),
+                                  &new_x, &new_y);
+      if (widget)
+       {
+         event->any.window = gtk_widget_get_window (widget);
+         event->crossing.x = new_x;
+         event->crossing.y = new_y;
+         return 1;
+       }
+      return 0;
+    default:
+      return 0;
+    }
+}
+
+static gboolean
+xw_forward_event_from_view (GtkWidget *widget, GdkEvent *event,
+                           gpointer user_data)
+{
+  struct xwidget_view *xv = user_data;
+  struct xwidget *xw = XXWIDGET (xv->model);
+  GdkEvent *eventcopy;
+  bool translated_p;
+
+  if (NILP (xw->buffer))
+    return TRUE;
+
+  eventcopy = gdk_event_copy (event);
+  translated_p = xw_forward_event_translate (eventcopy, xv, xw);
+  record_osr_embedder (xv);
+
+  g_object_ref (eventcopy->any.window);
+  if (translated_p)
+    gtk_main_do_event (eventcopy);
+  gdk_event_free (eventcopy);
+
+  /* Don't propagate this event further.  */
+  return TRUE;
+}
+#endif
+
+#ifdef HAVE_X_WINDOWS
+static guint
+xw_translate_x_modifiers (struct x_display_info *dpyinfo,
+                         unsigned int modifiers)
+{
+  guint mods = 0;
+
+  if (modifiers & dpyinfo->meta_mod_mask)
+    {
+      /* GDK always assumes Mod1 is alt, but that's no reason for
+        us to make that mistake as well.  */
+      if (!dpyinfo->alt_mod_mask)
+       mods |= GDK_MOD1_MASK;
+      else
+       mods |= GDK_META_MASK;
+    }
+
+  if (modifiers & dpyinfo->alt_mod_mask)
+    mods |= GDK_MOD1_MASK;
+  if (modifiers & dpyinfo->super_mod_mask)
+    mods |= GDK_SUPER_MASK;
+  if (modifiers & dpyinfo->hyper_mod_mask)
+    mods |= GDK_HYPER_MASK;
+  if (modifiers & ControlMask)
+    mods |= GDK_CONTROL_MASK;
+  if (modifiers & ShiftMask)
+    mods |= GDK_SHIFT_MASK;
+
+  return mods;
+}
+#endif
 
 DEFUN ("make-xwidget",
        Fmake_xwidget, Smake_xwidget,
@@ -149,6 +283,8 @@ fails.  */)
   if (!EQ (type, Qwebkit))
     error ("Bad xwidget type");
 
+  Frequire (Qxwidget, Qnil, Qnil);
+
   struct xwidget *xw = allocate_xwidget ();
   Lisp_Object val;
   xw->type = type;
@@ -185,6 +321,7 @@ fails.  */)
       xw->widgetwindow_osr = gtk_offscreen_window_new ();
       gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width,
                          xw->height);
+      gtk_container_check_resize (GTK_CONTAINER (xw->widgetwindow_osr));
 
       if (EQ (xw->type, Qwebkit))
         {
@@ -222,6 +359,7 @@ fails.  */)
 
       gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width,
                                    xw->height);
+      gtk_widget_queue_allocate (GTK_WIDGET (xw->widget_osr));
 
       if (EQ (xw->type, Qwebkit))
         {
@@ -236,7 +374,7 @@ fails.  */)
 
       gtk_widget_show (xw->widget_osr);
       gtk_widget_show (xw->widgetwindow_osr);
-#ifndef HAVE_XINPUT2
+#if !defined HAVE_XINPUT2 && !defined HAVE_PGTK
       synthesize_focus_in_event (xw->widgetwindow_osr);
 #endif
 
@@ -346,7 +484,7 @@ selected frame is not an X-Windows frame.  */)
 
   if (!NILP (frame))
     f = decode_window_system_frame (frame);
-  else if (FRAME_X_P (SELECTED_FRAME ()))
+  else if (FRAME_WINDOW_P (SELECTED_FRAME ()))
     f = SELECTED_FRAME ();
 
 #ifdef USE_GTK
@@ -355,10 +493,12 @@ selected frame is not an X-Windows frame.  */)
   if (!f)
     return Qnil;
 
+  block_input ();
   osw = gtk_widget_get_window (xw->widgetwindow_osr);
   embedder = gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (f));
 
   gdk_offscreen_window_set_embedder (osw, embedder);
+  unblock_input ();
 #endif
   widget = gtk_window_get_focus (GTK_WINDOW (xw->widgetwindow_osr));
 
@@ -383,10 +523,17 @@ selected frame is not an X-Windows frame.  */)
       if (character < 32)
        character += '_';
 
+#ifndef HAVE_PGTK
       if (f)
        modifiers = x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f), modifiers);
       else
        modifiers = 0;
+#else
+      if (f)
+       modifiers = pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f), 
modifiers);
+      else
+       modifiers = 0;
+#endif
     }
   else if (SYMBOLP (event))
     {
@@ -408,18 +555,36 @@ selected frame is not an X-Windows frame.  */)
          ++off;
        }
 
+#ifndef HAVE_PGTK
       if (f)
        modifiers = x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f),
                                            XFIXNUM (XCAR (XCDR (decoded))));
       else
        modifiers = 0;
+#else
+      if (f)
+       modifiers = pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
+                                                XFIXNUM (XCAR (XCDR 
(decoded))));
+      else
+       modifiers = 0;
+#endif
 
       if (found)
        keycode = off + 0xff00;
     }
 
   if (character == -1 && keycode == -1)
-    return Qnil;
+    {
+#ifdef HAVE_XINPUT2
+      block_input ();
+      if (xw->embedder_view)
+       record_osr_embedder (xw->embedder_view);
+      else
+       gdk_offscreen_window_set_embedder (osw, NULL);
+      unblock_input ();
+#endif
+      return Qnil;
+    }
 
   block_input ();
   xg_event = gdk_event_new (GDK_KEY_PRESS);
@@ -430,7 +595,13 @@ selected frame is not an X-Windows frame.  */)
     keycode = gdk_unicode_to_keyval (character);
 
   xg_event->key.keyval = keycode;
+#ifndef HAVE_X_WINDOWS
   xg_event->key.state = modifiers;
+#else
+  if (f)
+    xg_event->key.state = xw_translate_x_modifiers (FRAME_DISPLAY_INFO (f),
+                                                   modifiers);
+#endif
 
   if (keycode > -1)
     {
@@ -463,6 +634,13 @@ selected frame is not an X-Windows frame.  */)
   xg_event->type = GDK_KEY_RELEASE;
   gtk_main_do_event (xg_event);
   gdk_event_free (xg_event);
+
+#ifdef HAVE_XINPUT2
+  if (xw->embedder_view)
+    record_osr_embedder (xw->embedder_view);
+  else
+    gdk_offscreen_window_set_embedder (osw, NULL);
+#endif
   unblock_input ();
 #endif
 
@@ -547,8 +725,11 @@ record_osr_embedder (struct xwidget_view *view)
 
   xw = XXWIDGET (view->model);
   window = gtk_widget_get_window (xw->widgetwindow_osr);
+#ifndef HAVE_PGTK
   embedder = gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (view->frame));
-
+#else
+  embedder = gtk_widget_get_window (view->widget);
+#endif
   gdk_offscreen_window_set_embedder (window, embedder);
   xw->embedder = view->frame;
   xw->embedder_view = view;
@@ -583,6 +764,7 @@ from_embedder (GdkWindow *window, double x, double y,
 {
   double *xout = x_out_ptr;
   double *yout = y_out_ptr;
+#ifndef HAVE_PGTK
   struct xwidget *xw = find_xwidget_for_offscreen_window (window);
   struct xwidget_view *xvw;
   gint xoff, yoff;
@@ -606,6 +788,10 @@ from_embedder (GdkWindow *window, double x, double y,
       *xout = x - xvw->x - xoff;
       *yout = y - xvw->y - yoff;
     }
+#else
+  *xout = x;
+  *yout = y;
+#endif
 }
 
 static void
@@ -615,6 +801,7 @@ to_embedder (GdkWindow *window, double x, double y,
 {
   double *xout = x_out_ptr;
   double *yout = y_out_ptr;
+#ifndef HAVE_PGTK
   struct xwidget *xw = find_xwidget_for_offscreen_window (window);
   struct xwidget_view *xvw;
   gint xoff, yoff;
@@ -638,6 +825,10 @@ to_embedder (GdkWindow *window, double x, double y,
       *xout = x + xvw->x + xoff;
       *yout = y + xvw->y + yoff;
     }
+#else
+  *xout = x;
+  *yout = y;
+#endif
 }
 
 static GdkDevice *
@@ -810,6 +1001,9 @@ static void
 define_cursors (struct xwidget *xw, WebKitHitTestResult *res)
 {
   struct xwidget_view *xvw;
+#ifdef HAVE_PGTK
+  GdkWindow *wdesc;
+#endif
 
   xw->hit_result = webkit_hit_test_result_get_context (res);
 
@@ -823,8 +1017,16 @@ define_cursors (struct xwidget *xw, WebKitHitTestResult 
*res)
          if (XXWIDGET (xvw->model) == xw)
            {
              xvw->cursor = cursor_for_hit (xw->hit_result, xvw->frame);
+#ifdef HAVE_X_WINDOWS
              if (xvw->wdesc != None)
                XDefineCursor (xvw->dpy, xvw->wdesc, xvw->cursor);
+#else
+             if (gtk_widget_get_realized (xvw->widget))
+               {
+                 wdesc = gtk_widget_get_window (xvw->widget);
+                 gdk_window_set_cursor (wdesc, xvw->cursor);
+               }
+#endif
            }
        }
     }
@@ -898,6 +1100,7 @@ run_file_chooser_cb (WebKitWebView *webview,
   return TRUE;
 }
 
+#ifdef HAVE_X_WINDOWS
 
 static void
 xwidget_button_1 (struct xwidget_view *view,
@@ -907,12 +1110,6 @@ xwidget_button_1 (struct xwidget_view *view,
   GdkEvent *xg_event = gdk_event_new (down_p ? GDK_BUTTON_PRESS : 
GDK_BUTTON_RELEASE);
   struct xwidget *model = XXWIDGET (view->model);
   GtkWidget *target;
-#ifdef HAVE_XINPUT2
-  struct x_display_info *dpyinfo;
-  struct xi_device_t *xi_device;
-  GdkSeat *seat;
-  GdkDevice *device;
-#endif
 
   /* X and Y should be relative to the origin of view->wdesc.  */
   x += view->clip_left;
@@ -936,24 +1133,6 @@ xwidget_button_1 (struct xwidget_view *view,
   xg_event->button.time = time;
   xg_event->button.device = find_suitable_pointer (view->frame);
 
-#ifdef HAVE_XINPUT2
-  dpyinfo = FRAME_DISPLAY_INFO (view->frame);
-  device = xg_event->button.device;
-
-  for (int idx = 0; idx < dpyinfo->num_devices; ++idx)
-    {
-      xi_device = &dpyinfo->devices[idx];
-
-      XIUngrabDevice (view->dpy, xi_device->device_id, CurrentTime);
-    }
-
-  if (device)
-    {
-      seat = gdk_device_get_seat (device);
-      gdk_seat_ungrab (seat);
-    }
-#endif
-
   gtk_main_do_event (xg_event);
   gdk_event_free (xg_event);
 }
@@ -1021,7 +1200,9 @@ xwidget_button (struct xwidget_view *view,
 #ifdef HAVE_XINPUT2
 void
 xwidget_motion_notify (struct xwidget_view *view,
-                      double x, double y, uint state, Time time)
+                      double x, double y,
+                      double root_x, double root_y,
+                      uint state, Time time)
 {
   GdkEvent *xg_event;
   GtkWidget *target;
@@ -1034,7 +1215,8 @@ xwidget_motion_notify (struct xwidget_view *view,
   record_osr_embedder (view);
 
   target = find_widget_at_pos (model->widgetwindow_osr,
-                              lrint (x), lrint (y),
+                              lrint (x + view->clip_left),
+                              lrint (y + view->clip_top),
                               &target_x, &target_y);
 
   if (!target)
@@ -1048,8 +1230,8 @@ xwidget_motion_notify (struct xwidget_view *view,
   xg_event->any.window = gtk_widget_get_window (target);
   xg_event->motion.x = target_x;
   xg_event->motion.y = target_y;
-  xg_event->motion.x_root = lrint (x);
-  xg_event->motion.y_root = lrint (y);
+  xg_event->motion.x_root = root_x;
+  xg_event->motion.y_root = root_y;
   xg_event->motion.time = time;
   xg_event->motion.state = state;
   xg_event->motion.device = find_suitable_pointer (view->frame);
@@ -1076,7 +1258,8 @@ xwidget_scroll (struct xwidget_view *view, double x, 
double y,
   record_osr_embedder (view);
 
   target = find_widget_at_pos (model->widgetwindow_osr,
-                              lrint (x), lrint (y),
+                              lrint (x + view->clip_left),
+                              lrint (y + view->clip_top),
                               &target_x, &target_y);
 
   if (!target)
@@ -1105,6 +1288,92 @@ xwidget_scroll (struct xwidget_view *view, double x, 
double y,
   gtk_main_do_event (xg_event);
   gdk_event_free (xg_event);
 }
+
+#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+void
+xwidget_pinch (struct xwidget_view *view, XIGesturePinchEvent *xev)
+{
+#if GTK_CHECK_VERSION (3, 18, 0)
+  GdkEvent *xg_event;
+  GtkWidget *target;
+  struct xwidget *model = XXWIDGET (view->model);
+  int target_x, target_y;
+  double x = xev->event_x;
+  double y = xev->event_y;
+
+  if (NILP (model->buffer))
+    return;
+
+  record_osr_embedder (view);
+
+  target = find_widget_at_pos (model->widgetwindow_osr,
+                              lrint (x + view->clip_left),
+                              lrint (y + view->clip_top),
+                              &target_x, &target_y);
+
+  if (!target)
+    {
+      target_x = lrint (x);
+      target_y = lrint (y);
+      target = model->widget_osr;
+    }
+
+  xg_event = gdk_event_new (GDK_TOUCHPAD_PINCH);
+  xg_event->any.window = gtk_widget_get_window (target);
+  xg_event->touchpad_pinch.x = target_x;
+  xg_event->touchpad_pinch.y = target_y;
+  xg_event->touchpad_pinch.dx = xev->delta_x;
+  xg_event->touchpad_pinch.dy = xev->delta_y;
+  xg_event->touchpad_pinch.angle_delta = xev->delta_angle;
+  xg_event->touchpad_pinch.scale = xev->scale;
+  xg_event->touchpad_pinch.x_root = xev->root_x;
+  xg_event->touchpad_pinch.y_root = xev->root_y;
+  xg_event->touchpad_pinch.state = xev->mods.effective;
+  xg_event->touchpad_pinch.n_fingers = 2;
+
+  switch (xev->evtype)
+    {
+    case XI_GesturePinchBegin:
+      xg_event->touchpad_pinch.phase = GDK_TOUCHPAD_GESTURE_PHASE_BEGIN;
+      break;
+    case XI_GesturePinchUpdate:
+      xg_event->touchpad_pinch.phase = GDK_TOUCHPAD_GESTURE_PHASE_UPDATE;
+      break;
+    case XI_GesturePinchEnd:
+      xg_event->touchpad_pinch.phase = GDK_TOUCHPAD_GESTURE_PHASE_END;
+      break;
+    }
+
+  gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+
+  g_object_ref (xg_event->any.window);
+  gtk_main_do_event (xg_event);
+  gdk_event_free (xg_event);
+#endif
+}
+#endif
+#endif
+
+#ifdef HAVE_XINPUT2
+static GdkNotifyType
+xi_translate_notify_detail (int detail)
+{
+  switch (detail)
+    {
+    case XINotifyInferior:
+      return GDK_NOTIFY_INFERIOR;
+    case XINotifyAncestor:
+      return GDK_NOTIFY_ANCESTOR;
+    case XINotifyVirtual:
+      return GDK_NOTIFY_VIRTUAL;
+    case XINotifyNonlinear:
+      return GDK_NOTIFY_NONLINEAR;
+    case XINotifyNonlinearVirtual:
+      return GDK_NOTIFY_NONLINEAR_VIRTUAL;
+    default:
+      emacs_abort ();
+    }
+}
 #endif
 
 void
@@ -1115,24 +1384,47 @@ xwidget_motion_or_crossing (struct xwidget_view *view, 
const XEvent *event)
   int x;
   int y;
   GtkWidget *target;
+#ifdef HAVE_XINPUT2
+  XIEnterEvent *xev = NULL;
+#endif
 
   if (NILP (model->buffer))
     return;
 
-  xg_event = gdk_event_new (event->type == MotionNotify
-                           ? GDK_MOTION_NOTIFY
-                           : (event->type == LeaveNotify
-                              ? GDK_LEAVE_NOTIFY
-                              : GDK_ENTER_NOTIFY));
+#ifdef HAVE_XINPUT2
+  if (event->type != GenericEvent)
+#endif
+    {
+      xg_event = gdk_event_new (event->type == MotionNotify
+                               ? GDK_MOTION_NOTIFY
+                               : (event->type == LeaveNotify
+                                  ? GDK_LEAVE_NOTIFY
+                                  : GDK_ENTER_NOTIFY));
+      target = find_widget_at_pos (model->widgetwindow_osr,
+                                  (event->type == MotionNotify
+                                   ? event->xmotion.x + view->clip_left
+                                   : event->xcrossing.x + view->clip_left),
+                                  (event->type == MotionNotify
+                                   ? event->xmotion.y + view->clip_top
+                                   : event->xcrossing.y + view->clip_top),
+                                  &x, &y);
+    }
+#ifdef HAVE_XINPUT2
+  else
+    {
+      eassert (event->xcookie.evtype == XI_Enter
+              || event->xcookie.evtype == XI_Leave);
 
-  target = find_widget_at_pos (model->widgetwindow_osr,
-                              (event->type == MotionNotify
-                               ? event->xmotion.x + view->clip_left
-                               : event->xcrossing.x + view->clip_left),
-                              (event->type == MotionNotify
-                               ? event->xmotion.y + view->clip_top
-                               : event->xcrossing.y + view->clip_top),
-                              &x, &y);
+      xev = (XIEnterEvent *) event->xcookie.data;
+      xg_event = gdk_event_new (event->type == XI_Enter
+                               ? GDK_ENTER_NOTIFY
+                               : GDK_LEAVE_NOTIFY);
+      target = find_widget_at_pos (model->widgetwindow_osr,
+                                  lrint (xev->event_x + view->clip_left),
+                                  lrint (xev->event_y + view->clip_top),
+                                  &x, &y);
+    }
+#endif
 
   if (!target)
     target = model->widget_osr;
@@ -1152,6 +1444,32 @@ xwidget_motion_or_crossing (struct xwidget_view *view, 
const XEvent *event)
       xg_event->motion.state = event->xmotion.state;
       xg_event->motion.device = find_suitable_pointer (view->frame);
     }
+#ifdef HAVE_XINPUT2
+  else if (event->type == GenericEvent)
+    {
+      xg_event->crossing.x = (gdouble) xev->event_x;
+      xg_event->crossing.y = (gdouble) xev->event_y;
+      xg_event->crossing.x_root = (gdouble) xev->root_x;
+      xg_event->crossing.y_root = (gdouble) xev->root_y;
+      xg_event->crossing.time = xev->time;
+      xg_event->crossing.focus = xev->focus;
+      xg_event->crossing.mode = xev->mode;
+      xg_event->crossing.detail = xi_translate_notify_detail (xev->detail);
+      xg_event->crossing.state = xev->mods.effective;
+
+      if (xev->buttons.mask_len)
+       {
+         if (XIMaskIsSet (xev->buttons.mask, 1))
+           xg_event->crossing.state |= GDK_BUTTON1_MASK;
+         if (XIMaskIsSet (xev->buttons.mask, 2))
+           xg_event->crossing.state |= GDK_BUTTON2_MASK;
+         if (XIMaskIsSet (xev->buttons.mask, 3))
+           xg_event->crossing.state |= GDK_BUTTON3_MASK;
+       }
+
+      gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+    }
+#endif
   else
     {
       xg_event->crossing.detail = min (5, event->xcrossing.detail);
@@ -1160,6 +1478,7 @@ xwidget_motion_or_crossing (struct xwidget_view *view, 
const XEvent *event)
       xg_event->crossing.y = y;
       xg_event->crossing.x_root = event->xcrossing.x_root;
       xg_event->crossing.y_root = event->xcrossing.y_root;
+      xg_event->crossing.focus = event->xcrossing.focus;
       gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
     }
 
@@ -1167,6 +1486,8 @@ xwidget_motion_or_crossing (struct xwidget_view *view, 
const XEvent *event)
   gdk_event_free (xg_event);
 }
 
+#endif /* HAVE_X_WINDOWS */
+
 static void
 synthesize_focus_in_event (GtkWidget *offscreen_window)
 {
@@ -1192,6 +1513,7 @@ synthesize_focus_in_event (GtkWidget *offscreen_window)
   gdk_event_free (focus_event);
 }
 
+#ifdef HAVE_X_WINDOWS
 struct xwidget_view *
 xwidget_view_from_window (Window wdesc)
 {
@@ -1203,16 +1525,24 @@ xwidget_view_from_window (Window wdesc)
 
   return XXWIDGET_VIEW (xwv);
 }
+#endif
 
 static void
 xwidget_show_view (struct xwidget_view *xv)
 {
   xv->hidden = false;
+#ifdef HAVE_X_WINDOWS
   XMoveWindow (xv->dpy, xv->wdesc,
               xv->x + xv->clip_left,
               xv->y + xv->clip_top);
   XMapWindow (xv->dpy, xv->wdesc);
   XFlush (xv->dpy);
+#else
+  gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (xv->frame)),
+                 xv->widget, xv->x + xv->clip_left,
+                 xv->y + xv->clip_top);
+  gtk_widget_show_all (xv->widget);
+#endif
 }
 
 /* Hide an xwidget view.  */
@@ -1220,10 +1550,15 @@ static void
 xwidget_hide_view (struct xwidget_view *xv)
 {
   xv->hidden = true;
+#ifdef HAVE_X_WINDOWS
   XUnmapWindow (xv->dpy, xv->wdesc);
   XFlush (xv->dpy);
+#else
+  gtk_widget_hide (xv->widget);
+#endif
 }
 
+#ifndef HAVE_PGTK
 static void
 xv_do_draw (struct xwidget_view *xw, struct xwidget *w)
 {
@@ -1255,6 +1590,37 @@ xv_do_draw (struct xwidget_view *xw, struct xwidget *w)
 
   unblock_input ();
 }
+#else
+static void
+xwidget_view_draw_cb (GtkWidget *widget, cairo_t *cr,
+                     gpointer data)
+{
+  struct xwidget_view *view = data;
+  struct xwidget *w = XXWIDGET (view->model);
+  GtkOffscreenWindow *wnd;
+  cairo_surface_t *surface;
+
+  if (NILP (w->buffer))
+    return;
+
+  block_input ();
+  wnd = GTK_OFFSCREEN_WINDOW (w->widgetwindow_osr);
+  surface = gtk_offscreen_window_get_surface (wnd);
+
+  cairo_save (cr);
+  if (surface)
+    {
+      cairo_translate (cr, -view->clip_left,
+                      -view->clip_top);
+      cairo_set_source_surface (cr, surface, 0, 0);
+      cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+      cairo_paint (cr);
+    }
+  cairo_restore (cr);
+
+  unblock_input ();
+}
+#endif
 
 /* When the off-screen webkit master view changes this signal is called.
    It copies the bitmap from the off-screen instance.  */
@@ -1270,9 +1636,12 @@ offscreen_damage_event (GtkWidget *widget, GdkEvent 
*event,
       if (XWIDGET_VIEW_P (XCAR (tail)))
        {
          struct xwidget_view *view = XXWIDGET_VIEW (XCAR (tail));
-
+#ifdef HAVE_X_WINDOWS
          if (view->wdesc && XXWIDGET (view->model) == xwidget)
            xv_do_draw (view, XXWIDGET (view->model));
+#else
+         gtk_widget_queue_draw (view->widget);
+#endif
        }
     }
 
@@ -1281,6 +1650,7 @@ offscreen_damage_event (GtkWidget *widget, GdkEvent 
*event,
   return FALSE;
 }
 
+#ifdef HAVE_X_WINDOWS
 void
 xwidget_expose (struct xwidget_view *xv)
 {
@@ -1288,6 +1658,7 @@ xwidget_expose (struct xwidget_view *xv)
 
   xv_do_draw (xv, xw);
 }
+#endif
 #endif /* USE_GTK */
 
 void
@@ -1748,7 +2119,7 @@ xwidget_init_view (struct xwidget *xww,
   XSETWINDOW (xv->w, s->w);
   XSETXWIDGET (xv->model, xww);
 
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
   xv->dpy = FRAME_X_DISPLAY (s->f);
 
   xv->x = x;
@@ -1760,6 +2131,32 @@ xwidget_init_view (struct xwidget *xww,
   xv->clip_bottom = xww->height;
 
   xv->wdesc = None;
+  xv->frame = s->f;
+  xv->cursor = cursor_for_hit (xww->hit_result, s->f);
+  xv->just_resized = false;
+#elif defined HAVE_PGTK
+  xv->dpyinfo = FRAME_DISPLAY_INFO (s->f);
+  xv->widget = gtk_drawing_area_new ();
+  gtk_widget_set_app_paintable (xv->widget, TRUE);
+  gtk_widget_add_events (xv->widget, GDK_ALL_EVENTS_MASK);
+  gtk_container_add (GTK_CONTAINER (FRAME_GTK_WIDGET (s->f)),
+                    xv->widget);
+
+  g_signal_connect (xv->widget, "draw",
+                   G_CALLBACK (xwidget_view_draw_cb), xv);
+  g_signal_connect (xv->widget, "event",
+                   G_CALLBACK (xw_forward_event_from_view), xv);
+
+  g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, xv);
+
+  xv->x = x;
+  xv->y = y;
+
+  xv->clip_left = 0;
+  xv->clip_right = xww->width;
+  xv->clip_top = 0;
+  xv->clip_bottom = xww->height;
+
   xv->frame = s->f;
   xv->cursor = cursor_for_hit (xww->hit_result, s->f);
   xv->just_resized = false;
@@ -1841,13 +2238,13 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
   bool moved = (xv->x + xv->clip_left != x + clip_left
                || xv->y + xv->clip_top != y + clip_top);
 
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
   bool wdesc_was_none = xv->wdesc == None;
 #endif
   xv->x = x;
   xv->y = y;
 
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
   block_input ();
   if (xv->wdesc == None)
     {
@@ -1883,6 +2280,18 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
          mask.deviceid = XIAllMasterDevices;
 
          XISetMask (m, XI_Motion);
+         XISetMask (m, XI_ButtonPress);
+         XISetMask (m, XI_ButtonRelease);
+         XISetMask (m, XI_Enter);
+         XISetMask (m, XI_Leave);
+#ifdef XI_GesturePinchBegin
+         if (FRAME_DISPLAY_INFO (s->f)->xi2_version >= 4)
+           {
+             XISetMask (m, XI_GesturePinchBegin);
+             XISetMask (m, XI_GesturePinchUpdate);
+             XISetMask (m, XI_GesturePinchEnd);
+           }
+#endif
          XISelectEvents (xv->dpy, xv->wdesc, &mask, 1);
        }
 #endif
@@ -1899,16 +2308,25 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
       moved = false;
     }
 #endif
+#ifdef HAVE_PGTK
+  block_input ();
+#endif
 
   /* Has it moved?  */
   if (moved)
     {
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
       XMoveResizeWindow (xv->dpy, xv->wdesc, x + clip_left, y + clip_top,
                         clip_right - clip_left, clip_bottom - clip_top);
       XFlush (xv->dpy);
       cairo_xlib_surface_set_size (xv->cr_surface, clip_right - clip_left,
                                   clip_bottom - clip_top);
+#elif defined HAVE_PGTK
+      gtk_widget_set_size_request (xv->widget, clip_right - clip_left,
+                                  clip_bottom - clip_top);
+      gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (xv->frame)),
+                     xv->widget, x + clip_left, y + clip_top);
+      gtk_widget_queue_allocate (xv->widget);
 #elif defined NS_IMPL_COCOA
       nsxwidget_move_view (xv, x + clip_left, y + clip_top);
 #endif
@@ -1919,11 +2337,14 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
      covers the entire frame.  Clipping might have changed even if we
      haven't actually moved; try to figure out when we need to reclip
      for real.  */
+#ifndef HAVE_PGTK
   if (xv->clip_right != clip_right
       || xv->clip_bottom != clip_bottom
       || xv->clip_top != clip_top || xv->clip_left != clip_left)
+#endif
     {
 #ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
       if (!wdesc_was_none && !moved)
        {
          if (clip_right - clip_left <= 0
@@ -1941,6 +2362,13 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
          cairo_xlib_surface_set_size (xv->cr_surface, clip_right - clip_left,
                                       clip_bottom - clip_top);
        }
+#else
+      gtk_widget_set_size_request (xv->widget, clip_right - clip_left,
+                                  clip_bottom - clip_top);
+      gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (xv->frame)),
+                     xv->widget, x + clip_left, y + clip_top);
+      gtk_widget_queue_allocate (xv->widget);
+#endif
 #elif defined NS_IMPL_COCOA
       nsxwidget_resize_view (xv, clip_right - clip_left,
                              clip_bottom - clip_top);
@@ -1969,7 +2397,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
 #endif
        }
     }
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
   else
     {
       XSetWindowBackground (xv->dpy, xv->wdesc,
@@ -1977,7 +2405,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
     }
 #endif
 
-#ifdef HAVE_XINPUT2
+#if defined HAVE_XINPUT2 || defined HAVE_PGTK
   record_osr_embedder (xv);
   synthesize_focus_in_event (xww->widget_osr);
 #endif
@@ -2315,19 +2743,22 @@ DEFUN ("delete-xwidget-view",
 {
   CHECK_XWIDGET_VIEW (xwidget_view);
   struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view);
+
+  block_input ();
 #ifdef USE_GTK
   struct xwidget *xw = XXWIDGET (xv->model);
   GdkWindow *w;
-
+#ifdef HAVE_X_WINDOWS
   if (xv->wdesc != None)
     {
-      block_input ();
       cairo_destroy (xv->cr_context);
       cairo_surface_destroy (xv->cr_surface);
       XDestroyWindow (xv->dpy, xv->wdesc);
       Fremhash (make_fixnum (xv->wdesc), x_window_to_xwv_map);
-      unblock_input ();
     }
+#else
+  gtk_widget_destroy (xv->widget);
+#endif
 
   if (xw->embedder_view == xv && !NILP (xw->buffer))
     {
@@ -2344,6 +2775,7 @@ DEFUN ("delete-xwidget-view",
 
   internal_xwidget_view_list = Fdelq (xwidget_view, 
internal_xwidget_view_list);
   Vxwidget_view_list = Fcopy_sequence (internal_xwidget_view_list);
+  unblock_input ();
   return Qnil;
 }
 
@@ -2919,7 +3351,7 @@ syms_of_xwidget (void)
   internal_xwidget_view_list = Qnil;
   staticpro (&internal_xwidget_view_list);
 
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
   x_window_to_xwv_map = CALLN (Fmake_hash_table, QCtest, Qeq);
 
   staticpro (&x_window_to_xwv_map);
@@ -3109,7 +3541,7 @@ xwidget_end_redisplay (struct window *w, struct 
glyph_matrix *matrix)
     }
 }
 
-#ifdef USE_GTK
+#ifdef HAVE_X_WINDOWS
 void
 lower_frame_xwidget_views (struct frame *f)
 {
@@ -3123,7 +3555,9 @@ lower_frame_xwidget_views (struct frame *f)
        XLowerWindow (xv->dpy, xv->wdesc);
     }
 }
+#endif
 
+#ifndef NS_IMPL_COCOA
 void
 kill_frame_xwidget_views (struct frame *f)
 {
@@ -3176,6 +3610,8 @@ kill_xwidget (struct xwidget *xw)
   xw->widget_osr = NULL;
   xw->widgetwindow_osr = NULL;
   xw->find_text = NULL;
+
+  catch_child_signal ();
 #elif defined NS_IMPL_COCOA
   nsxwidget_kill (xw);
 #endif
@@ -3196,4 +3632,6 @@ kill_buffer_xwidgets (Lisp_Object buffer)
        kill_xwidget (xw);
       }
     }
+
+  catch_child_signal ();
 }
diff --git a/src/xwidget.h b/src/xwidget.h
index a03006fde9..ee74e53c4d 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -1,6 +1,6 @@
 /* Support for embedding graphical components in a buffer.
 
-Copyright (C) 2011-2021 Free Software Foundation, Inc.
+Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -32,13 +32,21 @@ struct window;
 
 #if defined (USE_GTK)
 #include <gtk/gtk.h>
+#ifndef HAVE_PGTK
 #include <X11/Xlib.h>
 #include "xterm.h"
+#else
+#include "pgtkterm.h"
+#endif
 #elif defined (NS_IMPL_COCOA) && defined (__OBJC__)
 #import <AppKit/NSView.h>
 #import "nsxwidget.h"
 #endif
 
+#ifdef HAVE_XINPUT2
+#include <X11/extensions/XInput2.h>
+#endif
+
 struct xwidget
 {
   union vectorlike_header header;
@@ -107,8 +115,13 @@ struct xwidget_view
   enum glyph_row_area area;
 
 #if defined (USE_GTK)
+#ifndef HAVE_PGTK
   Display *dpy;
   Window wdesc;
+#else
+  struct pgtk_display_info *dpyinfo;
+  GtkWidget *widget;
+#endif
   Emacs_Cursor cursor;
   struct frame *frame;
 
@@ -190,16 +203,23 @@ extern struct xwidget *xwidget_from_id (uint32_t id);
 struct xwidget_view *xwidget_view_from_window (Window wdesc);
 void xwidget_expose (struct xwidget_view *xv);
 extern void lower_frame_xwidget_views (struct frame *f);
+#endif
+#ifndef NS_IMPL_COCOA
 extern void kill_frame_xwidget_views (struct frame *f);
+#endif
+#ifdef HAVE_X_WINDOWS
 extern void xwidget_button (struct xwidget_view *, bool, int,
                            int, int, int, Time);
 extern void xwidget_motion_or_crossing (struct xwidget_view *,
                                        const XEvent *);
 #ifdef HAVE_XINPUT2
 extern void xwidget_motion_notify (struct xwidget_view *, double,
-                                  double, uint, Time);
+                                  double, double, double, uint, Time);
 extern void xwidget_scroll (struct xwidget_view *, double, double,
                             double, double, uint, Time, bool);
+#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+extern void xwidget_pinch (struct xwidget_view *, XIGesturePinchEvent *);
+#endif
 #endif
 #endif
 #else
diff --git a/test/ChangeLog.1 b/test/ChangeLog.1
index 7085b9ea10..fe7e6626cb 100644
--- a/test/ChangeLog.1
+++ b/test/ChangeLog.1
@@ -2952,7 +2952,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2008-2021 Free Software Foundation, Inc.
+  Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/test/Makefile.in b/test/Makefile.in
index f2c49584e7..d6ab7b244d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2010-2021 Free Software Foundation, Inc.
+# Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -183,8 +183,8 @@ testloadfile = $*
 endif
 
 %.log: %.elc
-       $(AM_V_at)${MKDIR_P} $(dir $@)
-       $(AM_V_GEN)HOME=$(TEST_HOME) $(emacs) \
+       $(AM_V_GEN)${MKDIR_P} $(dir $@)
+       $(AM_V_at)HOME=$(TEST_HOME) $(emacs) \
          -l ert ${ert_opts} -l $(testloadfile) \
          $(TEST_RUN_ERT)
 
@@ -291,8 +291,8 @@ FREE_SOURCE_1 = $(srcdir)/../lib/free.c
 # 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) \
+       $(AM_V_CCLD)${MKDIR_P} $(dir $@)
+       $(AM_V_at)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \
          -o $@ $< $(LIBGMP) \
          $(and $(GMP_H),$(srcdir)/../lib/mini-gmp-gnulib.c) \
          $(FREE_SOURCE_$(REPLACE_FREE)) \
@@ -353,6 +353,7 @@ mostlyclean:
 
 clean:
        find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE)
+       find . '(' -name '*.xml' -a ! -path '*resources*' ')' $(FIND_DELETE)
        rm -f ${srcdir}/lisp/gnus/mml-sec-resources/random_seed
        rm -f $(test_module_dir)/*.o $(test_module_dir)/*.so \
          $(test_module_dir)/*.dll
@@ -374,10 +375,10 @@ check-declare:
 .PHONY: subdirs subdir-targets generate-test-jobs
 
 subdirs:
-       @echo $(SUBDIRS)
+       @: $(info $(SUBDIRS))
 
 subdir-targets:
-       @echo $(SUBDIR_TARGETS)
+       @: $(info $(SUBDIR_TARGETS))
 
 generate-test-jobs:
        @$(MAKE) -C infra generate-test-jobs SUBDIRS="$(SUBDIRS)"
diff --git a/test/README b/test/README
index 4d447c9bf1..e44c4a43ee 100644
--- a/test/README
+++ b/test/README
@@ -1,4 +1,4 @@
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 This directory contains files intended to test various aspects of
@@ -114,6 +114,9 @@ mode--only the names of the failed tests are listed.  If the
 $EMACS_TEST_VERBOSE environment variable is set, the failure summaries
 will also include the data from the failing test.
 
+If the $EMACS_TEST_JUNIT_REPORT environment variable is set to a file
+name, a JUnit test report is generated under this name.
+
 Some of the tests require a remote temporary directory
 (autorevert-tests.el, filenotify-tests.el, shadowfile-tests.el and
 tramp-tests.el).  Per default, a mock-up connection method is used
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba
index aef68c6e81..d9d963bcfd 100644
--- a/test/infra/Dockerfile.emba
+++ b/test/infra/Dockerfile.emba
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2022 Free Software Foundation, Inc.
 #
 #  This file is part of GNU Emacs.
 #
diff --git a/test/infra/Makefile.in b/test/infra/Makefile.in
index fd11d36798..c251578e6a 100644
--- a/test/infra/Makefile.in
+++ b/test/infra/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -84,7 +84,7 @@ define subdir_template
        @echo '        - test/$(1)/*resources/**' >>$(FILE)
        @echo '  variables:' >>$(FILE)
        @echo '    target: emacs-inotify' >>$(FILE)
-       @echo '    make_params: "-C test $(target)"' >>$(FILE)
+       @echo '    make_params: "-k -C test $(target)"' >>$(FILE)
 endef
 
 $(foreach subdir, $(SUBDIRS), $(eval $(call subdir_template,$(subdir))))
@@ -93,10 +93,8 @@ all: generate-test-jobs
 
 .PHONY: generate-test-jobs $(FILE) $(SUBDIR_TARGETS)
 
-generate-test-jobs: clean $(FILE) $(SUBDIR_TARGETS)
+generate-test-jobs: $(FILE) $(SUBDIR_TARGETS)
 
 $(FILE):
        $(AM_V_GEN)
-
-clean:
-       @rm -f $(FILE)
+       @echo "# Generated by \"make generate-test-jobs\", don't edit." >$(FILE)
diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml
index b0ea6813b3..e034430edc 100644
--- a/test/infra/gitlab-ci.yml
+++ b/test/infra/gitlab-ci.yml
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2021 Free Software Foundation, Inc.
+# Copyright (C) 2017-2022 Free Software Foundation, Inc.
 #
 #  This file is part of GNU Emacs.
 #
@@ -44,6 +44,7 @@ workflow:
 variables:
   GIT_STRATEGY: fetch
   EMACS_EMBA_CI: 1
+  EMACS_TEST_JUNIT_REPORT: junit-test-report.xml
   EMACS_TEST_TIMEOUT: 3600
   EMACS_TEST_VERBOSE: 1
   # Use TLS 
https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
@@ -85,7 +86,7 @@ default:
     # TODO: with make -j4 several of the tests were failing, for
     # example shadowfile-tests, but passed without it.
     - 'export PWD=$(pwd)'
-    - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} -e 
EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e 
EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} --volumes-from $(docker ps -q -f 
"label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} 
${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD 
&& echo checking out these updated files && git diff --name-only FETCH_HEAD && 
( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make 
- [...]
+    - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} -e 
EMACS_TEST_JUNIT_REPORT=${EMACS_TEST_JUNIT_REPORT} -e 
EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e 
EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} --volumes-from $(docker ps -q -f 
"label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} 
${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD 
&& echo checking out these updated files && git diff --name-only FETCH_HEAD && 
( git diff --name-only FET [...]
   after_script:
     # - docker ps -a
     # - printenv
@@ -93,7 +94,8 @@ default:
     # Prepare test artifacts.
     - test -n "$(docker ps -aq -f name=${test_name})" && docker cp 
${test_name}:checkout/test ${test_name}
     - test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
-    - find ${test_name} ! -name "*.log" -type f -delete
+    - find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} 
\) -type f -delete
+    # BusyBox find does not know -empty.
     - find ${test_name} -type d -depth -exec rmdir {} + 2>/dev/null
 
 .build-template:
@@ -103,7 +105,6 @@ default:
       when: always
     - changes:
         - "**.in"
-        - "**.yml"
         - GNUmakefile
         - aclocal.m4
         - autogen.sh
@@ -112,7 +113,7 @@ default:
         - lib/malloc/*.{h,c}
         - lisp/emacs-lisp/*.el
         - src/*.{h,c}
-        - test/infra/Dockerfile.emba
+        - test/infra/*
     - changes:
         # gfilemonitor, kqueue
         - src/gfilenotify.c
@@ -133,9 +134,11 @@ default:
     name: ${test_name}
     public: true
     expire_in: 1 week
+    when: always
     paths:
       - ${test_name}/
-    when: always
+    reports:
+      junit: ${test_name}/${EMACS_TEST_JUNIT_REPORT}
 
 .gnustep-template:
   rules:
@@ -143,12 +146,11 @@ default:
     - if: '$CI_PIPELINE_SOURCE == "schedule"'
       changes:
         - "**.in"
-        - "**.yml"
         - src/ns*.{h,m}
         - src/macfont.{h,m}
         - lisp/term/ns-win.el
         - nextstep/**
-        - test/infra/Dockerfile.emba
+        - test/infra/*
 
 .filenotify-gio-template:
   rules:
@@ -156,12 +158,11 @@ default:
     - if: '$CI_PIPELINE_SOURCE == "schedule"'
       changes:
         - "**.in"
-        - "**.yml"
         - lisp/autorevert.el
         - lisp/filenotify.el
         - lisp/net/tramp-sh.el
         - src/gfilenotify.c
-        - test/infra/Dockerfile.emba
+        - test/infra/*
         - test/lisp/autorevert-tests.el
         - test/lisp/filenotify-tests.el
 
@@ -171,11 +172,10 @@ default:
     - if: '$CI_PIPELINE_SOURCE == "schedule"'
       changes:
         - "**.in"
-        - "**.yml"
         - lisp/emacs-lisp/comp.el
         - lisp/emacs-lisp/comp-cstr.el
         - src/comp.{h,m}
-        - test/infra/Dockerfile.emba
+        - test/infra/*
         - test/src/comp-resources/*.el
         - test/src/comp-tests.el
   timeout: 8 hours
@@ -226,7 +226,8 @@ test-filenotify-gio:
       optional: true
   variables:
     target: emacs-filenotify-gio
-    make_params: "-k -C test autorevert-tests.log filenotify-tests.log"
+    # This is needed in order to get a JUnit test report.
+    make_params: '-k -C test check-expensive 
LOGFILES="lisp/autorevert-tests.log lisp/filenotify-tests.log"'
 
 build-image-gnustep:
   stage: platform-images
@@ -271,7 +272,7 @@ test-native-comp-speed0:
       optional: true
   variables:
     target: emacs-native-comp-speed0
-    make_params: "-C test check SELECTOR='(not (tag :unstable))'"
+    make_params: "-k -C test check SELECTOR='(not (tag :unstable))'"
 
 # Local Variables:
 # add-log-current-defun-header-regexp: "^\\([-_.[:alnum:]]+\\)[ \t]*:"
diff --git a/test/infra/test-jobs.yml b/test/infra/test-jobs.yml
index bad8575b5c..51707c181b 100644
--- a/test/infra/test-jobs.yml
+++ b/test/infra/test-jobs.yml
@@ -1,3 +1,4 @@
+# Generated by "make generate-test-jobs", don't edit.
 
 test-lib-src-inotify:
   stage: normal
@@ -14,7 +15,7 @@ test-lib-src-inotify:
         - test/lib-src/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lib-src"
+    make_params: "-k -C test check-lib-src"
 
 test-lisp-inotify:
   stage: normal
@@ -31,7 +32,7 @@ test-lisp-inotify:
         - test/lisp/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp"
+    make_params: "-k -C test check-lisp"
 
 test-lisp-calc-inotify:
   stage: normal
@@ -48,7 +49,7 @@ test-lisp-calc-inotify:
         - test/lisp/calc/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-calc"
+    make_params: "-k -C test check-lisp-calc"
 
 test-lisp-calendar-inotify:
   stage: normal
@@ -65,7 +66,7 @@ test-lisp-calendar-inotify:
         - test/lisp/calendar/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-calendar"
+    make_params: "-k -C test check-lisp-calendar"
 
 test-lisp-cedet-inotify:
   stage: normal
@@ -82,7 +83,7 @@ test-lisp-cedet-inotify:
         - test/lisp/cedet/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-cedet"
+    make_params: "-k -C test check-lisp-cedet"
 
 test-lisp-cedet-semantic-inotify:
   stage: normal
@@ -99,7 +100,7 @@ test-lisp-cedet-semantic-inotify:
         - test/lisp/cedet/semantic/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-cedet-semantic"
+    make_params: "-k -C test check-lisp-cedet-semantic"
 
 test-lisp-cedet-semantic-bovine-inotify:
   stage: normal
@@ -116,7 +117,7 @@ test-lisp-cedet-semantic-bovine-inotify:
         - test/lisp/cedet/semantic/bovine/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-cedet-semantic-bovine"
+    make_params: "-k -C test check-lisp-cedet-semantic-bovine"
 
 test-lisp-cedet-srecode-inotify:
   stage: normal
@@ -133,7 +134,7 @@ test-lisp-cedet-srecode-inotify:
         - test/lisp/cedet/srecode/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-cedet-srecode"
+    make_params: "-k -C test check-lisp-cedet-srecode"
 
 test-lisp-emacs-lisp-inotify:
   stage: normal
@@ -150,7 +151,7 @@ test-lisp-emacs-lisp-inotify:
         - test/lisp/emacs-lisp/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-emacs-lisp"
+    make_params: "-k -C test check-lisp-emacs-lisp"
 
 test-lisp-emacs-lisp-eieio-tests-inotify:
   stage: normal
@@ -167,7 +168,7 @@ test-lisp-emacs-lisp-eieio-tests-inotify:
         - test/lisp/emacs-lisp/eieio-tests/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-emacs-lisp-eieio-tests"
+    make_params: "-k -C test check-lisp-emacs-lisp-eieio-tests"
 
 test-lisp-emacs-lisp-faceup-tests-inotify:
   stage: normal
@@ -184,7 +185,7 @@ test-lisp-emacs-lisp-faceup-tests-inotify:
         - test/lisp/emacs-lisp/faceup-tests/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-emacs-lisp-faceup-tests"
+    make_params: "-k -C test check-lisp-emacs-lisp-faceup-tests"
 
 test-lisp-emulation-inotify:
   stage: normal
@@ -201,7 +202,7 @@ test-lisp-emulation-inotify:
         - test/lisp/emulation/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-emulation"
+    make_params: "-k -C test check-lisp-emulation"
 
 test-lisp-erc-inotify:
   stage: normal
@@ -218,7 +219,7 @@ test-lisp-erc-inotify:
         - test/lisp/erc/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-erc"
+    make_params: "-k -C test check-lisp-erc"
 
 test-lisp-eshell-inotify:
   stage: normal
@@ -235,7 +236,7 @@ test-lisp-eshell-inotify:
         - test/lisp/eshell/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-eshell"
+    make_params: "-k -C test check-lisp-eshell"
 
 test-lisp-gnus-inotify:
   stage: normal
@@ -252,7 +253,7 @@ test-lisp-gnus-inotify:
         - test/lisp/gnus/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-gnus"
+    make_params: "-k -C test check-lisp-gnus"
 
 test-lisp-image-inotify:
   stage: normal
@@ -269,7 +270,7 @@ test-lisp-image-inotify:
         - test/lisp/image/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-image"
+    make_params: "-k -C test check-lisp-image"
 
 test-lisp-international-inotify:
   stage: normal
@@ -286,7 +287,7 @@ test-lisp-international-inotify:
         - test/lisp/international/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-international"
+    make_params: "-k -C test check-lisp-international"
 
 test-lisp-mail-inotify:
   stage: normal
@@ -303,7 +304,7 @@ test-lisp-mail-inotify:
         - test/lisp/mail/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-mail"
+    make_params: "-k -C test check-lisp-mail"
 
 test-lisp-mh-e-inotify:
   stage: normal
@@ -320,7 +321,7 @@ test-lisp-mh-e-inotify:
         - test/lisp/mh-e/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-mh-e"
+    make_params: "-k -C test check-lisp-mh-e"
 
 test-lisp-net-inotify:
   stage: normal
@@ -337,7 +338,7 @@ test-lisp-net-inotify:
         - test/lisp/net/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-net"
+    make_params: "-k -C test check-lisp-net"
 
 test-lisp-nxml-inotify:
   stage: normal
@@ -354,7 +355,7 @@ test-lisp-nxml-inotify:
         - test/lisp/nxml/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-nxml"
+    make_params: "-k -C test check-lisp-nxml"
 
 test-lisp-obsolete-inotify:
   stage: normal
@@ -371,7 +372,7 @@ test-lisp-obsolete-inotify:
         - test/lisp/obsolete/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-obsolete"
+    make_params: "-k -C test check-lisp-obsolete"
 
 test-lisp-org-inotify:
   stage: normal
@@ -388,7 +389,7 @@ test-lisp-org-inotify:
         - test/lisp/org/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-org"
+    make_params: "-k -C test check-lisp-org"
 
 test-lisp-play-inotify:
   stage: normal
@@ -405,7 +406,7 @@ test-lisp-play-inotify:
         - test/lisp/play/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-play"
+    make_params: "-k -C test check-lisp-play"
 
 test-lisp-progmodes-inotify:
   stage: normal
@@ -422,7 +423,7 @@ test-lisp-progmodes-inotify:
         - test/lisp/progmodes/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-progmodes"
+    make_params: "-k -C test check-lisp-progmodes"
 
 test-lisp-so-long-tests-inotify:
   stage: normal
@@ -439,7 +440,7 @@ test-lisp-so-long-tests-inotify:
         - test/lisp/so-long-tests/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-so-long-tests"
+    make_params: "-k -C test check-lisp-so-long-tests"
 
 test-lisp-term-inotify:
   stage: normal
@@ -456,7 +457,7 @@ test-lisp-term-inotify:
         - test/lisp/term/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-term"
+    make_params: "-k -C test check-lisp-term"
 
 test-lisp-textmodes-inotify:
   stage: normal
@@ -473,7 +474,7 @@ test-lisp-textmodes-inotify:
         - test/lisp/textmodes/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-textmodes"
+    make_params: "-k -C test check-lisp-textmodes"
 
 test-lisp-url-inotify:
   stage: normal
@@ -490,7 +491,7 @@ test-lisp-url-inotify:
         - test/lisp/url/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-url"
+    make_params: "-k -C test check-lisp-url"
 
 test-lisp-vc-inotify:
   stage: normal
@@ -507,7 +508,7 @@ test-lisp-vc-inotify:
         - test/lisp/vc/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-lisp-vc"
+    make_params: "-k -C test check-lisp-vc"
 
 test-misc-inotify:
   stage: normal
@@ -524,7 +525,7 @@ test-misc-inotify:
         - test/misc/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-misc"
+    make_params: "-k -C test check-misc"
 
 test-src-inotify:
   stage: normal
@@ -541,4 +542,4 @@ test-src-inotify:
         - test/src/*resources/**
   variables:
     target: emacs-inotify
-    make_params: "-C test check-src"
+    make_params: "-k -C test check-src"
diff --git a/test/lib-src/emacsclient-tests.el 
b/test/lib-src/emacsclient-tests.el
index 8bad9c04e0..1302fbe30c 100644
--- a/test/lib-src/emacsclient-tests.el
+++ b/test/lib-src/emacsclient-tests.el
@@ -1,6 +1,6 @@
 ;;; emacsclient-tests.el --- Test emacsclient  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
index 863806af7b..394eae48ee 100644
--- a/test/lisp/abbrev-tests.el
+++ b/test/lisp/abbrev-tests.el
@@ -1,6 +1,6 @@
 ;;; abbrev-tests.el --- Test suite for abbrevs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <eliz@gnu.org>
 ;; Keywords: abbrevs
diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el
index a9c36e30e1..5b964fc5c0 100644
--- a/test/lisp/align-tests.el
+++ b/test/lisp/align-tests.el
@@ -1,6 +1,6 @@
 ;;; align-tests.el --- Test suite for aligns  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/allout-tests.el b/test/lisp/allout-tests.el
index 3a346fd1e2..4c3fd9c5dc 100644
--- a/test/lisp/allout-tests.el
+++ b/test/lisp/allout-tests.el
@@ -1,6 +1,6 @@
 ;;; allout-tests.el --- Tests for allout.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/allout-widgets-tests.el 
b/test/lisp/allout-widgets-tests.el
index 59ff678369..c6616922be 100644
--- a/test/lisp/allout-widgets-tests.el
+++ b/test/lisp/allout-widgets-tests.el
@@ -1,6 +1,6 @@
 ;;; allout-widgets-tests.el --- Tests for allout-widgets.el  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el
index 14a14ca4f0..71b706c763 100644
--- a/test/lisp/ansi-color-tests.el
+++ b/test/lisp/ansi-color-tests.el
@@ -1,6 +1,6 @@
 ;;; ansi-color-tests.el --- Test suite for ansi-color  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Pablo Barbáchano <pablob@amazon.com>
 
diff --git a/test/lisp/apropos-tests.el b/test/lisp/apropos-tests.el
index 7eaa64207f..289700abf7 100644
--- a/test/lisp/apropos-tests.el
+++ b/test/lisp/apropos-tests.el
@@ -1,6 +1,6 @@
 ;;; apropos-tests.el --- Tests for apropos.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/arc-mode-tests.el b/test/lisp/arc-mode-tests.el
index b05a9629c1..341a835039 100644
--- a/test/lisp/arc-mode-tests.el
+++ b/test/lisp/arc-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; arc-mode-tests.el --- Test suite for arc-mode. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/auth-source-pass-tests.el 
b/test/lisp/auth-source-pass-tests.el
index 3da6f3e9b7..f5147a7ce0 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -1,6 +1,6 @@
 ;;; auth-source-pass-tests.el --- Tests for auth-source-pass.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013, 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <damien.cassou@gmail.com>
 
diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el
index 34c68b421c..7060d9570e 100644
--- a/test/lisp/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
@@ -1,6 +1,6 @@
 ;;; auth-source-tests.el --- Tests for auth-source.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <damien@cassou.me>,
 ;;         Nicolas Petton <nicolas@petton.fr>
diff --git a/test/lisp/autoinsert-tests.el b/test/lisp/autoinsert-tests.el
index b264323ca1..722215cb7e 100644
--- a/test/lisp/autoinsert-tests.el
+++ b/test/lisp/autoinsert-tests.el
@@ -1,6 +1,6 @@
 ;;; autoinsert-tests.el --- Tests for autoinsert.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el
index b31f0a9afc..d26e0f5a15 100644
--- a/test/lisp/autorevert-tests.el
+++ b/test/lisp/autorevert-tests.el
@@ -1,6 +1,6 @@
 ;;; autorevert-tests.el --- Tests of auto-revert   -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
@@ -281,9 +281,9 @@ This expects `auto-revert--messages' to be bound by
 (ert-deftest auto-revert-test02-auto-revert-deleted-file ()
   "Check autorevert for a deleted file."
   ;; Repeated unpredictable failures, bug#32645.
-  ;; Unlikely to be hydra-specific?
-                                        ;  (skip-unless (not (getenv 
"EMACS_HYDRA_CI")))
   :tags '(:unstable)
+  ;; Unlikely to be hydra-specific?
+  ;; (skip-unless (not (getenv "EMACS_HYDRA_CI")))
   (with-auto-revert-test
    (ert-with-temp-file tmpfile
      (let (;; Try to catch bug#32645.
@@ -484,8 +484,6 @@ This expects `auto-revert--messages' to be bound by
        (ert-with-temp-file file-3
          (let* ((auto-revert-use-notify t)
                 (auto-revert-avoid-polling t)
-                (auto-revert-debug (getenv "EMACS_EMBA_CI"))
-                (file-notify-debug (getenv "EMACS_EMBA_CI"))
                 (was-in-global-auto-revert-mode global-auto-revert-mode)
                 (file-2b (concat file-2 "-b"))
                 require-final-newline buf-1 buf-2 buf-3)
@@ -531,28 +529,16 @@ This expects `auto-revert--messages' to be bound by
                  (should (equal (auto-revert-test--buffer-string buf-3) "3-a"))
 
                  ;; Delete a visited file, and re-create it with new contents.
-                 (when auto-revert-debug (message "Hallo0"))
                  (delete-file file-1)
-                 (when auto-revert-debug (message "Hallo1"))
                  (should (equal (auto-revert-test--buffer-string buf-1) "1-a"))
-                 (when auto-revert-debug (message "Hallo2"))
                  (auto-revert-test--write-file "1-b" file-1)
-                 (when auto-revert-debug (message "Hallo3"))
+                 ;; Since the file is deleted, it needs at least
+                 ;; `autorevert-interval' to recognize the new file,
+                 ;; while polling.  So increase the timeout.
                  (auto-revert-test--wait-for-buffer-text
-                  buf-1 "1-b" (auto-revert--timeout))
-                 ;; On emba, `buf-1' is a killed buffer.
-                 (when auto-revert-debug
-                   (message
-                    "Hallo4 %s %s %s %s %s %s %s"
-                    buf-1 (buffer-name buf-1) (buffer-live-p buf-1)
-                    file-1 (get-file-buffer file-1)
-                    (buffer-name (get-file-buffer file-1))
-                    (buffer-live-p (get-file-buffer file-1)))
-                   (with-current-buffer buf-1
-                     (message "Hallo5\n%s" (buffer-local-variables))))
+                  buf-1 "1-b" (* 2 (auto-revert--timeout)))
                  (should (buffer-local-value
                           'auto-revert-notify-watch-descriptor buf-1))
-                 (when auto-revert-debug (message "Hallo6"))
 
                  ;; Write a buffer to a new file, then modify the new file on 
disk.
                  (with-current-buffer buf-2
diff --git a/test/lisp/battery-tests.el b/test/lisp/battery-tests.el
index e34d59102b..1f9cfaee01 100644
--- a/test/lisp/battery-tests.el
+++ b/test/lisp/battery-tests.el
@@ -1,6 +1,6 @@
 ;;; battery-tests.el --- tests for battery.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/bookmark-tests.el b/test/lisp/bookmark-tests.el
index dc2dec68ee..ae7331fcc2 100644
--- a/test/lisp/bookmark-tests.el
+++ b/test/lisp/bookmark-tests.el
@@ -1,6 +1,6 @@
 ;;; bookmark-tests.el --- Tests for bookmark.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/buff-menu-tests.el b/test/lisp/buff-menu-tests.el
index b223a64308..8e7981e699 100644
--- a/test/lisp/buff-menu-tests.el
+++ b/test/lisp/buff-menu-tests.el
@@ -1,6 +1,6 @@
 ;;; buff-menu-tests.el --- Test suite for buff-menu.el -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 
diff --git a/test/lisp/button-tests.el b/test/lisp/button-tests.el
index 2f5ad795df..99d1ee3de4 100644
--- a/test/lisp/button-tests.el
+++ b/test/lisp/button-tests.el
@@ -1,6 +1,6 @@
 ;;; button-tests.el --- tests for button.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -21,11 +21,9 @@
 
 (require 'ert)
 
-(defvar button-tests--map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "x" #'ignore)
-    map)
-  "Keymap for testing command substitution.")
+(defvar-keymap button-tests--map
+  :doc "Keymap for testing command substitution."
+  "x" #'ignore)
 
 (ert-deftest button-at ()
   "Test `button-at' behavior."
diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el
index 3eb6b34c13..892fd278df 100644
--- a/test/lisp/calc/calc-tests.el
+++ b/test/lisp/calc/calc-tests.el
@@ -1,6 +1,6 @@
 ;;; calc-tests.el --- tests for calc                 -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <sdl.web@gmail.com>
 ;; Keywords: maint
diff --git a/test/lisp/calculator-tests.el b/test/lisp/calculator-tests.el
index f24ca97310..c1a1942cf7 100644
--- a/test/lisp/calculator-tests.el
+++ b/test/lisp/calculator-tests.el
@@ -1,6 +1,6 @@
 ;;; calculator-tests.el --- Test suite for calculator. -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/calendar/cal-french-tests.el 
b/test/lisp/calendar/cal-french-tests.el
index 1de5dea088..771681228e 100644
--- a/test/lisp/calendar/cal-french-tests.el
+++ b/test/lisp/calendar/cal-french-tests.el
@@ -1,6 +1,6 @@
 ;;; cal-french-tests.el --- tests for cal-french.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/calendar/cal-julian-tests.el 
b/test/lisp/calendar/cal-julian-tests.el
index db3a4909fa..46d49c68c1 100644
--- a/test/lisp/calendar/cal-julian-tests.el
+++ b/test/lisp/calendar/cal-julian-tests.el
@@ -1,6 +1,6 @@
 ;;; cal-julian-tests.el --- tests for calendar/cal-julian.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/calendar/icalendar-tests.el 
b/test/lisp/calendar/icalendar-tests.el
index 1551922028..c918b0f63f 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -1,6 +1,6 @@
 ;;; icalendar-tests.el --- Test suite for icalendar.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2005, 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2008-2022 Free Software Foundation, Inc.
 
 ;; Author:         Ulf Jasper <ulf.jasper@web.de>
 ;; Created:        March 2005
diff --git a/test/lisp/calendar/iso8601-tests.el 
b/test/lisp/calendar/iso8601-tests.el
index c4d038ab68..6c9e85ec92 100644
--- a/test/lisp/calendar/iso8601-tests.el
+++ b/test/lisp/calendar/iso8601-tests.el
@@ -1,6 +1,6 @@
 ;;; iso8601-tests.el --- tests for calendar/iso8601.el    -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/calendar/lunar-tests.el 
b/test/lisp/calendar/lunar-tests.el
index 268dcfdb55..846a749eb5 100644
--- a/test/lisp/calendar/lunar-tests.el
+++ b/test/lisp/calendar/lunar-tests.el
@@ -1,6 +1,6 @@
 ;;; lunar-tests.el --- tests for calendar/lunar.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/calendar/parse-time-tests.el 
b/test/lisp/calendar/parse-time-tests.el
index b706b73570..3fd53c6c1e 100644
--- a/test/lisp/calendar/parse-time-tests.el
+++ b/test/lisp/calendar/parse-time-tests.el
@@ -1,6 +1,6 @@
 ;;; parse-time-tests.el --- Test suite for parse-time.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
diff --git a/test/lisp/calendar/solar-tests.el 
b/test/lisp/calendar/solar-tests.el
index 921be1d2d4..9f79fed7c7 100644
--- a/test/lisp/calendar/solar-tests.el
+++ b/test/lisp/calendar/solar-tests.el
@@ -1,6 +1,6 @@
 ;;; solar-tests.el --- tests for solar.el            -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/calendar/time-date-tests.el 
b/test/lisp/calendar/time-date-tests.el
index ed842e34fd..5a37c91493 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -1,6 +1,6 @@
 ;;; time-date-tests.el --- tests for calendar/time-date.el    -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/calendar/todo-mode-tests.el 
b/test/lisp/calendar/todo-mode-tests.el
index 79978a2041..0102b62c10 100644
--- a/test/lisp/calendar/todo-mode-tests.el
+++ b/test/lisp/calendar/todo-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; todo-mode-tests.el --- tests for todo-mode.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Stephen Berman <stephen.berman@gmx.net>
 ;; Keywords: calendar
diff --git a/test/lisp/cedet/cedet-files-tests.el 
b/test/lisp/cedet/cedet-files-tests.el
index 5502d42431..d264410e3c 100644
--- a/test/lisp/cedet/cedet-files-tests.el
+++ b/test/lisp/cedet/cedet-files-tests.el
@@ -1,6 +1,6 @@
 ;;; cedet-files-tests.el --- Tests for cedet-files.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-c.el 
b/test/lisp/cedet/semantic-utest-c.el
index c5eb5b0ec0..2da450c273 100644
--- a/test/lisp/cedet/semantic-utest-c.el
+++ b/test/lisp/cedet/semantic-utest-c.el
@@ -1,6 +1,6 @@
 ;;; semantic-utest-c.el --- C based parsing tests.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/test.srt 
b/test/lisp/cedet/semantic-utest-ia-resources/test.srt
index 38e6f9ed7b..46f14d8480 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/test.srt
+++ b/test/lisp/cedet/semantic-utest-ia-resources/test.srt
@@ -1,6 +1,6 @@
 ;; test.srt --- unit test support file for semantic-utest-ia
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp
index ea3afc72a6..54941fa974 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp
@@ -1,6 +1,6 @@
 // testdoublens.cpp --- semantic-ia-utest completion engine unit tests
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp
index e8c9b345b2..6157af4212 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp
@@ -1,6 +1,6 @@
 // testdoublens.hpp --- Header file used in one of the Semantic tests
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java 
b/test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java
index bfc016903c..10735a5aa9 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java
@@ -1,6 +1,6 @@
 //  testjavacomp.java --- Semantic unit test for Java
 
-// Copyright (C) 2009-2021 Free Software Foundation, Inc.
+// Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 //  Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp
index 9d2329a0fa..920022648f 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp
@@ -1,6 +1,6 @@
 //  testlocalvars.java --- Semantic unit test for Java
 
-// Copyright (C) 2009-2021 Free Software Foundation, Inc.
+// Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 //  Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp
index db1603cead..05f8f54afd 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp
@@ -1,6 +1,6 @@
 /* testnsp.cpp --- semantic-ia-utest completion engine unit tests
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c 
b/test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c
index 084d6a8687..1d2c51e365 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c
@@ -1,6 +1,6 @@
 /* testesppcomplete.cpp --- semantic-ia-utest completion engine unit tests
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp
index 6659b5557b..e7d85101a1 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp
@@ -1,6 +1,6 @@
 // teststruct.cpp --- semantic-ia-utest completion engine unit tests
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp
index 409950cce2..4c56d34c90 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp
@@ -1,6 +1,6 @@
 // testsubclass.cpp --- unit test for analyzer and complex C++ inheritance
 
-// Copyright (C) 2007-2021 Free Software Foundation, Inc.
+// Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh 
b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh
index 5d795b32b1..870da66ade 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh
@@ -1,6 +1,6 @@
 // testsubclass.hh --- unit test for analyzer and complex C++ inheritance
 
-// Copyright (C) 2007-2021 Free Software Foundation, Inc.
+// Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp
index ed7a057df0..d2b0f5d3c3 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp
@@ -1,6 +1,6 @@
 // testtemplates.cpp --- semantic-ia-utest completion engine unit tests
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp
index c82535f958..09ab78942e 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp
@@ -1,6 +1,6 @@
 // testtypedefs.cpp --- Sample with some fake bits out of std::string
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp 
b/test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp
index 6f6c854263..661c09b01b 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp
@@ -1,6 +1,6 @@
 // testusing.cpp --- semantic-ia-utest completion engine unit tests
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testusing.hh 
b/test/lisp/cedet/semantic-utest-ia-resources/testusing.hh
index d3b690f854..e438e62e29 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testusing.hh
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testusing.hh
@@ -1,6 +1,6 @@
 // testusing.hh --- semantic-ia-utest completion engine unit tests
 
-// Copyright (C) 2008-2021 Free Software Foundation, Inc.
+// Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c 
b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c
index e796eb285c..00c877a182 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c
@@ -1,6 +1,6 @@
 /* testvarnames.cpp --- semantic-ia-utest completion engine unit tests
 
-   Copyright (C) 2008-2021 Free Software Foundation, Inc.
+   Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java 
b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java
index 7ed9785fc0..323e2059c4 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java
@@ -1,6 +1,6 @@
 //  testvarnames.java --- Semantic unit test for Java
 
-// Copyright (C) 2009-2021 Free Software Foundation, Inc.
+// Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 //  Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy 
b/test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy
index 49eb5780f4..901a662e79 100644
--- a/test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy
@@ -1,6 +1,6 @@
 ;; testwisent.wy --- unit test support file for semantic-utest-ia
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest-ia.el 
b/test/lisp/cedet/semantic-utest-ia.el
index 6ea4ca1a16..caf20fa8e0 100644
--- a/test/lisp/cedet/semantic-utest-ia.el
+++ b/test/lisp/cedet/semantic-utest-ia.el
@@ -1,6 +1,6 @@
 ;;; semantic-utest-ia.el --- Analyzer unit tests  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic-utest.el 
b/test/lisp/cedet/semantic-utest.el
index 3e4cfb0f0c..78bbbbf459 100644
--- a/test/lisp/cedet/semantic-utest.el
+++ b/test/lisp/cedet/semantic-utest.el
@@ -1,6 +1,6 @@
 ;;; semantic-utest.el --- Tests for semantic's parsing system. -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic/bovine/gcc-tests.el 
b/test/lisp/cedet/semantic/bovine/gcc-tests.el
index ba84ce4d81..2e61f91e58 100644
--- a/test/lisp/cedet/semantic/bovine/gcc-tests.el
+++ b/test/lisp/cedet/semantic/bovine/gcc-tests.el
@@ -1,6 +1,6 @@
 ;;; gcc-tests.el --- Tests for semantic/bovine/gcc.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2003-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
@@ -128,7 +128,7 @@ gcc version 2.95.2 19991024 (release)"
     ;; We can't even check if it's a symlink; it's a binary placed in
     ;; "/usr/bin/gcc".  So check the output and just skip this test if
     ;; it looks like that's the case.
-    (unless (string-match "Apple LLVM\\|Xcode.app"
+    (unless (string-match "Apple \\(LLVM\\|clang\\)\\|Xcode\\.app"
                           (car semantic-gcc-test-strings))
         (semantic-gcc-test-output-parser))))
 
diff --git a/test/lisp/cedet/semantic/format-resources/test-fmt.cpp 
b/test/lisp/cedet/semantic/format-resources/test-fmt.cpp
index ab869c1ce0..39843a2219 100644
--- a/test/lisp/cedet/semantic/format-resources/test-fmt.cpp
+++ b/test/lisp/cedet/semantic/format-resources/test-fmt.cpp
@@ -1,6 +1,6 @@
 /** test-fmt.cpp --- Signatures, and format answers for testing
  *
- * Copyright (C) 2012, 2016, 2019-2021 Free Software Foundation, Inc.
+ * Copyright (C) 2012, 2016, 2019-2022 Free Software Foundation, Inc.
  *
  * Author: Eric M. Ludlam <zappo@gnu.org>
  *
diff --git a/test/lisp/cedet/semantic/format-resources/test-fmt.el 
b/test/lisp/cedet/semantic/format-resources/test-fmt.el
index 8458a8e651..5fcb8ef3c3 100644
--- a/test/lisp/cedet/semantic/format-resources/test-fmt.el
+++ b/test/lisp/cedet/semantic/format-resources/test-fmt.el
@@ -1,6 +1,6 @@
 ;;; test-fmt.el --- test semantic tag formatting  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic/format-tests.el 
b/test/lisp/cedet/semantic/format-tests.el
index 149f408af1..f698d865c3 100644
--- a/test/lisp/cedet/semantic/format-tests.el
+++ b/test/lisp/cedet/semantic/format-tests.el
@@ -1,6 +1,6 @@
 ;;; semantic/format-tests.el --- Parsing / Formatting tests -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/semantic/fw-tests.el 
b/test/lisp/cedet/semantic/fw-tests.el
index 6a5f3c85fc..c8bfffb3cf 100644
--- a/test/lisp/cedet/semantic/fw-tests.el
+++ b/test/lisp/cedet/semantic/fw-tests.el
@@ -1,6 +1,6 @@
 ;;; fw-tests.el --- Tests for semantic/fw.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/srecode-utest-getset.el 
b/test/lisp/cedet/srecode-utest-getset.el
index 1c6578038c..fbcb0ad4cf 100644
--- a/test/lisp/cedet/srecode-utest-getset.el
+++ b/test/lisp/cedet/srecode-utest-getset.el
@@ -1,6 +1,7 @@
 ;;; srecode/test-getset.el --- Test the getset inserter. -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2008, 2009, 2011, 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2009, 2011, 2019-2022 Free Software Foundation,
+;; Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/cedet/srecode-utest-template.el 
b/test/lisp/cedet/srecode-utest-template.el
index 087dcfd899..1eb91e6053 100644
--- a/test/lisp/cedet/srecode-utest-template.el
+++ b/test/lisp/cedet/srecode-utest-template.el
@@ -1,6 +1,6 @@
 ;;; srecode-utest-template.el --- SRecode Core Template tests. -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/cedet/srecode/document-tests.el 
b/test/lisp/cedet/srecode/document-tests.el
index 0bc6e10d7a..71c4cd7410 100644
--- a/test/lisp/cedet/srecode/document-tests.el
+++ b/test/lisp/cedet/srecode/document-tests.el
@@ -1,6 +1,6 @@
 ;;; document-tests.el --- Tests for srecode/document.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/cedet/srecode/fields-tests.el 
b/test/lisp/cedet/srecode/fields-tests.el
index 3c66f219bd..292ac4e3b5 100644
--- a/test/lisp/cedet/srecode/fields-tests.el
+++ b/test/lisp/cedet/srecode/fields-tests.el
@@ -1,6 +1,6 @@
 ;;; srecode/fields-tests.el --- Tests for srecode/fields.el  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el
index 063c893516..749ec0a8d3 100644
--- a/test/lisp/char-fold-tests.el
+++ b/test/lisp/char-fold-tests.el
@@ -1,6 +1,6 @@
 ;;; char-fold-tests.el --- Tests for char-fold.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 
diff --git a/test/lisp/color-tests.el b/test/lisp/color-tests.el
index 2493476a66..49b632c841 100644
--- a/test/lisp/color-tests.el
+++ b/test/lisp/color-tests.el
@@ -1,6 +1,6 @@
 ;;; color-tests.el --- Tests for color.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index 0bd5c1e9d1..2885aaa914 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -1,6 +1,6 @@
 ;;; comint-tests.el --- Tests for comint.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/completion-tests.el b/test/lisp/completion-tests.el
index c13fb2e44b..dee6f8d5dd 100644
--- a/test/lisp/completion-tests.el
+++ b/test/lisp/completion-tests.el
@@ -1,6 +1,6 @@
 ;;; completion-tests.el --- Tests for completion.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el
index f7d5283437..01a1407dca 100644
--- a/test/lisp/cus-edit-tests.el
+++ b/test/lisp/cus-edit-tests.el
@@ -1,6 +1,6 @@
 ;;; cus-edit-tests.el --- Tests for cus-edit.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el
index 769db6ceab..77bb337d6a 100644
--- a/test/lisp/custom-tests.el
+++ b/test/lisp/custom-tests.el
@@ -1,6 +1,6 @@
 ;;; custom-tests.el --- tests for custom.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dabbrev-tests.el b/test/lisp/dabbrev-tests.el
index d3fe78b618..278a59c015 100644
--- a/test/lisp/dabbrev-tests.el
+++ b/test/lisp/dabbrev-tests.el
@@ -1,6 +1,6 @@
 ;;; dabbrev-tests.el --- Test suite for dabbrev.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Alan Third <alan@idiocy.org>
 ;; Keywords: dabbrev
diff --git a/test/lisp/delim-col-tests.el b/test/lisp/delim-col-tests.el
index 838fc92e82..97fa0f1e8f 100644
--- a/test/lisp/delim-col-tests.el
+++ b/test/lisp/delim-col-tests.el
@@ -1,6 +1,6 @@
 ;;; delim-col-tests.el --- Tests for delim-col.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/descr-text-tests.el b/test/lisp/descr-text-tests.el
index 715fafa44c..e5547d4f6e 100644
--- a/test/lisp/descr-text-tests.el
+++ b/test/lisp/descr-text-tests.el
@@ -1,6 +1,6 @@
 ;;; descr-text-tests.el --- ERT tests for descr-text.el -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2014, 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Michal Nazarewicz <mina86@mina86.com>
 
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 69fc95ba55..694deaae4c 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -1,6 +1,6 @@
 ;;; dired-aux-tests.el --- Test suite for dired-aux. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 1c4f37bd32..0e89325907 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -1,6 +1,6 @@
 ;;; dired-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el
index 69c88c060a..cec266b0ef 100644
--- a/test/lisp/dired-x-tests.el
+++ b/test/lisp/dired-x-tests.el
@@ -1,6 +1,6 @@
 ;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dom-tests.el b/test/lisp/dom-tests.el
index b55982c1a1..cb96f12d19 100644
--- a/test/lisp/dom-tests.el
+++ b/test/lisp/dom-tests.el
@@ -1,6 +1,6 @@
 ;;; dom-tests.el --- Tests for dom.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/edmacro-tests.el b/test/lisp/edmacro-tests.el
index 974f506a36..b5809ad0b7 100644
--- a/test/lisp/edmacro-tests.el
+++ b/test/lisp/edmacro-tests.el
@@ -1,6 +1,6 @@
 ;;; edmacro-tests.el --- Tests for edmacro.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 85727bd091..e10ed04f9d 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -1,6 +1,6 @@
 ;;; electric-tests.el --- tests for electric.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/elide-head-tests.el b/test/lisp/elide-head-tests.el
index 4b9a559ac7..804617f48f 100644
--- a/test/lisp/elide-head-tests.el
+++ b/test/lisp/elide-head-tests.el
@@ -1,6 +1,6 @@
 ;;; elide-head-tests.el --- Tests for elide-head.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
@@ -58,5 +58,110 @@
       (elide-head-show)
       (should-not (overlays-at 14)))))
 
+(defmacro elide-head--add-test (name text search-str)
+  `(ert-deftest ,(intern (format "elide-head--test-headers-to-hide/%s" name)) 
()
+     (with-temp-buffer
+       (insert ,text)
+       (elide-head)
+       (goto-char (point-min))
+       (re-search-forward ,search-str)
+       (let ((o (car (overlays-at (match-beginning 0)))))
+         (should (overlayp o))
+         (should (overlay-get o 'invisible))
+         (should (overlay-get o 'evaporate))))))
+
+
+;;; GPLv3
+
+;; from Emacs
+(elide-head--add-test gpl3-1 "\
+;; 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/>.
+" "GNU Emacs is distributed in the hope that")
+
+;; from libtorrent
+(elide-head--add-test gpl3-2 "\
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+" "This library is distributed in the hope that")
+
+;; from notmuch
+(elide-head--add-test gpl3-3 "\
+ * 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/ .
+" "This program is distributed in the hope that")
+
+;; from fribok
+(elide-head--add-test gpl3-4 "\
+/***************************************************************************
+ *   Copyright (C) 2007, 2009 by J. Random Hacker <jrh@example.org>        *
+ *                                                                         *
+ *   This program is free software: you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation, either version 3 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>  *.
+ *                                                                         *
+ ***************************************************************************/
+" "This program is distributed in the hope that")
+
+
+;;; GPLv2
+
+;; from jackmeter
+(elide-head--add-test gpl2-1 "\
+        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 2
+        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, write to the Free Software
+        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
USA.
+" "This program is distributed in the hope that")
+
 (provide 'elide-head-tests)
 ;;; elide-head-tests.el ends here
diff --git a/test/lisp/emacs-lisp/backquote-tests.el 
b/test/lisp/emacs-lisp/backquote-tests.el
index a196d0b886..2ba61726f0 100644
--- a/test/lisp/emacs-lisp/backquote-tests.el
+++ b/test/lisp/emacs-lisp/backquote-tests.el
@@ -1,6 +1,6 @@
 ;;; backquote-tests.el --- Tests for backquote.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el 
b/test/lisp/emacs-lisp/backtrace-tests.el
index e35a7a729b..b08695a22b 100644
--- a/test/lisp/emacs-lisp/backtrace-tests.el
+++ b/test/lisp/emacs-lisp/backtrace-tests.el
@@ -1,6 +1,6 @@
 ;;; backtrace-tests.el --- Tests for backtraces -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/benchmark-tests.el 
b/test/lisp/emacs-lisp/benchmark-tests.el
index 71bb52f82f..b3c4949acc 100644
--- a/test/lisp/emacs-lisp/benchmark-tests.el
+++ b/test/lisp/emacs-lisp/benchmark-tests.el
@@ -1,6 +1,6 @@
 ;;; benchmark-tests.el --- Test suite for benchmark.  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/bindat-tests.el 
b/test/lisp/emacs-lisp/bindat-tests.el
index 911a5f0c7b..7722cf6c02 100644
--- a/test/lisp/emacs-lisp/bindat-tests.el
+++ b/test/lisp/emacs-lisp/bindat-tests.el
@@ -1,6 +1,6 @@
 ;;; bindat-tests.el --- tests for bindat.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index a442eb473b..abd33ab8e5 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1,6 +1,6 @@
 ;;; bytecomp-tests.el --- Tests for bytecomp.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Shigeru Fukaya <shigeru.fukaya@gmail.com>
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/test/lisp/emacs-lisp/cconv-tests.el 
b/test/lisp/emacs-lisp/cconv-tests.el
index 479afe12c0..0668e44ba5 100644
--- a/test/lisp/emacs-lisp/cconv-tests.el
+++ b/test/lisp/emacs-lisp/cconv-tests.el
@@ -1,6 +1,6 @@
 ;;; cconv-tests.el --- Tests for cconv.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/check-declare-tests.el 
b/test/lisp/emacs-lisp/check-declare-tests.el
index 5c9d847e34..59dfc10163 100644
--- a/test/lisp/emacs-lisp/check-declare-tests.el
+++ b/test/lisp/emacs-lisp/check-declare-tests.el
@@ -1,6 +1,6 @@
 ;;; check-declare-tests.el --- Tests for check-declare.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el 
b/test/lisp/emacs-lisp/checkdoc-tests.el
index ef49e71599..289476f024 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -1,6 +1,6 @@
 ;;; checkdoc-tests.el --- unit tests for checkdoc.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el 
b/test/lisp/emacs-lisp/cl-extra-tests.el
index 91f0a1e201..801885c0d4 100644
--- a/test/lisp/emacs-lisp/cl-extra-tests.el
+++ b/test/lisp/emacs-lisp/cl-extra-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-extra-tests.el --- tests for emacs-lisp/cl-extra.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el 
b/test/lisp/emacs-lisp/cl-generic-tests.el
index 9c285a9fac..2ec01b2b5d 100644
--- a/test/lisp/emacs-lisp/cl-generic-tests.el
+++ b/test/lisp/emacs-lisp/cl-generic-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-generic-tests.el --- Tests for cl-generic.el functionality  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el 
b/test/lisp/emacs-lisp/cl-lib-tests.el
index a0facc81db..b19494af74 100644
--- a/test/lisp/emacs-lisp/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-lib-tests.el --- tests for emacs-lisp/cl-lib.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el 
b/test/lisp/emacs-lisp/cl-macs-tests.el
index 13da60ec45..008ec0de4a 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-macs-tests.el --- tests for emacs-lisp/cl-macs.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -666,7 +666,24 @@ collection clause."
   (should (pcase (macroexpand
                   '(cl-labels ((len (xs n) (if xs (len (cdr xs) (1+ n)) n)))
                      #'len))
-            (`(function (lambda (,_ ,_) . ,_)) t))))
+            (`(function (lambda (,_ ,_) . ,_)) t)))
+
+  ;; Verify that there is no tail position inside dynamic variable bindings.
+  (defvar dyn-var)
+  (let ((dyn-var 'a))
+    (cl-labels ((f (x) (if x
+                           dyn-var
+                         (let ((dyn-var 'b))
+                           (f dyn-var)))))
+      (should (equal (f nil) 'b))))
+
+  ;; Control: same as above but with lexical binding.
+  (let ((lex-var 'a))
+    (cl-labels ((f (x) (if x
+                           lex-var
+                         (let ((lex-var 'b))
+                           (f lex-var)))))
+      (should (equal (f nil) 'a)))))
 
 (ert-deftest cl-macs--progv ()
   (defvar cl-macs--test)
diff --git a/test/lisp/emacs-lisp/cl-preloaded-tests.el 
b/test/lisp/emacs-lisp/cl-preloaded-tests.el
index 97cb204f77..43cd7b6bff 100644
--- a/test/lisp/emacs-lisp/cl-preloaded-tests.el
+++ b/test/lisp/emacs-lisp/cl-preloaded-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-preloaded-tests.el --- unit tests for cl-preloaded.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 ;; Author: Philipp Stephani <phst@google.com>
 
 ;; This file is part of GNU Emacs.
diff --git a/test/lisp/emacs-lisp/cl-print-tests.el 
b/test/lisp/emacs-lisp/cl-print-tests.el
index 199795106a..57fe52a948 100644
--- a/test/lisp/emacs-lisp/cl-print-tests.el
+++ b/test/lisp/emacs-lisp/cl-print-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-print-tests.el --- Test suite for the cl-print facility.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/cl-seq-tests.el 
b/test/lisp/emacs-lisp/cl-seq-tests.el
index d0fad8907d..f42ae69873 100644
--- a/test/lisp/emacs-lisp/cl-seq-tests.el
+++ b/test/lisp/emacs-lisp/cl-seq-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-seq-tests.el --- Tests for cl-seq.el functionality  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Richard <youngfrog@members.fsf.org>
 
diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el 
b/test/lisp/emacs-lisp/comp-cstr-tests.el
index 59e1b6982e..ba7ab6331e 100644
--- a/test/lisp/emacs-lisp/comp-cstr-tests.el
+++ b/test/lisp/emacs-lisp/comp-cstr-tests.el
@@ -1,6 +1,6 @@
 ;;; comp-cstr-tests.el --- unit tests for src/comp.c -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.org>
 
diff --git a/test/lisp/emacs-lisp/copyright-tests.el 
b/test/lisp/emacs-lisp/copyright-tests.el
index 6bb6e350d1..dc82974a99 100644
--- a/test/lisp/emacs-lisp/copyright-tests.el
+++ b/test/lisp/emacs-lisp/copyright-tests.el
@@ -1,6 +1,6 @@
 ;;; copyright-tests.el --- tests for copyright.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/derived-tests.el 
b/test/lisp/emacs-lisp/derived-tests.el
index 2647b86826..d867a18183 100644
--- a/test/lisp/emacs-lisp/derived-tests.el
+++ b/test/lisp/emacs-lisp/derived-tests.el
@@ -1,6 +1,6 @@
 ;;; derived-tests.el --- tests for derived.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/easy-mmode-tests.el 
b/test/lisp/emacs-lisp/easy-mmode-tests.el
index 77eaed6257..0a3bbb189b 100644
--- a/test/lisp/emacs-lisp/easy-mmode-tests.el
+++ b/test/lisp/emacs-lisp/easy-mmode-tests.el
@@ -1,6 +1,6 @@
 ;;; easy-mmode-tests.el --- tests for easy-mmode.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el 
b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
index 9257f167d6..42d06889ea 100644
--- a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
+++ b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
@@ -1,6 +1,6 @@
 ;;; edebug-test-code.el --- Sample code for the Edebug test suite  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/edebug-tests.el 
b/test/lisp/emacs-lisp/edebug-tests.el
index 210bf24880..d238bffdaa 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -1,6 +1,6 @@
 ;;; edebug-tests.el --- Edebug test suite   -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
@@ -53,22 +53,20 @@ Since `should' failures which happen inside 
`post-command-hook' will
 be trapped by the command loop, this preserves them until we get
 back to the top level.")
 
-(defvar edebug-tests-keymap
-  (let ((map (make-sparse-keymap)))
-    (define-key map "@"     'edebug-tests-call-instrumented-func)
-    (define-key map "C-u"   'universal-argument)
-    (define-key map "C-p"   'previous-line)
-    (define-key map "C-n"   'next-line)
-    (define-key map "C-b"   'backward-char)
-    (define-key map "C-a"   'move-beginning-of-line)
-    (define-key map "C-e"   'move-end-of-line)
-    (define-key map "C-k"   'kill-line)
-    (define-key map "M-x"   'execute-extended-command)
-    (define-key map "C-M-x" 'eval-defun)
-    (define-key map "C-x X b" 'edebug-set-breakpoint)
-    (define-key map "C-x X w" 'edebug-where)
-    map)
-  "Keys used by the keyboard macros in Edebug's tests.")
+(defvar-keymap edebug-tests-keymap
+  :doc "Keys used by the keyboard macros in Edebug's tests."
+  "@"       'edebug-tests-call-instrumented-func
+  "C-u"     'universal-argument
+  "C-p"     'previous-line
+  "C-n"     'next-line
+  "C-b"     'backward-char
+  "C-a"     'move-beginning-of-line
+  "C-e"     'move-end-of-line
+  "C-k"     'kill-line
+  "M-x"     'execute-extended-command
+  "C-M-x"   'eval-defun
+  "C-x X b" 'edebug-set-breakpoint
+  "C-x X w" 'edebug-where)
 
 ;;; Macros for defining tests:
 
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
index e881e46a2d..af19c122b9 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
@@ -1,6 +1,6 @@
 ;;; eieio-test-methodinvoke.el --- eieio tests for method invocation  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2005, 2008, 2010, 2013-2021 Free Software Foundation,
+;; Copyright (C) 2005, 2008, 2010, 2013-2022 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
@@ -55,6 +55,9 @@
 ;;; Code:
 
 (require 'eieio)
+;; FIXME: See Bug#52971.
+(with-no-warnings
+  (require 'eieio-compat))
 (require 'ert)
 
 (defvar eieio-test-method-order-list nil
@@ -271,6 +274,7 @@
 (defclass E (E-base1 E-base2) () :method-invocation-order :breadth-first)
 
 (with-suppressed-warnings ((obsolete defmethod)
+                           (obsolete defgeneric)
                            (obsolete next-method-p)
                            (obsolete call-next-method))
   (defmethod eitest-F ((_p E))
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
index fd044ff373..e839e1262f 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
@@ -1,6 +1,6 @@
 ;;; eieio-test-persist.el --- Tests for eieio-persistent class  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
@@ -99,7 +99,7 @@ This is usually a symbol that starts with `:'."
 (defclass persist-simple (eieio-persistent)
   ((slot1 :initarg :slot1
          :type symbol
-         :initform moose)
+          :initform 'moose)
    (slot2 :initarg :slot2
          :initform "foo")
    (slot3 :initform 2))
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index 599d7900c3..9b27d4ab93 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -1,6 +1,6 @@
 ;;; eieio-tests.el --- eieio test routines -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2003, 2005-2010, 2012-2021 Free Software
+;; Copyright (C) 1999-2003, 2005-2010, 2012-2022 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
@@ -27,18 +27,26 @@
 (require 'ert)
 (require 'eieio)
 (require 'eieio-base)
+;; FIXME: See Bug#52971.
+(with-no-warnings
+  (require 'eieio-compat))
 (require 'eieio-opt)
 
 (eval-when-compile (require 'cl-lib))
 
+;; Silence byte-compiler.
+(eval-when-compile
+  (dolist (slot '(:a :b ooga-booga :derived-value missing-slot))
+    (cl-pushnew slot eieio--known-slot-names)))
+
 ;;; Code:
 ;; Set up some test classes
 (defclass class-a ()
   ((water :initarg :water
-         :initform h20
+          :initform 'h20
          :type symbol
          :documentation "Detail about water.")
-   (classslot :initform penguin
+   (classslot :initform 'penguin
              :type symbol
              :documentation "A class allocated slot."
              :allocation :class)
@@ -50,6 +58,9 @@
    )
   "Class A.")
 
+;; Silence compiler warning about `water' not being a class-allocated slot.
+(defclass eieio-tests--dummy () ((water :allocation :class)))
+
 (defclass class-b ()
   ((land :initform "Sc"
         :type string
@@ -61,40 +72,41 @@
              :documentation "Detail about amphibian on land and water."))
   "Class A and B combined.")
 
-(defclass class-c ()
-  ((slot-1 :initarg :moose
-          :initform moose
-          :type symbol
-          :allocation :instance
-          :documentation "First slot testing slot arguments."
-          :custom symbol
-          :label "Wild Animal"
-          :group borg
-          :protection :public)
-   (slot-2 :initarg :penguin
-          :initform "penguin"
-          :type string
-          :allocation :instance
-          :documentation "Second slot testing slot arguments."
-          :custom string
-          :label "Wild bird"
-          :group vorlon
-          :accessor get-slot-2
-          :protection :private)
-   (slot-3 :initarg :emu
-          :initform emu
-          :type symbol
-          :allocation :class
-          :documentation "Third slot test class allocated accessor"
-          :custom symbol
-          :label "Fuzz"
-          :group tokra
-          :accessor get-slot-3
-          :protection :private)
-   )
-  (:custom-groups (foo))
-  "A class for testing slot arguments."
-  )
+(with-no-warnings ; FIXME: Make more specific.
+  (defclass class-c ()
+    ((slot-1 :initarg :moose
+             :initform 'moose
+             :type symbol
+             :allocation :instance
+             :documentation "First slot testing slot arguments."
+             :custom symbol
+             :label "Wild Animal"
+             :group borg
+             :protection :public)
+     (slot-2 :initarg :penguin
+             :initform "penguin"
+             :type string
+             :allocation :instance
+             :documentation "Second slot testing slot arguments."
+             :custom string
+             :label "Wild bird"
+             :group vorlon
+             :accessor get-slot-2
+             :protection :private)
+     (slot-3 :initarg :emu
+             :initform 'emu
+             :type symbol
+             :allocation :class
+             :documentation "Third slot test class allocated accessor"
+             :custom symbol
+             :label "Fuzz"
+             :group tokra
+             :accessor get-slot-3
+             :protection :private)
+     )
+    (:custom-groups (foo))
+    "A class for testing slot arguments."
+    ))
 
 (defclass class-subc (class-c)
   ((slot-1 ;; :initform moose  - don't override this
@@ -132,21 +144,25 @@
 ;;      (error "invalid-slot-type thrown when 
eieio-error-unsupported-class-tags is nil")
 ;;      )))
 
+;; Silence byte-compiler.
+(declare-function eitest-subordinate--eieio-childp nil)
+(declare-function class-alloc-initarg--eieio-childp nil)
 (ert-deftest eieio-test-01-mix-alloc-initarg ()
   ;; Only run this test if the message framework thingy works.
-  (when (and (message "foo") (string= "foo" (current-message)))
+  (skip-unless (and (message "foo") (string= "foo" (current-message))))
 
-    ;; Defining this class should generate a warning(!) message that
-    ;; you should not mix :initarg with class allocated slots.
+  ;; Defining this class should generate a warning(!) message that
+  ;; you should not mix :initarg with class allocated slots.
+  (with-no-warnings ; FIXME: Make more specific.
     (defclass class-alloc-initarg ()
       ((throwwarning :initarg :throwwarning
-                    :allocation :class))
-      "Throw a warning mixing allocation class and an initarg.")
+                     :allocation :class))
+      "Throw a warning mixing allocation class and an initarg."))
 
-    ;; Check that message is there
-    (should (current-message))
-    (should (string-match "Class allocated slots do not need :initarg"
-                         (current-message)))))
+  ;; Check that message is there
+  (should (current-message))
+  (should (string-match "Class allocated slots do not need :initarg"
+                        (current-message))))
 
 (defclass abstract-class ()
   ((some-slot :initarg :some-slot
@@ -202,6 +218,9 @@ Argument C is the class bound to this static method."
     (if (eieio-object-p c) (setq c (eieio-object-class c)))
     (oset-default c some-slot value)))
 
+;; Silence byte-compiler.
+(declare-function static-method-class-2 nil)
+(declare-function static-method-class-2--eieio-childp nil)
 (ert-deftest eieio-test-04-static-method ()
   ;; Call static method on a class and see if it worked
   (static-method-class-method 'static-method-class 'class)
@@ -514,7 +533,7 @@ METHOD is the method that was attempting to be called."
 
 (defclass inittest nil
   ((staticval :initform 1)
-   (symval :initform eieio-test-permuting-value)
+   (symval :initform 'eieio-test-permuting-value)
    (evalval :initform (symbol-value 'eieio-test-permuting-value))
    (evalnow :initform (symbol-value 'eieio-test-permuting-value)
            :allocation :class)
@@ -531,8 +550,10 @@ METHOD is the method that was attempting to be called."
   (should (eq (oref eitest-pvinit evalval) 2))
   (should (eq (oref eitest-pvinit evalnow) 1)))
 
+;; Silence byte-compiler.
 (defvar eitest-tests nil)
-
+(declare-function eitest-superior nil)
+(declare-function eitest-superior--eieio-childp nil)
 (ert-deftest eieio-test-22-init-forms-dont-match-runnable ()
   ;; Init forms with types that don't match the runnable.
   (defclass eitest-subordinate nil
@@ -540,7 +561,7 @@ METHOD is the method that was attempting to be called."
     "Test class that will be a calculated value.")
 
   (defclass eitest-superior nil
-    ((sub :initform (eitest-subordinate)
+    ((sub :initform (funcall #'eitest-subordinate)
          :type eitest-subordinate))
     "A class with an initform that creates a class.")
 
@@ -580,7 +601,10 @@ METHOD is the method that was attempting to be called."
     (should-not (cl-typep listooa '(list-of class-b)))
     (should-not (cl-typep listoob '(list-of class-a)))))
 
+;; Silence byte-compiler.
 (defvar eitest-t1 nil)
+(declare-function eieio-tests-initform-not-evaluated-when-initarg-is-present 
nil)
+(declare-function 
eieio-tests-initform-not-evaluated-when-initarg-is-present--eieio-childp nil)
 (ert-deftest eieio-test-25-slot-tests ()
   (setq eitest-t1 (class-c))
   ;; Slot initialization
@@ -758,7 +782,7 @@ Do not override for `prot-2'."
   (should (eq (oref eitest-II3 slot3) 'penguin)))
 
 (defclass slotattr-base ()
-  ((initform :initform init)
+  ((initform :initform 'init)
    (type :type list)
    (initarg :initarg :initarg)
    (protection :protection :private)
@@ -773,7 +797,7 @@ Do not override for `prot-2'."
 Subclasses to override slot attributes.")
 
 (defclass slotattr-ok (slotattr-base)
-  ((initform :initform no-init)
+  ((initform :initform 'no-init)
    (initarg :initarg :initblarg)
    (custom :custom string
           :label "One String"
@@ -807,28 +831,29 @@ Subclasses to override slot attributes.")
   (let ((obj (slotattr-ok)))
     (should (eq (oref obj initform) 'no-init))))
 
-(defclass slotattr-class-base ()
-  ((initform :allocation :class
-            :initform init)
-   (type :allocation :class
-        :type list)
-   (initarg :allocation :class
-           :initarg :initarg)
-   (protection :allocation :class
-              :protection :private)
-   (custom :allocation :class
-          :custom (repeat string)
-          :label "Custom Strings"
-          :group moose)
-   (docstring :allocation :class
-             :documentation
-             "Replace the doc-string for this property.")
-   )
-  "Baseclass we will attempt to subclass.
-Subclasses to override slot attributes.")
+(with-no-warnings ; FIXME: Make more specific.
+  (defclass slotattr-class-base ()
+    ((initform :allocation :class
+               :initform 'init)
+     (type :allocation :class
+           :type list)
+     (initarg :allocation :class
+              :initarg :initarg)
+     (protection :allocation :class
+                 :protection :private)
+     (custom :allocation :class
+             :custom (repeat string)
+             :label "Custom Strings"
+             :group moose)
+     (docstring :allocation :class
+                :documentation
+                "Replace the doc-string for this property.")
+     )
+    "Baseclass we will attempt to subclass.
+Subclasses to override slot attributes."))
 
 (defclass slotattr-class-ok (slotattr-class-base)
-  ((initform :initform no-init)
+  ((initform :initform 'no-init)
    (initarg :initarg :initblarg)
    (custom :custom string
           :label "One String"
@@ -890,7 +915,7 @@ Subclasses to override slot attributes.")
   (should (setq eitest-CLONETEST2 (clone eitest-CLONETEST1))))
 
 (defclass IT (eieio-instance-tracker)
-  ((tracking-symbol :initform IT-list)
+  ((tracking-symbol :initform 'IT-list)
    (slot1 :initform 'die))
   "Instance Tracker test object.")
 
@@ -951,7 +976,12 @@ Subclasses to override slot attributes.")
 (ert-deftest eieio-test-37-obsolete-name-in-constructor ()
   ;; FIXME repeated intermittent failures on hydra and elsewhere (bug#24503).
   :tags '(:unstable)
-  (should (equal (eieio--testing "toto") '("toto" 2))))
+  ;; Disable byte-compiler "Warning: Obsolete name arg "toto" to
+  ;; constructor eieio--testing".  This could be made more specific
+  ;; with changes to `with-suppressed-warnings', but it's not worth
+  ;; the hassle for just this one test.
+  (with-no-warnings
+    (should (equal (eieio--testing "toto") '("toto" 2)))))
 
 (ert-deftest eieio-autoload ()
   "Tests to see whether reftex-auc has been autoloaded"
diff --git a/test/lisp/emacs-lisp/ert-tests.el 
b/test/lisp/emacs-lisp/ert-tests.el
index 1a8c9bf4f0..ac13064474 100644
--- a/test/lisp/emacs-lisp/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
@@ -1,6 +1,6 @@
 ;;; ert-tests.el --- ERT's self-tests  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2008, 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Christian Ohler <ohler@gnu.org>
 
@@ -495,6 +495,12 @@ This macro is used to test if macroexpansion in `should' 
works."
     (should (equal (ert-select-tests '(tag b) (list test)) (list test)))
     (should (equal (ert-select-tests '(tag c) (list test)) '()))))
 
+(ert-deftest ert-test-select-undefined ()
+  (let* ((symbol (make-symbol "ert-not-a-test"))
+         (data (should-error (ert-select-tests symbol t)
+                             :type 'ert-test-unbound)))
+    (should (eq (cadr data) symbol))))
+
 
 ;;; Tests for utility functions.
 (ert-deftest ert-test-parse-keys-and-body ()
diff --git a/test/lisp/emacs-lisp/ert-x-tests.el 
b/test/lisp/emacs-lisp/ert-x-tests.el
index 7106b7abc0..3869804110 100644
--- a/test/lisp/emacs-lisp/ert-x-tests.el
+++ b/test/lisp/emacs-lisp/ert-x-tests.el
@@ -1,6 +1,6 @@
 ;;; ert-x-tests.el --- Tests for ert-x.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Hagelberg
 ;;        Christian Ohler <ohler@gnu.org>
diff --git a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el 
b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
index 9040cc0727..9b9c863aa0 100644
--- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
+++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-mode.el --- Dummy major mode for testing `faceup'.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git 
a/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el 
b/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el
index 9fe5fe9218..137b43a5df 100644
--- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el
+++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-this-file-directory.el --- Support file for faceup tests  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git a/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el 
b/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el
index 0c7e001cc7..b9fcb4e886 100644
--- a/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el
+++ b/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-basics.el --- Tests for the `faceup' package.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git a/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el 
b/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el
index 16e172692c..f07b8d830b 100644
--- a/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el
+++ b/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-files.el --- Self test of `faceup' using dummy major mode.  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git a/test/lisp/emacs-lisp/find-func-tests.el 
b/test/lisp/emacs-lisp/find-func-tests.el
index 987e4047d3..d29d9ff656 100644
--- a/test/lisp/emacs-lisp/find-func-tests.el
+++ b/test/lisp/emacs-lisp/find-func-tests.el
@@ -1,6 +1,6 @@
 ;;; find-func-tests.el --- Unit tests for find-func.el  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/float-sup-tests.el 
b/test/lisp/emacs-lisp/float-sup-tests.el
index 9e87928c23..f4353d9e85 100644
--- a/test/lisp/emacs-lisp/float-sup-tests.el
+++ b/test/lisp/emacs-lisp/float-sup-tests.el
@@ -1,6 +1,6 @@
 ;;; float-sup-tests.el --- Tests for float-sup.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/generator-tests.el 
b/test/lisp/emacs-lisp/generator-tests.el
index 1d2aa7ab37..b7a21d49b2 100644
--- a/test/lisp/emacs-lisp/generator-tests.el
+++ b/test/lisp/emacs-lisp/generator-tests.el
@@ -1,6 +1,6 @@
 ;;; generator-tests.el --- Testing generators -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Colascione <dancol@dancol.org>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el
index 6ee274ae10..0757e3c7aa 100644
--- a/test/lisp/emacs-lisp/gv-tests.el
+++ b/test/lisp/emacs-lisp/gv-tests.el
@@ -1,6 +1,6 @@
 ;;; gv-tests.el --- tests for gv.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/let-alist-tests.el 
b/test/lisp/emacs-lisp/let-alist-tests.el
index bbceb04b49..c4e4feaad3 100644
--- a/test/lisp/emacs-lisp/let-alist-tests.el
+++ b/test/lisp/emacs-lisp/let-alist-tests.el
@@ -1,6 +1,6 @@
 ;;; let-alist.el --- tests for file handling. -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/lisp-mnt-tests.el 
b/test/lisp/emacs-lisp/lisp-mnt-tests.el
index d77804fbe6..200be7354a 100644
--- a/test/lisp/emacs-lisp/lisp-mnt-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mnt-tests.el
@@ -1,6 +1,6 @@
 ;;; lisp-mnt-tests.el --- Tests for lisp-mnt  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021  2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el 
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index e2cecdf6b0..fd1af75ba3 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; lisp-mode-tests.el --- Test Lisp editing commands  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/lisp-tests.el 
b/test/lisp/emacs-lisp/lisp-tests.el
index 7f4d50c595..901447ecd2 100644
--- a/test/lisp/emacs-lisp/lisp-tests.el
+++ b/test/lisp/emacs-lisp/lisp-tests.el
@@ -1,6 +1,6 @@
 ;;; lisp-tests.el --- Test Lisp editing commands     -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com>
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/test/lisp/emacs-lisp/macroexp-resources/m1.el 
b/test/lisp/emacs-lisp/macroexp-resources/m1.el
index 96b5f7091a..88c51e7526 100644
--- a/test/lisp/emacs-lisp/macroexp-resources/m1.el
+++ b/test/lisp/emacs-lisp/macroexp-resources/m1.el
@@ -1,27 +1,27 @@
 ;;; m1.el --- Some sample code for macroexp-tests    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021  Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
 
-;; This program is free software; you can redistribute it and/or modify
+;; 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.
 
-;; This program is distributed in the hope that it will be useful,
+;; 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
-;;
-
 ;;; Code:
 
 (defconst macroexp--m1-tests-filename (macroexp-file-name))
diff --git a/test/lisp/emacs-lisp/macroexp-resources/m2.el 
b/test/lisp/emacs-lisp/macroexp-resources/m2.el
index 4f2b96d8ca..cebe4cac12 100644
--- a/test/lisp/emacs-lisp/macroexp-resources/m2.el
+++ b/test/lisp/emacs-lisp/macroexp-resources/m2.el
@@ -1,27 +1,27 @@
 ;;; m2.el --- More sample code for macroexp-tests    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021  Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
 
-;; This program is free software; you can redistribute it and/or modify
+;; 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.
 
-;; This program is distributed in the hope that it will be useful,
+;; 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
-;;
-
 ;;; Code:
 
 (defconst macroexp--m2-tests-filename (macroexp-file-name))
diff --git a/test/lisp/emacs-lisp/macroexp-resources/vk.el 
b/test/lisp/emacs-lisp/macroexp-resources/vk.el
new file mode 100644
index 0000000000..d9ca33671e
--- /dev/null
+++ b/test/lisp/emacs-lisp/macroexp-resources/vk.el
@@ -0,0 +1,130 @@
+;;; vk.el --- test code for macroexp-tests    -*- lexical-binding: t -*-
+
+;; Copyright (C) 2021-2022 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 'macroexp)
+
+(defmacro vk-variable-kind (var)
+  (if (macroexp--dynamic-variable-p var) ''dyn ''lex))
+
+(defvar vk-a 1)
+(defconst vk-b 2)
+(defvar vk-c)
+
+(defun vk-f1 (x)
+  (defvar vk-u1)
+  (let ((vk-a 10)
+        (vk-b 20)
+        (vk-c 30)
+        (vk-u1 40)
+        (y 50))
+    (ignore vk-a vk-b vk-c vk-u1 x y)
+    (list
+     (vk-variable-kind vk-a)            ; dyn
+     (vk-variable-kind vk-b)            ; dyn
+     (vk-variable-kind vk-c)            ; dyn
+     (vk-variable-kind vk-u1)           ; dyn
+     (vk-variable-kind x)               ; lex
+     (vk-variable-kind y))))            ; lex
+
+(eval-and-compile
+  (defvar vk-u2)
+  (defun vk-f2 (x)
+    (defvar vk-v2)
+    (let ((vk-u2 11)
+          (vk-v2 12)
+          (y 13))
+      (ignore vk-u2 vk-v2 x y)
+      (list
+       (vk-variable-kind vk-u2)          ; dyn
+       (vk-variable-kind vk-v2)          ; dyn
+       (vk-variable-kind x)              ; lex
+       (vk-variable-kind y)))))          ; lex
+
+(eval-when-compile
+  (defvar vk-u3)
+  (defun vk-f3 (x)
+    (defvar vk-v3)
+    (let ((vk-a 23)
+          (vk-b 24)
+          (vk-u3 25)
+          (vk-v3 26)
+          (y 27))
+      (ignore vk-a vk-b vk-u3 vk-v3 x y)
+      (list
+       (vk-variable-kind vk-a)          ; dyn
+       (vk-variable-kind vk-b)          ; dyn
+       (vk-variable-kind vk-u3)         ; dyn
+       (vk-variable-kind vk-v3)         ; dyn
+       (vk-variable-kind x)             ; lex
+       (vk-variable-kind y)))))         ; lex
+
+(defconst vk-val3 (eval-when-compile (vk-f3 0)))
+
+(defconst vk-f4 '(lambda (x)
+                   (defvar vk-v4)
+                   (let ((vk-v4 31)
+                         (y 32))
+                     (ignore vk-v4 x y)
+                     (list
+                      (vk-variable-kind vk-a)   ; dyn
+                      (vk-variable-kind vk-b)   ; dyn
+                      (vk-variable-kind vk-v4)  ; dyn
+                      (vk-variable-kind x)      ; dyn
+                      (vk-variable-kind y)))))  ; dyn
+
+(defconst vk-f5 '(closure (t) (x)
+                   (defvar vk-v5)
+                   (let ((vk-v5 41)
+                         (y 42))
+                     (ignore vk-v5 x y)
+                     (list
+                      (vk-variable-kind vk-a)   ; dyn
+                      (vk-variable-kind vk-b)   ; dyn
+                      (vk-variable-kind vk-v5)  ; dyn
+                      (vk-variable-kind x)      ; lex
+                      (vk-variable-kind y)))))  ; lex
+
+(defun vk-f6 ()
+  (eval '(progn
+           (defvar vk-v6)
+           (let ((vk-v6 51)
+                 (y 52))
+             (ignore vk-v6 y)
+             (list
+              (vk-variable-kind vk-a)        ; dyn
+              (vk-variable-kind vk-b)        ; dyn
+              (vk-variable-kind vk-v6)       ; dyn
+              (vk-variable-kind vk-y))))))   ; dyn
+
+(defun vk-f7 ()
+  (eval '(progn
+           (defvar vk-v7)
+           (let ((vk-v7 51)
+                 (y 52))
+             (ignore vk-v7 y)
+             (list
+              (vk-variable-kind vk-a)        ; dyn
+              (vk-variable-kind vk-b)        ; dyn
+              (vk-variable-kind vk-v7)       ; dyn
+              (vk-variable-kind vk-y))))     ; lex
+        t))
+
+(provide 'vk)
diff --git a/test/lisp/emacs-lisp/macroexp-tests.el 
b/test/lisp/emacs-lisp/macroexp-tests.el
index 89d3882d1d..4e6bd8b8fc 100644
--- a/test/lisp/emacs-lisp/macroexp-tests.el
+++ b/test/lisp/emacs-lisp/macroexp-tests.el
@@ -1,29 +1,32 @@
 ;;; macroexp-tests.el --- Tests for macroexp.el      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021  Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
 
-;; This program is free software; you can redistribute it and/or modify
+;; 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.
 
-;; This program is distributed in the hope that it will be useful,
+;; 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
-;;
-
 ;;; Code:
 
+(require 'macroexp)
+(require 'ert-x)
+
 (ert-deftest macroexp--tests-fgrep ()
   (should (equal (macroexp--fgrep '((x) (y)) '([x] z ((u))))
                  '((x))))
@@ -67,6 +70,58 @@
     (should (equal "m1.el"
                    (file-name-nondirectory 
macroexp--m1-tests-comp-filename)))))
 
+(defun macroexp-tests--run-emacs (&rest args)
+  "Run Emacs in batch mode with ARGS, return output."
+  (let ((emacs (expand-file-name invocation-name invocation-directory)))
+    (with-temp-buffer
+      (let ((res (apply #'call-process emacs nil t nil
+                        "-Q" "--batch" args))
+            (output (buffer-string)))
+        (unless (equal res 0)
+          (message "%s" output)
+          (error "Inferior Emacs exited with status %S" res))
+        output))))
+
+(defun macroexp-tests--eval-in-subprocess (file expr)
+  (let ((output (macroexp-tests--run-emacs
+                 "-l" file (format "--eval=(print %S)" expr))))
+    (car (read-from-string output))))
+
+(defun macroexp-tests--byte-compile-in-subprocess (file)
+  "Byte-compile FILE using a subprocess to avoid contaminating the lisp state."
+  (let ((output (macroexp-tests--run-emacs "-f" "batch-byte-compile" file)))
+    (when output
+      (message "%s" output))))
+
+(ert-deftest macroexp--tests-dynamic-variable-p ()
+  "Test `macroexp--dynamic-variable-p'."
+  (let* ((vk-el (ert-resource-file "vk.el"))
+         (vk-elc (concat vk-el "c"))
+         (expr '(list (vk-f1 0)
+                      (vk-f2 0)
+                      vk-val3
+                      (funcall vk-f4 0)
+                      (funcall vk-f5 0)
+                      (vk-f6)
+                      (vk-f7))))
+    ;; We compile and run the test in separate processes for complete
+    ;; isolation between test cases.
+    (should (equal (macroexp-tests--eval-in-subprocess vk-el expr)
+                   '((dyn dyn dyn dyn lex lex)
+                     (dyn dyn lex lex)
+                     (dyn dyn dyn dyn lex lex)
+                     (dyn dyn dyn dyn dyn)
+                     (dyn dyn dyn lex lex)
+                     (dyn dyn dyn dyn)
+                     (dyn dyn dyn lex))))
+    (macroexp-tests--byte-compile-in-subprocess vk-el)
+    (should (equal (macroexp-tests--eval-in-subprocess vk-elc expr)
+                   '((dyn dyn dyn dyn lex lex)
+                     (dyn dyn lex lex)
+                     (dyn dyn dyn dyn lex lex)
+                     (dyn dyn dyn dyn dyn)
+                     (dyn dyn dyn lex lex)
+                     (dyn dyn dyn dyn)
+                     (dyn dyn dyn lex))))))
 
-(provide 'macroexp-tests)
 ;;; macroexp-tests.el ends here
diff --git a/test/lisp/emacs-lisp/map-tests.el 
b/test/lisp/emacs-lisp/map-tests.el
index afade8e295..314a1c9e30 100644
--- a/test/lisp/emacs-lisp/map-tests.el
+++ b/test/lisp/emacs-lisp/map-tests.el
@@ -1,6 +1,6 @@
 ;;; map-tests.el --- Tests for map.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/emacs-lisp/memory-report-tests.el 
b/test/lisp/emacs-lisp/memory-report-tests.el
index d37f09b34f..869144163b 100644
--- a/test/lisp/emacs-lisp/memory-report-tests.el
+++ b/test/lisp/emacs-lisp/memory-report-tests.el
@@ -1,6 +1,6 @@
 ;;; memory-report-tests.el --- tests for memory-report.el -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/multisession-tests.el 
b/test/lisp/emacs-lisp/multisession-tests.el
new file mode 100644
index 0000000000..5807c27bd2
--- /dev/null
+++ b/test/lisp/emacs-lisp/multisession-tests.el
@@ -0,0 +1,207 @@
+;;; multisession-tests.el --- Tests for multisession.el  -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 2021-2022 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 'multisession)
+(require 'ert)
+(require 'ert-x)
+(require 'cl-lib)
+
+(declare-function sqlite-close "sqlite.c")
+
+(ert-deftest multi-test-sqlite-simple ()
+  (skip-unless (sqlite-available-p))
+  (ert-with-temp-file dir
+    :directory t
+    (let ((user-init-file "/tmp/foo.el")
+          (multisession-storage 'sqlite)
+          (multisession-directory dir))
+      (unwind-protect
+          (progn
+            (define-multisession-variable multisession--foo 0
+              ""
+              :synchronized t)
+            (should (= (multisession-value multisession--foo) 0))
+            (cl-incf (multisession-value multisession--foo))
+            (should (= (multisession-value multisession--foo) 1))
+            (call-process
+             (concat invocation-directory invocation-name)
+             nil t nil
+             "-Q" "-batch"
+             "--eval" (prin1-to-string
+                       `(progn
+                          (require 'multisession)
+                          (let ((multisession-directory ,dir)
+                                (multisession-storage 'sqlite)
+                                (user-init-file "/tmp/foo.el"))
+                            (define-multisession-variable multisession--foo 0
+                              ""
+                              :synchronized t)
+                            (cl-incf (multisession-value 
multisession--foo))))))
+            (should (= (multisession-value multisession--foo) 2)))
+        (sqlite-close multisession--db)
+        (setq multisession--db nil)))))
+
+(ert-deftest multi-test-sqlite-busy ()
+  (skip-unless (sqlite-available-p))
+  (ert-with-temp-file dir
+    :directory t
+    (let ((user-init-file "/tmp/foo.el")
+          (multisession-directory dir)
+          (multisession-storage 'sqlite)
+          proc)
+      (unwind-protect
+          (progn
+            (define-multisession-variable multisession--bar 0
+              ""
+              :synchronized t)
+            (should (= (multisession-value multisession--bar) 0))
+            (cl-incf (multisession-value multisession--bar))
+            (should (= (multisession-value multisession--bar) 1))
+            (setq proc
+                  (start-process
+                   "other-emacs"
+                   nil
+                   (concat invocation-directory invocation-name)
+                   "-Q" "-batch"
+                   "--eval" (prin1-to-string
+                             `(progn
+                                (require 'multisession)
+                                (let ((multisession-directory ,dir)
+                                      (multisession-storage 'sqlite)
+                                      (user-init-file "/tmp/bar.el"))
+                                  (define-multisession-variable 
multisession--bar 0
+                                    "" :synchronized t)
+                                  (dotimes (i 100)
+                                    (cl-incf (multisession-value 
multisession--bar))))))))
+            (while (process-live-p proc)
+              (ignore-error 'sqlite-locked-error
+                (message "multisession--bar %s" (multisession-value 
multisession--bar))
+                ;;(cl-incf (multisession-value multisession--bar))
+                )
+              (sleep-for 0.1))
+            (message "multisession--bar ends up as %s" (multisession-value 
multisession--bar))
+            (should (< (multisession-value multisession--bar) 1003)))
+        (sqlite-close multisession--db)
+        (setq multisession--db nil)))))
+
+(ert-deftest multi-test-files-simple ()
+  (ert-with-temp-file dir
+    :directory t
+    (let ((user-init-file "/tmp/sfoo.el")
+          (multisession-storage 'files)
+          (multisession-directory dir))
+      (define-multisession-variable multisession--sfoo 0
+        ""
+        :synchronized t)
+      (should (= (multisession-value multisession--sfoo) 0))
+      (cl-incf (multisession-value multisession--sfoo))
+      (should (= (multisession-value multisession--sfoo) 1))
+      ;; On Windows and Haiku, we don't have sub-second resolution, so
+      ;; let some time pass to make the "later" logic work.
+      (when (memq system-type '(windows-nt haiku))
+        (sleep-for 0.6))
+      (call-process
+       (concat invocation-directory invocation-name)
+       nil t nil
+       "-Q" "-batch"
+       "--eval" (prin1-to-string
+                 `(progn
+                    (require 'multisession)
+                    (let ((multisession-directory ,dir)
+                          (multisession-storage 'files)
+                          (user-init-file "/tmp/sfoo.el"))
+                      (define-multisession-variable multisession--sfoo 0
+                        ""
+                        :synchronized t)
+                      (cl-incf (multisession-value multisession--sfoo))))))
+      (should (= (multisession-value multisession--sfoo) 2)))))
+
+(ert-deftest multi-test-files-busy ()
+  (skip-unless (sqlite-available-p))
+  (ert-with-temp-file dir
+    :directory t
+    (let ((user-init-file "/tmp/foo.el")
+          (multisession-storage 'files)
+          (multisession-directory dir)
+          proc)
+      (define-multisession-variable multisession--sbar 0
+        ""
+        :synchronized t)
+      (should (= (multisession-value multisession--sbar) 0))
+      (cl-incf (multisession-value multisession--sbar))
+      (should (= (multisession-value multisession--sbar) 1))
+      (setq proc
+            (start-process
+             "other-emacs"
+             nil
+             (concat invocation-directory invocation-name)
+             "-Q" "-batch"
+             "--eval" (prin1-to-string
+                       `(progn
+                          (require 'multisession)
+                          (let ((multisession-directory ,dir)
+                                (multisession-storage 'files)
+                                (user-init-file "/tmp/sbar.el"))
+                            (define-multisession-variable multisession--sbar 0
+                              "" :synchronized t)
+                            (dotimes (i 100)
+                              (cl-incf (multisession-value 
multisession--sbar))))))))
+      (while (process-live-p proc)
+        (message "multisession--sbar %s" (multisession-value 
multisession--sbar))
+        ;;(cl-incf (multisession-value multisession--sbar))
+        (sleep-for 0.1))
+      (message "multisession--sbar ends up as %s" (multisession-value 
multisession--sbar))
+      (should (< (multisession-value multisession--sbar) 200)))))
+
+(ert-deftest multi-test-files-some-values ()
+  (ert-with-temp-file dir
+    :directory t
+    (let ((user-init-file "/tmp/sfoo.el")
+          (multisession-storage 'files)
+          (multisession-directory dir))
+      (define-multisession-variable multisession--foo1 nil)
+      (should (eq (multisession-value multisession--foo1) nil))
+      (setf (multisession-value multisession--foo1) nil)
+      (should (eq (multisession-value multisession--foo1) nil))
+      (setf (multisession-value multisession--foo1) t)
+      (should (eq (multisession-value multisession--foo1) t))
+
+      (define-multisession-variable multisession--foo2 t)
+      (setf (multisession-value multisession--foo2) nil)
+      (should (eq (multisession-value multisession--foo2) nil))
+      (setf (multisession-value multisession--foo2) t)
+      (should (eq (multisession-value multisession--foo2) t))
+
+      (define-multisession-variable multisession--foo3 t)
+      (should-error (setf (multisession-value multisession--foo3) 
(make-marker)))
+
+      (let ((string (with-temp-buffer
+                      (set-buffer-multibyte nil)
+                      (insert 0 1 2)
+                      (buffer-string))))
+        (should-not (multibyte-string-p string))
+        (define-multisession-variable multisession--foo4 nil)
+        (setf (multisession-value multisession--foo4) string)
+        (should (equal (multisession-value multisession--foo4) string))))))
+
+;;; multisession-tests.el ends here
diff --git a/test/lisp/emacs-lisp/nadvice-tests.el 
b/test/lisp/emacs-lisp/nadvice-tests.el
index cd59f44033..9cd14c4c29 100644
--- a/test/lisp/emacs-lisp/nadvice-tests.el
+++ b/test/lisp/emacs-lisp/nadvice-tests.el
@@ -1,6 +1,6 @@
 ;;; nadvice-tests.el --- Test suite for the new advice thingy.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh 
b/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh
index ca16f8b27a..c3e82fd173 100755
--- a/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh
+++ b/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh
@@ -2,7 +2,7 @@
 
 # Generate a new key and update the signatures for tests.
 
-# Copyright (C) 2020-2021 Free Software Foundation, Inc.
+# Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/package-tests.el 
b/test/lisp/emacs-lisp/package-tests.el
index efa9f83411..d7a55998c2 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -1,6 +1,6 @@
 ;;; package-tests.el --- Tests for the Emacs package system  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Hackney <dan@haxney.org>
 ;; Version: 1.0
diff --git a/test/lisp/emacs-lisp/pcase-tests.el 
b/test/lisp/emacs-lisp/pcase-tests.el
index 7ad01e7aef..8060799080 100644
--- a/test/lisp/emacs-lisp/pcase-tests.el
+++ b/test/lisp/emacs-lisp/pcase-tests.el
@@ -1,6 +1,6 @@
 ;;; pcase-tests.el --- Test suite for pcase macro.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -107,8 +107,11 @@
   (should (equal (pcase 1
                    ((cl-type (integer 0 2)) 'integer-0<=n<=2))
                  'integer-0<=n<=2))
-  (should-error (pcase 1
-                  ((cl-type notatype) 'integer))))
+  (should-error
+   ;; Avoid error at compile time due to compiler macro.
+   (eval '(pcase 1
+            ((cl-type notatype) 'integer))
+         t)))
 
 (ert-deftest pcase-tests-setq ()
   (should (equal (let (a b)
diff --git a/test/lisp/emacs-lisp/pp-resources/code-formats.erts 
b/test/lisp/emacs-lisp/pp-resources/code-formats.erts
index 2b2001d096..002a5cf165 100644
--- a/test/lisp/emacs-lisp/pp-resources/code-formats.erts
+++ b/test/lisp/emacs-lisp/pp-resources/code-formats.erts
@@ -122,3 +122,9 @@ Name: code-formats11
 (lambda ()
   [(foo bar) (foo bar)])
 =-=-=
+
+Name: code-formats12
+
+=-=
+(global-set-key (kbd "s-x") #'kill-region)
+=-=-=
diff --git a/test/lisp/emacs-lisp/pp-tests.el b/test/lisp/emacs-lisp/pp-tests.el
index 4cae1a7377..01ac572c53 100644
--- a/test/lisp/emacs-lisp/pp-tests.el
+++ b/test/lisp/emacs-lisp/pp-tests.el
@@ -1,6 +1,6 @@
 ;;; pp-tests.el --- Test suite for pretty printer.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/regexp-opt-tests.el 
b/test/lisp/emacs-lisp/regexp-opt-tests.el
index 65494e20df..46ed7c29b2 100644
--- a/test/lisp/emacs-lisp/regexp-opt-tests.el
+++ b/test/lisp/emacs-lisp/regexp-opt-tests.el
@@ -1,6 +1,6 @@
 ;;; regexp-opt-tests.el --- Tests for regexp-opt.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:       internal
diff --git a/test/lisp/emacs-lisp/ring-tests.el 
b/test/lisp/emacs-lisp/ring-tests.el
index 3ec20a1e8e..6bbcd94f20 100644
--- a/test/lisp/emacs-lisp/ring-tests.el
+++ b/test/lisp/emacs-lisp/ring-tests.el
@@ -1,6 +1,6 @@
 ;;; ring-tests.el --- Tests for ring.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/rmc-tests.el 
b/test/lisp/emacs-lisp/rmc-tests.el
index 9d8f3d4801..c1c46d6400 100644
--- a/test/lisp/emacs-lisp/rmc-tests.el
+++ b/test/lisp/emacs-lisp/rmc-tests.el
@@ -1,6 +1,6 @@
 ;;; rmc-tests.el --- Test suite for rmc.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 ;; Keywords:
@@ -22,14 +22,42 @@
 
 ;;; Commentary:
 
-;;
-
 ;;; Code:
 
 (require 'ert)
 (require 'rmc)
+(require 'cl-lib)
 (eval-when-compile (require 'cl-lib))
 
+(ert-deftest test-rmc--add-key-description ()
+  (cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ 
_) t)))
+    (should (equal (rmc--add-key-description '(?y "yes"))
+                   '(?y . "yes")))
+    (should (equal (rmc--add-key-description '(?n "foo"))
+                   '(?n . "n foo")))
+    (should (equal (rmc--add-key-description '(?\s "foo bar"))
+                   `(?\s . "SPC foo bar")))))
+
+(ert-deftest test-rmc--add-key-description/with-attributes ()
+  (cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ 
_) t)))
+    (should (equal-including-properties
+             (rmc--add-key-description '(?y "yes"))
+             `(?y . ,(concat (propertize "y" 'face 'read-multiple-choice-face) 
"es"))))
+    (should (equal-including-properties
+             (rmc--add-key-description '(?n "foo"))
+             `(?n . ,(concat (propertize "n" 'face 'read-multiple-choice-face) 
" foo"))))
+    (should (equal-including-properties
+             (rmc--add-key-description '(?\s "foo bar"))
+             `(?\s . ,(concat (propertize "SPC" 'face 
'read-multiple-choice-face) " foo bar"))))))
+
+(ert-deftest test-rmc--add-key-description/non-graphical-display ()
+  (cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ 
_) nil)))
+    (should (equal-including-properties
+             (rmc--add-key-description '(?y "yes"))
+             '(?y . "[Y]es")))
+    (should (equal-including-properties
+             (rmc--add-key-description '(?n "foo"))
+             `(?n . ,(concat (propertize "n" 'face 'help-key-binding) " 
foo"))))))
 
 (ert-deftest test-read-multiple-choice ()
   (dolist (char '(?y ?n))
@@ -38,6 +66,5 @@
       (should (equal (list char str)
                      (read-multiple-choice "Do it? " '((?y "yes") (?n 
"no"))))))))
 
-
 (provide 'rmc-tests)
 ;;; rmc-tests.el ends here
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index 3bc35feb6d..125ddee859 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -1,6 +1,6 @@
 ;;; rx-tests.el --- tests for rx.el              -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/seq-tests.el 
b/test/lisp/emacs-lisp/seq-tests.el
index 4b940af81f..9e5d59163f 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -1,6 +1,6 @@
 ;;; seq-tests.el --- Tests for seq.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/emacs-lisp/shadow-tests.el 
b/test/lisp/emacs-lisp/shadow-tests.el
index 52d1d21cee..a91c4efd04 100644
--- a/test/lisp/emacs-lisp/shadow-tests.el
+++ b/test/lisp/emacs-lisp/shadow-tests.el
@@ -1,6 +1,6 @@
 ;;; shadow-tests.el --- Test suite for shadow.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/shortdoc-tests.el 
b/test/lisp/emacs-lisp/shortdoc-tests.el
index cfb0b4244b..8515b9fdfb 100644
--- a/test/lisp/emacs-lisp/shortdoc-tests.el
+++ b/test/lisp/emacs-lisp/shortdoc-tests.el
@@ -1,6 +1,6 @@
 ;;; shortdoc-tests.el --- tests for shortdoc.el   -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -44,6 +44,17 @@
                 (should (shortdoc-tests--tree-contains expr fun))))
             (setq props (cddr props))))))))
 
+(ert-deftest shortdoc-all-groups-work ()
+  "Test that all defined shortdoc groups display correctly."
+  (dolist (group (mapcar (lambda (x) (car x)) shortdoc--groups))
+    (let ((buf-name (format "*Shortdoc %s*" group)) buf)
+      (unwind-protect
+          (progn
+            (shortdoc-display-group group)
+            (should (setq buf (get-buffer buf-name))))
+        (when buf
+          (kill-buffer buf))))))
+
 (provide 'shortdoc-tests)
 
 ;;; shortdoc-tests.el ends here
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el 
b/test/lisp/emacs-lisp/subr-x-tests.el
index 821b6770ba..d38a8e2352 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -1,6 +1,6 @@
 ;;; subr-x-tests.el --- Testing the extended lisp routines  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Fabián E. Gallina <fgallina@gnu.org>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/syntax-tests.el 
b/test/lisp/emacs-lisp/syntax-tests.el
index 1ae1cbc93f..53812c0c80 100644
--- a/test/lisp/emacs-lisp/syntax-tests.el
+++ b/test/lisp/emacs-lisp/syntax-tests.el
@@ -1,6 +1,6 @@
 ;;; syntax-tests.el --- tests for syntax.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/tabulated-list-tests.el 
b/test/lisp/emacs-lisp/tabulated-list-tests.el
index e376d2f328..0074b10170 100644
--- a/test/lisp/emacs-lisp/tabulated-list-tests.el
+++ b/test/lisp/emacs-lisp/tabulated-list-tests.el
@@ -1,6 +1,6 @@
 ;;; tabulated-list-tests.el --- Tests for emacs-lisp/tabulated-list.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 
diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el 
b/test/lisp/emacs-lisp/testcover-resources/testcases.el
index 4d49e5ae70..46040be1a6 100644
--- a/test/lisp/emacs-lisp/testcover-resources/testcases.el
+++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el
@@ -1,6 +1,6 @@
 ;;;; testcases.el -- Test cases for testcover-tests.el
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/testcover-tests.el 
b/test/lisp/emacs-lisp/testcover-tests.el
index a7e055a28b..39cd3175c2 100644
--- a/test/lisp/emacs-lisp/testcover-tests.el
+++ b/test/lisp/emacs-lisp/testcover-tests.el
@@ -1,6 +1,6 @@
 ;;; testcover-tests.el --- Testcover test suite   -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el 
b/test/lisp/emacs-lisp/text-property-search-tests.el
index 90f06c3c4c..d137572f30 100644
--- a/test/lisp/emacs-lisp/text-property-search-tests.el
+++ b/test/lisp/emacs-lisp/text-property-search-tests.el
@@ -1,6 +1,6 @@
 ;;; text-property-search-tests.el --- Testing text-property-search  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/thunk-tests.el 
b/test/lisp/emacs-lisp/thunk-tests.el
index 1a8537f3b7..f593737fd2 100644
--- a/test/lisp/emacs-lisp/thunk-tests.el
+++ b/test/lisp/emacs-lisp/thunk-tests.el
@@ -1,6 +1,6 @@
 ;;; thunk-tests.el --- Tests for thunk.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/emacs-lisp/timer-tests.el 
b/test/lisp/emacs-lisp/timer-tests.el
index 0f5b1a7186..4d974cfd9d 100644
--- a/test/lisp/emacs-lisp/timer-tests.el
+++ b/test/lisp/emacs-lisp/timer-tests.el
@@ -1,6 +1,6 @@
 ;;; timer-tests.el --- tests for timers -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/unsafep-tests.el 
b/test/lisp/emacs-lisp/unsafep-tests.el
index f0d9b03243..fdd82b4fc3 100644
--- a/test/lisp/emacs-lisp/unsafep-tests.el
+++ b/test/lisp/emacs-lisp/unsafep-tests.el
@@ -2,7 +2,7 @@
 
 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/warnings-tests.el 
b/test/lisp/emacs-lisp/warnings-tests.el
index aa39463482..3b12092505 100644
--- a/test/lisp/emacs-lisp/warnings-tests.el
+++ b/test/lisp/emacs-lisp/warnings-tests.el
@@ -2,7 +2,7 @@
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emulation/viper-tests.el 
b/test/lisp/emulation/viper-tests.el
index b8efc87ab7..1d2bf46b19 100644
--- a/test/lisp/emulation/viper-tests.el
+++ b/test/lisp/emulation/viper-tests.el
@@ -1,6 +1,6 @@
 ;;; viper-tests.el --- tests for viper.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/epg-config-tests.el b/test/lisp/epg-config-tests.el
index fba61e573c..ac065909c4 100644
--- a/test/lisp/epg-config-tests.el
+++ b/test/lisp/epg-config-tests.el
@@ -1,6 +1,6 @@
 ;;; epg-config-tests.el --- Test suite for epg.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index 1384221c49..65aaafd9f1 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -1,6 +1,6 @@
 ;;; epg-tests.el --- Test suite for epg.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index b2dbc1012d..5603e76454 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -1,6 +1,6 @@
 ;;; erc-tests.el --- Tests for erc.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el
index b2687a96ab..475a436bb1 100644
--- a/test/lisp/erc/erc-track-tests.el
+++ b/test/lisp/erc/erc-track-tests.el
@@ -1,6 +1,6 @@
 ;;; erc-track-tests.el --- Tests for erc-track.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Author: Vivek Dasmohapatra <vivek@etla.org>
diff --git a/test/lisp/eshell/em-hist-tests.el 
b/test/lisp/eshell/em-hist-tests.el
index 5bc5690675..634e981983 100644
--- a/test/lisp/eshell/em-hist-tests.el
+++ b/test/lisp/eshell/em-hist-tests.el
@@ -1,6 +1,6 @@
 ;;; em-hist-tests.el --- em-hist test suite  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/eshell/em-ls-tests.el b/test/lisp/eshell/em-ls-tests.el
index 3ea11ab2de..272280e81c 100644
--- a/test/lisp/eshell/em-ls-tests.el
+++ b/test/lisp/eshell/em-ls-tests.el
@@ -1,6 +1,6 @@
 ;;; em-ls-tests.el --- em-ls test suite  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 
diff --git a/test/lisp/eshell/esh-opt-tests.el 
b/test/lisp/eshell/esh-opt-tests.el
index e2a0ea59d1..532adfb733 100644
--- a/test/lisp/eshell/esh-opt-tests.el
+++ b/test/lisp/eshell/esh-opt-tests.el
@@ -1,6 +1,6 @@
 ;;; esh-opt-tests.el --- esh-opt test suite  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index 0974784ef4..aef1447907 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -1,6 +1,6 @@
 ;;; eshell-tests.el --- Eshell test suite  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
diff --git a/test/lisp/faces-resources/faces-test-dark-theme.el 
b/test/lisp/faces-resources/faces-test-dark-theme.el
index 7e8871ec10..37f793a16e 100644
--- a/test/lisp/faces-resources/faces-test-dark-theme.el
+++ b/test/lisp/faces-resources/faces-test-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; faces-test-dark-theme.el --- A dark theme from tests ;;; -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/faces-resources/faces-test-light-theme.el 
b/test/lisp/faces-resources/faces-test-light-theme.el
index 70a7501761..f89ccf36c5 100644
--- a/test/lisp/faces-resources/faces-test-light-theme.el
+++ b/test/lisp/faces-resources/faces-test-light-theme.el
@@ -1,6 +1,6 @@
 ;;; faces-test-light-theme.el --- A dark theme from tests ;;; -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el
index fe5f3ec95f..f28f9e6aed 100644
--- a/test/lisp/faces-tests.el
+++ b/test/lisp/faces-tests.el
@@ -1,6 +1,6 @@
 ;;; faces-tests.el --- Tests for faces.el            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index df5c264baa..aebc9b6dbb 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -1,6 +1,6 @@
 ;;; ffap-tests.el --- Test suite for ffap.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 0fe72f278d..13bb2cd345 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -1,6 +1,6 @@
 ;;; filenotify-tests.el --- Tests of file notifications  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 462048802f..a3c67bc3d6 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1,6 +1,6 @@
 ;;; files-tests.el --- tests for files.el.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el
index e97e2c325e..60787e1cd3 100644
--- a/test/lisp/files-x-tests.el
+++ b/test/lisp/files-x-tests.el
@@ -1,6 +1,6 @@
 ;;; files-x-tests.el --- tests for files-x.el.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/find-cmd-tests.el b/test/lisp/find-cmd-tests.el
index b8e0f27398..853ac9e27b 100644
--- a/test/lisp/find-cmd-tests.el
+++ b/test/lisp/find-cmd-tests.el
@@ -1,6 +1,6 @@
 ;;; find-cmd-tests.el --- tests for find-cmd.el.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/font-lock-tests.el b/test/lisp/font-lock-tests.el
index eba51f2885..acdfc5a63d 100644
--- a/test/lisp/font-lock-tests.el
+++ b/test/lisp/font-lock-tests.el
@@ -1,6 +1,6 @@
 ;;; font-lock-tests.el --- Test suite for font-lock. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/format-spec-tests.el b/test/lisp/format-spec-tests.el
index 3c6fa540fe..4a3cc74c33 100644
--- a/test/lisp/format-spec-tests.el
+++ b/test/lisp/format-spec-tests.el
@@ -1,6 +1,6 @@
 ;;; format-spec-tests.el --- tests for format-spec.el -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/gnus/gnus-group-tests.el 
b/test/lisp/gnus/gnus-group-tests.el
index ee1e01be4b..4ae5fea3eb 100644
--- a/test/lisp/gnus/gnus-group-tests.el
+++ b/test/lisp/gnus/gnus-group-tests.el
@@ -1,6 +1,6 @@
 ;;; gnus-group-tests.el --- Tests for gnus-group.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/gnus/gnus-icalendar-tests.el 
b/test/lisp/gnus/gnus-icalendar-tests.el
index 1206a976f6..348ddf9f05 100644
--- a/test/lisp/gnus/gnus-icalendar-tests.el
+++ b/test/lisp/gnus/gnus-icalendar-tests.el
@@ -1,6 +1,6 @@
 ;;; gnus-icalendar-tests.el --- tests                -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Jan Tatarik <jan.tatarik@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/gnus/gnus-search-tests.el 
b/test/lisp/gnus/gnus-search-tests.el
index 9f012d4e88..4a5def97d3 100644
--- a/test/lisp/gnus/gnus-search-tests.el
+++ b/test/lisp/gnus/gnus-search-tests.el
@@ -1,6 +1,6 @@
 ;;; gnus-search-tests.el --- Tests for Gnus' search routines  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017, 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
 ;; Keywords:
diff --git a/test/lisp/gnus/gnus-test-headers.el 
b/test/lisp/gnus/gnus-test-headers.el
index a240784ee0..730c10f981 100644
--- a/test/lisp/gnus/gnus-test-headers.el
+++ b/test/lisp/gnus/gnus-test-headers.el
@@ -1,6 +1,6 @@
 ;;; gnus-test-headers.el --- Tests for Gnus header-related functions  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
 
diff --git a/test/lisp/gnus/gnus-tests.el b/test/lisp/gnus/gnus-tests.el
index 6602e67a34..4c5a6a8191 100644
--- a/test/lisp/gnus/gnus-tests.el
+++ b/test/lisp/gnus/gnus-tests.el
@@ -1,6 +1,6 @@
 ;;; gnus-tests.el --- Wrapper for the Gnus tests  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
 
diff --git a/test/lisp/gnus/gnus-util-tests.el 
b/test/lisp/gnus/gnus-util-tests.el
index 60a9cde0e7..464567061f 100644
--- a/test/lisp/gnus/gnus-util-tests.el
+++ b/test/lisp/gnus/gnus-util-tests.el
@@ -1,5 +1,5 @@
 ;;; gnus-util-tests.el --- Selectived tests only.  -*- lexical-binding:t -*-
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Jens Lechtenbörger <jens.lechtenboerger@fsfe.org>
 
diff --git a/test/lisp/gnus/message-tests.el b/test/lisp/gnus/message-tests.el
index 0f42f62f38..8f3c1250a9 100644
--- a/test/lisp/gnus/message-tests.el
+++ b/test/lisp/gnus/message-tests.el
@@ -1,6 +1,6 @@
 ;;; message-tests.el --- Tests for message-mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 
diff --git a/test/lisp/gnus/mm-decode-tests.el 
b/test/lisp/gnus/mm-decode-tests.el
index 586097aaf3..5f39a32b0d 100644
--- a/test/lisp/gnus/mm-decode-tests.el
+++ b/test/lisp/gnus/mm-decode-tests.el
@@ -1,6 +1,6 @@
 ;;; mm-decode-tests.el ---  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el
index a7ed7d3975..182d82b961 100644
--- a/test/lisp/gnus/mml-sec-tests.el
+++ b/test/lisp/gnus/mml-sec-tests.el
@@ -1,6 +1,6 @@
 ;;; mml-sec-tests.el --- Tests mml-sec.el, see README-mml-secure.txt.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2015, 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Jens Lechtenbörger <jens.lechtenboerger@fsfe.org>
 
diff --git a/test/lisp/gnus/nnrss-tests.el b/test/lisp/gnus/nnrss-tests.el
index 92b7dacf18..47d208cb16 100644
--- a/test/lisp/gnus/nnrss-tests.el
+++ b/test/lisp/gnus/nnrss-tests.el
@@ -1,6 +1,6 @@
 ;;; nnrss-tests.el --- tests for gnus/nnrss.el    -*- lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index 24a42290a3..6ee7b4f3eb 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -1,6 +1,6 @@
 ;;; help-fns-tests.el --- tests for help-fns.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el
index 43db59d4b1..c0c1cf8b53 100644
--- a/test/lisp/help-mode-tests.el
+++ b/test/lisp/help-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; help-mode-tests.el --- Tests for help-mode.el    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el
index 281d97ee92..d27e3d7cd4 100644
--- a/test/lisp/help-tests.el
+++ b/test/lisp/help-tests.el
@@ -1,6 +1,6 @@
 ;;; help-tests.el --- Tests for help.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <lekktu@gmail.com>
 ;;         Eli Zaretskii <eliz@gnu.org>
@@ -106,11 +106,34 @@
   (should (eq (get-text-property 0 'face (substitute-command-keys "\\`f'"))
               'help-key-binding)))
 
+(defvar-keymap help-tests--test-keymap
+  :doc "Just some keymap for testing."
+  "C-g"           #'abort-minibuffers
+  "TAB"           #'minibuffer-complete
+  "C-j"           #'minibuffer-complete-and-exit
+  "RET"           #'minibuffer-complete-and-exit
+  "SPC"           #'minibuffer-complete-word
+  "?"             #'minibuffer-completion-help
+  "C-<tab>"       #'file-cache-minibuffer-complete
+  "<XF86Back>"    #'previous-history-element
+  "<XF86Forward>" #'next-history-element
+  "<backtab>"     #'minibuffer-complete
+  "<down>"        #'next-line-or-history-element
+  "<next>"        #'next-history-element
+  "<prior>"       #'switch-to-completions
+  "<up>"          #'previous-line-or-history-element
+  "M-v"           #'switch-to-completions
+  "M-<"           #'minibuffer-beginning-of-buffer
+  "M-n"           #'next-history-element
+  "M-p"           #'previous-history-element
+  "M-r"           #'previous-matching-history-element
+  "M-s"           #'next-matching-history-element
+  "M-g M-c"       #'switch-to-completions)
 
 (ert-deftest help-tests-substitute-command-keys/keymaps ()
   (with-substitute-command-keys-test
-   (test-re "\\{minibuffer-local-must-match-map}"
-         "
+   (test-re "\\{help-tests--test-keymap}"
+            "
 Key             Binding
 -+
 C-g            abort-minibuffers
@@ -122,18 +145,18 @@ SPC               minibuffer-complete-word
 C-<tab>                file-cache-minibuffer-complete
 <XF86Back>     previous-history-element
 <XF86Forward>  next-history-element
+<backtab>      minibuffer-complete
 <down>         next-line-or-history-element
 <next>         next-history-element
 <prior>                switch-to-completions
 <up>           previous-line-or-history-element
 
-M-v            switch-to-completions
-
 M-<            minibuffer-beginning-of-buffer
 M-n            next-history-element
 M-p            previous-history-element
 M-r            previous-matching-history-element
 M-s            next-matching-history-element
+M-v            switch-to-completions
 
 M-g M-c                switch-to-completions
 ")))
@@ -143,12 +166,11 @@ M-g M-c           switch-to-completions
    (test "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]" "C-]")
    (test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x")))
 
-(defvar help-tests-remap-map
-  (let ((map (make-keymap)))
-    (define-key map (kbd "x") 'foo)
-    (define-key map (kbd "y") 'bar)
-    (define-key map [remap foo] 'bar)
-    map))
+(defvar-keymap help-tests-remap-map
+  :full t
+  "x" 'foo
+  "y" 'bar
+  "<remap> <foo>" 'bar)
 
 (ert-deftest help-tests-substitute-command-keys/remap ()
   (should (equal (substitute-command-keys "\\<help-tests-remap-map>\\[foo]") 
"y"))
@@ -212,30 +234,28 @@ M-g M-c           switch-to-completions
     (goto-char (point-min))
     (should (looking-at "Type RET on"))))
 
-(defvar help-tests-major-mode-map
-  (let ((map (make-keymap)))
-    (define-key map "x" 'foo-original)
-    (define-key map "1" 'foo-range)
-    (define-key map "2" 'foo-range)
-    (define-key map "3" 'foo-range)
-    (define-key map "4" 'foo-range)
-    (define-key map (kbd "C-e") 'foo-something)
-    (define-key map '[F1] 'foo-function-key1)
-    (define-key map "(" 'short-range)
-    (define-key map ")" 'short-range)
-    (define-key map "a" 'foo-other-range)
-    (define-key map "b" 'foo-other-range)
-    (define-key map "c" 'foo-other-range)
-    map))
+(defvar-keymap help-tests-major-mode-map
+  :full t
+  "x"    'foo-original
+  "1"    'foo-range
+  "2"    'foo-range
+  "3"    'foo-range
+  "4"    'foo-range
+  "C-e"  'foo-something
+  "<f1>" 'foo-function-key1
+  "("    'short-range
+  ")"    'short-range
+  "a"    'foo-other-range
+  "b"    'foo-other-range
+  "c"    'foo-other-range)
 
 (define-derived-mode help-tests-major-mode nil
   "Major mode for testing shadowing.")
 
-(defvar help-tests-minor-mode-map
-  (let ((map (make-keymap)))
-    (define-key map "x" 'foo-shadow)
-    (define-key map (kbd "C-e") 'foo-shadow)
-    map))
+(defvar-keymap help-tests-minor-mode-map
+  :full t
+  "x"   'foo-shadow
+  "C-e" 'foo-shadow)
 
 (define-minor-mode help-tests-minor-mode
   "Minor mode for testing shadowing.")
diff --git a/test/lisp/hfy-cmap-tests.el b/test/lisp/hfy-cmap-tests.el
index 7e0be3753b..fa9c51df4c 100644
--- a/test/lisp/hfy-cmap-tests.el
+++ b/test/lisp/hfy-cmap-tests.el
@@ -1,6 +1,6 @@
 ;;; hfy-cmap-tests.el --- tests for hfy-cmap.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/hi-lock-tests.el b/test/lisp/hi-lock-tests.el
index 200caa7e1a..71983c713d 100644
--- a/test/lisp/hi-lock-tests.el
+++ b/test/lisp/hi-lock-tests.el
@@ -1,6 +1,6 @@
 ;;; hi-lock-tests.el --- Tests for hi-lock.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/htmlfontify-tests.el b/test/lisp/htmlfontify-tests.el
index 15798319a1..fdfe996b03 100644
--- a/test/lisp/htmlfontify-tests.el
+++ b/test/lisp/htmlfontify-tests.el
@@ -1,6 +1,6 @@
 ;;; htmlfontify-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el
index 9b0327b0ef..252d2c5d7f 100644
--- a/test/lisp/ibuffer-tests.el
+++ b/test/lisp/ibuffer-tests.el
@@ -1,6 +1,6 @@
 ;;; ibuffer-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/ido-tests.el b/test/lisp/ido-tests.el
index 90a64b2fd2..56ef6cde35 100644
--- a/test/lisp/ido-tests.el
+++ b/test/lisp/ido-tests.el
@@ -1,6 +1,6 @@
 ;;; ido-tests.el --- unit tests for ido.el           -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/lisp/image-dired-tests.el b/test/lisp/image-dired-tests.el
index 3f0304ee40..00df72487f 100644
--- a/test/lisp/image-dired-tests.el
+++ b/test/lisp/image-dired-tests.el
@@ -1,6 +1,6 @@
 ;;; image-dired-tests.el --- Tests for image-dired.el  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/image-file-tests.el b/test/lisp/image-file-tests.el
index d3290f6f4c..59af6ba909 100644
--- a/test/lisp/image-file-tests.el
+++ b/test/lisp/image-file-tests.el
@@ -1,6 +1,6 @@
 ;;; image-file-tests.el --- Test suite for image-files  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el
index 79b0014f60..6abfcfedcf 100644
--- a/test/lisp/image-tests.el
+++ b/test/lisp/image-tests.el
@@ -1,6 +1,6 @@
 ;;; image-tests.el --- tests for image.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -82,7 +82,8 @@
 (ert-deftest image-type/from-filename ()
   ;; On emba, `image-types' and `image-load-path' do not exist.
   (skip-unless (and (bound-and-true-p image-types)
-                    (bound-and-true-p image-load-path)))
+                    (bound-and-true-p image-load-path)
+                    (image-type-available-p 'jpeg)))
   (should (eq (image-type "foo.jpg") 'jpeg)))
 
 (defun image-tests--type-from-file-header (type)
diff --git a/test/lisp/image/exif-tests.el b/test/lisp/image/exif-tests.el
index 2357113f63..d62eef4798 100644
--- a/test/lisp/image/exif-tests.el
+++ b/test/lisp/image/exif-tests.el
@@ -1,6 +1,6 @@
 ;;; exif-tests.el --- tests for exif.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/image/gravatar-tests.el 
b/test/lisp/image/gravatar-tests.el
index 2324dc5e8b..3b3a0ad464 100644
--- a/test/lisp/image/gravatar-tests.el
+++ b/test/lisp/image/gravatar-tests.el
@@ -1,6 +1,6 @@
 ;;; gravatar-tests.el --- tests for gravatar.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/imenu-tests.el b/test/lisp/imenu-tests.el
index 17f2501f67..9667f0566c 100644
--- a/test/lisp/imenu-tests.el
+++ b/test/lisp/imenu-tests.el
@@ -1,6 +1,6 @@
 ;;; imenu-tests.el --- Test suite for imenu.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO <yamato@redhat.com>
 ;; Keywords: tools convenience
diff --git a/test/lisp/info-tests.el b/test/lisp/info-tests.el
index 3e2aa3e089..11ac25555d 100644
--- a/test/lisp/info-tests.el
+++ b/test/lisp/info-tests.el
@@ -1,6 +1,6 @@
 ;;; info-tests.el --- Tests for info.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/info-xref-tests.el b/test/lisp/info-xref-tests.el
index 9379a53fe1..acfd6e82f1 100644
--- a/test/lisp/info-xref-tests.el
+++ b/test/lisp/info-xref-tests.el
@@ -1,6 +1,6 @@
 ;;; info-xref-tests.el --- tests for info-xref.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/ccl-tests.el 
b/test/lisp/international/ccl-tests.el
index f3da2d8873..57ac74639b 100644
--- a/test/lisp/international/ccl-tests.el
+++ b/test/lisp/international/ccl-tests.el
@@ -1,6 +1,6 @@
 ;;; ccl-tests.el --- unit tests for ccl.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/mule-tests.el 
b/test/lisp/international/mule-tests.el
index 8ca1ade771..94e864817f 100644
--- a/test/lisp/international/mule-tests.el
+++ b/test/lisp/international/mule-tests.el
@@ -1,6 +1,6 @@
 ;;; mule-tests.el --- unit tests for mule.el         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/mule-util-tests.el 
b/test/lisp/international/mule-util-tests.el
index 0fcff9d02d..cf29e0e290 100644
--- a/test/lisp/international/mule-util-tests.el
+++ b/test/lisp/international/mule-util-tests.el
@@ -1,6 +1,6 @@
 ;;; mule-util-tests.el --- tests for international/mule-util.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/ucs-normalize-tests.el 
b/test/lisp/international/ucs-normalize-tests.el
index eb577b97dc..27a4e70c78 100644
--- a/test/lisp/international/ucs-normalize-tests.el
+++ b/test/lisp/international/ucs-normalize-tests.el
@@ -1,6 +1,6 @@
 ;;; ucs-normalize-tests.el --- tests for international/ucs-normalize.el -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/isearch-tests.el b/test/lisp/isearch-tests.el
index 9f3ac37312..4600757d94 100644
--- a/test/lisp/isearch-tests.el
+++ b/test/lisp/isearch-tests.el
@@ -1,6 +1,6 @@
 ;;; isearch-tests.el --- Tests for isearch.el        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 
diff --git a/test/lisp/jit-lock-tests.el b/test/lisp/jit-lock-tests.el
index a54aad8165..190825d325 100644
--- a/test/lisp/jit-lock-tests.el
+++ b/test/lisp/jit-lock-tests.el
@@ -1,6 +1,6 @@
 ;;; jit-lock-tests.el --- tests for jit-lock  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <dgutov@yandex.ru>
 
diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el
index f400fb064a..ef7805a341 100644
--- a/test/lisp/json-tests.el
+++ b/test/lisp/json-tests.el
@@ -1,6 +1,6 @@
 ;;; json-tests.el --- Test suite for json.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <dgutov@yandex.ru>
 
diff --git a/test/lisp/jsonrpc-tests.el b/test/lisp/jsonrpc-tests.el
index 92306d1c7e..e02cb15423 100644
--- a/test/lisp/jsonrpc-tests.el
+++ b/test/lisp/jsonrpc-tests.el
@@ -1,6 +1,6 @@
 ;;; jsonrpc-tests.el --- tests for jsonrpc.el        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Keywords: tests
diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el
index 9744854f08..75d700070a 100644
--- a/test/lisp/kmacro-tests.el
+++ b/test/lisp/kmacro-tests.el
@@ -1,6 +1,6 @@
 ;;; kmacro-tests.el --- Tests for kmacro.el       -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <gazally@runbox.com>
 
@@ -91,33 +91,30 @@ body in KEYS-AND-BODY."
        ,docstring ,@keys
        (kmacro-tests-with-kmacro-clean-slate ,@body))))
 
-(defvar kmacro-tests-keymap
-  (let ((map (make-sparse-keymap)))
-    (dotimes (i 26)
-      (define-key map (string (+ ?a i)) 'self-insert-command))
-    (dotimes (i 10)
-      (define-key map (string (+ ?0 i)) 'self-insert-command))
-    ;; Define a few key sequences of different lengths.
-    (dolist (item '(("\C-a"     . beginning-of-line)
-                    ("\C-b"     . backward-char)
-                    ("\C-e"     . end-of-line)
-                    ("\C-f"     . forward-char)
-                    ("\C-r"     . isearch-backward)
-                    ("\C-u"     . universal-argument)
-                    ("\C-w"     . kill-region)
-                    ("\C-SPC"   . set-mark-command)
-                    ("\M-w"     . kill-ring-save)
-                    ("\M-x"     . execute-extended-command)
-                    ("\C-cd"    . downcase-word)
-                    ("\C-cxu"   . upcase-word)
-                    ("\C-cxq"   . quoted-insert)
-                    ("\C-cxi"   . kmacro-insert-counter)
-                    ("\C-x\C-k" . kmacro-keymap)))
-      (define-key map (car item) (cdr item)))
-    map)
-  "Keymap to use for testing keyboard macros.
+(defvar-keymap kmacro-tests-keymap
+  :doc "Keymap to use for testing keyboard macros.
 This is used to obtain consistent results even if tests are run
-in an environment with rebound keys.")
+in an environment with rebound keys."
+  ;; Define a few key sequences of different lengths.
+  "C-a"     'beginning-of-line
+  "C-b"     'backward-char
+  "C-e"     'end-of-line
+  "C-f"     'forward-char
+  "C-r"     'isearch-backward
+  "C-u"     'universal-argument
+  "C-w"     'kill-region
+  "C-SPC"   'set-mark-command
+  "M-w"     'kill-ring-save
+  "M-x"     'execute-extended-command
+  "C-c d"   'downcase-word
+  "C-c x u" 'upcase-word
+  "C-c x q" 'quoted-insert
+  "C-c x i" 'kmacro-insert-counter
+  "C-x C-k" 'kmacro-keymap)
+(dotimes (i 26)
+  (keymap-set kmacro-tests-keymap (string (+ ?a i)) 'self-insert-command))
+(dotimes (i 10)
+  (keymap-set kmacro-tests-keymap (string (+ ?0 i)) 'self-insert-command))
 
 (defvar kmacro-tests-events nil
   "Input events used by the kmacro test in progress.")
diff --git a/test/lisp/loadhist-tests.el b/test/lisp/loadhist-tests.el
index b29796da42..a941ac0632 100644
--- a/test/lisp/loadhist-tests.el
+++ b/test/lisp/loadhist-tests.el
@@ -1,6 +1,6 @@
 ;;; loadhist-tests.el --- Tests for loadhist.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/lpr-tests.el b/test/lisp/lpr-tests.el
index bc31982a11..8e8179446d 100644
--- a/test/lisp/lpr-tests.el
+++ b/test/lisp/lpr-tests.el
@@ -1,6 +1,6 @@
 ;;; lpr-tests.el --- Tests for lpr.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/ls-lisp-tests.el b/test/lisp/ls-lisp-tests.el
index 9f2c63225b..3e23fc7454 100644
--- a/test/lisp/ls-lisp-tests.el
+++ b/test/lisp/ls-lisp-tests.el
@@ -1,6 +1,6 @@
 ;;; ls-lisp-tests.el --- tests for ls-lisp.el  -*- lexical-binding: t-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/mail/flow-fill-tests.el 
b/test/lisp/mail/flow-fill-tests.el
index ec5b984dc0..8436a9627a 100644
--- a/test/lisp/mail/flow-fill-tests.el
+++ b/test/lisp/mail/flow-fill-tests.el
@@ -1,6 +1,6 @@
 ;;; flow-fill-tests.el --- Tests for flow-fill.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/footnote-tests.el b/test/lisp/mail/footnote-tests.el
index 731ba3e706..e33b59bc41 100644
--- a/test/lisp/mail/footnote-tests.el
+++ b/test/lisp/mail/footnote-tests.el
@@ -1,6 +1,6 @@
 ;;; footnote-tests.el --- Tests for footnote-mode    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/test/lisp/mail/mail-parse-tests.el 
b/test/lisp/mail/mail-parse-tests.el
index 70de92df45..f5e6f1fb03 100644
--- a/test/lisp/mail/mail-parse-tests.el
+++ b/test/lisp/mail/mail-parse-tests.el
@@ -1,6 +1,6 @@
 ;;; mail-parse-tests.el --- tests for mail-parse.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/mail-utils-tests.el 
b/test/lisp/mail/mail-utils-tests.el
index f75de5c620..29a9b9eeb9 100644
--- a/test/lisp/mail/mail-utils-tests.el
+++ b/test/lisp/mail/mail-utils-tests.el
@@ -1,6 +1,6 @@
 ;;; mail-utils-tests.el --- tests for mail-utils.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/mail/qp-tests.el b/test/lisp/mail/qp-tests.el
index 89f02894ea..e8e58063b9 100644
--- a/test/lisp/mail/qp-tests.el
+++ b/test/lisp/mail/qp-tests.el
@@ -1,6 +1,6 @@
 ;;; qp-tests.el --- Tests for qp.el  -*- lexical-binding:t; coding:utf-8 -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/mail/rfc2045-tests.el b/test/lisp/mail/rfc2045-tests.el
index ac547aabe5..c65a0011c7 100644
--- a/test/lisp/mail/rfc2045-tests.el
+++ b/test/lisp/mail/rfc2045-tests.el
@@ -1,6 +1,6 @@
 ;;; rfc2045-tests.el --- Tests for rfc2045.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/mail/rfc2047-tests.el b/test/lisp/mail/rfc2047-tests.el
index befcbc018b..6e50ce2f32 100644
--- a/test/lisp/mail/rfc2047-tests.el
+++ b/test/lisp/mail/rfc2047-tests.el
@@ -1,6 +1,6 @@
 ;;; rfc2047-tests.el --- tests for rfc2047.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/rfc6068-tests.el b/test/lisp/mail/rfc6068-tests.el
index caf8230cb1..0efbb68cc2 100644
--- a/test/lisp/mail/rfc6068-tests.el
+++ b/test/lisp/mail/rfc6068-tests.el
@@ -1,6 +1,6 @@
 ;;; rfc6068-tests.el --- Tests for rfc6068.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/rfc822-tests.el b/test/lisp/mail/rfc822-tests.el
index 3e36a61a1f..ff29dac427 100644
--- a/test/lisp/mail/rfc822-tests.el
+++ b/test/lisp/mail/rfc822-tests.el
@@ -1,6 +1,6 @@
 ;;; rfc822-tests.el --- Tests for rfc822.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/rmail-tests.el b/test/lisp/mail/rmail-tests.el
index 826a90455f..44394cd52e 100644
--- a/test/lisp/mail/rmail-tests.el
+++ b/test/lisp/mail/rmail-tests.el
@@ -1,6 +1,6 @@
 ;;; rmail-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/rmailmm-tests.el b/test/lisp/mail/rmailmm-tests.el
index d7b3775d6d..5d1ac6d630 100644
--- a/test/lisp/mail/rmailmm-tests.el
+++ b/test/lisp/mail/rmailmm-tests.el
@@ -1,6 +1,6 @@
 ;;; rmailmm-tests.el --- Tests for rmailmm.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mail/uudecode-tests.el b/test/lisp/mail/uudecode-tests.el
index 1899ff50f6..7946e99dbc 100644
--- a/test/lisp/mail/uudecode-tests.el
+++ b/test/lisp/mail/uudecode-tests.el
@@ -1,6 +1,6 @@
 ;;; uudecode-tests.el --- Tests for uudecode.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/makesum-tests.el b/test/lisp/makesum-tests.el
index 2b57af7818..e5317be847 100644
--- a/test/lisp/makesum-tests.el
+++ b/test/lisp/makesum-tests.el
@@ -1,6 +1,6 @@
 ;;; makesum-tests.el --- Tests for makesum.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/man-tests.el b/test/lisp/man-tests.el
index 7fb0c5e944..82714f1566 100644
--- a/test/lisp/man-tests.el
+++ b/test/lisp/man-tests.el
@@ -1,6 +1,6 @@
 ;;; man-tests.el --- Test suite for man.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Jenkner <wjenkner@inode.at>
 ;; Keywords: help, internal, unix
diff --git a/test/lisp/md4-tests.el b/test/lisp/md4-tests.el
index ac7eedec6a..fb7df652bc 100644
--- a/test/lisp/md4-tests.el
+++ b/test/lisp/md4-tests.el
@@ -1,6 +1,6 @@
 ;;; md4-tests.el --- tests for md4.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <mvoteiza@udel.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/mh-e/mh-limit-tests.el b/test/lisp/mh-e/mh-limit-tests.el
index 982573d9b4..5aedb89054 100644
--- a/test/lisp/mh-e/mh-limit-tests.el
+++ b/test/lisp/mh-e/mh-limit-tests.el
@@ -1,6 +1,6 @@
 ;;; mh-limit-tests.el --- tests for mh-limit.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mh-e/mh-thread-tests.el 
b/test/lisp/mh-e/mh-thread-tests.el
index 4f09677e53..84f59e5d30 100644
--- a/test/lisp/mh-e/mh-thread-tests.el
+++ b/test/lisp/mh-e/mh-thread-tests.el
@@ -1,6 +1,6 @@
 ;;; mh-thread-tests.el --- tests for mh-thread.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el
index f282a0b08f..0708617259 100644
--- a/test/lisp/mh-e/mh-utils-tests.el
+++ b/test/lisp/mh-e/mh-utils-tests.el
@@ -1,6 +1,6 @@
 ;;; mh-utils-tests.el --- tests for mh-utils.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mh-e/mh-xface-tests.el b/test/lisp/mh-e/mh-xface-tests.el
index 43355810ab..6c9c7ea1bf 100644
--- a/test/lisp/mh-e/mh-xface-tests.el
+++ b/test/lisp/mh-e/mh-xface-tests.el
@@ -1,6 +1,6 @@
 ;;; mh-xface-tests.el --- tests for mh-xface.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/mh-e/test-all-mh-variants.sh 
b/test/lisp/mh-e/test-all-mh-variants.sh
index eaee98fcf4..3789a5fded 100755
--- a/test/lisp/mh-e/test-all-mh-variants.sh
+++ b/test/lisp/mh-e/test-all-mh-variants.sh
@@ -1,7 +1,7 @@
 #! /bin/bash
 # Run the mh-utils-tests against all MH variants found on this system.
 
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index c3ba8f9a92..2a29d5f167 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -1,6 +1,6 @@
 ;;; minibuffer-tests.el --- Tests for completion functions  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/test/lisp/misc-tests.el b/test/lisp/misc-tests.el
index a519fd1ee6..36a8726b88 100644
--- a/test/lisp/misc-tests.el
+++ b/test/lisp/misc-tests.el
@@ -1,6 +1,6 @@
 ;;; misc-tests.el --- Tests for misc.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el
index 56411d0365..1be32006a1 100644
--- a/test/lisp/mouse-tests.el
+++ b/test/lisp/mouse-tests.el
@@ -1,6 +1,6 @@
 ;;; mouse-tests.el --- unit tests for mouse.el       -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
@@ -52,5 +52,167 @@ translate `mouse-1' events into `mouse-2' events."
     (should (equal (mouse-position)
                    (cons frame (cons 0 0))))))
 
+(ert-deftest context-menu-map-remove-consecutive-separators ()
+  "Check that `context-menu-map' removes consecutive separators."
+  ;; Both separators after the overall prompt string.
+  (let ((context-menu-functions
+         '((lambda (menu _click)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             (define-key-after menu [separator-1] menu-bar-separator)
+             (define-key-after menu [separator-2] menu-bar-separator)
+             (define-key-after menu [bar-item] '(menu-item "Bar" identity))
+             menu))))
+    (should (equal `(keymap
+                     "Context Menu"
+                     (foo-item menu-item "Foo" identity)
+                     (separator-1 . ,menu-bar-separator)
+                     (bar-item menu-item "Bar" identity))
+                   (context-menu-map))))
+  ;; Both separators before the overall prompt string.
+  (let ((context-menu-functions
+         '((lambda (menu _click)
+             (define-key menu [bar-item] '(menu-item "Bar" identity))
+             (define-key menu [separator-2] menu-bar-separator)
+             (define-key menu [separator-1] menu-bar-separator)
+             (define-key menu [foo-item] '(menu-item "Foo" identity))
+             menu))))
+    (should (equal `(keymap
+                     (foo-item menu-item "Foo" identity)
+                     (separator-1 . ,menu-bar-separator)
+                     (bar-item menu-item "Bar" identity)
+                     "Context Menu")
+                   (context-menu-map))))
+  ;; First separator before and second separator after the overall
+  ;; prompt string.
+  (let ((context-menu-functions
+         '((lambda (menu _click)
+             (define-key-after menu [separator-2] menu-bar-separator)
+             (define-key-after menu [bar-item] '(menu-item "Bar" identity))
+             (define-key menu [separator-1] menu-bar-separator)
+             (define-key menu [foo-item] '(menu-item "Foo" identity))
+             menu))))
+    (should (equal `(keymap
+                     (foo-item menu-item "Foo" identity)
+                     (separator-1 . ,menu-bar-separator)
+                     "Context Menu"
+                     (bar-item menu-item "Bar" identity))
+                   (context-menu-map))))
+  ;; Three consecutive separators.
+  (let ((context-menu-functions
+         '((lambda (menu _click)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             (define-key-after menu [separator-1] menu-bar-separator)
+             (define-key-after menu [separator-2] menu-bar-separator)
+             (define-key-after menu [separator-3] menu-bar-separator)
+             (define-key-after menu [bar-item] '(menu-item "Bar" identity))
+             menu))))
+    (should (equal `(keymap
+                     "Context Menu"
+                     (foo-item menu-item "Foo" identity)
+                     (separator-1 . ,menu-bar-separator)
+                     (bar-item menu-item "Bar" identity))
+                   (context-menu-map)))))
+
+(ert-deftest context-menu-map-remove-separators-at-beginning-or-end ()
+  "Check that `context-menu-map' removes separators at the
+beginning or end of the menu."
+  ;; Menus with only separators.
+  (let ((test-functions
+         '(;; Separator before the overall prompt string.
+           (lambda (menu _click)
+             (define-key menu [separator] menu-bar-separator)
+             menu)
+           ;; Separator after the overall prompt string.
+           (lambda (menu _click)
+             (define-key-after menu [separator] menu-bar-separator)
+             menu)
+           ;; Begin and end separators before the overall prompt string.
+           (lambda (menu _click)
+             (define-key menu [end-separator] menu-bar-separator)
+             (define-key menu [begin-separator] menu-bar-separator)
+             menu)
+           ;; Begin and end separators after the overall prompt string.
+           (lambda (menu _click)
+             (define-key-after menu [begin-separator] menu-bar-separator)
+             (define-key-after menu [end-separator] menu-bar-separator)
+             menu)
+           ;; Begin separator before and end separator after the
+           ;; overall prompt string.
+           (lambda (menu _click)
+             (define-key menu [begin-separator] menu-bar-separator)
+             (define-key-after menu [end-separator] menu-bar-separator)
+             menu))))
+    (dolist (fun test-functions)
+      (let ((context-menu-functions (list fun)))
+        (should (equal '(keymap "Context Menu")
+                       (context-menu-map))))))
+  ;; Menus with separators at beginning and/or end with a menu-item
+  ;; before the prompt string.
+  (let ((test-functions
+         '(;; Separator before the overall prompt string and the menu-item.
+           (lambda (menu _click)
+             (define-key menu [foo-item] '(menu-item "Foo" identity))
+             (define-key menu [separator] menu-bar-separator)
+             menu)
+           ;; Separator before the overall prompt string, but after
+           ;; the menu-item.
+           (lambda (menu _click)
+             (define-key menu [separator] menu-bar-separator)
+             (define-key menu [foo-item] '(menu-item "Foo" identity))
+             menu)
+           ;; Separator at the end.
+           (lambda (menu _click)
+             (define-key menu [foo-item] '(menu-item "Foo" identity))
+             (define-key-after menu [separator] menu-bar-separator)
+             menu)
+           ;; Begin separator before and end separator after the
+           ;; overall prompt string.
+           (lambda (menu _click)
+             (define-key menu [foo-item] '(menu-item "Foo" identity))
+             (define-key menu [begin-separator] menu-bar-separator)
+             (define-key-after menu [end-separator] menu-bar-separator)
+             menu))))
+    (dolist (fun test-functions)
+      (let ((context-menu-functions (list fun)))
+        (should (equal '(keymap (foo-item menu-item "Foo" identity)
+                                "Context Menu")
+                       (context-menu-map))))))
+  ;; Menus with separators at beginning and/or end with a menu-item
+  ;; after the prompt string.
+  (let ((test-functions
+         '(;; Separator before the overall prompt string.
+           (lambda (menu _click)
+             (define-key menu [separator] menu-bar-separator)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             menu)
+           ;; Separator after the overall prompt string, but before
+           ;; the menu-item.
+           (lambda (menu _click)
+             (define-key-after menu [separator] menu-bar-separator)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             menu)
+           ;; Separator at the end.
+           (lambda (menu _click)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             (define-key-after menu [separator] menu-bar-separator)
+             menu)
+           ;; Begin and end separators after the overall prompt string.
+           (lambda (menu _click)
+             (define-key-after menu [begin-separator] menu-bar-separator)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             (define-key-after menu [end-separator] menu-bar-separator)
+             menu)
+           ;; Begin separator before and end separator after the
+           ;; overall prompt string.
+           (lambda (menu _click)
+             (define-key menu [begin-separator] menu-bar-separator)
+             (define-key-after menu [foo-item] '(menu-item "Foo" identity))
+             (define-key-after menu [end-separator] menu-bar-separator)
+             menu))))
+    (dolist (fun test-functions)
+      (let ((context-menu-functions (list fun)))
+        (should (equal '(keymap "Context Menu"
+                                (foo-item menu-item "Foo" identity))
+                       (context-menu-map)))))))
 
 ;;; mouse-tests.el ends here
diff --git a/test/lisp/mwheel-tests.el b/test/lisp/mwheel-tests.el
index 058f1a8afb..947dfdbb5e 100644
--- a/test/lisp/mwheel-tests.el
+++ b/test/lisp/mwheel-tests.el
@@ -1,6 +1,6 @@
 ;;; mwheel-tests.el --- tests for mwheel.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/browse-url-tests.el 
b/test/lisp/net/browse-url-tests.el
index 68c7c34901..8f180f3d6b 100644
--- a/test/lisp/net/browse-url-tests.el
+++ b/test/lisp/net/browse-url-tests.el
@@ -1,6 +1,6 @@
 ;;; browse-url-tests.el --- Tests for browse-url.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index cfc380d302..7631842918 100644
--- a/test/lisp/net/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
@@ -1,6 +1,6 @@
 ;;; dbus-tests.el --- Tests of D-Bus integration into Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/net/dig-tests.el b/test/lisp/net/dig-tests.el
index 780985cb6d..c3bdc43d3f 100644
--- a/test/lisp/net/dig-tests.el
+++ b/test/lisp/net/dig-tests.el
@@ -1,6 +1,6 @@
 ;;; dig-tests.el --- Tests for dig.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/gnutls-tests.el b/test/lisp/net/gnutls-tests.el
index 76c00b7eaa..f14ee20a30 100644
--- a/test/lisp/net/gnutls-tests.el
+++ b/test/lisp/net/gnutls-tests.el
@@ -1,6 +1,6 @@
 ;;; gnutls-tests.el --- Test suite for gnutls.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 
@@ -30,6 +30,14 @@
 (require 'gnutls)
 (require 'hex-util)
 
+(declare-function gnutls-symmetric-decrypt "gnutls.c")
+(declare-function gnutls-symmetric-encrypt "gnutls.c")
+(declare-function gnutls-hash-mac "gnutls.c")
+(declare-function gnutls-hash-digest "gnutls.c")
+(declare-function gnutls-ciphers "gnutls.c")
+(declare-function gnutls-digests "gnutls.c")
+(declare-function gnutls-macs "gnutls.c")
+
 (defvar gnutls-tests-message-prefix "")
 
 (defsubst gnutls-tests-message (format-string &rest args)
diff --git a/test/lisp/net/hmac-md5-tests.el b/test/lisp/net/hmac-md5-tests.el
index 8e01353fa3..ce08dd89d1 100644
--- a/test/lisp/net/hmac-md5-tests.el
+++ b/test/lisp/net/hmac-md5-tests.el
@@ -1,6 +1,6 @@
 ;;; hmac-md5-tests.el --- Tests for hmac-md5.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/mailcap-tests.el b/test/lisp/net/mailcap-tests.el
index a1a08322c0..362cb22bb2 100644
--- a/test/lisp/net/mailcap-tests.el
+++ b/test/lisp/net/mailcap-tests.el
@@ -1,6 +1,6 @@
 ;;; mailcap-tests.el --- tests for mailcap.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <mvoteiza@udel.edu>
 
diff --git a/test/lisp/net/netrc-tests.el b/test/lisp/net/netrc-tests.el
index 2f68b9bbb2..8e83f405bc 100644
--- a/test/lisp/net/netrc-tests.el
+++ b/test/lisp/net/netrc-tests.el
@@ -1,6 +1,6 @@
 ;;; netrc-tests.el --- Tests for netrc.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/net/network-stream-tests.el 
b/test/lisp/net/network-stream-tests.el
index 8f5bddb71f..1bdc35da19 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -1,6 +1,6 @@
 ;;; network-stream-tests.el --- tests for network processes       -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
@@ -32,6 +32,8 @@
 ;; it pulls in nsm, which then makes the :nowait t' tests fail unless
 ;; we disable the nsm, which we do by binding 'network-security-level'
 
+(declare-function gnutls-peer-status "gnutls.c")
+
 (ert-deftest make-local-unix-server ()
   (skip-unless (featurep 'make-network-process '(:family local)))
   (let* ((file (make-temp-name "/tmp/server-test"))
diff --git a/test/lisp/net/newsticker-tests.el 
b/test/lisp/net/newsticker-tests.el
index e08f311016..2dc92566a6 100644
--- a/test/lisp/net/newsticker-tests.el
+++ b/test/lisp/net/newsticker-tests.el
@@ -1,6 +1,6 @@
 ;;; newsticker-tests.el --- Test suite for newsticker.  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <ulf.jasper@web.de>
 ;; Keywords:    News, RSS, Atom
diff --git a/test/lisp/net/nsm-tests.el b/test/lisp/net/nsm-tests.el
index 1a35ec34cb..e0536320cc 100644
--- a/test/lisp/net/nsm-tests.el
+++ b/test/lisp/net/nsm-tests.el
@@ -1,6 +1,6 @@
 ;;; nsm-tests.el --- tests for network security manager  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Robert Pluim <rpluim@gmail.com>
 
diff --git a/test/lisp/net/ntlm-tests.el b/test/lisp/net/ntlm-tests.el
index 2420b3b48a..f740703232 100644
--- a/test/lisp/net/ntlm-tests.el
+++ b/test/lisp/net/ntlm-tests.el
@@ -1,6 +1,6 @@
 ;;; ntlm-tests.el --- tests for ntlm.el            -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -227,6 +227,8 @@ This string will be returned from the NTLM server to the 
NTLM client."
 
 ;; Silence some byte-compiler warnings that occur when
 ;; web-server/web-server.el is not found.
+(eval-when-compile (cl-pushnew 'headers eieio--known-slot-names)
+                   (cl-pushnew 'process eieio--known-slot-names))
 (declare-function ws-send nil)
 (declare-function ws-parse-request nil)
 (declare-function ws-start nil)
diff --git a/test/lisp/net/puny-tests.el b/test/lisp/net/puny-tests.el
index 9119084209..c6f9474f65 100644
--- a/test/lisp/net/puny-tests.el
+++ b/test/lisp/net/puny-tests.el
@@ -1,6 +1,6 @@
 ;;; puny-tests.el --- tests for net/puny.el  -*- coding: utf-8; 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/rcirc-tests.el b/test/lisp/net/rcirc-tests.el
index fd96b7ba71..0ba4f2b86e 100644
--- a/test/lisp/net/rcirc-tests.el
+++ b/test/lisp/net/rcirc-tests.el
@@ -1,6 +1,6 @@
 ;;; rcirc-tests.el --- Tests for rcirc -*- lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 ;;
diff --git a/test/lisp/net/rfc2104-tests.el b/test/lisp/net/rfc2104-tests.el
index f3498e760a..9cce2aa4b3 100644
--- a/test/lisp/net/rfc2104-tests.el
+++ b/test/lisp/net/rfc2104-tests.el
@@ -1,6 +1,6 @@
 ;;; rfc2104-tests.el --- Tests of RFC2104 hashes  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
diff --git a/test/lisp/net/sasl-cram-tests.el b/test/lisp/net/sasl-cram-tests.el
index e0230ddee6..e8dbeca090 100644
--- a/test/lisp/net/sasl-cram-tests.el
+++ b/test/lisp/net/sasl-cram-tests.el
@@ -1,6 +1,6 @@
 ;;; sasl-cram-tests.el --- tests for sasl-cram.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/net/sasl-scram-rfc-tests.el 
b/test/lisp/net/sasl-scram-rfc-tests.el
index dfd4cf0e7a..b61b437c75 100644
--- a/test/lisp/net/sasl-scram-rfc-tests.el
+++ b/test/lisp/net/sasl-scram-rfc-tests.el
@@ -1,6 +1,6 @@
 ;;; sasl-scram-rfc-tests.el --- tests for SCRAM       -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Magnus Henoch <magnus.henoch@gmail.com>
 
diff --git a/test/lisp/net/sasl-tests.el b/test/lisp/net/sasl-tests.el
index dab40754c0..f0e99e8f09 100644
--- a/test/lisp/net/sasl-tests.el
+++ b/test/lisp/net/sasl-tests.el
@@ -1,6 +1,6 @@
 ;;; sasl-tests.el --- tests for sasl.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/net/secrets-tests.el b/test/lisp/net/secrets-tests.el
index b392c4d184..7e66774701 100644
--- a/test/lisp/net/secrets-tests.el
+++ b/test/lisp/net/secrets-tests.el
@@ -1,6 +1,6 @@
 ;;; secrets-tests.el --- Tests of Secret Service API -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
@@ -57,8 +57,11 @@
 
 (defun secrets--test-delete-all-session-items ()
   "Delete all items of collection \"session\" bound to this Emacs."
-  (dolist (item (secrets-list-items "session"))
-    (secrets-delete-item "session" item)))
+  ;; If the "session" collection does not exist, a `dbus-error' is
+  ;; fired, which we ignore.
+  (dbus-ignore-errors
+    (dolist (item (secrets-list-items "session"))
+      (secrets-delete-item "session" item))))
 
 (ert-deftest secrets-test01-sessions ()
   "Test opening / closing a secrets session."
@@ -93,7 +96,7 @@
   (unwind-protect
       (progn
        (should (secrets-open-session))
-       (should (member "session" (secrets-list-collections)))
+       (skip-unless (member "session" (secrets-list-collections)))
 
        ;; Create a random collection.  This asks for a password
        ;; outside our control, so we make it in the interactive case
@@ -153,6 +156,7 @@
   (unwind-protect
       (let (item-path)
        (should (secrets-open-session))
+       (skip-unless (member "session" (secrets-list-collections)))
 
         ;; Cleanup.  There could be items in the "session" collection.
         (secrets--test-delete-all-session-items)
@@ -214,6 +218,7 @@
   (unwind-protect
       (progn
        (should (secrets-open-session))
+       (skip-unless (member "session" (secrets-list-collections)))
 
         ;; Cleanup.  There could be items in the "session" collection.
         (secrets--test-delete-all-session-items)
diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index bfb83f2518..821ca5ca63 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -1,6 +1,6 @@
 ;;; shr-tests.el --- tests for shr.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
@@ -27,6 +27,8 @@
 (require 'ert-x)
 (require 'shr)
 
+(declare-function libxml-parse-html-region "xml.c")
+
 (defun shr-test (name)
   (with-temp-buffer
     (insert-file-contents (format (concat (ert-resource-directory) "/%s.html") 
name))
diff --git a/test/lisp/net/socks-tests.el b/test/lisp/net/socks-tests.el
index 7fb885235c..461796bdf9 100644
--- a/test/lisp/net/socks-tests.el
+++ b/test/lisp/net/socks-tests.el
@@ -1,6 +1,6 @@
 ;;; socks-tests.el --- tests for SOCKS -*- coding: utf-8; lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index a307a40157..254595d1b4 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -1,6 +1,6 @@
 ;;; tramp-archive-tests.el --- Tests of file archive access  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 9c65f9a635..ea0ff3c760 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1,6 +1,6 @@
 ;;; tramp-tests.el --- Tests of remote file access  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
@@ -157,13 +157,6 @@ being the result.")
   ;; Return result.
   (cdr tramp--test-enabled-checked))
 
-(defsubst tramp--test-expensive-test ()
-  "Whether expensive tests are run."
-  (ert-select-tests
-   (ert--stats-selector ert--current-run-stats)
-   (list (make-ert-test :name (ert-test-name (ert-running-test))
-                        :body nil :tags '(:expensive-test)))))
-
 (defun tramp--test-make-temp-name (&optional local quoted)
   "Return a temporary file name for test.
 If LOCAL is non-nil, a local file name is returned.
@@ -2330,7 +2323,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `file-exist-p', `write-region' and `delete-file'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
       (should-not (file-exists-p tmp-name))
       (write-region "foo" nil tmp-name)
@@ -2338,8 +2331,10 @@ This checks also `file-name-as-directory', 
`file-name-directory',
       (delete-file tmp-name)
       (should-not (file-exists-p tmp-name))
 
-      ;; Trashing files doesn't work on MS Windows, and for crypted remote 
files.
-      (unless (or (tramp--test-windows-nt-p) (tramp--test-crypt-p))
+      ;; Trashing files doesn't work when `system-move-file-to-trash'
+      ;; is defined (on MS Windows and macOS), and for crypted remote
+      ;; files.
+      (unless (or (fboundp 'system-move-file-to-trash) (tramp--test-crypt-p))
        (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
              (delete-by-moving-to-trash t))
          (make-directory trash-directory)
@@ -2363,7 +2358,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `file-local-copy'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          tmp-name2)
       (unwind-protect
@@ -2395,7 +2390,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `insert-file-contents'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
       (unwind-protect
          (with-temp-buffer
@@ -2432,7 +2427,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `write-region'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
           (inhibit-message t))
       (unwind-protect
@@ -2568,8 +2563,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   (skip-unless (tramp--test-enabled))
 
   ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted (if (and (tramp--test-expensive-test) 
(tramp--test-emacs27-p))
-                     '(nil t) '(nil)))
+  (dolist (quoted
+          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
+              '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -2596,7 +2592,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                (with-temp-buffer
                  (insert-file-contents target)
                  (should (string-equal (buffer-string) "foo")))
-               (when (tramp--test-expensive-test)
+               (when (tramp--test-expensive-test-p)
                  (should-error
                   (copy-file source target)
                   :type 'file-already-exists))
@@ -2614,7 +2610,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                (should (file-exists-p source))
                (make-directory target)
                (should (file-directory-p target))
-               (when (tramp--test-expensive-test)
+               (when (tramp--test-expensive-test-p)
                  (should-error
                   (copy-file source target)
                   :type 'file-already-exists)
@@ -2679,8 +2675,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   (skip-unless (tramp--test-enabled))
 
   ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted (if (and (tramp--test-expensive-test) 
(tramp--test-emacs27-p))
-                     '(nil t) '(nil)))
+  (dolist (quoted
+          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
+              '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -2710,7 +2707,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                  (should (string-equal (buffer-string) "foo")))
                (write-region "foo" nil source)
                (should (file-exists-p source))
-               (when (tramp--test-expensive-test)
+               (when (tramp--test-expensive-test-p)
                  (should-error
                   (rename-file source target)
                   :type 'file-already-exists))
@@ -2728,7 +2725,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                (should (file-exists-p source))
                (make-directory target)
                (should (file-directory-p target))
-               (when (tramp--test-expensive-test)
+               (when (tramp--test-expensive-test-p)
                  (should-error
                   (rename-file source target)
                   :type 'file-already-exists)
@@ -2796,7 +2793,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 This tests also `file-directory-p' and `file-accessible-directory-p'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
           (tmp-name2 (expand-file-name "foo/bar" tmp-name1))
           (unusual-file-mode-1 #o740)
@@ -2834,7 +2831,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   "Check `delete-directory'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
           (tmp-name2 (expand-file-name "foo" tmp-name1)))
       ;; Delete empty directory.
@@ -2858,9 +2855,12 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
       (should-not (file-directory-p tmp-name1))
 
       ;; Trashing directories works only since Emacs 27.1.  It doesn't
-      ;; work on MS Windows, for crypted remote directories and for ange-ftp.
-      (when (and (not  (tramp--test-windows-nt-p)) (not (tramp--test-crypt-p))
-                (not (tramp--test-ftp-p)) (tramp--test-emacs27-p))
+      ;; work when `system-move-file-to-trash' is defined (on MS
+      ;; Windows and macOS), for crypted remote directories and for
+      ;; ange-ftp.
+      (when (and (not (fboundp 'system-move-file-to-trash))
+                (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p))
+                (tramp--test-emacs27-p))
        (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
              (delete-by-moving-to-trash t))
          (make-directory trash-directory)
@@ -2908,7 +2908,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (tramp--test-rclone-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
           (tmp-name2 (tramp--test-make-temp-name nil quoted))
           (tmp-name3 (expand-file-name
@@ -3017,7 +3017,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   "Check `directory-files'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
           (tmp-name2 (expand-file-name "bla" tmp-name1))
           (tmp-name3 (expand-file-name "foo" tmp-name1)))
@@ -3061,7 +3061,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   "Check `file-expand-wildcards'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
           (tmp-name2 (expand-file-name "foo" tmp-name1))
           (tmp-name3 (expand-file-name "bar" tmp-name1))
@@ -3131,7 +3131,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   ;; Emacs 27.1.
   (skip-unless (or (not (tramp--test-crypt-p)) (tramp--test-emacs27-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1
             (expand-file-name (tramp--test-make-temp-name nil quoted)))
           (tmp-name2 (expand-file-name "foo" tmp-name1))
@@ -3212,7 +3212,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   ;; Wildcards are not supported in tramp-crypt.el.
   (skip-unless (not (tramp--test-crypt-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1
            (expand-file-name (tramp--test-make-temp-name nil quoted)))
           (tmp-name2
@@ -3316,7 +3316,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   ;; Relative file names in dired are not supported in tramp-crypt.el.
   (skip-unless (not (tramp--test-crypt-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1
            (expand-file-name (tramp--test-make-temp-name nil quoted)))
           (tmp-name2 (expand-file-name "foo" tmp-name1))
@@ -3370,7 +3370,7 @@ This tests also `access-file', `file-readable-p',
 `file-regular-p' and `file-ownership-preserved-p'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     ;; We must use `file-truename' for the temporary directory,
     ;; because it could be located on a symlinked directory.  This
     ;; would let the test fail.
@@ -3405,12 +3405,12 @@ This tests also `access-file', `file-readable-p',
            (when (tramp--test-supports-set-file-modes-p)
              (write-region "foo" nil tmp-name1)
              ;; A file is always accessible for user "root".
-             (when (not (zerop (file-attribute-user-id
-                                (file-attributes tmp-name1))))
+             (unless
+                 (zerop (file-attribute-user-id (file-attributes tmp-name1)))
                (set-file-modes tmp-name1 0)
                (should-error
                 (access-file tmp-name1 "error")
-                :type 'file-error)
+                :type tramp-permission-denied)
                (set-file-modes tmp-name1 #o777))
              (delete-file tmp-name1))
            (should-error
@@ -3575,7 +3575,7 @@ They might differ only in time attributes or directory 
size."
   "Check `directory-files-and-attributes'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     ;; `directory-files-and-attributes' contains also values for
     ;; "../".  Ensure that this doesn't change during tests, for
     ;; example due to handling temporary files.
@@ -3633,7 +3633,7 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-set-file-modes-p))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted)))
 
@@ -3724,7 +3724,7 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
 This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     ;; We must use `file-truename' for the temporary directory,
     ;; because it could be located on a symlinked directory.  This
     ;; would let the test fail.
@@ -3749,11 +3749,11 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
               (if quoted #'tramp-compat-file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
-           (when (tramp--test-expensive-test)
+           (when (tramp--test-expensive-test-p)
              (should-error
               (make-symbolic-link tmp-name1 tmp-name2)
               :type 'file-already-exists))
-           (when (tramp--test-expensive-test)
+           (when (tramp--test-expensive-test-p)
              ;; A number means interactive case.
              (cl-letf (((symbol-function #'yes-or-no-p) #'ignore))
                (should-error
@@ -3793,7 +3793,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
               (string-equal tmp-name1 (file-symlink-p tmp-name3))))
            ;; Check directory as newname.
            (make-directory tmp-name4)
-           (when (tramp--test-expensive-test)
+           (when (tramp--test-expensive-test-p)
              (should-error
               (make-symbolic-link tmp-name1 tmp-name4)
               :type 'file-already-exists))
@@ -3821,7 +3821,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 
       ;; Check `add-name-to-file'.
       (unwind-protect
-         (when (tramp--test-expensive-test)
+         (when (tramp--test-expensive-test-p)
            (tramp--test-ignore-add-name-to-file-error
             (write-region "foo" nil tmp-name1)
             (should (file-exists-p tmp-name1))
@@ -3936,11 +3936,11 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
               (string-equal
                (file-truename tmp-name2)
                (file-truename tmp-name3)))
-             (when (tramp--test-expensive-test)
+             (when (tramp--test-expensive-test-p)
                (should-error
                 (with-temp-buffer (insert-file-contents tmp-name2))
                 :type 'file-missing))
-             (when (tramp--test-expensive-test)
+             (when (tramp--test-expensive-test-p)
                (should-error
                 (with-temp-buffer (insert-file-contents tmp-name3))
                 :type 'file-missing))
@@ -3958,7 +3958,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 
       ;; Detect cyclic symbolic links.
       (unwind-protect
-         (when (tramp--test-expensive-test)
+         (when (tramp--test-expensive-test-p)
            (tramp--test-ignore-make-symbolic-link-error
             (make-symbolic-link tmp-name2 tmp-name1)
             (should (file-symlink-p tmp-name1))
@@ -3996,7 +3996,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
    (or (tramp--test-adb-p) (tramp--test-gvfs-p)
        (tramp--test-sh-p) (tramp--test-sudoedit-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name nil quoted)))
@@ -4045,7 +4045,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   "Check `set-visited-file-modtime' and `verify-visited-file-modtime'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
       (unwind-protect
          (progn
@@ -4078,8 +4078,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   (skip-unless (not (tramp--test-crypt-p)))
 
   ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted (if (and (tramp--test-expensive-test) 
(tramp--test-emacs27-p))
-                     '(nil t) '(nil)))
+  (dolist (quoted
+          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
+              '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -4094,7 +4095,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should (file-acl tmp-name2))
            (should (string-equal (file-acl tmp-name1) (file-acl tmp-name2)))
            ;; Different permissions mean different ACLs.
-           (when (not (tramp--test-windows-nt-or-smb-p))
+           (unless (tramp--test-windows-nt-or-smb-p)
              (set-file-modes tmp-name1 #o777)
              (set-file-modes tmp-name2 #o444)
              (should-not
@@ -4157,8 +4158,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   (skip-unless (not (tramp--test-crypt-p)))
 
   ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted (if (and (tramp--test-expensive-test) 
(tramp--test-emacs27-p))
-                     '(nil t) '(nil)))
+  (dolist (quoted
+          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
+              '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -4295,7 +4297,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 
   ;; Method and host name in completion mode.  This kind of completion
   ;; does not work on MS Windows.
-  (when (not (memq system-type '(cygwin windows-nt)))
+  (unless (memq system-type '(cygwin windows-nt))
     (let ((method (file-remote-p tramp-test-temporary-file-directory 'method))
          (host (file-remote-p tramp-test-temporary-file-directory 'host))
           (orig-syntax tramp-syntax))
@@ -4305,7 +4307,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
       (unwind-protect
           (dolist
              (syntax
-              (if (tramp--test-expensive-test)
+              (if (tramp--test-expensive-test-p)
                   (tramp-syntax-values) `(,orig-syntax)))
             (tramp-change-syntax syntax)
            ;; This has cleaned up all connection data, which are used
@@ -4347,7 +4349,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
         (tramp-change-syntax orig-syntax))))
 
   (dolist (non-essential '(nil t))
-    (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+    (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
       (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
 
        (unwind-protect
@@ -4414,7 +4416,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   "Check `load'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
       (unwind-protect
          (progn
@@ -4443,7 +4445,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name (tramp--test-make-temp-name nil quoted))
           (fnnd (file-name-nondirectory tmp-name))
           (default-directory tramp-test-temporary-file-directory)
@@ -4519,11 +4521,11 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
 
 (ert-deftest tramp-test29-start-file-process ()
   "Check `start-file-process'."
-  :tags '(:expensive-test)
+  :tags '(:expensive-test :tramp-asynchronous-processes)
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((default-directory tramp-test-temporary-file-directory)
          (tmp-name (tramp--test-make-temp-name nil quoted))
          kill-buffer-query-functions proc)
@@ -4586,8 +4588,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
 
-      ;; "telnet" and "sshfs" do not cooperate with disabled filter.
-      (unless (or (tramp--test-telnet-p) (tramp--test-sshfs-p))
+      ;; Disabled process filter.  "sshfs" does not cooperate.
+      (unless (tramp--test-sshfs-p)
        (unwind-protect
            (with-temp-buffer
              (setq proc (start-file-process "test3" (current-buffer) "cat"))
@@ -4596,8 +4598,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (set-process-filter proc t)
              (process-send-string proc "foo\n")
              (process-send-eof proc)
-             ;; Read output.
-             (with-timeout (10 (tramp--test-timeout-handler))
+             ;; Read output.  There shouldn't be any.
+             (with-timeout (10)
                (while (process-live-p proc)
                  (while (accept-process-output proc 0 nil t))))
              ;; No output due to process filter.
@@ -4675,7 +4677,8 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
          (ignore-errors (make-process :file-handler t)))
     `(ert-deftest ,(intern (concat (symbol-name test) "-direct-async")) ()
        ,docstring
-       :tags (if ,unstable '(:expensive-test :unstable) '(:expensive-test))
+       :tags (append '(:expensive-test :tramp-asynchronous-processes)
+                    (and ,unstable '(:unstable)))
        (skip-unless (tramp--test-enabled))
        (let ((default-directory tramp-test-temporary-file-directory)
             (ert-test (ert-get-test ',test))
@@ -4698,13 +4701,13 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
 
 (ert-deftest tramp-test30-make-process ()
   "Check `make-process'."
-  :tags '(:expensive-test)
+  :tags '(:expensive-test :tramp-asynchronous-processes)
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
   ;; `make-process' supports file name handlers since Emacs 27.
   (skip-unless (tramp--test-emacs27-p))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((default-directory tramp-test-temporary-file-directory)
          (tmp-name (tramp--test-make-temp-name nil quoted))
          kill-buffer-query-functions proc)
@@ -4778,8 +4781,8 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
 
-      ;; "telnet" and "sshfs" do not cooperate with disabled filter.
-      (unless (or (tramp--test-telnet-p) (tramp--test-sshfs-p))
+      ;; Disabled process filter.  "sshfs" does not cooperate.
+      (unless (tramp--test-sshfs-p)
        (unwind-protect
            (with-temp-buffer
              (setq proc
@@ -4792,8 +4795,8 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
              (should (equal (process-status proc) 'run))
              (process-send-string proc "foo\n")
              (process-send-eof proc)
-             ;; Read output.
-             (with-timeout (10 (tramp--test-timeout-handler))
+             ;; Read output.  There shouldn't be any.
+             (with-timeout (10)
                (while (process-live-p proc)
                  (while (accept-process-output proc 0 nil t))))
              ;; No output due to process filter.
@@ -4941,8 +4944,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
 
 (ert-deftest tramp-test31-interrupt-process ()
   "Check `interrupt-process'."
-  :tags (if (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))
-           '(:expensive-test :unstable) '(:expensive-test))
+  :tags (append '(:expensive-test :tramp-asynchronous-processes)
+               (and (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))
+                    '(:unstable)))
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-crypt-p)))
@@ -5007,7 +5011,7 @@ INPUT, if non-nil, is a string sent to the process."
   (when (tramp--test-adb-p)
     (skip-unless (tramp--test-emacs27-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
          (default-directory tramp-test-temporary-file-directory)
          ;; Suppress nasty messages.
@@ -5015,10 +5019,12 @@ INPUT, if non-nil, is a string sent to the process."
          kill-buffer-query-functions)
 
       (dolist (this-shell-command
-              '(;; Synchronously.
-                shell-command
-                ;; Asynchronously.
-                tramp--test-async-shell-command))
+              (append
+               ;; Synchronously.
+               '(shell-command)
+               ;; Asynchronously.
+               (and (tramp--test-asynchronous-processes-p)
+                    '(tramp--test-async-shell-command))))
 
        ;; Test ordinary `{async-}shell-command'.
        (unwind-protect
@@ -5059,31 +5065,34 @@ INPUT, if non-nil, is a string sent to the process."
              (ignore-errors (kill-buffer stderr))))))
 
       ;; Test sending string to `async-shell-command'.
-      (unwind-protect
-         (with-temp-buffer
-           (write-region "foo" nil tmp-name)
-           (should (file-exists-p tmp-name))
-           (tramp--test-async-shell-command
-            "read line; ls $line" (current-buffer) nil
-            ;; String to be sent.
-            (format "%s\n" (file-name-nondirectory tmp-name)))
-           (should
-            (string-equal
-             ;; tramp-adb.el echoes, so we must add the string.
-             (if (and (tramp--test-adb-p) (not (tramp-direct-async-process-p)))
-                 (format
-                  "%s\n%s\n"
-                  (file-name-nondirectory tmp-name)
-                  (file-name-nondirectory tmp-name))
-               (format "%s\n" (file-name-nondirectory tmp-name)))
-             (buffer-string))))
+      (when (tramp--test-asynchronous-processes-p)
+       (unwind-protect
+           (with-temp-buffer
+             (write-region "foo" nil tmp-name)
+             (should (file-exists-p tmp-name))
+             (tramp--test-async-shell-command
+              "read line; ls $line" (current-buffer) nil
+              ;; String to be sent.
+              (format "%s\n" (file-name-nondirectory tmp-name)))
+             (should
+              (string-equal
+               ;; tramp-adb.el echoes, so we must add the string.
+               (if (and (tramp--test-adb-p)
+                        (not (tramp-direct-async-process-p)))
+                   (format
+                    "%s\n%s\n"
+                    (file-name-nondirectory tmp-name)
+                    (file-name-nondirectory tmp-name))
+                 (format "%s\n" (file-name-nondirectory tmp-name)))
+               (buffer-string))))
 
-       ;; Cleanup.
-       (ignore-errors (delete-file tmp-name)))))
+         ;; Cleanup.
+         (ignore-errors (delete-file tmp-name))))))
 
   ;; Test `async-shell-command-width'.  It exists since Emacs 26.1,
   ;; but seems to work since Emacs 27.1 only.
-  (when (and (tramp--test-sh-p) (tramp--test-emacs27-p))
+  (when (and (tramp--test-asynchronous-processes-p)
+            (tramp--test-sh-p) (tramp--test-emacs27-p))
     (let* ((async-shell-command-width 1024)
           (default-directory tramp-test-temporary-file-directory)
           (cols (ignore-errors
@@ -5230,10 +5239,12 @@ INPUT, if non-nil, is a string sent to the process."
   (skip-unless (not (tramp--test-crypt-p)))
 
   (dolist (this-shell-command-to-string
-          '(;; Synchronously.
-            shell-command-to-string
-            ;; Asynchronously.
-            tramp--test-shell-command-to-string-asynchronously))
+          (append
+           ;; Synchronously.
+           '(shell-command-to-string)
+           ;; Asynchronously.
+           (and (tramp--test-asynchronous-processes-p)
+                '(tramp--test-shell-command-to-string-asynchronously))))
 
     (let ((default-directory tramp-test-temporary-file-directory)
          (shell-file-name "/bin/sh")
@@ -5417,7 +5428,7 @@ Use direct async.")
 
 (ert-deftest tramp-test34-explicit-shell-file-name ()
   "Check that connection-local `explicit-shell-file-name' is set."
-  :tags '(:expensive-test)
+  :tags '(:expensive-test :tramp-asynchronous-processes)
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
   ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
@@ -5582,7 +5593,7 @@ Use direct async.")
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-crypt-p)))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     ;; We must use `file-truename' for the temporary directory, in
     ;; order to establish the connection prior running an asynchronous
     ;; process.
@@ -5652,7 +5663,7 @@ Use direct async.")
   "Check `make-auto-save-file-name'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          tramp-allow-unsafe-temporary-files)
@@ -5775,7 +5786,7 @@ Use direct async.")
   "Check `find-backup-file-name'."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (ange-ftp-make-backup-files t)
@@ -5926,7 +5937,7 @@ Use direct async.")
   ;; `lock-file', `unlock-file', `file-locked-p' and
   ;; `make-lock-file-name' exists since Emacs 28.1.  We don't want to
   ;; see compiler warnings for older Emacsen.
-  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (remote-file-name-inhibit-cache t)
@@ -6106,6 +6117,15 @@ This requires restrictions of file name syntax."
    (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
    'tramp-ftp-file-name-handler))
 
+(defun tramp--test-asynchronous-processes-p ()
+  "Whether asynchronous processes tests are run.
+This is used in tests which we dont't want to tag
+`:tramp-asynchronous-processes' completely."
+  (ert-select-tests
+   (ert--stats-selector ert--current-run-stats)
+   (list (make-ert-test :name (ert-test-name (ert-running-test))
+                        :body nil :tags '(:tramp-asynchronous-processes)))))
+
 (defun tramp--test-crypt-p ()
   "Check, whether the remote directory is crypted."
   (tramp-crypt-file-name-p tramp-test-temporary-file-directory))
@@ -6116,6 +6136,15 @@ This does not support some special file names."
   (string-equal
    "docker" (file-remote-p tramp-test-temporary-file-directory 'method)))
 
+(defun tramp--test-expensive-test-p ()
+  "Whether expensive tests are run.
+This is used in tests which we dont't want to tag `:expensive'
+completely."
+  (ert-select-tests
+   (ert--stats-selector ert--current-run-stats)
+   (list (make-ert-test :name (ert-test-name (ert-running-test))
+                        :body nil :tags '(:expensive-test)))))
+
 (defun tramp--test-ftp-p ()
   "Check, whether an FTP-like method is used.
 This does not support globbing characters in file names (yet)."
@@ -6259,8 +6288,9 @@ This requires restrictions of file name syntax."
 (defun tramp--test-check-files (&rest files)
   "Run a simple but comprehensive test over every file in FILES."
   ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted (if (and (tramp--test-expensive-test) 
(tramp--test-emacs27-p))
-                     '(nil t) '(nil)))
+  (dolist (quoted
+          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
+              '(nil t) '(nil)))
     ;; We must use `file-truename' for the temporary directory,
     ;; because it could be located on a symlinked directory.  This
     ;; would let the test fail.
@@ -6420,7 +6450,7 @@ This requires restrictions of file name syntax."
            ;; Check, that environment variables are set correctly.
             ;; We do not run on macOS due to encoding problems.  See
             ;; Bug#36940.
-           (when (and (tramp--test-expensive-test) (tramp--test-sh-p)
+           (when (and (tramp--test-expensive-test-p) (tramp--test-sh-p)
                       (not (tramp--test-crypt-p))
                       (not (eq system-type 'darwin)))
              (dolist (elt files)
@@ -6502,7 +6532,7 @@ This requires restrictions of file name syntax."
          "{foo}bar{baz}")))
     ;; Simplify test in order to speed up.
     (apply #'tramp--test-check-files
-          (if (tramp--test-expensive-test)
+          (if (tramp--test-expensive-test-p)
               files (list (mapconcat #'identity files ""))))))
 
 ;; These tests are inspired by Bug#17238.
@@ -6601,7 +6631,7 @@ Use the \"ls\" command."
        ;; to U+1FFFF).
        "🌈🍒👋")
 
-      (when (tramp--test-expensive-test)
+      (when (tramp--test-expensive-test-p)
        (delete-dups
         (mapcar
          ;; Use all available language specific snippets.
@@ -6773,8 +6803,8 @@ This is needed in timer functions as well as process 
filters and sentinels."
   "Check parallel asynchronous requests.
 Such requests could arrive from timers, process filters and
 process sentinels.  They shall not disturb each other."
-  :tags (if (getenv "EMACS_EMBA_CI")
-           '(:expensive-test :unstable) '(:expensive-test))
+  :tags (append '(:expensive-test :tramp-asynchronous-processes)
+               (and (getenv "EMACS_HYDRA_CI") '(:unstable)))
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
   ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
diff --git a/test/lisp/net/webjump-tests.el b/test/lisp/net/webjump-tests.el
index f767099925..457e465991 100644
--- a/test/lisp/net/webjump-tests.el
+++ b/test/lisp/net/webjump-tests.el
@@ -1,6 +1,6 @@
 ;;; webjump-tests.el --- Tests for webjump.el        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/newcomment-tests.el b/test/lisp/newcomment-tests.el
index 65690e593d..a4e2847141 100644
--- a/test/lisp/newcomment-tests.el
+++ b/test/lisp/newcomment-tests.el
@@ -1,6 +1,6 @@
 ;;; newcomment-tests.el --- Tests for newcomment.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/nxml/nxml-mode-tests.el 
b/test/lisp/nxml/nxml-mode-tests.el
index 7824691333..04346e0f4f 100644
--- a/test/lisp/nxml/nxml-mode-tests.el
+++ b/test/lisp/nxml/nxml-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; nxml-mode-tests.el --- Test NXML Mode -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/nxml/xsd-regexp-tests.el 
b/test/lisp/nxml/xsd-regexp-tests.el
index 2194602dbe..bd43889a5a 100644
--- a/test/lisp/nxml/xsd-regexp-tests.el
+++ b/test/lisp/nxml/xsd-regexp-tests.el
@@ -1,6 +1,6 @@
 ;;; xsd-regexp-tests.el --- Test NXML Mode -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/obarray-tests.el b/test/lisp/obarray-tests.el
index 45d82c75c1..f34109af24 100644
--- a/test/lisp/obarray-tests.el
+++ b/test/lisp/obarray-tests.el
@@ -1,6 +1,6 @@
 ;;; obarray-tests.el --- Tests for obarray -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Przemysław Wojnowski <esperanto@cumego.com>
 
diff --git a/test/lisp/obsolete/cl-tests.el b/test/lisp/obsolete/cl-tests.el
index 659c51ebcf..5a701a1e55 100644
--- a/test/lisp/obsolete/cl-tests.el
+++ b/test/lisp/obsolete/cl-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-tests.el --- tests for emacs-lisp/cl.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/obsolete/inversion-tests.el 
b/test/lisp/obsolete/inversion-tests.el
index c8b45d67ea..7c8815c282 100644
--- a/test/lisp/obsolete/inversion-tests.el
+++ b/test/lisp/obsolete/inversion-tests.el
@@ -1,6 +1,6 @@
 ;;; inversion-tests.el --- Tests for inversion.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/lisp/obsolete/rfc2368-tests.el 
b/test/lisp/obsolete/rfc2368-tests.el
index f997ea3ecb..28fac3785c 100644
--- a/test/lisp/obsolete/rfc2368-tests.el
+++ b/test/lisp/obsolete/rfc2368-tests.el
@@ -1,6 +1,6 @@
 ;;; rfc2368-tests.el --- Tests for rfc2368.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/org/org-tests.el b/test/lisp/org/org-tests.el
index e53b038408..91c8ffc48d 100644
--- a/test/lisp/org/org-tests.el
+++ b/test/lisp/org/org-tests.el
@@ -1,6 +1,6 @@
 ;;; org-tests.el --- tests for org/org.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
diff --git a/test/lisp/paren-tests.el b/test/lisp/paren-tests.el
index 11249ee9bc..baf5590cb9 100644
--- a/test/lisp/paren-tests.el
+++ b/test/lisp/paren-tests.el
@@ -1,6 +1,6 @@
 ;;; paren-tests.el --- Tests for paren.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/password-cache-tests.el 
b/test/lisp/password-cache-tests.el
index 11cb65cc16..ca760c2fb3 100644
--- a/test/lisp/password-cache-tests.el
+++ b/test/lisp/password-cache-tests.el
@@ -1,6 +1,6 @@
 ;;; password-cache-tests.el --- Tests for password-cache.el  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/pcmpl-linux-tests.el b/test/lisp/pcmpl-linux-tests.el
index 1b795ad706..a02c535fd5 100644
--- a/test/lisp/pcmpl-linux-tests.el
+++ b/test/lisp/pcmpl-linux-tests.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-linux-tests.el --- Tests for pcmpl-linux.el  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/play/animate-tests.el b/test/lisp/play/animate-tests.el
index 6252724467..1c7bb0f081 100644
--- a/test/lisp/play/animate-tests.el
+++ b/test/lisp/play/animate-tests.el
@@ -1,6 +1,6 @@
 ;;; animate-tests.el --- Tests for animate.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/play/cookie1-tests.el b/test/lisp/play/cookie1-tests.el
index 2dd73d1802..5f3ad6d8f8 100644
--- a/test/lisp/play/cookie1-tests.el
+++ b/test/lisp/play/cookie1-tests.el
@@ -1,6 +1,6 @@
 ;;; cookie1-tests.el --- Tests for cookie1.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/play/dissociate-tests.el 
b/test/lisp/play/dissociate-tests.el
index e2f1e03101..7af7e425c4 100644
--- a/test/lisp/play/dissociate-tests.el
+++ b/test/lisp/play/dissociate-tests.el
@@ -1,6 +1,6 @@
 ;;; dissociate-tests.el --- Tests for dissociate.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/play/fortune-tests.el b/test/lisp/play/fortune-tests.el
index 3b85febaf0..b79b1f2701 100644
--- a/test/lisp/play/fortune-tests.el
+++ b/test/lisp/play/fortune-tests.el
@@ -1,6 +1,6 @@
 ;;; fortune-tests.el --- Tests for fortune.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/play/life-tests.el b/test/lisp/play/life-tests.el
index cdc507b576..c1dcc9d40f 100644
--- a/test/lisp/play/life-tests.el
+++ b/test/lisp/play/life-tests.el
@@ -1,6 +1,6 @@
 ;;; life-tests.el --- Tests for life.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/play/morse-tests.el b/test/lisp/play/morse-tests.el
index 7e03952970..82ac910100 100644
--- a/test/lisp/play/morse-tests.el
+++ b/test/lisp/play/morse-tests.el
@@ -1,6 +1,6 @@
 ;;; morse-tests.el --- Tests for morse.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/play/studly-tests.el b/test/lisp/play/studly-tests.el
index 87e16fdd33..ea241bfbe8 100644
--- a/test/lisp/play/studly-tests.el
+++ b/test/lisp/play/studly-tests.el
@@ -1,6 +1,6 @@
 ;;; studly-tests.el --- Tests for studly.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/progmodes/asm-mode-tests.el 
b/test/lisp/progmodes/asm-mode-tests.el
index 87872179d9..e321224c54 100644
--- a/test/lisp/progmodes/asm-mode-tests.el
+++ b/test/lisp/progmodes/asm-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; asm-mode-tests.el --- Tests for asm-mode.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/progmodes/autoconf-tests.el 
b/test/lisp/progmodes/autoconf-tests.el
index 3d347feaf6..e383b4bb6c 100644
--- a/test/lisp/progmodes/autoconf-tests.el
+++ b/test/lisp/progmodes/autoconf-tests.el
@@ -1,6 +1,6 @@
 ;;; autoconf-tests.el --- Tests for autoconf.el      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/progmodes/bat-mode-tests.el 
b/test/lisp/progmodes/bat-mode-tests.el
index 78145124fb..5ef4158ec9 100644
--- a/test/lisp/progmodes/bat-mode-tests.el
+++ b/test/lisp/progmodes/bat-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; bat-mode-tests.el --- Tests for bat-mode.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Vladimir Panteleev <vladimir@thecybershadow.net>
 ;; Keywords:
diff --git a/test/lisp/progmodes/bug-reference-tests.el 
b/test/lisp/progmodes/bug-reference-tests.el
index 7a3ab5fbda..fa06d7a1cd 100644
--- a/test/lisp/progmodes/bug-reference-tests.el
+++ b/test/lisp/progmodes/bug-reference-tests.el
@@ -1,6 +1,6 @@
 ;;; bug-reference-tests.el --- Tests for bug-reference.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/cc-mode-tests.el 
b/test/lisp/progmodes/cc-mode-tests.el
index a3a8ff208e..2220721ccf 100644
--- a/test/lisp/progmodes/cc-mode-tests.el
+++ b/test/lisp/progmodes/cc-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; cc-mode-tests.el --- Test suite for cc-mode.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Michal Nazarewicz <mina86@mina86.com>
 ;; Keywords:       internal
diff --git a/test/lisp/progmodes/compile-tests.el 
b/test/lisp/progmodes/compile-tests.el
index c87a4453cb..774370be4c 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -1,6 +1,6 @@
 ;;; compile-tests.el --- Test suite for compile.el.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <cyd@stupidchicken.com>
 ;; Keywords:       internal
diff --git a/test/lisp/progmodes/cperl-mode-tests.el 
b/test/lisp/progmodes/cperl-mode-tests.el
index 29b9e3f6fb..0124dad6f1 100644
--- a/test/lisp/progmodes/cperl-mode-tests.el
+++ b/test/lisp/progmodes/cperl-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; cperl-mode-tests.el --- Test for cperl-mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Harald Jörg <haj@posteo.de>
 ;; Maintainer: Harald Jörg
diff --git a/test/lisp/progmodes/elisp-mode-tests.el 
b/test/lisp/progmodes/elisp-mode-tests.el
index b6161c367e..3bcb6b9f04 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <dgutov@yandex.ru>
 ;; Author: Stephen Leake <stephen_leake@member.fsf.org>
diff --git a/test/lisp/progmodes/etags-tests.el 
b/test/lisp/progmodes/etags-tests.el
index 32b73f101e..673c582cc7 100644
--- a/test/lisp/progmodes/etags-tests.el
+++ b/test/lisp/progmodes/etags-tests.el
@@ -1,6 +1,6 @@
 ;;; etags-tests.el --- Test suite for etags.el.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <eliz@gnu.org>
 
diff --git a/test/lisp/progmodes/executable-tests.el 
b/test/lisp/progmodes/executable-tests.el
index 4f0fa699f7..6988fef87d 100644
--- a/test/lisp/progmodes/executable-tests.el
+++ b/test/lisp/progmodes/executable-tests.el
@@ -1,6 +1,6 @@
 ;;; executable-tests.el --- Tests for executable.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/f90-tests.el b/test/lisp/progmodes/f90-tests.el
index 330eab38c4..3fe5eecd1b 100644
--- a/test/lisp/progmodes/f90-tests.el
+++ b/test/lisp/progmodes/f90-tests.el
@@ -1,6 +1,6 @@
 ;;; f90-tests.el --- tests for progmodes/f90.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <rgm@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/progmodes/flymake-tests.el 
b/test/lisp/progmodes/flymake-tests.el
index 4840018236..ced7b5aace 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -1,6 +1,6 @@
 ;;; flymake-tests.el --- Test suite for flymake -*- lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Eduard Wiebe <usenet@pusto.de>
 
@@ -140,9 +140,15 @@ SEVERITY-PREDICATE is used to setup
         (flymake-goto-next-error)
         (should (eq 'flymake-error (face-at-point)))))))
 
+(defun flymake-tests--gcc-is-clang ()
+  "Whether the `gcc' command actually runs the Clang compiler."
+  (string-match "[Cc]lang version "
+                (shell-command-to-string "gcc --version")))
+
 (ert-deftest different-diagnostic-types ()
   "Test GCC warning via function predicate."
   (skip-unless (and (executable-find "gcc")
+                    (not (flymake-tests--gcc-is-clang))
                     (version<=
                      "5" (string-trim
                           (shell-command-to-string "gcc -dumpversion")))
@@ -166,7 +172,9 @@ SEVERITY-PREDICATE is used to setup
 
 (ert-deftest included-c-header-files ()
   "Test inclusion of .h header files."
-  (skip-unless (and (executable-find "gcc") (executable-find "make")))
+  (skip-unless (and (executable-find "gcc")
+                    (not (flymake-tests--gcc-is-clang))
+                    (executable-find "make")))
   (let ((flymake-wrap-around nil))
     (flymake-tests--with-flymake
         ("some-problems.h")
diff --git a/test/lisp/progmodes/gdb-mi-tests.el 
b/test/lisp/progmodes/gdb-mi-tests.el
index d66df961b6..b91eab7705 100644
--- a/test/lisp/progmodes/gdb-mi-tests.el
+++ b/test/lisp/progmodes/gdb-mi-tests.el
@@ -1,6 +1,6 @@
 ;;; gdb-mi-tests.el --- tests for gdb-mi.el    -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/glasses-tests.el 
b/test/lisp/progmodes/glasses-tests.el
index 633c7bf2db..915fb60d3c 100644
--- a/test/lisp/progmodes/glasses-tests.el
+++ b/test/lisp/progmodes/glasses-tests.el
@@ -1,6 +1,6 @@
 ;;; glasses-tests.el --- Tests for glasses.el        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/progmodes/grep-tests.el 
b/test/lisp/progmodes/grep-tests.el
index 205982238f..101052c5ad 100644
--- a/test/lisp/progmodes/grep-tests.el
+++ b/test/lisp/progmodes/grep-tests.el
@@ -1,6 +1,6 @@
 ;;; grep-tests.el --- Test suite for grep.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index cb7011e9a7..2ce9db65d4 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -1,6 +1,6 @@
 ;;; js-tests.el --- Test suite for js-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/octave-tests.el 
b/test/lisp/progmodes/octave-tests.el
index e28fe73b83..76dd5c9e5f 100644
--- a/test/lisp/progmodes/octave-tests.el
+++ b/test/lisp/progmodes/octave-tests.el
@@ -1,6 +1,6 @@
 ;;; octave-tests.el --- Test suite for octave.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/opascal-tests.el 
b/test/lisp/progmodes/opascal-tests.el
index ea91479362..cf6bd37614 100644
--- a/test/lisp/progmodes/opascal-tests.el
+++ b/test/lisp/progmodes/opascal-tests.el
@@ -1,6 +1,6 @@
 ;;; opascal-tests.el --- tests for opascal.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/pascal-tests.el 
b/test/lisp/progmodes/pascal-tests.el
index f5202143e2..fb9b52fb86 100644
--- a/test/lisp/progmodes/pascal-tests.el
+++ b/test/lisp/progmodes/pascal-tests.el
@@ -1,6 +1,6 @@
 ;;; pascal-tests.el --- tests for pascal.el    -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/perl-mode-tests.el 
b/test/lisp/progmodes/perl-mode-tests.el
index 3f4af5e1f6..91f1db23d6 100644
--- a/test/lisp/progmodes/perl-mode-tests.el
+++ b/test/lisp/progmodes/perl-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; perl-mode-tests.el --- Test for perl-mode  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -37,4 +37,6 @@
                               (file-name-directory (or load-file-name
                                                        buffer-file-name)))))
 
+(setq ert-load-file-name load-file-name)
+
 ;;; perl-mode-tests.el ends here
diff --git a/test/lisp/progmodes/project-tests.el 
b/test/lisp/progmodes/project-tests.el
index a469414a74..d4b6bca7e8 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -1,6 +1,6 @@
 ;;; project-tests.el --- tests for project.el -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021  Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Keywords:
 
diff --git a/test/lisp/progmodes/ps-mode-tests.el 
b/test/lisp/progmodes/ps-mode-tests.el
index eccc862ee3..7fa40eb0cb 100644
--- a/test/lisp/progmodes/ps-mode-tests.el
+++ b/test/lisp/progmodes/ps-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; ps-mode-tests.el --- Test suite for ps-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index 15bda5c197..0eb1c087f4 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -1,6 +1,6 @@
 ;;; python-tests.el --- Test suite for python.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -5449,15 +5449,21 @@ buffer with overlapping strings."
                     (python-nav-end-of-statement)))
     (should (eolp))))
 
-;; After call `run-python' the buffer running the python process is current.
-(ert-deftest python-tests--bug31398 ()
-  "Test for https://debbugs.gnu.org/31398 ."
+;; Interactively, `run-python' focuses the buffer running the
+;; interpreter.
+(ert-deftest python-tests--run-python-selects-window ()
+  "Test for bug#31398.  See also bug#44421 and bug#52380."
   (skip-unless (executable-find python-tests-shell-interpreter))
-  (let ((buffer (process-buffer (run-python nil nil 'show))))
-    (should (eq buffer (current-buffer)))
+  (let* ((buffer (process-buffer (run-python nil nil 'show)))
+         (window (get-buffer-window buffer)))
+    ;; We look at `selected-window' rather than `current-buffer'
+    ;; because as `(elisp)Current buffer' says, the latter will only
+    ;; be synchronized with the former when returning to the "command
+    ;; loop"; until then, `current-buffer' can change arbitrarily.
+    (should (eq window (selected-window)))
     (pop-to-buffer (other-buffer))
     (run-python nil nil 'show)
-    (should (eq buffer (current-buffer)))))
+    (should (eq window (selected-window)))))
 
 (ert-deftest python-tests--fill-long-first-line ()
   (should
diff --git a/test/lisp/progmodes/ruby-mode-tests.el 
b/test/lisp/progmodes/ruby-mode-tests.el
index 2168b38484..23e13b94e6 100644
--- a/test/lisp/progmodes/ruby-mode-tests.el
+++ b/test/lisp/progmodes/ruby-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; ruby-mode-tests.el --- Test suite for ruby-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/scheme-tests.el 
b/test/lisp/progmodes/scheme-tests.el
index 8f2f75f81c..b36e85c770 100644
--- a/test/lisp/progmodes/scheme-tests.el
+++ b/test/lisp/progmodes/scheme-tests.el
@@ -1,6 +1,6 @@
 ;;; scheme-tests.el --- Test suite for scheme.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/sh-script-tests.el 
b/test/lisp/progmodes/sh-script-tests.el
index c21010c8b4..ebd26ab429 100644
--- a/test/lisp/progmodes/sh-script-tests.el
+++ b/test/lisp/progmodes/sh-script-tests.el
@@ -1,6 +1,6 @@
 ;;; sh-script-tests.el --- Tests for sh-script.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el
index 1bbe3a95e9..7e36d845e2 100644
--- a/test/lisp/progmodes/sql-tests.el
+++ b/test/lisp/progmodes/sql-tests.el
@@ -1,6 +1,6 @@
 ;;; sql-tests.el --- Tests for sql.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/progmodes/subword-tests.el 
b/test/lisp/progmodes/subword-tests.el
index 28a9445e01..7ce27e4df4 100644
--- a/test/lisp/progmodes/subword-tests.el
+++ b/test/lisp/progmodes/subword-tests.el
@@ -1,6 +1,6 @@
 ;;; subword-tests.el --- Testing the subword rules  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords:
diff --git a/test/lisp/progmodes/tcl-tests.el b/test/lisp/progmodes/tcl-tests.el
index e55eb6d901..d2346606c2 100644
--- a/test/lisp/progmodes/tcl-tests.el
+++ b/test/lisp/progmodes/tcl-tests.el
@@ -1,6 +1,6 @@
 ;;; tcl-tests.el --- Test suite for tcl-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/xref-tests.el 
b/test/lisp/progmodes/xref-tests.el
index b1de1a4df5..f7af5055c7 100644
--- a/test/lisp/progmodes/xref-tests.el
+++ b/test/lisp/progmodes/xref-tests.el
@@ -1,6 +1,6 @@
 ;;; xref-tests.el --- tests for xref  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <dgutov@yandex.ru>
 
diff --git a/test/lisp/ps-print-tests.el b/test/lisp/ps-print-tests.el
index d468911dd3..35aa1a9bd1 100644
--- a/test/lisp/ps-print-tests.el
+++ b/test/lisp/ps-print-tests.el
@@ -1,6 +1,6 @@
 ;;; ps-print-tests.el --- Test suite for ps-print.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Phillip Lord <phillip.lord@russet.org.uk>
 
diff --git a/test/lisp/register-tests.el b/test/lisp/register-tests.el
index 537a66737b..881a2f90e1 100644
--- a/test/lisp/register-tests.el
+++ b/test/lisp/register-tests.el
@@ -1,6 +1,6 @@
 ;;; register-tests.el --- tests for register.el  -*- lexical-binding: t-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/repeat-tests.el b/test/lisp/repeat-tests.el
index 02d9ddbc96..1382d00359 100644
--- a/test/lisp/repeat-tests.el
+++ b/test/lisp/repeat-tests.el
@@ -1,6 +1,6 @@
 ;;; repeat-tests.el --- Tests for repeat.el          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@linkov.net>
 
@@ -34,20 +34,16 @@
   (interactive "p")
   (push `(,arg b) repeat-tests-calls))
 
-(defvar repeat-tests-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-x w a") 'repeat-tests-call-a)
-    (define-key map (kbd "M-C-a") 'repeat-tests-call-a)
-    (define-key map (kbd "M-C-z") 'repeat-tests-call-a)
-    map)
-  "Keymap for keys that initiate repeating sequences.")
-
-(defvar repeat-tests-repeat-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "a" 'repeat-tests-call-a)
-    (define-key map "b" 'repeat-tests-call-b)
-    map)
-  "Keymap for repeating sequences.")
+(defvar-keymap repeat-tests-map
+  :doc "Keymap for keys that initiate repeating sequences."
+  "C-x w a" 'repeat-tests-call-a
+  "C-M-a"   'repeat-tests-call-a
+  "C-M-z"   'repeat-tests-call-a)
+
+(defvar-keymap repeat-tests-repeat-map
+  :doc "Keymap for repeating sequences."
+  "a" 'repeat-tests-call-a
+  "b" 'repeat-tests-call-b)
 (put 'repeat-tests-call-a 'repeat-map 'repeat-tests-repeat-map)
 (put 'repeat-tests-call-b 'repeat-map repeat-tests-repeat-map)
 
diff --git a/test/lisp/replace-tests.el b/test/lisp/replace-tests.el
index dcd5ebb1fe..5ba11ed0d5 100644
--- a/test/lisp/replace-tests.el
+++ b/test/lisp/replace-tests.el
@@ -1,6 +1,6 @@
 ;;; replace-tests.el --- tests for replace.el.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Richard <youngfrog@members.fsf.org>
 ;; Author: Juri Linkov <juri@jurta.org>
diff --git a/test/lisp/rot13-tests.el b/test/lisp/rot13-tests.el
index 374d4ebaa8..bbe9531666 100644
--- a/test/lisp/rot13-tests.el
+++ b/test/lisp/rot13-tests.el
@@ -1,6 +1,6 @@
 ;;; rot13-tests.el --- Tests for rot13.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/saveplace-tests.el b/test/lisp/saveplace-tests.el
index 190ffb7828..6f66f3fa34 100644
--- a/test/lisp/saveplace-tests.el
+++ b/test/lisp/saveplace-tests.el
@@ -1,6 +1,6 @@
 ;;; saveplace-tests.el --- Tests for saveplace.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/scroll-lock-tests.el b/test/lisp/scroll-lock-tests.el
index 8391a75f49..2bad8e7d48 100644
--- a/test/lisp/scroll-lock-tests.el
+++ b/test/lisp/scroll-lock-tests.el
@@ -1,6 +1,6 @@
 ;;; scroll-lock-tests.el --- Test suite for scroll-lock -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el
index 932291afcc..cd524cbf6e 100644
--- a/test/lisp/ses-tests.el
+++ b/test/lisp/ses-tests.el
@@ -1,6 +1,6 @@
 ;;; ses-tests.el --- Tests for ses.el              -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Vincent Belaïche <vincentb1@users.sourceforge.net>
 
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el
index 1ab539f3e4..46ab34535d 100644
--- a/test/lisp/shadowfile-tests.el
+++ b/test/lisp/shadowfile-tests.el
@@ -1,6 +1,6 @@
 ;;; shadowfile-tests.el --- Tests of shadowfile  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/shell-tests.el b/test/lisp/shell-tests.el
index 342b421911..f2cd2f6aea 100644
--- a/test/lisp/shell-tests.el
+++ b/test/lisp/shell-tests.el
@@ -1,6 +1,6 @@
 ;;; shell-tests.el --- Tests for shell.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el
index 742da0bde5..6350bebeee 100644
--- a/test/lisp/simple-tests.el
+++ b/test/lisp/simple-tests.el
@@ -1,6 +1,6 @@
 ;;; simple-tests.el --- Tests for simple.el           -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 
diff --git a/test/lisp/so-long-tests/autoload-longlines-mode-tests.el 
b/test/lisp/so-long-tests/autoload-longlines-mode-tests.el
index 696206efe2..11c018b36c 100644
--- a/test/lisp/so-long-tests/autoload-longlines-mode-tests.el
+++ b/test/lisp/so-long-tests/autoload-longlines-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; autoload-longlines-mode-tests.el --- Test suite for so-long.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Keywords: convenience
diff --git a/test/lisp/so-long-tests/autoload-major-mode-tests.el 
b/test/lisp/so-long-tests/autoload-major-mode-tests.el
index 87adf826ab..2cde241d0b 100644
--- a/test/lisp/so-long-tests/autoload-major-mode-tests.el
+++ b/test/lisp/so-long-tests/autoload-major-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; autoload-major-mode-tests.el --- Test suite for so-long.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Keywords: convenience
diff --git a/test/lisp/so-long-tests/autoload-minor-mode-tests.el 
b/test/lisp/so-long-tests/autoload-minor-mode-tests.el
index 4980a7e1bc..cf89cff558 100644
--- a/test/lisp/so-long-tests/autoload-minor-mode-tests.el
+++ b/test/lisp/so-long-tests/autoload-minor-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; autoload-minor-mode-tests.el --- Test suite for so-long.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Keywords: convenience
diff --git a/test/lisp/so-long-tests/so-long-tests-helpers.el 
b/test/lisp/so-long-tests/so-long-tests-helpers.el
index f542806ac1..852e7811cc 100644
--- a/test/lisp/so-long-tests/so-long-tests-helpers.el
+++ b/test/lisp/so-long-tests/so-long-tests-helpers.el
@@ -1,6 +1,6 @@
 ;;; so-long-tests-helpers.el --- Test suite for so-long.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Keywords: convenience
diff --git a/test/lisp/so-long-tests/so-long-tests.el 
b/test/lisp/so-long-tests/so-long-tests.el
index cda5ae497f..d83ed34e27 100644
--- a/test/lisp/so-long-tests/so-long-tests.el
+++ b/test/lisp/so-long-tests/so-long-tests.el
@@ -1,6 +1,6 @@
 ;;; so-long-tests.el --- Test suite for so-long.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Keywords: convenience
diff --git a/test/lisp/so-long-tests/spelling-tests.el 
b/test/lisp/so-long-tests/spelling-tests.el
index b598366ba7..317513e9a9 100644
--- a/test/lisp/so-long-tests/spelling-tests.el
+++ b/test/lisp/so-long-tests/spelling-tests.el
@@ -1,6 +1,6 @@
 ;;; spelling-tests.el --- Test suite for so-long.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Phil Sainty <psainty@orcon.net.nz>
 ;; Keywords: convenience
diff --git a/test/lisp/sort-tests.el b/test/lisp/sort-tests.el
index 62b89c1825..7f49cc38d1 100644
--- a/test/lisp/sort-tests.el
+++ b/test/lisp/sort-tests.el
@@ -1,6 +1,6 @@
 ;;; sort-tests.el --- Tests for sort.el              -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 
diff --git a/test/lisp/soundex-tests.el b/test/lisp/soundex-tests.el
index aa3609e5db..0ac0ddd666 100644
--- a/test/lisp/soundex-tests.el
+++ b/test/lisp/soundex-tests.el
@@ -1,6 +1,6 @@
 ;;; soundex-tests.el --- tests for soundex.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
diff --git a/test/lisp/startup-tests.el b/test/lisp/startup-tests.el
index 109d909622..01ed3a69fd 100644
--- a/test/lisp/startup-tests.el
+++ b/test/lisp/startup-tests.el
@@ -1,6 +1,6 @@
 ;;; startup-tests.el --- unit tests for startup.el   -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 063c6fe6a7..9be7511bdc 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1,6 +1,6 @@
 ;;; subr-tests.el --- Tests for subr.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Oleh Krehel <ohwoeowho@gmail.com>,
 ;;         Nicolas Petton <nicolas@petton.fr>
diff --git a/test/lisp/tab-bar-tests.el b/test/lisp/tab-bar-tests.el
index 7212ce8916..6d57146cd0 100644
--- a/test/lisp/tab-bar-tests.el
+++ b/test/lisp/tab-bar-tests.el
@@ -1,6 +1,6 @@
 ;;; tab-bar-tests.el --- Tests for tab-bar.el          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <juri@linkov.net>
 
diff --git a/test/lisp/tabify-tests.el b/test/lisp/tabify-tests.el
index 4896e4a1aa..eaa3527df0 100644
--- a/test/lisp/tabify-tests.el
+++ b/test/lisp/tabify-tests.el
@@ -1,6 +1,6 @@
 ;;; tabify-tests.el --- tests for tabify.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el
index 2e0d1529a5..47c658eb9a 100644
--- a/test/lisp/tar-mode-tests.el
+++ b/test/lisp/tar-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; tar-mode-tests.el --- Test suite for tar-mode. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/tempo-tests.el b/test/lisp/tempo-tests.el
index 7594c360ad..52553d791f 100644
--- a/test/lisp/tempo-tests.el
+++ b/test/lisp/tempo-tests.el
@@ -1,6 +1,6 @@
 ;;; tempo-tests.el --- Test suite for tempo.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Federico Tedin <federicotedin@gmail.com>
 ;; Keywords: abbrev
diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el
index 73d39cf3b6..f60d2ff574 100644
--- a/test/lisp/term-tests.el
+++ b/test/lisp/term-tests.el
@@ -1,6 +1,6 @@
 ;;; term-tests.el --- tests for term.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017, 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/term/tty-colors-tests.el 
b/test/lisp/term/tty-colors-tests.el
index d0e739b5ec..e55b10511e 100644
--- a/test/lisp/term/tty-colors-tests.el
+++ b/test/lisp/term/tty-colors-tests.el
@@ -1,6 +1,6 @@
 ;;; tty-colors-tests.el --- tests for tty-colors.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/textmodes/bibtex-tests.el 
b/test/lisp/textmodes/bibtex-tests.el
index 010808ce48..1bf15d1729 100644
--- a/test/lisp/textmodes/bibtex-tests.el
+++ b/test/lisp/textmodes/bibtex-tests.el
@@ -1,6 +1,6 @@
 ;;; bibtex-tests.el --- Test suite for bibtex.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Keywords: bibtex
 
diff --git a/test/lisp/textmodes/conf-mode-tests.el 
b/test/lisp/textmodes/conf-mode-tests.el
index 9c4fd1afdf..2b4fde40c3 100644
--- a/test/lisp/textmodes/conf-mode-tests.el
+++ b/test/lisp/textmodes/conf-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; conf-mode-tests.el --- Test suite for conf mode  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: J. Alexander Branham <alex.branham@gmail.com>
 ;; Keywords: internal
diff --git a/test/lisp/textmodes/css-mode-tests.el 
b/test/lisp/textmodes/css-mode-tests.el
index abf85dbff4..0ae1593508 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; css-mode-tests.el --- Test suite for CSS mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords: internal
diff --git a/test/lisp/textmodes/dns-mode-tests.el 
b/test/lisp/textmodes/dns-mode-tests.el
index 1be5291509..40896cf2f3 100644
--- a/test/lisp/textmodes/dns-mode-tests.el
+++ b/test/lisp/textmodes/dns-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; dns-mode-tests.el --- Test suite for dns-mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Peder O. Klingenberg <peder@klingenberg.no>
 ;; Keywords: dns zone
diff --git a/test/lisp/textmodes/fill-tests.el 
b/test/lisp/textmodes/fill-tests.el
index 2a1195b87e..a3265e2445 100644
--- a/test/lisp/textmodes/fill-tests.el
+++ b/test/lisp/textmodes/fill-tests.el
@@ -1,6 +1,6 @@
 ;;; fill-tests.el --- ERT tests for fill.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author:     Marcin Borkowski <mbork@mbork.pl>
 ;; Keywords:   text, wp
diff --git a/test/lisp/textmodes/mhtml-mode-tests.el 
b/test/lisp/textmodes/mhtml-mode-tests.el
index ad386bf1bd..f09a768f98 100644
--- a/test/lisp/textmodes/mhtml-mode-tests.el
+++ b/test/lisp/textmodes/mhtml-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; mhtml-mode-tests.el --- Tests for mhtml-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Keywords: tests
 
diff --git a/test/lisp/textmodes/page-tests.el 
b/test/lisp/textmodes/page-tests.el
index c02d125c2a..596f3a6ceb 100644
--- a/test/lisp/textmodes/page-tests.el
+++ b/test/lisp/textmodes/page-tests.el
@@ -1,6 +1,6 @@
 ;;; page-tests.el --- Tests for page.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/textmodes/paragraphs-tests.el 
b/test/lisp/textmodes/paragraphs-tests.el
index 712169029d..e54b459b20 100644
--- a/test/lisp/textmodes/paragraphs-tests.el
+++ b/test/lisp/textmodes/paragraphs-tests.el
@@ -1,6 +1,6 @@
 ;;; paragraphs-tests.el --- Tests for paragraphs.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/textmodes/po-tests.el b/test/lisp/textmodes/po-tests.el
index c75cb5eae7..982d3404ff 100644
--- a/test/lisp/textmodes/po-tests.el
+++ b/test/lisp/textmodes/po-tests.el
@@ -1,6 +1,6 @@
 ;;; po-tests.el --- Tests for po.el                  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords:
diff --git a/test/lisp/textmodes/reftex-tests.el 
b/test/lisp/textmodes/reftex-tests.el
index cc5b23e1c9..9ef41088d1 100644
--- a/test/lisp/textmodes/reftex-tests.el
+++ b/test/lisp/textmodes/reftex-tests.el
@@ -1,6 +1,6 @@
 ;;; reftex-tests.el --- Test suite for reftex. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
 ;; Keywords:       internal
diff --git a/test/lisp/textmodes/sgml-mode-tests.el 
b/test/lisp/textmodes/sgml-mode-tests.el
index b4c0186aac..d08851eb41 100644
--- a/test/lisp/textmodes/sgml-mode-tests.el
+++ b/test/lisp/textmodes/sgml-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; sgml-mode-tests.el --- Tests for sgml-mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Przemysław Wojnowski <esperanto@cumego.com>
 ;; Keywords: tests
diff --git a/test/lisp/textmodes/texinfo-tests.el 
b/test/lisp/textmodes/texinfo-tests.el
index fa0c4de005..48cc5fece2 100644
--- a/test/lisp/textmodes/texinfo-tests.el
+++ b/test/lisp/textmodes/texinfo-tests.el
@@ -1,6 +1,6 @@
 ;;; texinfo-tests.el --- Tests for texinfo.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/textmodes/tildify-tests.el 
b/test/lisp/textmodes/tildify-tests.el
index 3ee3cd6fb1..a663bc2996 100644
--- a/test/lisp/textmodes/tildify-tests.el
+++ b/test/lisp/textmodes/tildify-tests.el
@@ -1,6 +1,6 @@
 ;;; tildify-tests.el --- ERT tests for tildify.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author:     Michal Nazarewicz <mina86@mina86.com>
 ;; Version:    4.5
diff --git a/test/lisp/textmodes/underline-tests.el 
b/test/lisp/textmodes/underline-tests.el
index 481c9cca42..acc72a78a0 100644
--- a/test/lisp/textmodes/underline-tests.el
+++ b/test/lisp/textmodes/underline-tests.el
@@ -1,6 +1,6 @@
 ;;; underline-tests.el --- Tests for underline.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index f2031fa79a..b6d0b1446a 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -1,6 +1,6 @@
 ;;; thingatpt-tests.el --- tests for thing-at-point.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -215,12 +215,4 @@ position to retrieve THING.")
   (should (equal (test--number "0xf00" 2) 3840))
   (should (equal (test--number "0xf00" 3) 3840)))
 
-(ert-deftest test-fields ()
-  (with-temp-buffer
-    (insert (propertize "foo" 'field 1) "bar" (propertize "zot" 'field 2))
-    (goto-char 1)
-    (should (eq (symbol-at-point) 'foo))
-    (goto-char 5)
-    (should (eq (symbol-at-point) 'bar))))
-
 ;;; thingatpt-tests.el ends here
diff --git a/test/lisp/thread-tests.el b/test/lisp/thread-tests.el
index 4aed5057ff..108fa8cb98 100644
--- a/test/lisp/thread-tests.el
+++ b/test/lisp/thread-tests.el
@@ -1,6 +1,6 @@
 ;;; thread-tests.el --- Test suite for thread.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <gazally@runbox.com>
 ;; Keywords: threads
diff --git a/test/lisp/thumbs-tests.el b/test/lisp/thumbs-tests.el
index a9b41d7c00..a8972394fa 100644
--- a/test/lisp/thumbs-tests.el
+++ b/test/lisp/thumbs-tests.el
@@ -1,6 +1,6 @@
 ;;; thumbs-tests.el --- tests for thumbs.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index a049e5de58..d52a19ef5d 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -1,6 +1,6 @@
 ;;; time-stamp-tests.el --- tests for time-stamp.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/time-tests.el b/test/lisp/time-tests.el
index 89e6985b84..a95871eb56 100644
--- a/test/lisp/time-tests.el
+++ b/test/lisp/time-tests.el
@@ -1,6 +1,6 @@
 ;;; time-tests.el --- Tests for time.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/timezone-tests.el b/test/lisp/timezone-tests.el
index 9bbe36cfe8..a87f262376 100644
--- a/test/lisp/timezone-tests.el
+++ b/test/lisp/timezone-tests.el
@@ -1,6 +1,6 @@
 ;;; timezone-tests.el --- Tests for timezone.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefankangas@gmail.com>
 
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el
index 05ccfc0d12..fa6ecdce39 100644
--- a/test/lisp/url/url-auth-tests.el
+++ b/test/lisp/url/url-auth-tests.el
@@ -1,6 +1,6 @@
 ;;; url-auth-tests.el --- Test suite for url-auth.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Jarno Malmari <jarno@malmari.fi>
 
diff --git a/test/lisp/url/url-domsuf-tests.el 
b/test/lisp/url/url-domsuf-tests.el
index d084c7a8bc..3396284682 100644
--- a/test/lisp/url/url-domsuf-tests.el
+++ b/test/lisp/url/url-domsuf-tests.el
@@ -1,6 +1,6 @@
 ;;; url-domsuf-tests.el --- Tests for url-domsuf.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/url/url-expand-tests.el 
b/test/lisp/url/url-expand-tests.el
index 52124dfedd..a9695c6a19 100644
--- a/test/lisp/url/url-expand-tests.el
+++ b/test/lisp/url/url-expand-tests.el
@@ -1,6 +1,6 @@
 ;;; url-expand-tests.el --- Test suite for relative URI/URL resolution.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Alain Schneble <a.s@realize.ch>
 ;; Version: 1.0
diff --git a/test/lisp/url/url-file-tests.el b/test/lisp/url/url-file-tests.el
index 18365c7969..9fe3cb38eb 100644
--- a/test/lisp/url/url-file-tests.el
+++ b/test/lisp/url/url-file-tests.el
@@ -1,6 +1,6 @@
 ;;; url-file-tests.el --- Test suite for url-file. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/url/url-future-tests.el 
b/test/lisp/url/url-future-tests.el
index 8b0e20c4dd..5083fc5aba 100644
--- a/test/lisp/url/url-future-tests.el
+++ b/test/lisp/url/url-future-tests.el
@@ -1,6 +1,6 @@
 ;;; url-future-tests.el --- Test suite for url-future.  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
 ;; Keywords: data
diff --git a/test/lisp/url/url-handlers-tests.el 
b/test/lisp/url/url-handlers-tests.el
index 71e054b128..f43e9651f5 100644
--- a/test/lisp/url/url-handlers-tests.el
+++ b/test/lisp/url/url-handlers-tests.el
@@ -1,6 +1,6 @@
 ;;; url-handlers-tests.el --- Test suite for url-handlers.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <nicolas@petton.fr>
 
diff --git a/test/lisp/url/url-misc-tests.el b/test/lisp/url/url-misc-tests.el
index 40c6edbd61..df561eb888 100644
--- a/test/lisp/url/url-misc-tests.el
+++ b/test/lisp/url/url-misc-tests.el
@@ -1,6 +1,6 @@
 ;;; url-misc-tests.el --- Test suite for url-misc. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/url/url-parse-tests.el b/test/lisp/url/url-parse-tests.el
index a7f81eba8f..c115da1e4b 100644
--- a/test/lisp/url/url-parse-tests.el
+++ b/test/lisp/url/url-parse-tests.el
@@ -1,6 +1,6 @@
 ;;; url-parse-tests.el --- Test suite for URI/URL parsing.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Alain Schneble <a.s@realize.ch>
 ;; Version: 1.0
diff --git a/test/lisp/url/url-tramp-tests.el b/test/lisp/url/url-tramp-tests.el
index 63d752ac3a..033c17444d 100644
--- a/test/lisp/url/url-tramp-tests.el
+++ b/test/lisp/url/url-tramp-tests.el
@@ -1,6 +1,6 @@
 ;;; url-tramp-tests.el --- Test suite for Tramp / URL conversion.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/url/url-util-tests.el b/test/lisp/url/url-util-tests.el
index 57b67a04cc..8c042c0135 100644
--- a/test/lisp/url/url-util-tests.el
+++ b/test/lisp/url/url-util-tests.el
@@ -1,6 +1,6 @@
 ;;; url-util-tests.el --- Test suite for url-util.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
 ;; Keywords: data
diff --git a/test/lisp/vc/add-log-tests.el b/test/lisp/vc/add-log-tests.el
index 70e49fe57f..bb6841b645 100644
--- a/test/lisp/vc/add-log-tests.el
+++ b/test/lisp/vc/add-log-tests.el
@@ -1,6 +1,6 @@
 ;;; add-log-tests.el --- Test suite for add-log.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO <yamato@redhat.com>
 ;; Keywords: vc tools
diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el
index 909d5620de..19e3dbb42a 100644
--- a/test/lisp/vc/diff-mode-tests.el
+++ b/test/lisp/vc/diff-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; diff-mode-tests.el --- Tests for diff-mode.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Dima Kogan <dima@secretsauce.net>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/vc/ediff-diff-tests.el b/test/lisp/vc/ediff-diff-tests.el
index 001db8b0c4..b0ceb4792c 100644
--- a/test/lisp/vc/ediff-diff-tests.el
+++ b/test/lisp/vc/ediff-diff-tests.el
@@ -1,6 +1,6 @@
 ;;; ediff-diff-tests.el --- Unit tests for ediff-diff.el  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el
index 0f09616a81..935046198f 100644
--- a/test/lisp/vc/ediff-ptch-tests.el
+++ b/test/lisp/vc/ediff-ptch-tests.el
@@ -1,6 +1,6 @@
 ;;; ediff-ptch-tests.el --- Tests for ediff-ptch.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <tino.calancha@gmail.com>
 
diff --git a/test/lisp/vc/log-edit-tests.el b/test/lisp/vc/log-edit-tests.el
index 84e363ad69..e1fe8fcf1c 100644
--- a/test/lisp/vc/log-edit-tests.el
+++ b/test/lisp/vc/log-edit-tests.el
@@ -1,6 +1,6 @@
 ;;; log-edit-tests.el --- Unit tests for log-edit.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; 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 d7827c7a8c..713df4c6e7 100644
--- a/test/lisp/vc/smerge-mode-tests.el
+++ b/test/lisp/vc/smerge-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; smerge-mode-tests.el --- Tests for smerge-mode.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el
index afced819fb..12f1e9034c 100644
--- a/test/lisp/vc/vc-bzr-tests.el
+++ b/test/lisp/vc/vc-bzr-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-bzr-tests.el --- tests for vc/vc-bzr.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <rgm@gnu.org>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/vc/vc-git-tests.el b/test/lisp/vc/vc-git-tests.el
index 997ab3c4b5..dc9641ed46 100644
--- a/test/lisp/vc/vc-git-tests.el
+++ b/test/lisp/vc/vc-git-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-git-tests.el --- tests for vc/vc-git.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Justin Schell <justinmschell@gmail.com>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/vc/vc-hg-tests.el b/test/lisp/vc/vc-hg-tests.el
index 2edd4b6fd7..2cceceb2c8 100644
--- a/test/lisp/vc/vc-hg-tests.el
+++ b/test/lisp/vc/vc-hg-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-hg-tests.el --- tests for vc/vc-hg.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <dgutov@yandex.ru>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index 578d7ebb41..7bf5ae6bc1 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-tests.el --- Tests of different backends of vc.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 
diff --git a/test/lisp/version-tests.el b/test/lisp/version-tests.el
index ef2e945305..25dcc3d30c 100644
--- a/test/lisp/version-tests.el
+++ b/test/lisp/version-tests.el
@@ -1,6 +1,6 @@
 ;;; version-tests.el --- Tests for version.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index 47ed26f609..58caa1deda 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -1,6 +1,6 @@
 ;;; wdired-tests.el --- tests for wdired.el          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el
index 1001476a28..07eaad4862 100644
--- a/test/lisp/whitespace-tests.el
+++ b/test/lisp/whitespace-tests.el
@@ -1,6 +1,6 @@
 ;;; whitespace-tests.el --- Test suite for whitespace -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el
index f843649784..34c96f1c93 100644
--- a/test/lisp/wid-edit-tests.el
+++ b/test/lisp/wid-edit-tests.el
@@ -1,6 +1,6 @@
 ;;; wid-edit-tests.el --- tests for wid-edit.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/xdg-tests.el b/test/lisp/xdg-tests.el
index 67cd940193..e8e103348b 100644
--- a/test/lisp/xdg-tests.el
+++ b/test/lisp/xdg-tests.el
@@ -1,6 +1,6 @@
 ;;; xdg-tests.el --- tests for xdg.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <mvoteiza@udel.edu>
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el
index 7c64ef39f8..eecf6406fb 100644
--- a/test/lisp/xml-tests.el
+++ b/test/lisp/xml-tests.el
@@ -1,6 +1,6 @@
 ;;; xml-tests.el --- Test suite for XML parsing.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <cyd@stupidchicken.com>
 ;; Keywords:       internal
diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index 72659ddf99..9318e8ef59 100644
--- a/test/lisp/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
@@ -1,6 +1,6 @@
 ;;; xt-mouse-tests.el --- Test suite for xt-mouse.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/manual/biditest.el b/test/manual/biditest.el
index c84e7ed731..d7fa359bf8 100644
--- a/test/manual/biditest.el
+++ b/test/manual/biditest.el
@@ -1,6 +1,6 @@
 ;;; biditest.el --- test bidi reordering in GNU Emacs display engine.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
 ;; Maintainer: emacs-devel@gnu.org
diff --git a/test/manual/cedet/cedet-utests.el 
b/test/manual/cedet/cedet-utests.el
index af6b4defb3..b365908c63 100644
--- a/test/manual/cedet/cedet-utests.el
+++ b/test/manual/cedet/cedet-utests.el
@@ -1,6 +1,6 @@
 ;;; cedet-utests.el --- Run all unit tests in the CEDET suite.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/ede-tests.el b/test/manual/cedet/ede-tests.el
index 17618381ef..c23e098481 100644
--- a/test/manual/cedet/ede-tests.el
+++ b/test/manual/cedet/ede-tests.el
@@ -1,6 +1,6 @@
 ;;; ede-tests.el --- Some tests for the Emacs Development Environment  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/semantic-tests.el 
b/test/manual/cedet/semantic-tests.el
index 3e416cc6b2..dcdeb45b0a 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -1,6 +1,6 @@
 ;;; semantic-tests.el --- Miscellaneous Semantic tests.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2003-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/tests/test.c b/test/manual/cedet/tests/test.c
index 2cdaf4fb0a..6efaa8a75e 100644
--- a/test/manual/cedet/tests/test.c
+++ b/test/manual/cedet/tests/test.c
@@ -1,6 +1,6 @@
 /* test.c --- Semantic unit test for C.
 
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/tests/test.el b/test/manual/cedet/tests/test.el
index 34c03619f8..a523438f68 100644
--- a/test/manual/cedet/tests/test.el
+++ b/test/manual/cedet/tests/test.el
@@ -1,6 +1,6 @@
 ;;; test.el --- Unit test file for Semantic Emacs Lisp support.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
@@ -63,11 +63,11 @@
 
 ;;; Methods
 ;;
-(defmethod a-method ((obj some-class) &optional arg2)
+(cl-defmethod a-method ((obj some-class) &optional arg2)
   "Doc String for a method."
   (call-next-method))
 
-(defgeneric a-generic (arg1 arg2)
+(cl-defgeneric a-generic (arg1 arg2)
   "General description of a-generic.")
 
 ;;; Advice
diff --git a/test/manual/cedet/tests/test.make 
b/test/manual/cedet/tests/test.make
index 9841567b6b..80c0c8051c 100644
--- a/test/manual/cedet/tests/test.make
+++ b/test/manual/cedet/tests/test.make
@@ -1,6 +1,6 @@
 # test.make --- Semantic unit test for Make -*- makefile -*-
 
-# Copyright (C) 2001-2002, 2010-2021 Free Software Foundation, Inc.
+# Copyright (C) 2001-2002, 2010-2022 Free Software Foundation, Inc.
 
 # Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/tests/testpolymorph.cpp 
b/test/manual/cedet/tests/testpolymorph.cpp
index e4befcf0ff..ba64e39a7a 100644
--- a/test/manual/cedet/tests/testpolymorph.cpp
+++ b/test/manual/cedet/tests/testpolymorph.cpp
@@ -1,6 +1,6 @@
 /** testpolymorph.cpp --- A sequence of polymorphism examples.
  *
- * Copyright (C) 2009-2021 Free Software Foundation, Inc.
+ * Copyright (C) 2009-2022 Free Software Foundation, Inc.
  *
  * Author: Eric M. Ludlam <zappo@gnu.org>
  *
diff --git a/test/manual/cedet/tests/testspp.c 
b/test/manual/cedet/tests/testspp.c
index 2698f48d5f..74b336172c 100644
--- a/test/manual/cedet/tests/testspp.c
+++ b/test/manual/cedet/tests/testspp.c
@@ -1,6 +1,6 @@
 /* testspp.cpp --- Semantic unit test for the C preprocessor
 
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/tests/testsppreplace.c 
b/test/manual/cedet/tests/testsppreplace.c
index 42a22e14b0..54ae3f0323 100644
--- a/test/manual/cedet/tests/testsppreplace.c
+++ b/test/manual/cedet/tests/testsppreplace.c
@@ -1,5 +1,5 @@
 /* testsppreplace.c --- unit test for CPP/SPP Replacement
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/cedet/tests/testsppreplaced.c 
b/test/manual/cedet/tests/testsppreplaced.c
index d546d61bff..c359fa7d69 100644
--- a/test/manual/cedet/tests/testsppreplaced.c
+++ b/test/manual/cedet/tests/testsppreplaced.c
@@ -1,5 +1,5 @@
 /* testsppreplaced.c --- unit test for CPP/SPP Replacement
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <zappo@gnu.org>
 
diff --git a/test/manual/etags/ETAGS.good_1 b/test/manual/etags/ETAGS.good_1
index 4eae68b5c2..1b4f80ceaa 100644
--- a/test/manual/etags/ETAGS.good_1
+++ b/test/manual/etags/ETAGS.good_1
@@ -2202,73 +2202,73 @@ el-src/emacs/lisp/progmodes/etags.el,5069
 (defun visit-tags-table-buffer 543,22204
 (defun tags-reset-tags-tables 712,28514
 (defun file-of-tag 731,29171
-(defun tags-table-files 740,29520
-(defun tags-included-tables 749,29870
-(defun tags-completion-table 755,30116
-(defun tags-lazy-completion-table 783,31310
-(defun tags-completion-at-point-function 799,31945
-(defun find-tag-tag 818,32695
-(defvar last-tag 837,33368
-(defun find-tag-interactive 840,33427
-(defvar find-tag-history 852,33842
-(defun find-tag-noselect 860,34012
-(defun find-tag 932,37126
-(defun find-tag-other-window 959,38342
-(defun find-tag-other-frame 1000,40270
-(defun find-tag-regexp 1025,41444
-(defalias 'pop-tag-mark pop-tag-mark1049,42606
-(defvar tag-lines-already-matched 1052,42657
-(defun find-tag-in-order 1055,42764
-(defun tag-find-file-of-tag-noselect 1167,47110
-(defun tag-find-file-of-tag 1200,48956
-(defun etags-recognize-tags-table 1208,49182
-(defun etags-verify-tags-table 1241,50813
-(defun etags-file-of-tag 1246,51011
-(defun etags-tags-completion-table 1256,51346
-(defun etags-snarf-tag 1286,52552
-(defun etags-goto-tag-location 1324,54121
-(defun etags-list-tags 1388,56564
-(defmacro tags-with-face 1423,57839
-(defun etags-tags-apropos-additional 1431,58172
-(defun etags-tags-apropos 1465,59409
-(defun etags-tags-table-files 1527,61618
-(defun etags-tags-included-tables 1542,62054
-(defun tags-recognize-empty-tags-table 1559,62594
-(defun tag-exact-file-name-match-p 1587,63740
-(defun tag-file-name-match-p 1596,64133
-(defun tag-exact-match-p 1609,64689
-(defun tag-implicit-name-match-p 1620,65257
-(defun tag-symbol-match-p 1633,65857
-(defun tag-word-match-p 1643,66293
-(defun tag-partial-file-name-match-p 1652,66691
-(defun tag-any-match-p 1662,67135
-(defun tag-re-match-p 1667,67319
-(defcustom tags-loop-revert-buffers 1675,67568
-(defun next-file 1685,67977
-(defvar tags-loop-operate 1760,70891
-(defvar tags-loop-scan1763,70985
-(defun tags-loop-eval 1771,71314
-(defun tags-loop-continue 1782,71643
-(defun tags-search 1850,73949
-(defun tags-query-replace 1871,74775
-(defun tags-complete-tags-table-file 1896,75999
-(defun list-tags 1906,76378
-(defun tags-apropos 1934,77331
-(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78157
-(defun select-tags-table 1964,78396
-(defvar select-tags-table-mode-map 2019,80523
-(define-derived-mode select-tags-table-mode 2030,80906
-(defun select-tags-table-select 2034,81090
-(defun select-tags-table-quit 2043,81456
-(defun complete-tag 2049,81611
-(defconst etags--xref-limit 2074,82552
-(defvar etags-xref-find-definitions-tag-order 2076,82587
-(defun etags-xref-find 2082,82877
-(defun etags--xref-find-definitions 2096,83406
-(defclass xref-etags-location 2129,85120
-(defun xref-make-etags-location 2135,85343
-(cl-defmethod xref-location-marker 2139,85498
-(cl-defmethod xref-location-line 2146,85742
+(defun tags-table-files 740,29521
+(defun tags-included-tables 749,29871
+(defun tags-completion-table 755,30117
+(defun tags-lazy-completion-table 783,31311
+(defun tags-completion-at-point-function 799,31946
+(defun find-tag-tag 818,32696
+(defvar last-tag 837,33369
+(defun find-tag-interactive 840,33428
+(defvar find-tag-history 852,33843
+(defun find-tag-noselect 860,34013
+(defun find-tag 932,37127
+(defun find-tag-other-window 959,38343
+(defun find-tag-other-frame 1000,40271
+(defun find-tag-regexp 1025,41445
+(defalias 'pop-tag-mark pop-tag-mark1049,42607
+(defvar tag-lines-already-matched 1052,42658
+(defun find-tag-in-order 1055,42765
+(defun tag-find-file-of-tag-noselect 1167,47111
+(defun tag-find-file-of-tag 1200,48957
+(defun etags-recognize-tags-table 1208,49183
+(defun etags-verify-tags-table 1241,50814
+(defun etags-file-of-tag 1246,51012
+(defun etags-tags-completion-table 1256,51347
+(defun etags-snarf-tag 1286,52553
+(defun etags-goto-tag-location 1324,54122
+(defun etags-list-tags 1388,56565
+(defmacro tags-with-face 1423,57840
+(defun etags-tags-apropos-additional 1431,58173
+(defun etags-tags-apropos 1465,59410
+(defun etags-tags-table-files 1527,61619
+(defun etags-tags-included-tables 1542,62055
+(defun tags-recognize-empty-tags-table 1559,62595
+(defun tag-exact-file-name-match-p 1587,63741
+(defun tag-file-name-match-p 1596,64134
+(defun tag-exact-match-p 1609,64690
+(defun tag-implicit-name-match-p 1620,65258
+(defun tag-symbol-match-p 1633,65858
+(defun tag-word-match-p 1643,66294
+(defun tag-partial-file-name-match-p 1652,66692
+(defun tag-any-match-p 1662,67136
+(defun tag-re-match-p 1667,67320
+(defcustom tags-loop-revert-buffers 1675,67569
+(defun next-file 1685,67978
+(defvar tags-loop-operate 1760,70892
+(defvar tags-loop-scan1763,70986
+(defun tags-loop-eval 1771,71315
+(defun tags-loop-continue 1782,71644
+(defun tags-search 1850,73950
+(defun tags-query-replace 1871,74776
+(defun tags-complete-tags-table-file 1896,76000
+(defun list-tags 1906,76379
+(defun tags-apropos 1934,77332
+(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78158
+(defun select-tags-table 1964,78397
+(defvar select-tags-table-mode-map 2019,80524
+(define-derived-mode select-tags-table-mode 2030,80907
+(defun select-tags-table-select 2034,81091
+(defun select-tags-table-quit 2043,81457
+(defun complete-tag 2049,81612
+(defconst etags--xref-limit 2074,82553
+(defvar etags-xref-find-definitions-tag-order 2076,82588
+(defun etags-xref-find 2082,82878
+(defun etags--xref-find-definitions 2096,83407
+(defclass xref-etags-location 2129,85121
+(defun xref-make-etags-location 2135,85344
+(cl-defmethod xref-location-marker 2139,85499
+(cl-defmethod xref-location-line 2146,85743
 
 erl-src/gs_dialog.erl,98
 -define(VERSION2,32
diff --git a/test/manual/etags/ETAGS.good_2 b/test/manual/etags/ETAGS.good_2
index 45979d6a76..124aa7fc1c 100644
--- a/test/manual/etags/ETAGS.good_2
+++ b/test/manual/etags/ETAGS.good_2
@@ -2771,76 +2771,76 @@ el-src/emacs/lisp/progmodes/etags.el,5188
 (defun visit-tags-table-buffer 543,22204
 (defun tags-reset-tags-tables 712,28514
 (defun file-of-tag 731,29171
-(defun tags-table-files 740,29520
-(defun tags-included-tables 749,29870
-(defun tags-completion-table 755,30116
-(defun tags-lazy-completion-table 783,31310
-(defun tags-completion-at-point-function 799,31945
-(defun find-tag-tag 818,32695
-(defvar last-tag 837,33368
-(defun find-tag-interactive 840,33427
-(defvar find-tag-history 852,33842
-(defvar etags-case-fold-search)855,33907
-(defvar etags-syntax-table)856,33939
-(defvar local-find-tag-hook)857,33967
-(defun find-tag-noselect 860,34012
-(defun find-tag 932,37126
-(defun find-tag-other-window 959,38342
-(defun find-tag-other-frame 1000,40270
-(defun find-tag-regexp 1025,41444
-(defalias 'pop-tag-mark pop-tag-mark1049,42606
-(defvar tag-lines-already-matched 1052,42657
-(defun find-tag-in-order 1055,42764
-(defun tag-find-file-of-tag-noselect 1167,47110
-(defun tag-find-file-of-tag 1200,48956
-(defun etags-recognize-tags-table 1208,49182
-(defun etags-verify-tags-table 1241,50813
-(defun etags-file-of-tag 1246,51011
-(defun etags-tags-completion-table 1256,51346
-(defun etags-snarf-tag 1286,52552
-(defun etags-goto-tag-location 1324,54121
-(defun etags-list-tags 1388,56564
-(defmacro tags-with-face 1423,57839
-(defun etags-tags-apropos-additional 1431,58172
-(defun etags-tags-apropos 1465,59409
-(defun etags-tags-table-files 1527,61618
-(defun etags-tags-included-tables 1542,62054
-(defun tags-recognize-empty-tags-table 1559,62594
-(defun tag-exact-file-name-match-p 1587,63740
-(defun tag-file-name-match-p 1596,64133
-(defun tag-exact-match-p 1609,64689
-(defun tag-implicit-name-match-p 1620,65257
-(defun tag-symbol-match-p 1633,65857
-(defun tag-word-match-p 1643,66293
-(defun tag-partial-file-name-match-p 1652,66691
-(defun tag-any-match-p 1662,67135
-(defun tag-re-match-p 1667,67319
-(defcustom tags-loop-revert-buffers 1675,67568
-(defun next-file 1685,67977
-(defvar tags-loop-operate 1760,70891
-(defvar tags-loop-scan1763,70985
-(defun tags-loop-eval 1771,71314
-(defun tags-loop-continue 1782,71643
-(defun tags-search 1850,73949
-(defun tags-query-replace 1871,74775
-(defun tags-complete-tags-table-file 1896,75999
-(defun list-tags 1906,76378
-(defun tags-apropos 1934,77331
-(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78157
-(defun select-tags-table 1964,78396
-(defvar select-tags-table-mode-map 2019,80523
-(define-derived-mode select-tags-table-mode 2030,80906
-(defun select-tags-table-select 2034,81090
-(defun select-tags-table-quit 2043,81456
-(defun complete-tag 2049,81611
-(defconst etags--xref-limit 2074,82552
-(defvar etags-xref-find-definitions-tag-order 2076,82587
-(defun etags-xref-find 2082,82877
-(defun etags--xref-find-definitions 2096,83406
-(defclass xref-etags-location 2129,85120
-(defun xref-make-etags-location 2135,85343
-(cl-defmethod xref-location-marker 2139,85498
-(cl-defmethod xref-location-line 2146,85742
+(defun tags-table-files 740,29521
+(defun tags-included-tables 749,29871
+(defun tags-completion-table 755,30117
+(defun tags-lazy-completion-table 783,31311
+(defun tags-completion-at-point-function 799,31946
+(defun find-tag-tag 818,32696
+(defvar last-tag 837,33369
+(defun find-tag-interactive 840,33428
+(defvar find-tag-history 852,33843
+(defvar etags-case-fold-search)855,33908
+(defvar etags-syntax-table)856,33940
+(defvar local-find-tag-hook)857,33968
+(defun find-tag-noselect 860,34013
+(defun find-tag 932,37127
+(defun find-tag-other-window 959,38343
+(defun find-tag-other-frame 1000,40271
+(defun find-tag-regexp 1025,41445
+(defalias 'pop-tag-mark pop-tag-mark1049,42607
+(defvar tag-lines-already-matched 1052,42658
+(defun find-tag-in-order 1055,42765
+(defun tag-find-file-of-tag-noselect 1167,47111
+(defun tag-find-file-of-tag 1200,48957
+(defun etags-recognize-tags-table 1208,49183
+(defun etags-verify-tags-table 1241,50814
+(defun etags-file-of-tag 1246,51012
+(defun etags-tags-completion-table 1256,51347
+(defun etags-snarf-tag 1286,52553
+(defun etags-goto-tag-location 1324,54122
+(defun etags-list-tags 1388,56565
+(defmacro tags-with-face 1423,57840
+(defun etags-tags-apropos-additional 1431,58173
+(defun etags-tags-apropos 1465,59410
+(defun etags-tags-table-files 1527,61619
+(defun etags-tags-included-tables 1542,62055
+(defun tags-recognize-empty-tags-table 1559,62595
+(defun tag-exact-file-name-match-p 1587,63741
+(defun tag-file-name-match-p 1596,64134
+(defun tag-exact-match-p 1609,64690
+(defun tag-implicit-name-match-p 1620,65258
+(defun tag-symbol-match-p 1633,65858
+(defun tag-word-match-p 1643,66294
+(defun tag-partial-file-name-match-p 1652,66692
+(defun tag-any-match-p 1662,67136
+(defun tag-re-match-p 1667,67320
+(defcustom tags-loop-revert-buffers 1675,67569
+(defun next-file 1685,67978
+(defvar tags-loop-operate 1760,70892
+(defvar tags-loop-scan1763,70986
+(defun tags-loop-eval 1771,71315
+(defun tags-loop-continue 1782,71644
+(defun tags-search 1850,73950
+(defun tags-query-replace 1871,74776
+(defun tags-complete-tags-table-file 1896,76000
+(defun list-tags 1906,76379
+(defun tags-apropos 1934,77332
+(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78158
+(defun select-tags-table 1964,78397
+(defvar select-tags-table-mode-map 2019,80524
+(define-derived-mode select-tags-table-mode 2030,80907
+(defun select-tags-table-select 2034,81091
+(defun select-tags-table-quit 2043,81457
+(defun complete-tag 2049,81612
+(defconst etags--xref-limit 2074,82553
+(defvar etags-xref-find-definitions-tag-order 2076,82588
+(defun etags-xref-find 2082,82878
+(defun etags--xref-find-definitions 2096,83407
+(defclass xref-etags-location 2129,85121
+(defun xref-make-etags-location 2135,85344
+(cl-defmethod xref-location-marker 2139,85499
+(cl-defmethod xref-location-line 2146,85743
 
 erl-src/gs_dialog.erl,98
 -define(VERSION2,32
diff --git a/test/manual/etags/ETAGS.good_3 b/test/manual/etags/ETAGS.good_3
index 36edc38961..9dca0084de 100644
--- a/test/manual/etags/ETAGS.good_3
+++ b/test/manual/etags/ETAGS.good_3
@@ -2579,73 +2579,73 @@ el-src/emacs/lisp/progmodes/etags.el,5069
 (defun visit-tags-table-buffer 543,22204
 (defun tags-reset-tags-tables 712,28514
 (defun file-of-tag 731,29171
-(defun tags-table-files 740,29520
-(defun tags-included-tables 749,29870
-(defun tags-completion-table 755,30116
-(defun tags-lazy-completion-table 783,31310
-(defun tags-completion-at-point-function 799,31945
-(defun find-tag-tag 818,32695
-(defvar last-tag 837,33368
-(defun find-tag-interactive 840,33427
-(defvar find-tag-history 852,33842
-(defun find-tag-noselect 860,34012
-(defun find-tag 932,37126
-(defun find-tag-other-window 959,38342
-(defun find-tag-other-frame 1000,40270
-(defun find-tag-regexp 1025,41444
-(defalias 'pop-tag-mark pop-tag-mark1049,42606
-(defvar tag-lines-already-matched 1052,42657
-(defun find-tag-in-order 1055,42764
-(defun tag-find-file-of-tag-noselect 1167,47110
-(defun tag-find-file-of-tag 1200,48956
-(defun etags-recognize-tags-table 1208,49182
-(defun etags-verify-tags-table 1241,50813
-(defun etags-file-of-tag 1246,51011
-(defun etags-tags-completion-table 1256,51346
-(defun etags-snarf-tag 1286,52552
-(defun etags-goto-tag-location 1324,54121
-(defun etags-list-tags 1388,56564
-(defmacro tags-with-face 1423,57839
-(defun etags-tags-apropos-additional 1431,58172
-(defun etags-tags-apropos 1465,59409
-(defun etags-tags-table-files 1527,61618
-(defun etags-tags-included-tables 1542,62054
-(defun tags-recognize-empty-tags-table 1559,62594
-(defun tag-exact-file-name-match-p 1587,63740
-(defun tag-file-name-match-p 1596,64133
-(defun tag-exact-match-p 1609,64689
-(defun tag-implicit-name-match-p 1620,65257
-(defun tag-symbol-match-p 1633,65857
-(defun tag-word-match-p 1643,66293
-(defun tag-partial-file-name-match-p 1652,66691
-(defun tag-any-match-p 1662,67135
-(defun tag-re-match-p 1667,67319
-(defcustom tags-loop-revert-buffers 1675,67568
-(defun next-file 1685,67977
-(defvar tags-loop-operate 1760,70891
-(defvar tags-loop-scan1763,70985
-(defun tags-loop-eval 1771,71314
-(defun tags-loop-continue 1782,71643
-(defun tags-search 1850,73949
-(defun tags-query-replace 1871,74775
-(defun tags-complete-tags-table-file 1896,75999
-(defun list-tags 1906,76378
-(defun tags-apropos 1934,77331
-(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78157
-(defun select-tags-table 1964,78396
-(defvar select-tags-table-mode-map 2019,80523
-(define-derived-mode select-tags-table-mode 2030,80906
-(defun select-tags-table-select 2034,81090
-(defun select-tags-table-quit 2043,81456
-(defun complete-tag 2049,81611
-(defconst etags--xref-limit 2074,82552
-(defvar etags-xref-find-definitions-tag-order 2076,82587
-(defun etags-xref-find 2082,82877
-(defun etags--xref-find-definitions 2096,83406
-(defclass xref-etags-location 2129,85120
-(defun xref-make-etags-location 2135,85343
-(cl-defmethod xref-location-marker 2139,85498
-(cl-defmethod xref-location-line 2146,85742
+(defun tags-table-files 740,29521
+(defun tags-included-tables 749,29871
+(defun tags-completion-table 755,30117
+(defun tags-lazy-completion-table 783,31311
+(defun tags-completion-at-point-function 799,31946
+(defun find-tag-tag 818,32696
+(defvar last-tag 837,33369
+(defun find-tag-interactive 840,33428
+(defvar find-tag-history 852,33843
+(defun find-tag-noselect 860,34013
+(defun find-tag 932,37127
+(defun find-tag-other-window 959,38343
+(defun find-tag-other-frame 1000,40271
+(defun find-tag-regexp 1025,41445
+(defalias 'pop-tag-mark pop-tag-mark1049,42607
+(defvar tag-lines-already-matched 1052,42658
+(defun find-tag-in-order 1055,42765
+(defun tag-find-file-of-tag-noselect 1167,47111
+(defun tag-find-file-of-tag 1200,48957
+(defun etags-recognize-tags-table 1208,49183
+(defun etags-verify-tags-table 1241,50814
+(defun etags-file-of-tag 1246,51012
+(defun etags-tags-completion-table 1256,51347
+(defun etags-snarf-tag 1286,52553
+(defun etags-goto-tag-location 1324,54122
+(defun etags-list-tags 1388,56565
+(defmacro tags-with-face 1423,57840
+(defun etags-tags-apropos-additional 1431,58173
+(defun etags-tags-apropos 1465,59410
+(defun etags-tags-table-files 1527,61619
+(defun etags-tags-included-tables 1542,62055
+(defun tags-recognize-empty-tags-table 1559,62595
+(defun tag-exact-file-name-match-p 1587,63741
+(defun tag-file-name-match-p 1596,64134
+(defun tag-exact-match-p 1609,64690
+(defun tag-implicit-name-match-p 1620,65258
+(defun tag-symbol-match-p 1633,65858
+(defun tag-word-match-p 1643,66294
+(defun tag-partial-file-name-match-p 1652,66692
+(defun tag-any-match-p 1662,67136
+(defun tag-re-match-p 1667,67320
+(defcustom tags-loop-revert-buffers 1675,67569
+(defun next-file 1685,67978
+(defvar tags-loop-operate 1760,70892
+(defvar tags-loop-scan1763,70986
+(defun tags-loop-eval 1771,71315
+(defun tags-loop-continue 1782,71644
+(defun tags-search 1850,73950
+(defun tags-query-replace 1871,74776
+(defun tags-complete-tags-table-file 1896,76000
+(defun list-tags 1906,76379
+(defun tags-apropos 1934,77332
+(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78158
+(defun select-tags-table 1964,78397
+(defvar select-tags-table-mode-map 2019,80524
+(define-derived-mode select-tags-table-mode 2030,80907
+(defun select-tags-table-select 2034,81091
+(defun select-tags-table-quit 2043,81457
+(defun complete-tag 2049,81612
+(defconst etags--xref-limit 2074,82553
+(defvar etags-xref-find-definitions-tag-order 2076,82588
+(defun etags-xref-find 2082,82878
+(defun etags--xref-find-definitions 2096,83407
+(defclass xref-etags-location 2129,85121
+(defun xref-make-etags-location 2135,85344
+(cl-defmethod xref-location-marker 2139,85499
+(cl-defmethod xref-location-line 2146,85743
 
 erl-src/gs_dialog.erl,98
 -define(VERSION2,32
diff --git a/test/manual/etags/ETAGS.good_4 b/test/manual/etags/ETAGS.good_4
index e726a993a9..8527ed726e 100644
--- a/test/manual/etags/ETAGS.good_4
+++ b/test/manual/etags/ETAGS.good_4
@@ -2364,73 +2364,73 @@ el-src/emacs/lisp/progmodes/etags.el,5069
 (defun visit-tags-table-buffer 543,22204
 (defun tags-reset-tags-tables 712,28514
 (defun file-of-tag 731,29171
-(defun tags-table-files 740,29520
-(defun tags-included-tables 749,29870
-(defun tags-completion-table 755,30116
-(defun tags-lazy-completion-table 783,31310
-(defun tags-completion-at-point-function 799,31945
-(defun find-tag-tag 818,32695
-(defvar last-tag 837,33368
-(defun find-tag-interactive 840,33427
-(defvar find-tag-history 852,33842
-(defun find-tag-noselect 860,34012
-(defun find-tag 932,37126
-(defun find-tag-other-window 959,38342
-(defun find-tag-other-frame 1000,40270
-(defun find-tag-regexp 1025,41444
-(defalias 'pop-tag-mark pop-tag-mark1049,42606
-(defvar tag-lines-already-matched 1052,42657
-(defun find-tag-in-order 1055,42764
-(defun tag-find-file-of-tag-noselect 1167,47110
-(defun tag-find-file-of-tag 1200,48956
-(defun etags-recognize-tags-table 1208,49182
-(defun etags-verify-tags-table 1241,50813
-(defun etags-file-of-tag 1246,51011
-(defun etags-tags-completion-table 1256,51346
-(defun etags-snarf-tag 1286,52552
-(defun etags-goto-tag-location 1324,54121
-(defun etags-list-tags 1388,56564
-(defmacro tags-with-face 1423,57839
-(defun etags-tags-apropos-additional 1431,58172
-(defun etags-tags-apropos 1465,59409
-(defun etags-tags-table-files 1527,61618
-(defun etags-tags-included-tables 1542,62054
-(defun tags-recognize-empty-tags-table 1559,62594
-(defun tag-exact-file-name-match-p 1587,63740
-(defun tag-file-name-match-p 1596,64133
-(defun tag-exact-match-p 1609,64689
-(defun tag-implicit-name-match-p 1620,65257
-(defun tag-symbol-match-p 1633,65857
-(defun tag-word-match-p 1643,66293
-(defun tag-partial-file-name-match-p 1652,66691
-(defun tag-any-match-p 1662,67135
-(defun tag-re-match-p 1667,67319
-(defcustom tags-loop-revert-buffers 1675,67568
-(defun next-file 1685,67977
-(defvar tags-loop-operate 1760,70891
-(defvar tags-loop-scan1763,70985
-(defun tags-loop-eval 1771,71314
-(defun tags-loop-continue 1782,71643
-(defun tags-search 1850,73949
-(defun tags-query-replace 1871,74775
-(defun tags-complete-tags-table-file 1896,75999
-(defun list-tags 1906,76378
-(defun tags-apropos 1934,77331
-(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78157
-(defun select-tags-table 1964,78396
-(defvar select-tags-table-mode-map 2019,80523
-(define-derived-mode select-tags-table-mode 2030,80906
-(defun select-tags-table-select 2034,81090
-(defun select-tags-table-quit 2043,81456
-(defun complete-tag 2049,81611
-(defconst etags--xref-limit 2074,82552
-(defvar etags-xref-find-definitions-tag-order 2076,82587
-(defun etags-xref-find 2082,82877
-(defun etags--xref-find-definitions 2096,83406
-(defclass xref-etags-location 2129,85120
-(defun xref-make-etags-location 2135,85343
-(cl-defmethod xref-location-marker 2139,85498
-(cl-defmethod xref-location-line 2146,85742
+(defun tags-table-files 740,29521
+(defun tags-included-tables 749,29871
+(defun tags-completion-table 755,30117
+(defun tags-lazy-completion-table 783,31311
+(defun tags-completion-at-point-function 799,31946
+(defun find-tag-tag 818,32696
+(defvar last-tag 837,33369
+(defun find-tag-interactive 840,33428
+(defvar find-tag-history 852,33843
+(defun find-tag-noselect 860,34013
+(defun find-tag 932,37127
+(defun find-tag-other-window 959,38343
+(defun find-tag-other-frame 1000,40271
+(defun find-tag-regexp 1025,41445
+(defalias 'pop-tag-mark pop-tag-mark1049,42607
+(defvar tag-lines-already-matched 1052,42658
+(defun find-tag-in-order 1055,42765
+(defun tag-find-file-of-tag-noselect 1167,47111
+(defun tag-find-file-of-tag 1200,48957
+(defun etags-recognize-tags-table 1208,49183
+(defun etags-verify-tags-table 1241,50814
+(defun etags-file-of-tag 1246,51012
+(defun etags-tags-completion-table 1256,51347
+(defun etags-snarf-tag 1286,52553
+(defun etags-goto-tag-location 1324,54122
+(defun etags-list-tags 1388,56565
+(defmacro tags-with-face 1423,57840
+(defun etags-tags-apropos-additional 1431,58173
+(defun etags-tags-apropos 1465,59410
+(defun etags-tags-table-files 1527,61619
+(defun etags-tags-included-tables 1542,62055
+(defun tags-recognize-empty-tags-table 1559,62595
+(defun tag-exact-file-name-match-p 1587,63741
+(defun tag-file-name-match-p 1596,64134
+(defun tag-exact-match-p 1609,64690
+(defun tag-implicit-name-match-p 1620,65258
+(defun tag-symbol-match-p 1633,65858
+(defun tag-word-match-p 1643,66294
+(defun tag-partial-file-name-match-p 1652,66692
+(defun tag-any-match-p 1662,67136
+(defun tag-re-match-p 1667,67320
+(defcustom tags-loop-revert-buffers 1675,67569
+(defun next-file 1685,67978
+(defvar tags-loop-operate 1760,70892
+(defvar tags-loop-scan1763,70986
+(defun tags-loop-eval 1771,71315
+(defun tags-loop-continue 1782,71644
+(defun tags-search 1850,73950
+(defun tags-query-replace 1871,74776
+(defun tags-complete-tags-table-file 1896,76000
+(defun list-tags 1906,76379
+(defun tags-apropos 1934,77332
+(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78158
+(defun select-tags-table 1964,78397
+(defvar select-tags-table-mode-map 2019,80524
+(define-derived-mode select-tags-table-mode 2030,80907
+(defun select-tags-table-select 2034,81091
+(defun select-tags-table-quit 2043,81457
+(defun complete-tag 2049,81612
+(defconst etags--xref-limit 2074,82553
+(defvar etags-xref-find-definitions-tag-order 2076,82588
+(defun etags-xref-find 2082,82878
+(defun etags--xref-find-definitions 2096,83407
+(defclass xref-etags-location 2129,85121
+(defun xref-make-etags-location 2135,85344
+(cl-defmethod xref-location-marker 2139,85499
+(cl-defmethod xref-location-line 2146,85743
 
 erl-src/gs_dialog.erl,98
 -define(VERSION2,32
diff --git a/test/manual/etags/ETAGS.good_5 b/test/manual/etags/ETAGS.good_5
index 5133cc9e2b..6d2e44fbfe 100644
--- a/test/manual/etags/ETAGS.good_5
+++ b/test/manual/etags/ETAGS.good_5
@@ -3310,76 +3310,76 @@ el-src/emacs/lisp/progmodes/etags.el,5188
 (defun visit-tags-table-buffer 543,22204
 (defun tags-reset-tags-tables 712,28514
 (defun file-of-tag 731,29171
-(defun tags-table-files 740,29520
-(defun tags-included-tables 749,29870
-(defun tags-completion-table 755,30116
-(defun tags-lazy-completion-table 783,31310
-(defun tags-completion-at-point-function 799,31945
-(defun find-tag-tag 818,32695
-(defvar last-tag 837,33368
-(defun find-tag-interactive 840,33427
-(defvar find-tag-history 852,33842
-(defvar etags-case-fold-search)855,33907
-(defvar etags-syntax-table)856,33939
-(defvar local-find-tag-hook)857,33967
-(defun find-tag-noselect 860,34012
-(defun find-tag 932,37126
-(defun find-tag-other-window 959,38342
-(defun find-tag-other-frame 1000,40270
-(defun find-tag-regexp 1025,41444
-(defalias 'pop-tag-mark pop-tag-mark1049,42606
-(defvar tag-lines-already-matched 1052,42657
-(defun find-tag-in-order 1055,42764
-(defun tag-find-file-of-tag-noselect 1167,47110
-(defun tag-find-file-of-tag 1200,48956
-(defun etags-recognize-tags-table 1208,49182
-(defun etags-verify-tags-table 1241,50813
-(defun etags-file-of-tag 1246,51011
-(defun etags-tags-completion-table 1256,51346
-(defun etags-snarf-tag 1286,52552
-(defun etags-goto-tag-location 1324,54121
-(defun etags-list-tags 1388,56564
-(defmacro tags-with-face 1423,57839
-(defun etags-tags-apropos-additional 1431,58172
-(defun etags-tags-apropos 1465,59409
-(defun etags-tags-table-files 1527,61618
-(defun etags-tags-included-tables 1542,62054
-(defun tags-recognize-empty-tags-table 1559,62594
-(defun tag-exact-file-name-match-p 1587,63740
-(defun tag-file-name-match-p 1596,64133
-(defun tag-exact-match-p 1609,64689
-(defun tag-implicit-name-match-p 1620,65257
-(defun tag-symbol-match-p 1633,65857
-(defun tag-word-match-p 1643,66293
-(defun tag-partial-file-name-match-p 1652,66691
-(defun tag-any-match-p 1662,67135
-(defun tag-re-match-p 1667,67319
-(defcustom tags-loop-revert-buffers 1675,67568
-(defun next-file 1685,67977
-(defvar tags-loop-operate 1760,70891
-(defvar tags-loop-scan1763,70985
-(defun tags-loop-eval 1771,71314
-(defun tags-loop-continue 1782,71643
-(defun tags-search 1850,73949
-(defun tags-query-replace 1871,74775
-(defun tags-complete-tags-table-file 1896,75999
-(defun list-tags 1906,76378
-(defun tags-apropos 1934,77331
-(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78157
-(defun select-tags-table 1964,78396
-(defvar select-tags-table-mode-map 2019,80523
-(define-derived-mode select-tags-table-mode 2030,80906
-(defun select-tags-table-select 2034,81090
-(defun select-tags-table-quit 2043,81456
-(defun complete-tag 2049,81611
-(defconst etags--xref-limit 2074,82552
-(defvar etags-xref-find-definitions-tag-order 2076,82587
-(defun etags-xref-find 2082,82877
-(defun etags--xref-find-definitions 2096,83406
-(defclass xref-etags-location 2129,85120
-(defun xref-make-etags-location 2135,85343
-(cl-defmethod xref-location-marker 2139,85498
-(cl-defmethod xref-location-line 2146,85742
+(defun tags-table-files 740,29521
+(defun tags-included-tables 749,29871
+(defun tags-completion-table 755,30117
+(defun tags-lazy-completion-table 783,31311
+(defun tags-completion-at-point-function 799,31946
+(defun find-tag-tag 818,32696
+(defvar last-tag 837,33369
+(defun find-tag-interactive 840,33428
+(defvar find-tag-history 852,33843
+(defvar etags-case-fold-search)855,33908
+(defvar etags-syntax-table)856,33940
+(defvar local-find-tag-hook)857,33968
+(defun find-tag-noselect 860,34013
+(defun find-tag 932,37127
+(defun find-tag-other-window 959,38343
+(defun find-tag-other-frame 1000,40271
+(defun find-tag-regexp 1025,41445
+(defalias 'pop-tag-mark pop-tag-mark1049,42607
+(defvar tag-lines-already-matched 1052,42658
+(defun find-tag-in-order 1055,42765
+(defun tag-find-file-of-tag-noselect 1167,47111
+(defun tag-find-file-of-tag 1200,48957
+(defun etags-recognize-tags-table 1208,49183
+(defun etags-verify-tags-table 1241,50814
+(defun etags-file-of-tag 1246,51012
+(defun etags-tags-completion-table 1256,51347
+(defun etags-snarf-tag 1286,52553
+(defun etags-goto-tag-location 1324,54122
+(defun etags-list-tags 1388,56565
+(defmacro tags-with-face 1423,57840
+(defun etags-tags-apropos-additional 1431,58173
+(defun etags-tags-apropos 1465,59410
+(defun etags-tags-table-files 1527,61619
+(defun etags-tags-included-tables 1542,62055
+(defun tags-recognize-empty-tags-table 1559,62595
+(defun tag-exact-file-name-match-p 1587,63741
+(defun tag-file-name-match-p 1596,64134
+(defun tag-exact-match-p 1609,64690
+(defun tag-implicit-name-match-p 1620,65258
+(defun tag-symbol-match-p 1633,65858
+(defun tag-word-match-p 1643,66294
+(defun tag-partial-file-name-match-p 1652,66692
+(defun tag-any-match-p 1662,67136
+(defun tag-re-match-p 1667,67320
+(defcustom tags-loop-revert-buffers 1675,67569
+(defun next-file 1685,67978
+(defvar tags-loop-operate 1760,70892
+(defvar tags-loop-scan1763,70986
+(defun tags-loop-eval 1771,71315
+(defun tags-loop-continue 1782,71644
+(defun tags-search 1850,73950
+(defun tags-query-replace 1871,74776
+(defun tags-complete-tags-table-file 1896,76000
+(defun list-tags 1906,76379
+(defun tags-apropos 1934,77332
+(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78158
+(defun select-tags-table 1964,78397
+(defvar select-tags-table-mode-map 2019,80524
+(define-derived-mode select-tags-table-mode 2030,80907
+(defun select-tags-table-select 2034,81091
+(defun select-tags-table-quit 2043,81457
+(defun complete-tag 2049,81612
+(defconst etags--xref-limit 2074,82553
+(defvar etags-xref-find-definitions-tag-order 2076,82588
+(defun etags-xref-find 2082,82878
+(defun etags--xref-find-definitions 2096,83407
+(defclass xref-etags-location 2129,85121
+(defun xref-make-etags-location 2135,85344
+(cl-defmethod xref-location-marker 2139,85499
+(cl-defmethod xref-location-line 2146,85743
 
 erl-src/gs_dialog.erl,98
 -define(VERSION2,32
diff --git a/test/manual/etags/ETAGS.good_6 b/test/manual/etags/ETAGS.good_6
index 75047951a8..9a38e20dce 100644
--- a/test/manual/etags/ETAGS.good_6
+++ b/test/manual/etags/ETAGS.good_6
@@ -3310,76 +3310,76 @@ el-src/emacs/lisp/progmodes/etags.el,5188
 (defun visit-tags-table-buffer 543,22204
 (defun tags-reset-tags-tables 712,28514
 (defun file-of-tag 731,29171
-(defun tags-table-files 740,29520
-(defun tags-included-tables 749,29870
-(defun tags-completion-table 755,30116
-(defun tags-lazy-completion-table 783,31310
-(defun tags-completion-at-point-function 799,31945
-(defun find-tag-tag 818,32695
-(defvar last-tag 837,33368
-(defun find-tag-interactive 840,33427
-(defvar find-tag-history 852,33842
-(defvar etags-case-fold-search)855,33907
-(defvar etags-syntax-table)856,33939
-(defvar local-find-tag-hook)857,33967
-(defun find-tag-noselect 860,34012
-(defun find-tag 932,37126
-(defun find-tag-other-window 959,38342
-(defun find-tag-other-frame 1000,40270
-(defun find-tag-regexp 1025,41444
-(defalias 'pop-tag-mark pop-tag-mark1049,42606
-(defvar tag-lines-already-matched 1052,42657
-(defun find-tag-in-order 1055,42764
-(defun tag-find-file-of-tag-noselect 1167,47110
-(defun tag-find-file-of-tag 1200,48956
-(defun etags-recognize-tags-table 1208,49182
-(defun etags-verify-tags-table 1241,50813
-(defun etags-file-of-tag 1246,51011
-(defun etags-tags-completion-table 1256,51346
-(defun etags-snarf-tag 1286,52552
-(defun etags-goto-tag-location 1324,54121
-(defun etags-list-tags 1388,56564
-(defmacro tags-with-face 1423,57839
-(defun etags-tags-apropos-additional 1431,58172
-(defun etags-tags-apropos 1465,59409
-(defun etags-tags-table-files 1527,61618
-(defun etags-tags-included-tables 1542,62054
-(defun tags-recognize-empty-tags-table 1559,62594
-(defun tag-exact-file-name-match-p 1587,63740
-(defun tag-file-name-match-p 1596,64133
-(defun tag-exact-match-p 1609,64689
-(defun tag-implicit-name-match-p 1620,65257
-(defun tag-symbol-match-p 1633,65857
-(defun tag-word-match-p 1643,66293
-(defun tag-partial-file-name-match-p 1652,66691
-(defun tag-any-match-p 1662,67135
-(defun tag-re-match-p 1667,67319
-(defcustom tags-loop-revert-buffers 1675,67568
-(defun next-file 1685,67977
-(defvar tags-loop-operate 1760,70891
-(defvar tags-loop-scan1763,70985
-(defun tags-loop-eval 1771,71314
-(defun tags-loop-continue 1782,71643
-(defun tags-search 1850,73949
-(defun tags-query-replace 1871,74775
-(defun tags-complete-tags-table-file 1896,75999
-(defun list-tags 1906,76378
-(defun tags-apropos 1934,77331
-(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78157
-(defun select-tags-table 1964,78396
-(defvar select-tags-table-mode-map 2019,80523
-(define-derived-mode select-tags-table-mode 2030,80906
-(defun select-tags-table-select 2034,81090
-(defun select-tags-table-quit 2043,81456
-(defun complete-tag 2049,81611
-(defconst etags--xref-limit 2074,82552
-(defvar etags-xref-find-definitions-tag-order 2076,82587
-(defun etags-xref-find 2082,82877
-(defun etags--xref-find-definitions 2096,83406
-(defclass xref-etags-location 2129,85120
-(defun xref-make-etags-location 2135,85343
-(cl-defmethod xref-location-marker 2139,85498
-(cl-defmethod xref-location-line 2146,85742
+(defun tags-table-files 740,29521
+(defun tags-included-tables 749,29871
+(defun tags-completion-table 755,30117
+(defun tags-lazy-completion-table 783,31311
+(defun tags-completion-at-point-function 799,31946
+(defun find-tag-tag 818,32696
+(defvar last-tag 837,33369
+(defun find-tag-interactive 840,33428
+(defvar find-tag-history 852,33843
+(defvar etags-case-fold-search)855,33908
+(defvar etags-syntax-table)856,33940
+(defvar local-find-tag-hook)857,33968
+(defun find-tag-noselect 860,34013
+(defun find-tag 932,37127
+(defun find-tag-other-window 959,38343
+(defun find-tag-other-frame 1000,40271
+(defun find-tag-regexp 1025,41445
+(defalias 'pop-tag-mark pop-tag-mark1049,42607
+(defvar tag-lines-already-matched 1052,42658
+(defun find-tag-in-order 1055,42765
+(defun tag-find-file-of-tag-noselect 1167,47111
+(defun tag-find-file-of-tag 1200,48957
+(defun etags-recognize-tags-table 1208,49183
+(defun etags-verify-tags-table 1241,50814
+(defun etags-file-of-tag 1246,51012
+(defun etags-tags-completion-table 1256,51347
+(defun etags-snarf-tag 1286,52553
+(defun etags-goto-tag-location 1324,54122
+(defun etags-list-tags 1388,56565
+(defmacro tags-with-face 1423,57840
+(defun etags-tags-apropos-additional 1431,58173
+(defun etags-tags-apropos 1465,59410
+(defun etags-tags-table-files 1527,61619
+(defun etags-tags-included-tables 1542,62055
+(defun tags-recognize-empty-tags-table 1559,62595
+(defun tag-exact-file-name-match-p 1587,63741
+(defun tag-file-name-match-p 1596,64134
+(defun tag-exact-match-p 1609,64690
+(defun tag-implicit-name-match-p 1620,65258
+(defun tag-symbol-match-p 1633,65858
+(defun tag-word-match-p 1643,66294
+(defun tag-partial-file-name-match-p 1652,66692
+(defun tag-any-match-p 1662,67136
+(defun tag-re-match-p 1667,67320
+(defcustom tags-loop-revert-buffers 1675,67569
+(defun next-file 1685,67978
+(defvar tags-loop-operate 1760,70892
+(defvar tags-loop-scan1763,70986
+(defun tags-loop-eval 1771,71315
+(defun tags-loop-continue 1782,71644
+(defun tags-search 1850,73950
+(defun tags-query-replace 1871,74776
+(defun tags-complete-tags-table-file 1896,76000
+(defun list-tags 1906,76379
+(defun tags-apropos 1934,77332
+(define-button-type 'tags-select-tags-tabletags-select-tags-table1957,78158
+(defun select-tags-table 1964,78397
+(defvar select-tags-table-mode-map 2019,80524
+(define-derived-mode select-tags-table-mode 2030,80907
+(defun select-tags-table-select 2034,81091
+(defun select-tags-table-quit 2043,81457
+(defun complete-tag 2049,81612
+(defconst etags--xref-limit 2074,82553
+(defvar etags-xref-find-definitions-tag-order 2076,82588
+(defun etags-xref-find 2082,82878
+(defun etags--xref-find-definitions 2096,83407
+(defclass xref-etags-location 2129,85121
+(defun xref-make-etags-location 2135,85344
+(cl-defmethod xref-location-marker 2139,85499
+(cl-defmethod xref-location-line 2146,85743
 
 erl-src/gs_dialog.erl,98
 -define(VERSION2,32
diff --git a/test/manual/etags/c-src/abbrev.c b/test/manual/etags/c-src/abbrev.c
index 039addc5a3..301ca4e9d8 100644
--- a/test/manual/etags/c-src/abbrev.c
+++ b/test/manual/etags/c-src/abbrev.c
@@ -1,5 +1,5 @@
 /* Primitives for word-abbrev mode.
-   Copyright (C) 1985-1986, 1993, 1996, 1998, 2016-2021 Free Software
+   Copyright (C) 1985-1986, 1993, 1996, 1998, 2016-2022 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/test/manual/etags/c-src/emacs/src/gmalloc.c 
b/test/manual/etags/c-src/emacs/src/gmalloc.c
index f56a243465..0a28d0c6d3 100644
--- a/test/manual/etags/c-src/emacs/src/gmalloc.c
+++ b/test/manual/etags/c-src/emacs/src/gmalloc.c
@@ -1,5 +1,5 @@
 /* Declarations for `malloc' and friends.
-   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2021 Free
+   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2022 Free
    Software Foundation, Inc.
                  Written May 1989 by Mike Haertel.
 
diff --git a/test/manual/etags/c-src/emacs/src/keyboard.c 
b/test/manual/etags/c-src/emacs/src/keyboard.c
index db86515ef0..7228f8cb5d 100644
--- a/test/manual/etags/c-src/emacs/src/keyboard.c
+++ b/test/manual/etags/c-src/emacs/src/keyboard.c
@@ -1,6 +1,6 @@
 /* Keyboard and mouse input; editor command loop.
 
-Copyright (C) 1985-1989, 1993-1997, 1999-2021 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1997, 1999-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/test/manual/etags/c-src/emacs/src/lisp.h 
b/test/manual/etags/c-src/emacs/src/lisp.h
index e2744a1bf3..1fe50f5f93 100644
--- a/test/manual/etags/c-src/emacs/src/lisp.h
+++ b/test/manual/etags/c-src/emacs/src/lisp.h
@@ -1,6 +1,6 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1985-1987, 1993-1995, 1997-2021 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2022 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/test/manual/etags/c-src/emacs/src/regex.h 
b/test/manual/etags/c-src/emacs/src/regex.h
index 3e871303ea..f51e4fc594 100644
--- a/test/manual/etags/c-src/emacs/src/regex.h
+++ b/test/manual/etags/c-src/emacs/src/regex.h
@@ -1,7 +1,7 @@
 /* Definitions for data structures and routines for the regular
    expression library, version 0.12.
 
-   Copyright (C) 1985, 1989-1993, 1995, 2000-2021 Free Software
+   Copyright (C) 1985, 1989-1993, 1995, 2000-2022 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/test/manual/etags/c-src/etags.c b/test/manual/etags/c-src/etags.c
index 7105ad5cba..efa269d81c 100644
--- a/test/manual/etags/c-src/etags.c
+++ b/test/manual/etags/c-src/etags.c
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2021 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2022 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
diff --git a/test/manual/etags/c-src/exit.c b/test/manual/etags/c-src/exit.c
index 93b3563d83..c655b257c9 100644
--- a/test/manual/etags/c-src/exit.c
+++ b/test/manual/etags/c-src/exit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 2016-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 2016-2022 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
diff --git a/test/manual/etags/c-src/exit.strange_suffix 
b/test/manual/etags/c-src/exit.strange_suffix
index 93b3563d83..c655b257c9 100644
--- a/test/manual/etags/c-src/exit.strange_suffix
+++ b/test/manual/etags/c-src/exit.strange_suffix
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 2016-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 2016-2022 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
diff --git a/test/manual/etags/c-src/getopt.h b/test/manual/etags/c-src/getopt.h
index ec74c836f1..31e2a03c12 100644
--- a/test/manual/etags/c-src/getopt.h
+++ b/test/manual/etags/c-src/getopt.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1992, 2016-2021 Free Software Foundation, Inc.
+   Copyright (C) 1989-1992, 2016-2022 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
diff --git a/test/manual/etags/c-src/sysdep.h b/test/manual/etags/c-src/sysdep.h
index 187692f5c7..38edc43df3 100644
--- a/test/manual/etags/c-src/sysdep.h
+++ b/test/manual/etags/c-src/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1993, 2016-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1993, 2016-2022 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
diff --git a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el 
b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
index 86cc882546..e589263dc3 100644
--- a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
+++ b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
@@ -1,6 +1,6 @@
 ;;; etags.el --- etags facility for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2021 Free
+;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2022 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
diff --git a/test/manual/etags/tex-src/texinfo.tex 
b/test/manual/etags/tex-src/texinfo.tex
index a04371d1c9..e0de6afe96 100644
--- a/test/manual/etags/tex-src/texinfo.tex
+++ b/test/manual/etags/tex-src/texinfo.tex
@@ -1,6 +1,6 @@
 %% TeX macros to handle texinfo files
 
-%   Copyright (C) 1985--1986, 1988, 1990--1991, 2016--2021 Free Software
+%   Copyright (C) 1985--1986, 1988, 1990--1991, 2016--2022 Free Software
 %   Foundation, Inc.
 
 %This texinfo.tex file is free software; you can redistribute it and/or
diff --git a/test/manual/etags/y-src/cccp.c b/test/manual/etags/y-src/cccp.c
index 7156414b64..264adfae66 100644
--- a/test/manual/etags/y-src/cccp.c
+++ b/test/manual/etags/y-src/cccp.c
@@ -320,7 +320,7 @@ static const short yycheck[] =
 #line 3 "/usr/share/bison/bison.simple"
 
 /* Skeleton output parser for bison,
-   Copyright (C) 1984, 1989-1990, 2000-2001, 2016-2021 Free Software
+   Copyright (C) 1984, 1989-1990, 2000-2001, 2016-2022 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/test/manual/etags/y-src/parse.c b/test/manual/etags/y-src/parse.c
index f90d31505f..61794f713e 100644
--- a/test/manual/etags/y-src/parse.c
+++ b/test/manual/etags/y-src/parse.c
@@ -28,7 +28,7 @@
 
 #line 1 "y-src/parse.y"
 
-/*     Copyright (C) 1990, 1992-1993, 2016-2021 Free Software Foundation,
+/*     Copyright (C) 1990, 1992-1993, 2016-2022 Free Software Foundation,
  *     Inc.
 
 This file is part of Oleo, the GNU Spreadsheet.
diff --git a/test/manual/etags/y-src/parse.y b/test/manual/etags/y-src/parse.y
index 7985da525b..0bfa92b630 100644
--- a/test/manual/etags/y-src/parse.y
+++ b/test/manual/etags/y-src/parse.y
@@ -1,5 +1,5 @@
 %{
-/*     Copyright (C) 1990, 1992-1993, 2016-2021 Free Software Foundation,
+/*     Copyright (C) 1990, 1992-1993, 2016-2022 Free Software Foundation,
  *     Inc.
 
 This file is part of Oleo, the GNU Spreadsheet.
diff --git a/test/manual/image-circular-tests.el 
b/test/manual/image-circular-tests.el
index 7abb94dee6..edc65eee9b 100644
--- a/test/manual/image-circular-tests.el
+++ b/test/manual/image-circular-tests.el
@@ -1,6 +1,6 @@
 ;;; image-circular-tests.el --- test image functions with circular objects  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2019, 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019, 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Pip Cet <pipcet@gmail.com>
 ;; Keywords:       internal
diff --git a/test/manual/image-size-tests.el b/test/manual/image-size-tests.el
index 067a0bfc8e..ea7af88943 100644
--- a/test/manual/image-size-tests.el
+++ b/test/manual/image-size-tests.el
@@ -1,6 +1,6 @@
 ;;; image-size-tests.el --- tests for image scaling  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/manual/image-transforms-tests.el 
b/test/manual/image-transforms-tests.el
index acbaed5c0b..2f03073ab7 100644
--- a/test/manual/image-transforms-tests.el
+++ b/test/manual/image-transforms-tests.el
@@ -1,6 +1,6 @@
 ;;; image-transforms-tests.el --- Test suite for image transforms.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Alan Third <alan@idiocy.org>
 ;; Keywords:       internal
diff --git a/test/manual/indent/pascal.pas b/test/manual/indent/pascal.pas
index a166eedbc5..1efd9b8375 100644
--- a/test/manual/indent/pascal.pas
+++ b/test/manual/indent/pascal.pas
@@ -1,6 +1,6 @@
 { GPC demo program for the CRT unit.
 
-Copyright (C) 1999-2006, 2013-2021 Free Software Foundation, Inc.
+Copyright (C) 1999-2006, 2013-2022 Free Software Foundation, Inc.
 
 Author: Frank Heckenbach <frank@pascal.gnu.de>
 
diff --git a/test/manual/indent/perl.perl b/test/manual/indent/perl.perl
index 6ec04303b4..db94552a92 100755
--- a/test/manual/indent/perl.perl
+++ b/test/manual/indent/perl.perl
@@ -95,3 +95,15 @@ s#ijk#lmn#g;  # This is a regular expression sustitution.
 s #lmn#opq#g; # FIXME: this should be a comment starting with "#lmn"
   /lmn/rst/g; # and this is the actual regular expression
 print;        # prints "rstrst\n"
+
+given ($num) {
+    when ($num>10) {
+       printf "number is greater than 10\n";
+    }
+    when ($num<10) {
+       printf "number is less than 10\n";
+    }
+    default {
+       printf "number is equal to 10\n";
+    }
+}
diff --git a/test/manual/redisplay-testsuite.el 
b/test/manual/redisplay-testsuite.el
index 8a4828417c..01b0a895a4 100644
--- a/test/manual/redisplay-testsuite.el
+++ b/test/manual/redisplay-testsuite.el
@@ -1,6 +1,6 @@
 ;;; redisplay-testsuite.el --- Test suite for redisplay.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2009-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <cyd@stupidchicken.com>
 ;; Keywords:       internal
diff --git a/test/manual/scroll-tests.el b/test/manual/scroll-tests.el
index dd15d54fa8..e4a9e7cd6f 100644
--- a/test/manual/scroll-tests.el
+++ b/test/manual/scroll-tests.el
@@ -1,6 +1,6 @@
 ;;; scroll-tests.el --- tests for scrolling -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/misc/test-custom-deps.el b/test/misc/test-custom-deps.el
index f072adddcb..7836612bd3 100644
--- a/test/misc/test-custom-deps.el
+++ b/test/misc/test-custom-deps.el
@@ -1,6 +1,6 @@
 ;;; test-custom-deps.el --- Test custom deps  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/misc/test-custom-libs.el b/test/misc/test-custom-libs.el
index d826dfbcab..d9aa955ccb 100644
--- a/test/misc/test-custom-libs.el
+++ b/test/misc/test-custom-libs.el
@@ -1,6 +1,6 @@
 ;;; test-custom-libs.el --- Test custom loads  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/misc/test-custom-noloads.el b/test/misc/test-custom-noloads.el
index 5e95e7d774..15cdbc6623 100644
--- a/test/misc/test-custom-noloads.el
+++ b/test/misc/test-custom-noloads.el
@@ -1,6 +1,6 @@
 ;;; test-custom-noloads.el --- Test custom noloads  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/misc/test-custom-opts.el b/test/misc/test-custom-opts.el
index fa6b9e66ae..21809a9a97 100644
--- a/test/misc/test-custom-opts.el
+++ b/test/misc/test-custom-opts.el
@@ -1,6 +1,6 @@
 ;;; test-custom-opts.el --- Test custom opts  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el
index 5383c43603..967833e190 100644
--- a/test/src/alloc-tests.el
+++ b/test/src/alloc-tests.el
@@ -1,6 +1,6 @@
 ;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Daniel Colascione <dancol@dancol.org>
 ;; Keywords:
@@ -30,7 +30,7 @@
 (require 'cl-lib)
 
 (ert-deftest finalizer-object-type ()
-  (should (equal (type-of (make-finalizer nil)) 'finalizer)))
+  (should (equal (type-of (make-finalizer #'ignore)) 'finalizer)))
 
 (ert-deftest record-1 ()
   (let ((x (record 'foo 1 2 3)))
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 9b7023d18b..31a4b1ac71 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -1,6 +1,6 @@
 ;;; buffer-tests.el --- tests for buffer.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el
index 0df5887710..d964fc3c1f 100644
--- a/test/src/callint-tests.el
+++ b/test/src/callint-tests.el
@@ -1,6 +1,6 @@
 ;;; callint-tests.el --- unit tests for callint.c    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el
index 7262abbe0d..f44c7e199f 100644
--- a/test/src/callproc-tests.el
+++ b/test/src/callproc-tests.el
@@ -1,6 +1,6 @@
 ;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el
index dbbe9f3092..eb096f2112 100644
--- a/test/src/casefiddle-tests.el
+++ b/test/src/casefiddle-tests.el
@@ -1,6 +1,6 @@
 ;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2015-2016, 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2016, 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/character-tests.el b/test/src/character-tests.el
index ba24d49039..f83bac333d 100644
--- a/test/src/character-tests.el
+++ b/test/src/character-tests.el
@@ -1,6 +1,6 @@
 ;;; character-tests.el --- tests for character.c  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/charset-tests.el b/test/src/charset-tests.el
index 23e201ad45..51eb040e77 100644
--- a/test/src/charset-tests.el
+++ b/test/src/charset-tests.el
@@ -1,6 +1,6 @@
 ;;; charset-tests.el --- Tests for charset.c -*- lexical-binding: t -*-
 
-;; Copyright 2017-2021 Free Software Foundation, Inc.
+;; Copyright 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/chartab-tests.el b/test/src/chartab-tests.el
index bf37fb51cf..e4c4b06537 100644
--- a/test/src/chartab-tests.el
+++ b/test/src/chartab-tests.el
@@ -1,6 +1,6 @@
 ;;; chartab-tests.el --- Tests for char-tab.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <eliz@gnu.org>
 
diff --git a/test/src/cmds-tests.el b/test/src/cmds-tests.el
index 681bfb3016..73e933eb37 100644
--- a/test/src/cmds-tests.el
+++ b/test/src/cmds-tests.el
@@ -1,6 +1,6 @@
 ;;; cmds-tests.el --- Testing some Emacs commands -*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Richard <youngfrog@members.fsf.org>
 ;; Keywords:
diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el
index 1c585ea537..de4ddb546d 100644
--- a/test/src/coding-tests.el
+++ b/test/src/coding-tests.el
@@ -1,6 +1,6 @@
 ;;; coding-tests.el --- tests for text encoding and decoding -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <eliz@gnu.org>
 ;; Author: Kenichi Handa <handa@gnu.org>
diff --git a/test/src/comp-resources/comp-test-funcs-dyn.el 
b/test/src/comp-resources/comp-test-funcs-dyn.el
index 3118455e3f..07f8671c6d 100644
--- a/test/src/comp-resources/comp-test-funcs-dyn.el
+++ b/test/src/comp-resources/comp-test-funcs-dyn.el
@@ -1,6 +1,6 @@
 ;;; comp-test-funcs-dyn.el --- compilation unit tested by comp-tests.el -*- 
lexical-binding: nil; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.org>
 
diff --git a/test/src/comp-resources/comp-test-funcs.el 
b/test/src/comp-resources/comp-test-funcs.el
index 6352a7c7e9..d740a5f810 100644
--- a/test/src/comp-resources/comp-test-funcs.el
+++ b/test/src/comp-resources/comp-test-funcs.el
@@ -1,6 +1,6 @@
 ;;; comp-test-funcs.el --- compilation unit tested by comp-tests.el -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.org>
 
diff --git a/test/src/comp-resources/comp-test-pure.el 
b/test/src/comp-resources/comp-test-pure.el
index 5c1d2d1747..788739e04c 100644
--- a/test/src/comp-resources/comp-test-pure.el
+++ b/test/src/comp-resources/comp-test-pure.el
@@ -1,6 +1,6 @@
 ;;; comp-test-pure.el --- compilation unit tested by comp-tests.el -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.org>
 
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 5b20cf38ec..89cb3d153d 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -1,6 +1,6 @@
 ;;; comp-tests.el --- unit tests for src/comp.c      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 ;; Author: Andrea Corallo <akrl@sdf.org>
 
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 8cc271b9e1..7d8535f5f3 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -1,6 +1,6 @@
 ;;; data-tests.el --- tests for src/data.c  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el
index 1d25cf2f66..47d67b7bda 100644
--- a/test/src/decompress-tests.el
+++ b/test/src/decompress-tests.el
@@ -1,6 +1,6 @@
 ;;; decompress-tests.el --- Test suite for decompress. -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
@@ -23,6 +23,8 @@
 
 (require 'ert)
 
+(declare-function zlib-decompress-region "decompress.c")
+
 (defvar zlib-tests-data-directory
   (expand-file-name "data/decompress" (getenv "EMACS_TEST_DIRECTORY"))
   "Directory containing zlib test data.")
diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el
new file mode 100644
index 0000000000..8dabba9035
--- /dev/null
+++ b/test/src/doc-tests.el
@@ -0,0 +1,43 @@
+;;; doc-tests.el --- tests for doc.c functions  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2022 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 doc-tests-documentation/c-primitive ()
+  (should (stringp (documentation 'defalias))))
+
+(ert-deftest doc-tests-documentation/preloaded ()
+  (should (stringp (documentation 'defun))))
+
+(ert-deftest doc-tests-documentation/autoloaded-macro ()
+  (skip-unless noninteractive)
+  (should (autoloadp (symbol-function 'rx)))
+  (should (stringp (documentation 'rx))))     ; See Bug#52969.
+
+(ert-deftest doc-tests-documentation/autoloaded-defun ()
+  (skip-unless noninteractive)
+  (should (autoloadp (symbol-function 'tetris)))
+  (should (stringp (documentation 'tetris)))) ; See Bug#52969.
+
+(ert-deftest doc-tests-quoting-style ()
+  (should (memq (text-quoting-style) '(grave straight curve))))
+
+;;; doc-tests.el ends here
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index e83dd7c857..5fe896fbbd 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -1,6 +1,6 @@
 ;;; editfns-tests.el --- tests for editfns.c  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -413,4 +413,17 @@
       (translate-region-internal (point-min) (point-max) tt)
       (should (string-equal (buffer-string) "*")))))
 
+(ert-deftest find-fields ()
+  (with-temp-buffer
+    (insert "foo" (propertize "bar" 'field 'bar) "zot")
+    (goto-char (point-min))
+    (should (= (field-beginning) (point-min)))
+    (should (= (field-end) 4))
+    (goto-char 5)
+    (should (= (field-beginning) 4))
+    (should (= (field-end) 7))
+    (goto-char 8)
+    (should (= (field-beginning) 7))
+    (should (= (field-end) (point-max)))))
+
 ;;; editfns-tests.el ends here
diff --git a/test/src/emacs-module-resources/mod-test.c 
b/test/src/emacs-module-resources/mod-test.c
index 4c0b168e34..015c1efd97 100644
--- a/test/src/emacs-module-resources/mod-test.c
+++ b/test/src/emacs-module-resources/mod-test.c
@@ -1,6 +1,6 @@
 /* Test GNU Emacs modules.
 
-Copyright 2015-2021 Free Software Foundation, Inc.
+Copyright 2015-2022 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 988b311f5b..2ff33644a8 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -1,6 +1,6 @@
 ;;; emacs-module-tests.el --- Test GNU Emacs modules.  -*- lexical-binding: t; 
-*-
 
-;; Copyright 2015-2021 Free Software Foundation, Inc.
+;; Copyright 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/emacs-tests.el b/test/src/emacs-tests.el
index a1a412423c..52888135c1 100644
--- a/test/src/emacs-tests.el
+++ b/test/src/emacs-tests.el
@@ -1,6 +1,6 @@
 ;;; emacs-tests.el --- unit tests for emacs.c -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el
index 727c98aa5f..e4230c10ef 100644
--- a/test/src/eval-tests.el
+++ b/test/src/eval-tests.el
@@ -1,6 +1,6 @@
 ;;; eval-tests.el --- unit tests for src/eval.c      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index 4143503aa1..511490c574 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -1,6 +1,6 @@
 ;;; fileio-tests.el --- unit tests for src/fileio.c      -*- lexical-binding: 
t; -*-
 
-;; Copyright 2017-2021 Free Software Foundation, Inc.
+;; Copyright 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/filelock-tests.el b/test/src/filelock-tests.el
index ba00167963..21478a1a0f 100644
--- a/test/src/filelock-tests.el
+++ b/test/src/filelock-tests.el
@@ -1,6 +1,6 @@
 ;;; filelock-tests.el --- test file locking -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021  Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -123,7 +123,9 @@ the case)."
      (filelock-tests--spoil-lock-file buffer-file-truename)
      (let ((err (should-error (file-locked-p (buffer-file-name)))))
        (should (equal (seq-subseq err 0 2)
-                      '(file-error "Testing file lock")))))))
+                      (if (eq system-type 'windows-nt)
+                          '(permission-denied "Testing file lock")
+                        '(file-error "Testing file lock"))))))))
 
 (ert-deftest filelock-tests-unlock-spoiled ()
   "Check that `unlock-buffer' fails if the lockfile is \"spoiled\"."
@@ -144,8 +146,11 @@ the case)."
                   (lambda (err) (push err errors))))
          (unlock-buffer))
        (should (consp errors))
-       (should (equal '(file-error "Unlocking file")
-                      (seq-subseq (car errors) 0 2)))
+       (should (equal
+                (if (eq system-type 'windows-nt)
+                    '(permission-denied "Unlocking file")
+                  '(file-error "Unlocking file"))
+                (seq-subseq (car errors) 0 2)))
        (should (equal (length errors) 1))))))
 
 (ert-deftest filelock-tests-kill-buffer-spoiled ()
@@ -174,8 +179,11 @@ the case)."
                   (lambda (err) (push err errors))))
          (kill-buffer))
        (should (consp errors))
-       (should (equal '(file-error "Unlocking file")
-                      (seq-subseq (car errors) 0 2)))
+       (should (equal
+                (if (eq system-type 'windows-nt)
+                    '(permission-denied "Unlocking file")
+                  '(file-error "Unlocking file"))
+                (seq-subseq (car errors) 0 2)))
        (should (equal (length errors) 1))))))
 
 (provide 'filelock-tests)
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el
index a066d2e15e..aa709e3c2f 100644
--- a/test/src/floatfns-tests.el
+++ b/test/src/floatfns-tests.el
@@ -1,6 +1,6 @@
 ;;; floatfns-tests.el --- tests for floating point operations -*- 
lexical-binding: t -*-
 
-;; Copyright 2017-2021 Free Software Foundation, Inc.
+;; Copyright 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index bec5c03f9e..f74e925d3b 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -1,6 +1,6 @@
 ;;; fns-tests.el --- tests for src/fns.c  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -318,7 +318,10 @@
   (should (equal (base64-encode-string "fooba") "Zm9vYmE="))
   (should (equal (base64-encode-string "foobar") "Zm9vYmFy"))
   (should (equal (base64-encode-string "\x14\xfb\x9c\x03\xd9\x7e") "FPucA9l+"))
-  (should (equal (base64-encode-string "\x14\xfb\x9c\x03\xd9\x7f") 
"FPucA9l/")))
+  (should (equal (base64-encode-string "\x14\xfb\x9c\x03\xd9\x7f") "FPucA9l/"))
+
+  (should-error (base64-encode-string "ƒ"))
+  (should-error (base64-encode-string "ü")))
 
 (ert-deftest fns-test-base64url-encode-region ()
   ;; url variant with padding
@@ -360,7 +363,11 @@
   (should (equal (fns-tests--with-region base64url-encode-region 
(fns-tests--string-repeat "\x14\xfb\x9c\x03\xd9\x7e" 10) t)
                  (fns-tests--string-repeat "FPucA9l-" 10)))
   (should (equal (fns-tests--with-region base64url-encode-region 
(fns-tests--string-repeat "\x14\xfb\x9c\x03\xd9\x7f" 10) t)
-                 (fns-tests--string-repeat "FPucA9l_" 10))))
+                 (fns-tests--string-repeat "FPucA9l_" 10)))
+
+  (should-error (fns-tests--with-region base64url-encode-region "ƒ"))
+  (should-error (fns-tests--with-region base64url-encode-region "ü")))
+
 
 (ert-deftest fns-test-base64url-encode-string ()
   ;; url variant with padding
@@ -394,7 +401,10 @@
   (should (equal (base64url-encode-string (fns-tests--string-repeat "fooba" 
15) t) (fns-tests--string-repeat "Zm9vYmFmb29iYWZvb2Jh" 5)))
   (should (equal (base64url-encode-string (fns-tests--string-repeat "foobar" 
15) t) (concat (fns-tests--string-repeat "Zm9vYmFyZm9vYmFy" 7) "Zm9vYmFy")))
   (should (equal (base64url-encode-string (fns-tests--string-repeat 
"\x14\xfb\x9c\x03\xd9\x7e" 10) t) (fns-tests--string-repeat "FPucA9l-" 10)))
-  (should (equal (base64url-encode-string (fns-tests--string-repeat 
"\x14\xfb\x9c\x03\xd9\x7f" 10) t) (fns-tests--string-repeat "FPucA9l_" 10))))
+  (should (equal (base64url-encode-string (fns-tests--string-repeat 
"\x14\xfb\x9c\x03\xd9\x7f" 10) t) (fns-tests--string-repeat "FPucA9l_" 10)))
+
+  (should-error (base64url-encode-string "ƒ"))
+  (should-error (base64url-encode-string "ü")))
 
 (ert-deftest fns-tests-base64-decode-string ()
   ;; standard variant RFC2045
diff --git a/test/src/font-tests.el b/test/src/font-tests.el
index ea57b122f4..d99b0be89e 100644
--- a/test/src/font-tests.el
+++ b/test/src/font-tests.el
@@ -1,6 +1,6 @@
 ;;; font-tests.el --- Test suite for font-related functions. -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <cyd@stupidchicken.com>
 ;; Keywords:       internal
diff --git a/test/src/image-tests.el b/test/src/image-tests.el
index 2b236086b6..3885981e0b 100644
--- a/test/src/image-tests.el
+++ b/test/src/image-tests.el
@@ -1,6 +1,6 @@
 ;;; image-tests.el --- Tests for image.c  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Stefan Kangas <stefan@marxist.se>
 
@@ -239,7 +239,6 @@
 (ert-deftest image-tests-init-image-library ()
   (skip-unless (fboundp 'init-image-library))
   (should (init-image-library 'pbm)) ; built-in
-  (should (init-image-library 'xpm)) ; built-in
   (should-not (init-image-library 'invalid-image-type)))
 
 ;;; image-tests.el ends here
diff --git a/test/src/indent-tests.el b/test/src/indent-tests.el
index 6cfe64c07e..e6b1fde6e1 100644
--- a/test/src/indent-tests.el
+++ b/test/src/indent-tests.el
@@ -1,6 +1,6 @@
 ;;; indent-tests.el --- tests for src/indent.c  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el
index 70330ac865..295b184be0 100644
--- a/test/src/inotify-tests.el
+++ b/test/src/inotify-tests.el
@@ -1,6 +1,6 @@
 ;;; inotify-tests.el --- Test suite for inotify. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
 ;; Keywords:       internal
@@ -28,6 +28,7 @@
 
 (declare-function inotify-add-watch "inotify.c" (file-name aspect callback))
 (declare-function inotify-rm-watch "inotify.c" (watch-descriptor))
+(declare-function inotify-valid-p "inotify.c" (watch-descriptor))
 
 (ert-deftest inotify-valid-p-simple ()
   "Simple tests for `inotify-valid-p'."
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index 8dc0a744aa..f3dfeea30b 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -1,6 +1,6 @@
 ;;; json-tests.el --- unit tests for json.c          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el
index 41c8cdd15f..d17c9d96a6 100644
--- a/test/src/keyboard-tests.el
+++ b/test/src/keyboard-tests.el
@@ -1,6 +1,6 @@
 ;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el
index 629d6c5584..69aa723849 100644
--- a/test/src/keymap-tests.el
+++ b/test/src/keymap-tests.el
@@ -1,6 +1,6 @@
 ;;; keymap-tests.el --- Test suite for src/keymap.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <lekktu@gmail.com>
 ;;         Stefan Kangas <stefankangas@gmail.com>
@@ -276,15 +276,11 @@ commit 86c19714b097aa477d339ed99ffb5136c755a046."
     (should (equal (where-is-internal 'foo map t) [?y]))
     (should (equal (where-is-internal 'bar map t) [?y]))))
 
-(defvar keymap-tests-minor-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "x" 'keymap-tests--command-2)
-    map))
+(defvar-keymap keymap-tests-minor-mode-map
+  "x" 'keymap-tests--command-2)
 
-(defvar keymap-tests-major-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "x" 'keymap-tests--command-1)
-    map))
+(defvar-keymap keymap-tests-major-mode-map
+  "x" 'keymap-tests--command-1)
 
 (define-minor-mode keymap-tests-minor-mode "Test.")
 
@@ -407,6 +403,21 @@ g .. h             foo
     (define-key child [?a] nil t)
     (should (eq (lookup-key child [?a]) 'foo))))
 
+(ert-deftest keymap-text-char-description ()
+  (should (equal (text-char-description ?a) "a"))
+  (should (equal (text-char-description ?\s) " "))
+  (should (equal (text-char-description ?\t) "^I"))
+  (should (equal (text-char-description ?\^C) "^C"))
+  (should (equal (text-char-description ?\^?) "^?"))
+  (should (equal (text-char-description #x80) "€"))
+  (should (equal (text-char-description ?å) "å"))
+  (should (equal (text-char-description ?Ş) "Ş"))
+  (should (equal (text-char-description ?Ā) "Ā"))
+  (should-error (text-char-description "c"))
+  (should-error (text-char-description [?\C-x ?l]))
+  (should-error (text-char-description ?\M-c))
+  (should-error (text-char-description ?\s-c)))
+
 (provide 'keymap-tests)
 
 ;;; keymap-tests.el ends here
diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el
index d2d137e9bd..1829a7ea1f 100644
--- a/test/src/lcms-tests.el
+++ b/test/src/lcms-tests.el
@@ -1,6 +1,6 @@
 ;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 
@@ -35,6 +35,13 @@
 (require 'ert)
 (require 'color)
 
+(declare-function lcms-jab->jch "lcms.c")
+(declare-function lcms-jch->jab "lcms.c")
+(declare-function lcms-xyz->jch "lcms.c")
+(declare-function lcms-jch->xyz "lcms.c")
+(declare-function lcms-temp->white-point "lcms.c")
+(declare-function lcms-cam02-ucs "lcms.c")
+
 (defconst lcms-colorspacious-d65 '(0.95047 1.0 1.08883)
   "D65 white point from colorspacious.")
 
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index c635c592b2..862f6a6595 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -1,6 +1,6 @@
 ;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <phst@google.com>
 
diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el
index cf8e82cd56..32e4804fe7 100644
--- a/test/src/marker-tests.el
+++ b/test/src/marker-tests.el
@@ -1,6 +1,6 @@
 ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el
index 51d9c67453..6880072950 100644
--- a/test/src/minibuf-tests.el
+++ b/test/src/minibuf-tests.el
@@ -1,6 +1,6 @@
 ;;; minibuf-tests.el --- tests for minibuf.c functions -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index 0d2ea6e383..4c7b339e0c 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -1,6 +1,6 @@
 ;;; print-tests.el --- tests for src/print.c         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index f14a460d1a..f5908d3cda 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -1,6 +1,6 @@
 ;;; process-tests.el --- Testing the process facilities -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -31,6 +31,10 @@
 (require 'dns)
 (require 'url-http)
 
+(declare-function thread-last-error "thread.c")
+(declare-function thread-join "thread.c")
+(declare-function make-thread "thread.c")
+
 ;; Timeout in seconds; the test fails if the timeout is reached.
 (defvar process-test-sentinel-wait-timeout 2.0)
 
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index 71e3189443..e6288d1fc9 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -1,6 +1,6 @@
 ;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/search-tests.el b/test/src/search-tests.el
index b5f4730f26..2fa2384284 100644
--- a/test/src/search-tests.el
+++ b/test/src/search-tests.el
@@ -1,6 +1,6 @@
 ;;; search-tests.el --- tests for search.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2016, 2018-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2016, 2018-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index 6a88f0fd6c..6e44300f3a 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -1,6 +1,6 @@
 ;;; sqlite-tests.el --- Tests for sqlite.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -35,6 +35,7 @@
 (declare-function sqlite-more-p "sqlite.c")
 (declare-function sqlite-select "sqlite.c")
 (declare-function sqlite-open "sqlite.c")
+(declare-function sqlite-load-extension "sqlite.c")
 
 (ert-deftest sqlite-select ()
   (skip-unless (sqlite-available-p))
@@ -182,4 +183,37 @@
     (sqlite-close db)
     (should-error (sqlite-select db "select * from test6"))))
 
+(ert-deftest sqlite-load-extension ()
+  (skip-unless (sqlite-available-p))
+  (skip-unless (fboundp 'sqlite-load-extension))
+  (let (db)
+    (setq db (sqlite-open))
+    (should-error
+     (sqlite-load-extension db "/usr/lib/sqlite3/notpcre.so"))
+    (should-error
+     (sqlite-load-extension db "/usr/lib/sqlite3/n"))
+    (should-error
+     (sqlite-load-extension db "/usr/lib/sqlite3/"))
+    (should-error
+     (sqlite-load-extension db "/usr/lib/sqlite3"))
+    (should
+     (memq
+      (sqlite-load-extension db "/usr/lib/sqlite3/pcre.so")
+      '(nil t)))
+
+    (should-error
+     (sqlite-load-extension
+      db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_notcsvtable.so"))
+    (should-error
+     (sqlite-load-extension
+      db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtablen.so"))
+    (should-error
+     (sqlite-load-extension
+      db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable"))
+    (should
+     (memq
+      (sqlite-load-extension
+       db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable.so")
+      '(nil t)))))
+
 ;;; sqlite-tests.el ends here
diff --git a/test/src/syntax-tests.el b/test/src/syntax-tests.el
index bd89283dd1..3b9f21cde3 100644
--- a/test/src/syntax-tests.el
+++ b/test/src/syntax-tests.el
@@ -1,6 +1,6 @@
 ;;; syntax-tests.el --- tests for syntax.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/textprop-tests.el b/test/src/textprop-tests.el
index c001579c47..d6cee6b6cb 100644
--- a/test/src/textprop-tests.el
+++ b/test/src/textprop-tests.el
@@ -1,6 +1,6 @@
 ;;; textprop-tests.el --- Test suite for text properties. -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Jenkner <wjenkner@inode.at>
 ;; Keywords: internal
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 52eace7e9d..b7ab31120a 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -1,6 +1,6 @@
 ;;; thread-tests.el --- tests for threads. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -389,6 +389,7 @@
     (should (equal (thread-last-error) '(error "Die, die, die!")))))
 
 (ert-deftest threads-test-bug33073 ()
+  (skip-unless (fboundp 'make-thread))
   (let ((th (make-thread 'ignore)))
     (should-not (equal th main-thread))))
 
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el
index f801478a9a..1b49e0622f 100644
--- a/test/src/timefns-tests.el
+++ b/test/src/timefns-tests.el
@@ -1,6 +1,6 @@
 ;;; timefns-tests.el --- tests for timefns.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el
index 88fcfad14c..c84ed74f0b 100644
--- a/test/src/undo-tests.el
+++ b/test/src/undo-tests.el
@@ -1,6 +1,6 @@
 ;;; undo-tests.el --- Tests of primitive-undo -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com>
 
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el
index ae4aacd9c7..0870dc9de4 100644
--- a/test/src/xdisp-tests.el
+++ b/test/src/xdisp-tests.el
@@ -1,6 +1,6 @@
 ;;; xdisp-tests.el --- tests for xdisp.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/xfaces-tests.el b/test/src/xfaces-tests.el
index cba706f453..31c0f021b2 100644
--- a/test/src/xfaces-tests.el
+++ b/test/src/xfaces-tests.el
@@ -1,6 +1,6 @@
 ;;; xfaces-tests.el --- tests for xfaces.c           -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/xml-tests.el b/test/src/xml-tests.el
index 7c4ca396f7..6a8290bd0c 100644
--- a/test/src/xml-tests.el
+++ b/test/src/xml-tests.el
@@ -1,6 +1,6 @@
 ;;; xml-tests.el --- Test suite for libxml parsing. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; Author: Ulf Jasper <ulf.jasper@web.de>
 ;; Keywords:       internal
@@ -27,6 +27,8 @@
 
 (require 'ert)
 
+(declare-function libxml-parse-xml-region "xml.c")
+
 (defvar libxml-tests--data-comments-preserved
   `(;; simple case
     ("<?xml version=\"1.0\"?><foo baz=\"true\">bar</foo>"



reply via email to

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